dkg 8.0.13__tar.gz → 8.0.14__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.
Files changed (82) hide show
  1. {dkg-8.0.13 → dkg-8.0.14}/PKG-INFO +1 -1
  2. {dkg-8.0.13 → dkg-8.0.14}/dkg/utils/knowledge_collection_tools.py +8 -14
  3. {dkg-8.0.13 → dkg-8.0.14}/pyproject.toml +20 -1
  4. {dkg-8.0.13 → dkg-8.0.14}/LICENSE +0 -0
  5. {dkg-8.0.13 → dkg-8.0.14}/NOTICE +0 -0
  6. {dkg-8.0.13 → dkg-8.0.14}/README.md +0 -0
  7. {dkg-8.0.13 → dkg-8.0.14}/dkg/__init__.py +0 -0
  8. {dkg-8.0.13 → dkg-8.0.14}/dkg/assertion.py +0 -0
  9. {dkg-8.0.13 → dkg-8.0.14}/dkg/clients/__init__.py +0 -0
  10. {dkg-8.0.13 → dkg-8.0.14}/dkg/clients/async_dkg.py +0 -0
  11. {dkg-8.0.13 → dkg-8.0.14}/dkg/clients/dkg.py +0 -0
  12. {dkg-8.0.13 → dkg-8.0.14}/dkg/constants.py +0 -0
  13. {dkg-8.0.13 → dkg-8.0.14}/dkg/data/interfaces/AskStorage.json +0 -0
  14. {dkg-8.0.13 → dkg-8.0.14}/dkg/data/interfaces/Chronos.json +0 -0
  15. {dkg-8.0.13 → dkg-8.0.14}/dkg/data/interfaces/Hub.json +0 -0
  16. {dkg-8.0.13 → dkg-8.0.14}/dkg/data/interfaces/IdentityStorage.json +0 -0
  17. {dkg-8.0.13 → dkg-8.0.14}/dkg/data/interfaces/KnowledgeCollection.json +0 -0
  18. {dkg-8.0.13 → dkg-8.0.14}/dkg/data/interfaces/KnowledgeCollectionStorage.json +0 -0
  19. {dkg-8.0.13 → dkg-8.0.14}/dkg/data/interfaces/Paranet.json +0 -0
  20. {dkg-8.0.13 → dkg-8.0.14}/dkg/data/interfaces/ParanetIncentivesPoolFactory.json +0 -0
  21. {dkg-8.0.13 → dkg-8.0.14}/dkg/data/interfaces/ParanetKnowledgeMinersRegistry.json +0 -0
  22. {dkg-8.0.13 → dkg-8.0.14}/dkg/data/interfaces/ParanetNeuroIncentivesPool.json +0 -0
  23. {dkg-8.0.13 → dkg-8.0.14}/dkg/data/interfaces/ParanetsRegistry.json +0 -0
  24. {dkg-8.0.13 → dkg-8.0.14}/dkg/data/interfaces/Token.json +0 -0
  25. {dkg-8.0.13 → dkg-8.0.14}/dkg/dataclasses.py +0 -0
  26. {dkg-8.0.13 → dkg-8.0.14}/dkg/exceptions.py +0 -0
  27. {dkg-8.0.13 → dkg-8.0.14}/dkg/managers/__init__.py +0 -0
  28. {dkg-8.0.13 → dkg-8.0.14}/dkg/managers/async_manager.py +0 -0
  29. {dkg-8.0.13 → dkg-8.0.14}/dkg/managers/manager.py +0 -0
  30. {dkg-8.0.13 → dkg-8.0.14}/dkg/method.py +0 -0
  31. {dkg-8.0.13 → dkg-8.0.14}/dkg/modules/__init__.py +0 -0
  32. {dkg-8.0.13 → dkg-8.0.14}/dkg/modules/asset/__init__.py +0 -0
  33. {dkg-8.0.13 → dkg-8.0.14}/dkg/modules/asset/asset.py +0 -0
  34. {dkg-8.0.13 → dkg-8.0.14}/dkg/modules/asset/async_asset.py +0 -0
  35. {dkg-8.0.13 → dkg-8.0.14}/dkg/modules/async_module.py +0 -0
  36. {dkg-8.0.13 → dkg-8.0.14}/dkg/modules/graph/__init__.py +0 -0
  37. {dkg-8.0.13 → dkg-8.0.14}/dkg/modules/graph/async_graph.py +0 -0
  38. {dkg-8.0.13 → dkg-8.0.14}/dkg/modules/graph/graph.py +0 -0
  39. {dkg-8.0.13 → dkg-8.0.14}/dkg/modules/module.py +0 -0
  40. {dkg-8.0.13 → dkg-8.0.14}/dkg/modules/network/__init__.py +0 -0
  41. {dkg-8.0.13 → dkg-8.0.14}/dkg/modules/network/network.py +0 -0
  42. {dkg-8.0.13 → dkg-8.0.14}/dkg/modules/node/__init__.py +0 -0
  43. {dkg-8.0.13 → dkg-8.0.14}/dkg/modules/node/async_node.py +0 -0
  44. {dkg-8.0.13 → dkg-8.0.14}/dkg/modules/node/node.py +0 -0
  45. {dkg-8.0.13 → dkg-8.0.14}/dkg/modules/paranet/__init__.py +0 -0
  46. {dkg-8.0.13 → dkg-8.0.14}/dkg/modules/paranet/paranet.py +0 -0
  47. {dkg-8.0.13 → dkg-8.0.14}/dkg/providers/__init__.py +0 -0
  48. {dkg-8.0.13 → dkg-8.0.14}/dkg/providers/blockchain/__init__.py +0 -0
  49. {dkg-8.0.13 → dkg-8.0.14}/dkg/providers/blockchain/async_blockchain.py +0 -0
  50. {dkg-8.0.13 → dkg-8.0.14}/dkg/providers/blockchain/base_blockchain.py +0 -0
  51. {dkg-8.0.13 → dkg-8.0.14}/dkg/providers/blockchain/blockchain.py +0 -0
  52. {dkg-8.0.13 → dkg-8.0.14}/dkg/providers/node/__init__.py +0 -0
  53. {dkg-8.0.13 → dkg-8.0.14}/dkg/providers/node/async_node_http.py +0 -0
  54. {dkg-8.0.13 → dkg-8.0.14}/dkg/providers/node/base_node_http.py +0 -0
  55. {dkg-8.0.13 → dkg-8.0.14}/dkg/providers/node/node_http.py +0 -0
  56. {dkg-8.0.13 → dkg-8.0.14}/dkg/services/__init__.py +0 -0
  57. {dkg-8.0.13 → dkg-8.0.14}/dkg/services/blockchain_services/__init__.py +0 -0
  58. {dkg-8.0.13 → dkg-8.0.14}/dkg/services/blockchain_services/async_blockchain_service.py +0 -0
  59. {dkg-8.0.13 → dkg-8.0.14}/dkg/services/blockchain_services/blockchain_service.py +0 -0
  60. {dkg-8.0.13 → dkg-8.0.14}/dkg/services/input_service.py +0 -0
  61. {dkg-8.0.13 → dkg-8.0.14}/dkg/services/node_services/__init__.py +0 -0
  62. {dkg-8.0.13 → dkg-8.0.14}/dkg/services/node_services/async_node_service.py +0 -0
  63. {dkg-8.0.13 → dkg-8.0.14}/dkg/services/node_services/node_service.py +0 -0
  64. {dkg-8.0.13 → dkg-8.0.14}/dkg/types/__init__.py +0 -0
  65. {dkg-8.0.13 → dkg-8.0.14}/dkg/types/blockchain.py +0 -0
  66. {dkg-8.0.13 → dkg-8.0.14}/dkg/types/dkg_node.py +0 -0
  67. {dkg-8.0.13 → dkg-8.0.14}/dkg/types/encoding.py +0 -0
  68. {dkg-8.0.13 → dkg-8.0.14}/dkg/types/evm.py +0 -0
  69. {dkg-8.0.13 → dkg-8.0.14}/dkg/types/general.py +0 -0
  70. {dkg-8.0.13 → dkg-8.0.14}/dkg/types/generics.py +0 -0
  71. {dkg-8.0.13 → dkg-8.0.14}/dkg/types/network.py +0 -0
  72. {dkg-8.0.13 → dkg-8.0.14}/dkg/types/rdf.py +0 -0
  73. {dkg-8.0.13 → dkg-8.0.14}/dkg/utils/__init__.py +0 -0
  74. {dkg-8.0.13 → dkg-8.0.14}/dkg/utils/blockchain_request.py +0 -0
  75. {dkg-8.0.13 → dkg-8.0.14}/dkg/utils/decorators.py +0 -0
  76. {dkg-8.0.13 → dkg-8.0.14}/dkg/utils/knowledge_asset_tools.py +0 -0
  77. {dkg-8.0.13 → dkg-8.0.14}/dkg/utils/merkle.py +0 -0
  78. {dkg-8.0.13 → dkg-8.0.14}/dkg/utils/metadata.py +0 -0
  79. {dkg-8.0.13 → dkg-8.0.14}/dkg/utils/node_request.py +0 -0
  80. {dkg-8.0.13 → dkg-8.0.14}/dkg/utils/rdf.py +0 -0
  81. {dkg-8.0.13 → dkg-8.0.14}/dkg/utils/string_transformations.py +0 -0
  82. {dkg-8.0.13 → dkg-8.0.14}/dkg/utils/ual.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: dkg
3
- Version: 8.0.13
3
+ Version: 8.0.14
4
4
  Summary: Python library for interacting with the OriginTrail Decentralized Knowledge Graph
5
5
  License: Apache-2.0
6
6
  Author: Uladzislau Hubar
@@ -5,7 +5,7 @@ from dkg.exceptions import DatasetInputFormatNotSupported, InvalidDataset
5
5
  from dkg.types import JSONLD, NQuads
6
6
  from pyld import jsonld
7
7
  from dkg.constants import DEFAULT_RDF_FORMAT, DEFAULT_CANON_ALGORITHM, ESCAPE_MAP
8
- from rdflib import Graph, BNode, URIRef, Literal as RDFLiteral
8
+ from rdflib import Graph, BNode, URIRef, Dataset
9
9
  from rdflib.exceptions import ParserError as RDFParserError
10
10
  from uuid import uuid4
11
11
  from web3 import Web3
@@ -182,16 +182,13 @@ def generate_missing_ids_for_blank_nodes(nquads_list: list[str] | None) -> list[
182
182
  def group_nquads_by_subject(nquads_list: list[str], sort: bool = False):
183
183
  grouped = {}
184
184
 
185
- # Process each quad in original order
186
- for nquad in nquads_list:
187
- if not nquad.strip(): # Skip empty lines
188
- continue
185
+ all_nquads = "\n".join(nquad for nquad in nquads_list if nquad.strip())
189
186
 
190
- # Parse single quad
191
- g = Graph()
192
- g.parse(data=nquad, format="nquads")
193
- quad = next(iter(g))
194
- subject, predicate, obj = quad
187
+ d = Dataset()
188
+ d.parse(data=all_nquads, format="nquads")
189
+
190
+ for quad in d:
191
+ subject, predicate, obj, graph = quad
195
192
 
196
193
  # Get subject key
197
194
  subject_key = (
@@ -204,11 +201,8 @@ def group_nquads_by_subject(nquads_list: list[str], sort: bool = False):
204
201
  if subject_key not in grouped:
205
202
  grouped[subject_key] = []
206
203
 
207
- # Format object
208
- object_value = f'"{obj}"' if isinstance(obj, RDFLiteral) else f"<{obj}>"
209
-
210
204
  # Add quad to group
211
- quad_string = f"{subject_key} <{predicate}> {object_value} ."
205
+ quad_string = f"{subject.n3()} {predicate.n3()} {obj.n3()} ."
212
206
  grouped[subject_key].append(quad_string)
213
207
 
214
208
  # Return grouped quads (sorted if requested)
@@ -1,11 +1,12 @@
1
1
  [tool.poetry]
2
2
  name = "dkg"
3
- version = "8.0.13"
3
+ version = "8.0.14"
4
4
  description = "Python library for interacting with the OriginTrail Decentralized Knowledge Graph"
5
5
  authors = ["Uladzislau Hubar <hubar.uladzislau@gmail.com>, Zvonimir Sculac <zvonimir.sculac@origin-trail.com>"]
6
6
  license = "Apache-2.0"
7
7
  readme = "README.md"
8
8
 
9
+
9
10
  [tool.poetry.dependencies]
10
11
  python = "^3.10"
11
12
  pyyaml = "^6.0.2"
@@ -23,10 +24,28 @@ python-dotenv = "^1.0.1"
23
24
  [tool.poetry.group.dev.dependencies]
24
25
  ruff = "^0.8.4"
25
26
  pre-commit = "^4.0.1"
27
+ pytest = "^8.0"
28
+ pytest-cov = "^4.0"
29
+
26
30
 
27
31
  [tools.setuptools]
28
32
  packages = ["dkg"]
29
33
 
34
+
30
35
  [build-system]
31
36
  requires = ["poetry-core"]
32
37
  build-backend = "poetry.core.masonry.api"
38
+
39
+
40
+ [tool.pytest.ini_options]
41
+ minversion = "8.0"
42
+ addopts = "-ra"
43
+ testpaths = [
44
+ "test"
45
+ ]
46
+
47
+
48
+ python_files = [
49
+ "test_*.py",
50
+ "*_test.py"
51
+ ]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes