Skip to content
Snippets Groups Projects
Commit d641b22d authored by Jarrod Pas's avatar Jarrod Pas
Browse files

Fixes tiny code style things

parent 4344252c
No related branches found
No related tags found
2 merge requests!3Version 0.2,!1Full rewrite
...@@ -2,6 +2,7 @@ from random import Random ...@@ -2,6 +2,7 @@ from random import Random
from pydtn import Network, Node, random_trace, random_traffic from pydtn import Network, Node, random_trace, random_traffic
class RandomNode(Node): class RandomNode(Node):
def __init__(self, seed=None, **options): def __init__(self, seed=None, **options):
super().__init__(**options) super().__init__(**options)
...@@ -14,9 +15,10 @@ class RandomNode(Node): ...@@ -14,9 +15,10 @@ class RandomNode(Node):
return {target: 'random'} return {target: 'random'}
return {} return {}
def main(): def main():
nodes = 50 nodes = 50
seed = 42 seed = 42
traffic_speed = 1 traffic_speed = 1
node_options = { node_options = {
...@@ -38,5 +40,6 @@ def main(): ...@@ -38,5 +40,6 @@ def main():
print(network.stats_summary) print(network.stats_summary)
if __name__ == '__main__': if __name__ == '__main__':
exit(main()) exit(main())
...@@ -116,7 +116,6 @@ class Network: ...@@ -116,7 +116,6 @@ class Network:
@property @property
def stats(self): def stats(self):
"""Return detailed statistics for the simulation.""" """Return detailed statistics for the simulation."""
packets = [packet.stats for packet in self.packets] packets = [packet.stats for packet in self.packets]
nodes = [node.stats for node in self.nodes.values()] nodes = [node.stats for node in self.nodes.values()]
...@@ -156,7 +155,6 @@ class Network: ...@@ -156,7 +155,6 @@ class Network:
return stats return stats
class Packet: class Packet:
"""An item to route through the network.""" """An item to route through the network."""
...@@ -409,6 +407,7 @@ class Node: ...@@ -409,6 +407,7 @@ class Node:
@property @property
def stats(self): def stats(self):
"""Return node statistics."""
return dict(self._stats) return dict(self._stats)
def __repr__(self): def __repr__(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment