Graphinate 0.3.1__tar.gz → 0.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {graphinate-0.3.1 → graphinate-0.3.2}/.github/workflows/test-beta.yml +1 -1
- graphinate-0.3.2/.sonarcloud.properties +15 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/PKG-INFO +35 -32
- {graphinate-0.3.1 → graphinate-0.3.2}/README.md +19 -16
- graphinate-0.3.2/examples/code/requirements.txt +2 -0
- graphinate-0.3.2/examples/github/requirements.txt +2 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/examples/math/graph_atlas.py +4 -2
- graphinate-0.3.2/examples/system/requirements.txt +2 -0
- graphinate-0.3.2/examples/web/requirements.txt +4 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/pyproject.toml +21 -18
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/__init__.py +4 -5
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/builders.py +23 -12
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/color.py +1 -1
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/materializers/__init__.py +7 -7
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/modeling.py +25 -19
- graphinate-0.3.2/src/graphinate/server/web/static/js/murmurhash3_gc.js +64 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/server/web/viewer/index.html +1 -1
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/tools/gui.py +2 -2
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/tools/mutators.py +2 -2
- graphinate-0.3.2/src/graphinate/typing.py +65 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/tests/conftest.py +8 -7
- {graphinate-0.3.1 → graphinate-0.3.2}/tests/graphinate/test_builders.py +37 -34
- {graphinate-0.3.1 → graphinate-0.3.2}/tests/graphinate/test_cli.py +3 -2
- {graphinate-0.3.1 → graphinate-0.3.2}/tests/graphinate/test_color.py +1 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/tests/graphinate/test_materializers.py +9 -9
- {graphinate-0.3.1 → graphinate-0.3.2}/tests/graphinate/test_modeling.py +13 -5
- {graphinate-0.3.1 → graphinate-0.3.2}/tests/graphinate/test_server.py +4 -3
- graphinate-0.3.1/examples/code/requirements.txt +0 -2
- graphinate-0.3.1/examples/github/requirements.txt +0 -2
- graphinate-0.3.1/examples/system/requirements.txt +0 -2
- graphinate-0.3.1/examples/web/requirements.txt +0 -4
- graphinate-0.3.1/src/graphinate/typing.py +0 -54
- {graphinate-0.3.1 → graphinate-0.3.2}/.coveragerc +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/.github/dependabot.yml +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/.github/workflows/codeql.yml +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/.github/workflows/publish-docs.yaml +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/.github/workflows/publish.yml +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/.github/workflows/test.yml +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/.gitignore +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/LICENSE +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/STATS.md +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/docs/acknowledge.md +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/docs/assets/images/logo-128.png +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/docs/assets/images/network_graph.png +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/docs/assets/stylesheets/extra.css +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/docs/dev.md +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/docs/examples/code.md +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/docs/examples/github.md +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/docs/examples/math.md +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/docs/examples/system.md +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/docs/examples/web.md +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/docs/gen_ref_pages.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/docs/index.md +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/docs/intro.md +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/docs/start.md +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/docs/usage/cli.md +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/docs/usage/lib.md +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/examples/code/python_ast.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/examples/code/python_dependencies.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/examples/github/_client.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/examples/github/commits_visibilty_graph.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/examples/github/followers.graphql +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/examples/github/followers.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/examples/github/graphql.config.yml +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/examples/github/repositories.graphql +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/examples/github/repositories.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/examples/math/polygonal_graph.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/examples/math/requirements.txt +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/examples/system/processes.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/examples/web/page_links.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/mkdocs.yml +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/playground/ethernet/traceroute.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/playground/genric_graph.graphql +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/playground/graphql.config.yml +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/playground/house_of_graphs.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/playground/social/albums.json +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/playground/social/musicisians.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/playground/text/nlp_graph.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/playground/text/requirements.txt +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/playground/time_series/requirements.txt +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/playground/time_series/visibility_graph.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/sonar-project.properties +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/__main__.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/cli.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/materializers/matplotlib.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/server/__init__.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/server/starlette/__init__.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/server/starlette/views.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/server/web/__init__.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/server/web/elements/__init__.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/server/web/elements/index.html +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/server/web/graphiql/__init__.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/server/web/graphiql/index.html +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/server/web/rapidoc/__init__.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/server/web/rapidoc/index.html +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/server/web/static/images/logo-128.png +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/server/web/static/images/network_graph.png +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/server/web/viewer/__init__.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/server/web/voyager/__init__.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/server/web/voyager/index.html +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/tools/__init__.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/src/graphinate/tools/converters.py +0 -0
- {graphinate-0.3.1 → graphinate-0.3.2}/tests/graphinate/test_tools.py +0 -0
|
@@ -16,7 +16,7 @@ jobs:
|
|
|
16
16
|
fail-fast: false
|
|
17
17
|
matrix:
|
|
18
18
|
# https://github.com/actions/python-versions/blob/main/versions-manifest.json
|
|
19
|
-
python-version: [ "3.14.0-alpha.
|
|
19
|
+
python-version: [ "3.14.0-alpha.2" ]
|
|
20
20
|
steps:
|
|
21
21
|
- uses: actions/checkout@v4
|
|
22
22
|
- name: Set up Python ${{ matrix.python-version }}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Path to sources
|
|
2
|
+
#sonar.sources=.
|
|
3
|
+
#sonar.exclusions=
|
|
4
|
+
#sonar.inclusions=
|
|
5
|
+
|
|
6
|
+
# Path to tests
|
|
7
|
+
#sonar.tests=
|
|
8
|
+
#sonar.test.exclusions=
|
|
9
|
+
#sonar.test.inclusions=
|
|
10
|
+
|
|
11
|
+
# Source encoding
|
|
12
|
+
#sonar.sourceEncoding=UTF-8
|
|
13
|
+
|
|
14
|
+
# Exclusions for copy-paste detection
|
|
15
|
+
#sonar.cpd.exclusions=
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: Graphinate
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: Graphinate. Data to Graphs.
|
|
5
5
|
Project-URL: Homepage, https://erivlis.github.io/graphinate
|
|
6
6
|
Project-URL: Documentation, https://erivlis.github.io/graphinate
|
|
@@ -27,12 +27,12 @@ Classifier: Topic :: Scientific/Engineering
|
|
|
27
27
|
Classifier: Topic :: Software Development :: Libraries
|
|
28
28
|
Classifier: Typing :: Typed
|
|
29
29
|
Requires-Python: >=3.10
|
|
30
|
-
Requires-Dist: click
|
|
31
|
-
Requires-Dist: inflect
|
|
32
|
-
Requires-Dist: loguru
|
|
33
|
-
Requires-Dist: matplotlib
|
|
34
|
-
Requires-Dist: networkx
|
|
35
|
-
Requires-Dist: strawberry-graphql[asgi,opentelemetry]
|
|
30
|
+
Requires-Dist: click
|
|
31
|
+
Requires-Dist: inflect
|
|
32
|
+
Requires-Dist: loguru
|
|
33
|
+
Requires-Dist: matplotlib
|
|
34
|
+
Requires-Dist: networkx
|
|
35
|
+
Requires-Dist: strawberry-graphql[asgi,opentelemetry]
|
|
36
36
|
Provides-Extra: dev
|
|
37
37
|
Requires-Dist: pipdeptree; extra == 'dev'
|
|
38
38
|
Requires-Dist: ruff; extra == 'dev'
|
|
@@ -45,17 +45,17 @@ Requires-Dist: mkdocs-material; extra == 'docs'
|
|
|
45
45
|
Requires-Dist: mkdocs-section-index; extra == 'docs'
|
|
46
46
|
Requires-Dist: mkdocstrings-python; extra == 'docs'
|
|
47
47
|
Provides-Extra: plot
|
|
48
|
-
Requires-Dist: scipy
|
|
48
|
+
Requires-Dist: scipy; extra == 'plot'
|
|
49
49
|
Provides-Extra: server
|
|
50
50
|
Requires-Dist: starlette-prometheus; extra == 'server'
|
|
51
|
-
Requires-Dist: uvicorn[standard]
|
|
51
|
+
Requires-Dist: uvicorn[standard]; extra == 'server'
|
|
52
52
|
Provides-Extra: test
|
|
53
|
-
Requires-Dist: faker
|
|
54
|
-
Requires-Dist: pytest
|
|
55
|
-
Requires-Dist: pytest-
|
|
56
|
-
Requires-Dist: pytest-
|
|
57
|
-
Requires-Dist: pytest-
|
|
58
|
-
Requires-Dist: pytest
|
|
53
|
+
Requires-Dist: faker; extra == 'test'
|
|
54
|
+
Requires-Dist: pytest; extra == 'test'
|
|
55
|
+
Requires-Dist: pytest-asyncio; extra == 'test'
|
|
56
|
+
Requires-Dist: pytest-cov; extra == 'test'
|
|
57
|
+
Requires-Dist: pytest-randomly; extra == 'test'
|
|
58
|
+
Requires-Dist: pytest-xdist; extra == 'test'
|
|
59
59
|
Description-Content-Type: text/markdown
|
|
60
60
|
|
|
61
61
|
# [Graphinate. Data to Graphs.](https://erivlis.github.io/graphinate/)
|
|
@@ -66,31 +66,38 @@ Description-Content-Type: text/markdown
|
|
|
66
66
|
<tr style="vertical-align: middle;">
|
|
67
67
|
<td>Package</td>
|
|
68
68
|
<td>
|
|
69
|
-
<img alt="PyPI - version" src="https://img.shields.io/pypi/v/graphinate">
|
|
70
|
-
<img alt="PyPI - Status" src="https://img.shields.io/pypi/status/graphinate">
|
|
71
|
-
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/graphinate">
|
|
72
|
-
<img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dd/graphinate">
|
|
73
|
-
<
|
|
69
|
+
<img alt="PyPI - version" src="https://img.shields.io/pypi/v/graphinate.svg?logo=pypi&logoColor=lightblue">
|
|
70
|
+
<img alt="PyPI - Status" src="https://img.shields.io/pypi/status/graphinate.svg?logo=pypi&logoColor=lightblue">
|
|
71
|
+
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/graphinate.svg?logo=python&label=Python&logoColor=lightblue">
|
|
72
|
+
<img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dd/graphinate.svg?logo=pypi&logoColor=lightblue">
|
|
73
|
+
<img alt="Libraries.io SourceRank" src="https://img.shields.io/librariesio/sourcerank/pypi/Graphinate.svg?logo=Libraries.io&label=SourceRank">
|
|
74
|
+
</td>
|
|
75
|
+
</tr>
|
|
76
|
+
<tr>
|
|
77
|
+
<td>Code</td>
|
|
78
|
+
<td>
|
|
74
79
|
<img alt="GitHub" src="https://img.shields.io/github/license/erivlis/graphinate">
|
|
75
|
-
<img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/erivlis/graphinate">
|
|
76
|
-
<img alt="GitHub last commit (by committer)" src="https://img.shields.io/github/last-commit/erivlis/graphinate">
|
|
77
|
-
<a href="https://github.com/erivlis/graphinate/graphs/contributors"><img alt="Contributors" src="https://img.shields.io/github/contributors/erivlis/graphinate.svg"></a>
|
|
80
|
+
<img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/erivlis/graphinate.svg?label=Size&logo=git">
|
|
81
|
+
<img alt="GitHub last commit (by committer)" src="https://img.shields.io/github/last-commit/erivlis/graphinate.svg?&logo=git">
|
|
82
|
+
<a href="https://github.com/erivlis/graphinate/graphs/contributors"><img alt="Contributors" src="https://img.shields.io/github/contributors/erivlis/graphinate.svg?&logo=git"></a>
|
|
78
83
|
</td>
|
|
79
84
|
</tr>
|
|
80
85
|
<tr>
|
|
81
86
|
<td>Tools</td>
|
|
82
87
|
<td>
|
|
83
88
|
<a href="https://www.jetbrains.com/pycharm/"><img alt="PyCharm" src="https://img.shields.io/badge/PyCharm-FCF84A.svg?logo=PyCharm&logoColor=black&labelColor=21D789&color=FCF84A"></a>
|
|
84
|
-
<a href="https://github.com/astral-sh/ruff"><img alt="ruff" src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" style="max-width:100%;"></a>
|
|
85
89
|
<a href="https://github.com/astral-sh/uv"><img alt="uv" src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json" style="max-width:100%;"></a>
|
|
86
|
-
<a href="https://
|
|
90
|
+
<a href="https://github.com/astral-sh/ruff"><img alt="ruff" src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" style="max-width:100%;"></a>
|
|
87
91
|
<a href="https://github.com/tox-dev/pipdeptree"><img alt="pipdeptree" src="https://img.shields.io/badge/pipdeptree-526CFE.svg?labelColor=gray&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAADFElEQVR4nFxTW2tcVRRe39773E/mliZjwKRmhBaKt4BWRKmGgihCH3xUKNWC/Q/ii76IP8AHpSIiRfqmD5YKCinalhgiCMZLSVtMM0mTdDLTuZyZc9l7yTlp7WXBgXPW+fa31rfWtxU9FLMN79Crr028e+iJsZfb7fJMp23xRlOvbTR3L/y5cuOL3Vbv7/vxuPviecI/eWr6k/mj4+8AkM11y+zs2MKwMJvNgIgYINZX/rlx+tIvf72fZXr4P0EQyOCjjw98P9vwn8+/+z3Bq6sek7AJkNhsOjQcyjvFmHd2upd+PP/zsSxNI5mnPvjw8U9fPFJ9XVkgNuDVayEbcgVEfgikNfFg4JAmh1LyyfGq06QqE9vN6+fEs4fHnjv25vjbAOA4AsL2MVZ1hRcI4QXIH7ilMqQXkiYXRBJRbFNQnTsRlqfmxFvH66ccFyAQMxP3I5cqNZBSxIWcKORMO9g3yeSHzFkGbnVCIkDUZ+beEy+8VJ4XguC6TMPYokwrCAHUJsBxYptoFBYSMi0oLIlcAkuFYhal8Zl5VanZU0zErgfurufMFjEkWZ7iRFY4SlgYfW9bUIJKFQNjiNPYf1QZOZn/hTaStPQKTI4eDCxSjsL4I6BeJzOjgcnT0HqPqwBJCdHZjW/miWjkkG3hzqKIe5FVlM3llGuWqOxTDMBkWlJ/6PB2p0Sb21gXixdvLeTtDGOHLFvQHpkiYyTuNU5kuxJercTdpEK3Bz4yLdFrXVsQ33x1/bModjhvyrKKVXB/YD9gb8PgKAlolAZipmFTOIYcxq21Xz8XS5dbi+e+2zqbA3MjxYninH3PpkyZljwYjZE2FoxBIWm6YVHaW/k66qwtF05curz509OHHzvqBqWp232fE+2AoCjOXNMfhcRcjAxxoijNFNpbG0vL588cNzpLC4I00cnCD1fPBuVqffbA5DMGNjR5MOSBpC+UYxGE5G5PmNXff/vy4rdnTmRJHD1wG+9G42D9qVfeePLk/oONI8qv7+/2fbq11f53ZfnqhStLi6d3b67/cT/+vwAAAP//Xo5dwOtdLi4AAAAASUVORK5CYII="></a>
|
|
92
|
+
<a href="https://squidfunk.github.io/mkdocs-material/"><img alt="mkdocs-material" src="https://img.shields.io/badge/Material_for_MkDocs-526CFE?&logo=MaterialForMkDocs&logoColor=white&labelColor=grey"></a>
|
|
93
|
+
<a href="https://hatch.pypa.io"><img alt="Hatch project" class="off-glb" loading="lazy" src="https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg"></a>
|
|
88
94
|
</td>
|
|
89
95
|
</tr>
|
|
90
96
|
<tr>
|
|
91
97
|
<td>CI/CD</td>
|
|
92
98
|
<td>
|
|
93
99
|
<a href="https://github.com/erivlis/graphinate/actions/workflows/test.yml"><img alt="Tests" src="https://github.com/erivlis/graphinate/actions/workflows/test.yml/badge.svg?branch=master"></a>
|
|
100
|
+
<a href="https://github.com/erivlis/graphinate/actions/workflows/test.yml"><img alt="Tests" src="https://github.com/erivlis/graphinate/actions/workflows/test-beta.yml/badge.svg?branch=master"></a>
|
|
94
101
|
<a href="https://github.com/erivlis/graphinate/actions/workflows/publish.yml"><img alt="Publish" src="https://github.com/erivlis/graphinate/actions/workflows/publish.yml/badge.svg"></a>
|
|
95
102
|
<a href="https://github.com/erivlis/graphinate/actions/workflows/publish-docs.yaml"><img alt="Publish Docs" src="https://github.com/erivlis/graphinate/actions/workflows/publish-docs.yaml/badge.svg"></a>
|
|
96
103
|
</td>
|
|
@@ -99,20 +106,18 @@ Description-Content-Type: text/markdown
|
|
|
99
106
|
<td>Scans</td>
|
|
100
107
|
<td>
|
|
101
108
|
<a href="https://codecov.io/gh/erivlis/graphinate"><img alt="Coverage" src="https://codecov.io/gh/erivlis/graphinate/graph/badge.svg?token=POODT8M9NV"/></a>
|
|
102
|
-
<br>
|
|
103
109
|
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Quality Gate Status" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=alert_status"></a>
|
|
104
110
|
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Security Rating" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=security_rating"></a>
|
|
105
111
|
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Maintainability Rating" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=sqale_rating"></a>
|
|
106
112
|
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Reliability Rating" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=reliability_rating"></a>
|
|
107
|
-
<br>
|
|
108
113
|
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Lines of Code" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=ncloc"></a>
|
|
109
114
|
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Vulnerabilities" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=vulnerabilities"></a>
|
|
110
115
|
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Bugs" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=bugs"></a>
|
|
111
|
-
<br>
|
|
112
116
|
<a href="https://app.codacy.com/gh/erivlis/graphinate/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade"><img alt="Codacy Badge" src="https://app.codacy.com/project/badge/Grade/54b33c3f7313448f9471d01e2a06f037"></a>
|
|
113
117
|
<a href="https://app.codacy.com/gh/erivlis/graphinate/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage"><img alt="Codacy Coverage" src="https://app.codacy.com/project/badge/Coverage/54b33c3f7313448f9471d01e2a06f037"/></a>
|
|
114
118
|
<a href="https://scrutinizer-ci.com/g/erivlis/graphinate"><img alt="Scrutinizer" src="https://scrutinizer-ci.com/g/erivlis/graphinate/badges/quality-score.png?b=main"></a>
|
|
115
|
-
|
|
119
|
+
<a href="https://www.codefactor.io/repository/github/erivlis/graphinate"><img src="https://www.codefactor.io/repository/github/erivlis/graphinate/badge" alt="CodeFactor" /></a>
|
|
120
|
+
<a href="https://snyk.io/test/github/erivlis/graphinate"><img alt="Snyk" src="https://snyk.io/test/github/erivlis/Graphinate/badge.svg"></a>
|
|
116
121
|
</td>
|
|
117
122
|
</tr>
|
|
118
123
|
</table>
|
|
@@ -179,8 +184,6 @@ def edge():
|
|
|
179
184
|
graphinate.materialize(graph_model)
|
|
180
185
|
```
|
|
181
186
|
|
|
182
|
-
|
|
183
|
-
|
|
184
187
|
#### `graphinate.model` function
|
|
185
188
|
|
|
186
189
|
> [!NOTE]
|
|
@@ -6,31 +6,38 @@
|
|
|
6
6
|
<tr style="vertical-align: middle;">
|
|
7
7
|
<td>Package</td>
|
|
8
8
|
<td>
|
|
9
|
-
<img alt="PyPI - version" src="https://img.shields.io/pypi/v/graphinate">
|
|
10
|
-
<img alt="PyPI - Status" src="https://img.shields.io/pypi/status/graphinate">
|
|
11
|
-
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/graphinate">
|
|
12
|
-
<img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dd/graphinate">
|
|
13
|
-
<
|
|
9
|
+
<img alt="PyPI - version" src="https://img.shields.io/pypi/v/graphinate.svg?logo=pypi&logoColor=lightblue">
|
|
10
|
+
<img alt="PyPI - Status" src="https://img.shields.io/pypi/status/graphinate.svg?logo=pypi&logoColor=lightblue">
|
|
11
|
+
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/graphinate.svg?logo=python&label=Python&logoColor=lightblue">
|
|
12
|
+
<img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dd/graphinate.svg?logo=pypi&logoColor=lightblue">
|
|
13
|
+
<img alt="Libraries.io SourceRank" src="https://img.shields.io/librariesio/sourcerank/pypi/Graphinate.svg?logo=Libraries.io&label=SourceRank">
|
|
14
|
+
</td>
|
|
15
|
+
</tr>
|
|
16
|
+
<tr>
|
|
17
|
+
<td>Code</td>
|
|
18
|
+
<td>
|
|
14
19
|
<img alt="GitHub" src="https://img.shields.io/github/license/erivlis/graphinate">
|
|
15
|
-
<img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/erivlis/graphinate">
|
|
16
|
-
<img alt="GitHub last commit (by committer)" src="https://img.shields.io/github/last-commit/erivlis/graphinate">
|
|
17
|
-
<a href="https://github.com/erivlis/graphinate/graphs/contributors"><img alt="Contributors" src="https://img.shields.io/github/contributors/erivlis/graphinate.svg"></a>
|
|
20
|
+
<img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/erivlis/graphinate.svg?label=Size&logo=git">
|
|
21
|
+
<img alt="GitHub last commit (by committer)" src="https://img.shields.io/github/last-commit/erivlis/graphinate.svg?&logo=git">
|
|
22
|
+
<a href="https://github.com/erivlis/graphinate/graphs/contributors"><img alt="Contributors" src="https://img.shields.io/github/contributors/erivlis/graphinate.svg?&logo=git"></a>
|
|
18
23
|
</td>
|
|
19
24
|
</tr>
|
|
20
25
|
<tr>
|
|
21
26
|
<td>Tools</td>
|
|
22
27
|
<td>
|
|
23
28
|
<a href="https://www.jetbrains.com/pycharm/"><img alt="PyCharm" src="https://img.shields.io/badge/PyCharm-FCF84A.svg?logo=PyCharm&logoColor=black&labelColor=21D789&color=FCF84A"></a>
|
|
24
|
-
<a href="https://github.com/astral-sh/ruff"><img alt="ruff" src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" style="max-width:100%;"></a>
|
|
25
29
|
<a href="https://github.com/astral-sh/uv"><img alt="uv" src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json" style="max-width:100%;"></a>
|
|
26
|
-
<a href="https://
|
|
30
|
+
<a href="https://github.com/astral-sh/ruff"><img alt="ruff" src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" style="max-width:100%;"></a>
|
|
27
31
|
<a href="https://github.com/tox-dev/pipdeptree"><img alt="pipdeptree" src="https://img.shields.io/badge/pipdeptree-526CFE.svg?labelColor=gray&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAADFElEQVR4nFxTW2tcVRRe39773E/mliZjwKRmhBaKt4BWRKmGgihCH3xUKNWC/Q/ii76IP8AHpSIiRfqmD5YKCinalhgiCMZLSVtMM0mTdDLTuZyZc9l7yTlp7WXBgXPW+fa31rfWtxU9FLMN79Crr028e+iJsZfb7fJMp23xRlOvbTR3L/y5cuOL3Vbv7/vxuPviecI/eWr6k/mj4+8AkM11y+zs2MKwMJvNgIgYINZX/rlx+tIvf72fZXr4P0EQyOCjjw98P9vwn8+/+z3Bq6sek7AJkNhsOjQcyjvFmHd2upd+PP/zsSxNI5mnPvjw8U9fPFJ9XVkgNuDVayEbcgVEfgikNfFg4JAmh1LyyfGq06QqE9vN6+fEs4fHnjv25vjbAOA4AsL2MVZ1hRcI4QXIH7ilMqQXkiYXRBJRbFNQnTsRlqfmxFvH66ccFyAQMxP3I5cqNZBSxIWcKORMO9g3yeSHzFkGbnVCIkDUZ+beEy+8VJ4XguC6TMPYokwrCAHUJsBxYptoFBYSMi0oLIlcAkuFYhal8Zl5VanZU0zErgfurufMFjEkWZ7iRFY4SlgYfW9bUIJKFQNjiNPYf1QZOZn/hTaStPQKTI4eDCxSjsL4I6BeJzOjgcnT0HqPqwBJCdHZjW/miWjkkG3hzqKIe5FVlM3llGuWqOxTDMBkWlJ/6PB2p0Sb21gXixdvLeTtDGOHLFvQHpkiYyTuNU5kuxJercTdpEK3Bz4yLdFrXVsQ33x1/bModjhvyrKKVXB/YD9gb8PgKAlolAZipmFTOIYcxq21Xz8XS5dbi+e+2zqbA3MjxYninH3PpkyZljwYjZE2FoxBIWm6YVHaW/k66qwtF05curz509OHHzvqBqWp232fE+2AoCjOXNMfhcRcjAxxoijNFNpbG0vL588cNzpLC4I00cnCD1fPBuVqffbA5DMGNjR5MOSBpC+UYxGE5G5PmNXff/vy4rdnTmRJHD1wG+9G42D9qVfeePLk/oONI8qv7+/2fbq11f53ZfnqhStLi6d3b67/cT/+vwAAAP//Xo5dwOtdLi4AAAAASUVORK5CYII="></a>
|
|
32
|
+
<a href="https://squidfunk.github.io/mkdocs-material/"><img alt="mkdocs-material" src="https://img.shields.io/badge/Material_for_MkDocs-526CFE?&logo=MaterialForMkDocs&logoColor=white&labelColor=grey"></a>
|
|
33
|
+
<a href="https://hatch.pypa.io"><img alt="Hatch project" class="off-glb" loading="lazy" src="https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg"></a>
|
|
28
34
|
</td>
|
|
29
35
|
</tr>
|
|
30
36
|
<tr>
|
|
31
37
|
<td>CI/CD</td>
|
|
32
38
|
<td>
|
|
33
39
|
<a href="https://github.com/erivlis/graphinate/actions/workflows/test.yml"><img alt="Tests" src="https://github.com/erivlis/graphinate/actions/workflows/test.yml/badge.svg?branch=master"></a>
|
|
40
|
+
<a href="https://github.com/erivlis/graphinate/actions/workflows/test.yml"><img alt="Tests" src="https://github.com/erivlis/graphinate/actions/workflows/test-beta.yml/badge.svg?branch=master"></a>
|
|
34
41
|
<a href="https://github.com/erivlis/graphinate/actions/workflows/publish.yml"><img alt="Publish" src="https://github.com/erivlis/graphinate/actions/workflows/publish.yml/badge.svg"></a>
|
|
35
42
|
<a href="https://github.com/erivlis/graphinate/actions/workflows/publish-docs.yaml"><img alt="Publish Docs" src="https://github.com/erivlis/graphinate/actions/workflows/publish-docs.yaml/badge.svg"></a>
|
|
36
43
|
</td>
|
|
@@ -39,20 +46,18 @@
|
|
|
39
46
|
<td>Scans</td>
|
|
40
47
|
<td>
|
|
41
48
|
<a href="https://codecov.io/gh/erivlis/graphinate"><img alt="Coverage" src="https://codecov.io/gh/erivlis/graphinate/graph/badge.svg?token=POODT8M9NV"/></a>
|
|
42
|
-
<br>
|
|
43
49
|
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Quality Gate Status" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=alert_status"></a>
|
|
44
50
|
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Security Rating" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=security_rating"></a>
|
|
45
51
|
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Maintainability Rating" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=sqale_rating"></a>
|
|
46
52
|
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Reliability Rating" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=reliability_rating"></a>
|
|
47
|
-
<br>
|
|
48
53
|
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Lines of Code" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=ncloc"></a>
|
|
49
54
|
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Vulnerabilities" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=vulnerabilities"></a>
|
|
50
55
|
<a href="https://sonarcloud.io/summary/new_code?id=erivlis_graphinate"><img alt="Bugs" src="https://sonarcloud.io/api/project_badges/measure?project=erivlis_graphinate&metric=bugs"></a>
|
|
51
|
-
<br>
|
|
52
56
|
<a href="https://app.codacy.com/gh/erivlis/graphinate/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade"><img alt="Codacy Badge" src="https://app.codacy.com/project/badge/Grade/54b33c3f7313448f9471d01e2a06f037"></a>
|
|
53
57
|
<a href="https://app.codacy.com/gh/erivlis/graphinate/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage"><img alt="Codacy Coverage" src="https://app.codacy.com/project/badge/Coverage/54b33c3f7313448f9471d01e2a06f037"/></a>
|
|
54
58
|
<a href="https://scrutinizer-ci.com/g/erivlis/graphinate"><img alt="Scrutinizer" src="https://scrutinizer-ci.com/g/erivlis/graphinate/badges/quality-score.png?b=main"></a>
|
|
55
|
-
|
|
59
|
+
<a href="https://www.codefactor.io/repository/github/erivlis/graphinate"><img src="https://www.codefactor.io/repository/github/erivlis/graphinate/badge" alt="CodeFactor" /></a>
|
|
60
|
+
<a href="https://snyk.io/test/github/erivlis/graphinate"><img alt="Snyk" src="https://snyk.io/test/github/erivlis/Graphinate/badge.svg"></a>
|
|
56
61
|
</td>
|
|
57
62
|
</tr>
|
|
58
63
|
</table>
|
|
@@ -119,8 +124,6 @@ def edge():
|
|
|
119
124
|
graphinate.materialize(graph_model)
|
|
120
125
|
```
|
|
121
126
|
|
|
122
|
-
|
|
123
|
-
|
|
124
127
|
#### `graphinate.model` function
|
|
125
128
|
|
|
126
129
|
> [!NOTE]
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import itertools
|
|
2
2
|
|
|
3
3
|
import graphinate
|
|
4
|
-
import graphinate.tools.gui
|
|
5
4
|
import networkx as nx
|
|
5
|
+
from graphinate.tools.gui import listbox_chooser
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
def cylinder_edges(circumference: int, length: int):
|
|
@@ -820,7 +820,9 @@ def models(iterable):
|
|
|
820
820
|
model = next(models(atlas().items()))
|
|
821
821
|
|
|
822
822
|
if __name__ == '__main__':
|
|
823
|
-
choices = graphinate.tools.gui.modal_listbox_chooser('Choose Graph', atlas())
|
|
823
|
+
# choices = graphinate.tools.gui.modal_listbox_chooser('Choose Graph', atlas())
|
|
824
|
+
|
|
825
|
+
choices = listbox_chooser('Choose Graph', atlas())
|
|
824
826
|
|
|
825
827
|
for model in models(choices):
|
|
826
828
|
graphinate.materialize(model)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "Graphinate"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.2"
|
|
4
4
|
authors = [
|
|
5
5
|
{ name = "Eran Rivlis", email = "eran@rivlis.info" },
|
|
6
6
|
]
|
|
@@ -28,12 +28,12 @@ classifiers = [
|
|
|
28
28
|
]
|
|
29
29
|
keywords = ['graph', 'declarative']
|
|
30
30
|
dependencies = [
|
|
31
|
-
"click
|
|
32
|
-
"inflect
|
|
33
|
-
"loguru
|
|
34
|
-
"matplotlib
|
|
35
|
-
"networkx
|
|
36
|
-
"strawberry-graphql[asgi,opentelemetry]
|
|
31
|
+
"click",
|
|
32
|
+
"inflect",
|
|
33
|
+
"loguru",
|
|
34
|
+
"matplotlib",
|
|
35
|
+
"networkx",
|
|
36
|
+
"strawberry-graphql[asgi,opentelemetry]"
|
|
37
37
|
]
|
|
38
38
|
|
|
39
39
|
|
|
@@ -59,19 +59,19 @@ docs = [
|
|
|
59
59
|
"mkdocs-section-index",
|
|
60
60
|
]
|
|
61
61
|
test = [
|
|
62
|
-
"faker
|
|
63
|
-
"pytest
|
|
64
|
-
"pytest-asyncio
|
|
65
|
-
"pytest-cov
|
|
66
|
-
"pytest-randomly
|
|
67
|
-
"pytest-xdist
|
|
62
|
+
"faker",
|
|
63
|
+
"pytest",
|
|
64
|
+
"pytest-asyncio",
|
|
65
|
+
"pytest-cov",
|
|
66
|
+
"pytest-randomly",
|
|
67
|
+
"pytest-xdist"
|
|
68
68
|
]
|
|
69
69
|
plot = [
|
|
70
|
-
"scipy
|
|
70
|
+
"scipy"
|
|
71
71
|
]
|
|
72
72
|
server = [
|
|
73
73
|
"starlette-prometheus",
|
|
74
|
-
"uvicorn[standard]
|
|
74
|
+
"uvicorn[standard]"
|
|
75
75
|
]
|
|
76
76
|
|
|
77
77
|
|
|
@@ -79,16 +79,19 @@ server = [
|
|
|
79
79
|
requires = ["hatchling"]
|
|
80
80
|
build-backend = "hatchling.build"
|
|
81
81
|
|
|
82
|
-
|
|
83
82
|
[tool.hatch.metadata]
|
|
84
83
|
allow-direct-references = true
|
|
85
84
|
|
|
85
|
+
[tool.hatch.envs.default]
|
|
86
|
+
installer = "uv"
|
|
87
|
+
|
|
88
|
+
#[tool.hatch.build.targets.wheel]
|
|
89
|
+
#packages = ["src/graphinate"]
|
|
86
90
|
|
|
87
91
|
[tool.pytest.ini_options]
|
|
88
92
|
pythonpath = ["src"]
|
|
89
93
|
testpaths = ["tests"]
|
|
90
94
|
|
|
91
|
-
|
|
92
95
|
[tool.coverage.report]
|
|
93
96
|
exclude_also = [
|
|
94
97
|
"...",
|
|
@@ -129,7 +132,7 @@ select = [
|
|
|
129
132
|
"TRY",
|
|
130
133
|
"RUF",
|
|
131
134
|
]
|
|
132
|
-
ignore = ["
|
|
135
|
+
ignore = ["TRY003", "UP007", "UP038", "RUF100"]
|
|
133
136
|
# Exclude a variety of commonly ignored directories.
|
|
134
137
|
exclude = [
|
|
135
138
|
".bzr",
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
from graphinate import builders
|
|
2
2
|
from graphinate.builders import GraphType, build
|
|
3
3
|
from graphinate.materializers import materialize, plot
|
|
4
|
-
from graphinate.modeling import
|
|
4
|
+
from graphinate.modeling import GraphModel, model
|
|
5
5
|
from graphinate.server import graphql
|
|
6
6
|
|
|
7
7
|
__all__ = (
|
|
8
|
+
'GraphModel',
|
|
9
|
+
'GraphType',
|
|
8
10
|
'build',
|
|
9
11
|
'builders',
|
|
10
|
-
'GraphModel',
|
|
11
12
|
'graphql',
|
|
12
|
-
'GraphType',
|
|
13
13
|
'materialize',
|
|
14
14
|
'model',
|
|
15
|
-
'plot'
|
|
16
|
-
'UNIVERSE_NODE'
|
|
15
|
+
'plot'
|
|
17
16
|
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"""
|
|
2
|
-
|
|
2
|
+
Builder classes that generate graph data structures from a GraphModel
|
|
3
3
|
"""
|
|
4
4
|
import base64
|
|
5
5
|
import functools
|
|
@@ -12,11 +12,11 @@ import operator
|
|
|
12
12
|
import pickle
|
|
13
13
|
from abc import ABC
|
|
14
14
|
from collections import Counter
|
|
15
|
-
from collections.abc import Hashable, Mapping
|
|
15
|
+
from collections.abc import Callable, Hashable, Mapping
|
|
16
16
|
from datetime import datetime
|
|
17
17
|
from enum import Enum
|
|
18
18
|
from types import MappingProxyType
|
|
19
|
-
from typing import Any,
|
|
19
|
+
from typing import Any, Optional, Union
|
|
20
20
|
|
|
21
21
|
import inflect
|
|
22
22
|
import networkx as nx
|
|
@@ -25,14 +25,14 @@ from loguru import logger
|
|
|
25
25
|
from strawberry.extensions import ParserCache, QueryDepthLimiter, ValidationCache
|
|
26
26
|
|
|
27
27
|
from . import color
|
|
28
|
-
from .modeling import
|
|
28
|
+
from .modeling import GraphModel
|
|
29
29
|
from .tools import converters, mutators, utcnow
|
|
30
|
-
from .typing import NodeTypeAbsoluteId
|
|
30
|
+
from .typing import NodeTypeAbsoluteId, UniverseNode
|
|
31
31
|
|
|
32
32
|
DEFAULT_NODE_DELIMITER = ' ∋ '
|
|
33
33
|
DEFAULT_EDGE_DELIMITER = ' ↔ '
|
|
34
34
|
|
|
35
|
-
GraphRepresentation = Union[dict, nx.Graph, strawberry.Schema]
|
|
35
|
+
GraphRepresentation = Union[dict, nx.Graph, strawberry.Schema] # noqa: UP007
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
def label_converter(value, delimiter: str):
|
|
@@ -102,6 +102,17 @@ class GraphType(Enum):
|
|
|
102
102
|
MultiDiGraph = nx.MultiDiGraph
|
|
103
103
|
MultiGraph = nx.MultiGraph
|
|
104
104
|
|
|
105
|
+
@classmethod
|
|
106
|
+
def of(cls, graph: nx.Graph):
|
|
107
|
+
if graph.is_directed() and graph.is_multigraph():
|
|
108
|
+
return cls.MultiDiGraph
|
|
109
|
+
elif graph.is_directed():
|
|
110
|
+
return cls.MultiGraph
|
|
111
|
+
elif graph.is_multigraph():
|
|
112
|
+
return cls.MultiDiGraph.MultiGraph
|
|
113
|
+
else:
|
|
114
|
+
return cls.Graph
|
|
115
|
+
|
|
105
116
|
|
|
106
117
|
class Builder(ABC):
|
|
107
118
|
"""Builder abstract base class"""
|
|
@@ -157,7 +168,7 @@ class NetworkxBuilder(Builder):
|
|
|
157
168
|
|
|
158
169
|
return self._graph.edges(**params)
|
|
159
170
|
|
|
160
|
-
def _populate_node_type(self, node_type: Union[Hashable,
|
|
171
|
+
def _populate_node_type(self, node_type: Union[Hashable, UniverseNode] = UniverseNode, **kwargs):
|
|
161
172
|
for parent_node_type, child_node_types in self.model.node_children_types(node_type).items():
|
|
162
173
|
for child_node_type in child_node_types:
|
|
163
174
|
node_type_absolute_id = (parent_node_type, child_node_type)
|
|
@@ -165,8 +176,8 @@ class NetworkxBuilder(Builder):
|
|
|
165
176
|
|
|
166
177
|
@staticmethod
|
|
167
178
|
def _parent_node_id(node_type_absolute_id: NodeTypeAbsoluteId, **kwargs):
|
|
168
|
-
if node_type_absolute_id[0] is
|
|
169
|
-
return
|
|
179
|
+
if node_type_absolute_id[0] is UniverseNode:
|
|
180
|
+
return UniverseNode
|
|
170
181
|
|
|
171
182
|
ids = []
|
|
172
183
|
for k, v in kwargs.items():
|
|
@@ -181,7 +192,7 @@ class NetworkxBuilder(Builder):
|
|
|
181
192
|
unique = node_model.uniqueness
|
|
182
193
|
for node in node_model.generator(**kwargs):
|
|
183
194
|
parent_node_id = self._parent_node_id(node_type_absolute_id, **kwargs)
|
|
184
|
-
node_lineage = (*parent_node_id, node.key) if parent_node_id is not
|
|
195
|
+
node_lineage = (*parent_node_id, node.key) if parent_node_id is not UniverseNode else (node.key,)
|
|
185
196
|
node_id = (node.key,) if unique else node_lineage
|
|
186
197
|
|
|
187
198
|
label = node.key
|
|
@@ -209,7 +220,7 @@ class NetworkxBuilder(Builder):
|
|
|
209
220
|
|
|
210
221
|
self._graph.graph['node_types'].update({node_type: 1})
|
|
211
222
|
|
|
212
|
-
if node_model.parent_type is not
|
|
223
|
+
if node_model.parent_type is not UniverseNode:
|
|
213
224
|
logger.debug("Adding edge from: '{}' to '{}'", parent_node_id, node_id)
|
|
214
225
|
self._graph.add_edge(parent_node_id,
|
|
215
226
|
node_id,
|
|
@@ -808,4 +819,4 @@ def build(builder_cls: type[Builder],
|
|
|
808
819
|
return materialized_graph
|
|
809
820
|
|
|
810
821
|
|
|
811
|
-
__all__ = ('
|
|
822
|
+
__all__ = ('D3Builder', 'GraphQLBuilder', 'GraphType', 'NetworkxBuilder', 'build')
|
|
@@ -36,7 +36,7 @@ def color_hex(color: Union[str, Sequence[Union[float, int]]]) -> Union[str, Sequ
|
|
|
36
36
|
Returns:
|
|
37
37
|
Color HEX code
|
|
38
38
|
"""
|
|
39
|
-
if isinstance(color, (tuple, list)):
|
|
39
|
+
if isinstance(color, (tuple, list)): # noqa: UP038
|
|
40
40
|
rgb = color[:3]
|
|
41
41
|
|
|
42
42
|
if all(isinstance(c, float) and 0 <= c <= 1 for c in rgb):
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import functools
|
|
2
2
|
import json
|
|
3
3
|
import os
|
|
4
|
-
from collections.abc import Mapping
|
|
4
|
+
from collections.abc import Callable, Mapping
|
|
5
5
|
from enum import Enum
|
|
6
|
-
from typing import
|
|
6
|
+
from typing import Optional
|
|
7
7
|
|
|
8
8
|
from .. import builders, modeling, server
|
|
9
|
-
from ..tools.gui import
|
|
9
|
+
from ..tools.gui import radiobutton_chooser
|
|
10
10
|
from .matplotlib import plot
|
|
11
11
|
|
|
12
12
|
ENABLE_GUI = bool(os.getenv('GRAPHINATE_ENABLE_GUI', True))
|
|
@@ -43,7 +43,7 @@ def materialize(model: modeling.GraphModel,
|
|
|
43
43
|
default_node_attributes:
|
|
44
44
|
builder: Builder instance
|
|
45
45
|
actualizer: function that will consume the resulting built graph and
|
|
46
|
-
|
|
46
|
+
actualizes it (e.g., display, serves, print etc.)
|
|
47
47
|
**kwargs:
|
|
48
48
|
|
|
49
49
|
Returns:
|
|
@@ -51,9 +51,9 @@ def materialize(model: modeling.GraphModel,
|
|
|
51
51
|
"""
|
|
52
52
|
title = title or model.name
|
|
53
53
|
if ENABLE_GUI and builder is None and actualizer is None:
|
|
54
|
-
result =
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
result = radiobutton_chooser(title,
|
|
55
|
+
options={m.name: m.value for m in Materializers},
|
|
56
|
+
default=(None, None))
|
|
57
57
|
builder, actualizer = result[1]
|
|
58
58
|
|
|
59
59
|
if builder is None and actualizer is None:
|