From 6690ad3f4e7c0c81c6a3edc7f5eefea6d5004da3 Mon Sep 17 00:00:00 2001 From: Aaron Mussig Date: Tue, 7 Apr 2020 10:26:30 +1000 Subject: [PATCH] 1.0.1 --- vtracker/__init__.py | 2 +- vtracker/graph.py | 25 +++++++++++++++++++++---- vtracker/vtracker.py | 19 ++++++++++++++++++- 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/vtracker/__init__.py b/vtracker/__init__.py index 99c9c81..6014283 100644 --- a/vtracker/__init__.py +++ b/vtracker/__init__.py @@ -18,7 +18,7 @@ __title__ = 'VTracker' __description__ = 'For tracking the relationship between group membership changes across versions.' __url__ = 'https://github.com/aaronmussig/vtracker' -__version__ = '1.0.0' +__version__ = '1.0.1' __author__ = 'Aaron Mussig' __author_email__ = 'aaronmussig@gmail.com' __license__ = 'GPL3' diff --git a/vtracker/graph.py b/vtracker/graph.py index c5f169d..7e2be8f 100644 --- a/vtracker/graph.py +++ b/vtracker/graph.py @@ -1,4 +1,21 @@ -from typing import Optional, Dict, Tuple, Generator, Set, Hashable +############################################################################### +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### + +from typing import Optional, Dict, Tuple, Generator, Set from .exceptions import DuplicateNode, DuplicateEdge @@ -14,7 +31,7 @@ def __init__(self): self._edge_id = 0 # type: int def add_node(self, key, attrs=None): - # type: (Hashable, Optional[dict]) -> None + # type: (str, Optional[dict]) -> None """Add a node to the graph. Parameters @@ -106,7 +123,7 @@ def iter_nodes(self): ------- Generator[Node] Yields all nodes in the graph.""" - for node in self._nodes.values(): + for node in sorted(self._nodes.values(), key=lambda n: n._node_id): yield node def iter_edges(self): @@ -117,7 +134,7 @@ def iter_edges(self): ------- Generator[Edge] Yields all edges in the graph.""" - for edge in self._edges.values(): + for edge in sorted(self._edges.values(), key=lambda e: e._edge_id): yield edge diff --git a/vtracker/vtracker.py b/vtracker/vtracker.py index 24f8b12..3e9ace4 100644 --- a/vtracker/vtracker.py +++ b/vtracker/vtracker.py @@ -1,6 +1,23 @@ +############################################################################### +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### + from collections import defaultdict -from typing import Iterable, Dict, Tuple, Union, Set, List +from typing import Iterable, Dict, Tuple, Set, List from .exceptions import MissingVersion, DuplicateEntity from .graph import Graph