1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
From: Jochen Sprickerhof <git@jochen.sprickerhof.de>
Date: Mon, 4 Jul 2022 09:46:15 +0200
Subject: Fix write_yaml has been removed from NetworkX
---
androguard/cli/main.py | 6 +++++-
requirements.txt | 1 +
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/androguard/cli/main.py b/androguard/cli/main.py
index 7b3b1c0..5f65fa9 100644
--- a/androguard/cli/main.py
+++ b/androguard/cli/main.py
@@ -3,6 +3,7 @@ import os
import re
import shutil
import sys
+import yaml
# 3rd party modules
from lxml import etree
@@ -108,11 +109,14 @@ def androcg_main(verbose,
entry_points,
)
+ def write_yaml(G_to_be_yaml, path_for_yaml_output, **kwds):
+ yaml.dump(G_to_be_yaml, path_for_yaml_output, **kwds)
+
write_methods = dict(gml=_write_gml,
gexf=nx.write_gexf,
gpickle=nx.write_gpickle,
graphml=nx.write_graphml,
- yaml=nx.write_yaml,
+ yaml=write_yaml,
net=nx.write_pajek,
)
diff --git a/requirements.txt b/requirements.txt
index 65b4b9f..a77f696 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -8,3 +8,4 @@ click>=7.0
pydot>=1.4.1
ipython>=5.0.0
oscrypto
+pyyaml
|