Skip to content

Commit 3d50334

Browse files
author
qballand
committed
Fix standalone node bug
1 parent 63d1ada commit 3d50334

4 files changed

Lines changed: 10 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
(Released : April 30, 2021) : tag 1.2.0
55
* Add sub_graph
66
* Fix bug (forced to set an id on GraphNode constructor)
7-
7+
* Fix bug (standalone node without graph visitation failed)
8+
89
## Version 1.1.0
910
(Released : April 16, 2021) : tag 1.1.0
1011
* Fix documentation

freexgraph/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
# SOFTWARE.
2323

24-
__version__ = "1.2.0"
24+
__version__ = "1.2.1"

freexgraph/visitor.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ def _get_len(sorted_node_list: List[Tuple], with_progress_bar: bool) -> int:
3636

3737

3838
def _filter_graph_root_for_visitation(root: FreExNode, is_reversed: bool):
39+
if root.graph_ref is None:
40+
return [root]
3941
depth: int = root.depth
4042
sorted_node_list = list(nx.lexicographical_topological_sort(root.graph_ref))
4143
if is_reversed:
@@ -98,7 +100,10 @@ def apply_visitation_(self, root: FreExNode) -> bool:
98100
) as pbar:
99101
pbar.set_description(f"Processing Visitor {type(self).__name__}")
100102
for node_id in sorted_node_list:
101-
node = root.graph_ref.nodes[node_id]["content"]
103+
if len(sorted_node_list) == 1:
104+
node = root
105+
else:
106+
node = root.graph_ref.nodes[node_id]["content"]
102107

103108
# Trigger custom hook
104109
for predicate, hook in self.__custom_hooks:

recipe.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
python38.pkgs.buildPythonPackage rec {
55
pname = "freexgraph";
6-
version = "1.2.0";
6+
version = "1.2.1";
77

88
src = if (builtins.isNull use_revision || use_revision == "") then
99
nix-gitignore.gitignoreSource [ ".git" ] ./.

0 commit comments

Comments
 (0)