polly-python 4.6.0__tar.gz → 4.7.0__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 (71) hide show
  1. {polly_python-4.6.0/polly_python.egg-info → polly_python-4.7.0}/PKG-INFO +1 -1
  2. polly_python-4.7.0/polly/__init__.py +1 -0
  3. {polly_python-4.6.0 → polly_python-4.7.0}/polly/help.py +5 -2
  4. {polly_python-4.6.0 → polly_python-4.7.0}/polly/polly_kg.py +29 -43
  5. {polly_python-4.6.0 → polly_python-4.7.0/polly_python.egg-info}/PKG-INFO +1 -1
  6. polly_python-4.6.0/polly/__init__.py +0 -1
  7. {polly_python-4.6.0 → polly_python-4.7.0}/LICENSE.md +0 -0
  8. {polly_python-4.6.0 → polly_python-4.7.0}/MANIFEST.in +0 -0
  9. {polly_python-4.6.0 → polly_python-4.7.0}/README.md +0 -0
  10. {polly_python-4.6.0 → polly_python-4.7.0}/polly/analyze.py +0 -0
  11. {polly_python-4.6.0 → polly_python-4.7.0}/polly/application_error_info.py +0 -0
  12. {polly_python-4.6.0 → polly_python-4.7.0}/polly/atlas.py +0 -0
  13. {polly_python-4.6.0 → polly_python-4.7.0}/polly/auth.py +0 -0
  14. {polly_python-4.6.0 → polly_python-4.7.0}/polly/constants.py +0 -0
  15. {polly_python-4.6.0 → polly_python-4.7.0}/polly/curation.py +0 -0
  16. {polly_python-4.6.0 → polly_python-4.7.0}/polly/data_management.py +0 -0
  17. {polly_python-4.6.0 → polly_python-4.7.0}/polly/errors.py +0 -0
  18. {polly_python-4.6.0 → polly_python-4.7.0}/polly/helpers.py +0 -0
  19. {polly_python-4.6.0 → polly_python-4.7.0}/polly/http_response_codes.py +0 -0
  20. {polly_python-4.6.0 → polly_python-4.7.0}/polly/index_schema_level_conversion_const.py +0 -0
  21. {polly_python-4.6.0 → polly_python-4.7.0}/polly/jobs.py +0 -0
  22. {polly_python-4.6.0 → polly_python-4.7.0}/polly/omixatlas.py +0 -0
  23. {polly_python-4.6.0 → polly_python-4.7.0}/polly/omixatlas_hlpr.py +0 -0
  24. {polly_python-4.6.0 → polly_python-4.7.0}/polly/pipelines.py +0 -0
  25. {polly_python-4.6.0 → polly_python-4.7.0}/polly/s3_utils.py +0 -0
  26. {polly_python-4.6.0 → polly_python-4.7.0}/polly/session.py +0 -0
  27. {polly_python-4.6.0 → polly_python-4.7.0}/polly/threading_utils.py +0 -0
  28. {polly_python-4.6.0 → polly_python-4.7.0}/polly/tracking.py +0 -0
  29. {polly_python-4.6.0 → polly_python-4.7.0}/polly/validation.py +0 -0
  30. {polly_python-4.6.0 → polly_python-4.7.0}/polly/validation_hlpr.py +0 -0
  31. {polly_python-4.6.0 → polly_python-4.7.0}/polly/workspaces.py +0 -0
  32. {polly_python-4.6.0 → polly_python-4.7.0}/polly_interfaces/IFiles.py +0 -0
  33. {polly_python-4.6.0 → polly_python-4.7.0}/polly_interfaces/IReporting.py +0 -0
  34. {polly_python-4.6.0 → polly_python-4.7.0}/polly_interfaces/ISchema.py +0 -0
  35. {polly_python-4.6.0 → polly_python-4.7.0}/polly_interfaces/__init__.py +0 -0
  36. {polly_python-4.6.0 → polly_python-4.7.0}/polly_python.egg-info/SOURCES.txt +0 -0
  37. {polly_python-4.6.0 → polly_python-4.7.0}/polly_python.egg-info/dependency_links.txt +0 -0
  38. {polly_python-4.6.0 → polly_python-4.7.0}/polly_python.egg-info/requires.txt +0 -0
  39. {polly_python-4.6.0 → polly_python-4.7.0}/polly_python.egg-info/top_level.txt +0 -0
  40. {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/__init__.py +0 -0
  41. {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/dataset.py +0 -0
  42. {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/files/__init__.py +0 -0
  43. {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/files/files.py +0 -0
  44. {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/files/files_hlpr.py +0 -0
  45. {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/polly_services_hlpr.py +0 -0
  46. {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/reporting/__init__.py +0 -0
  47. {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/reporting/reporting.py +0 -0
  48. {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/reporting/reporting_hlpr.py +0 -0
  49. {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/schema/__init__.py +0 -0
  50. {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/schema/schema.py +0 -0
  51. {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/schema/schema_const.py +0 -0
  52. {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/schema/schema_hlpr.py +0 -0
  53. {polly_python-4.6.0 → polly_python-4.7.0}/polly_services/schema/validate_schema_hlpr.py +0 -0
  54. {polly_python-4.6.0 → polly_python-4.7.0}/pyproject.toml +0 -0
  55. {polly_python-4.6.0 → polly_python-4.7.0}/setup.cfg +0 -0
  56. {polly_python-4.6.0 → polly_python-4.7.0}/setup.py +0 -0
  57. {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_atlas.py +0 -0
  58. {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_constants.py +0 -0
  59. {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_curation.py +0 -0
  60. {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_data_management.py +0 -0
  61. {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_help.py +0 -0
  62. {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_helpers.py +0 -0
  63. {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_jobs.py +0 -0
  64. {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_kg.py +0 -0
  65. {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_omixatlas.py +0 -0
  66. {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_pipelines.py +0 -0
  67. {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_s3_utils.py +0 -0
  68. {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_schema_ux.py +0 -0
  69. {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_threading_utils.py +0 -0
  70. {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_validation.py +0 -0
  71. {polly_python-4.6.0 → polly_python-4.7.0}/tests/test_workspaces.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polly_python
3
- Version: 4.6.0
3
+ Version: 4.7.0
4
4
  Summary: Polly SDK
5
5
  Home-page: https://github.com/ElucidataInc/polly-python
6
6
  Project-URL: Documentation, https://docs.elucidata.io
@@ -0,0 +1 @@
1
+ __version__ = "4.7.0"
@@ -273,8 +273,11 @@ def get_txt(
273
273
  and (not function_name or function_name == fun.split(".")[-1])
274
274
  and should_show_fun
275
275
  ):
276
- import rst2txt
277
- from docutils.core import publish_string
276
+ try:
277
+ import rst2txt
278
+ from docutils.core import publish_string
279
+ except ImportError:
280
+ return None
278
281
 
279
282
  # converting rst to txt
280
283
  txt = publish_string(
@@ -221,21 +221,15 @@ class PollyKG:
221
221
  """
222
222
  if not query or query == "":
223
223
  raise InvalidParameterException("query")
224
-
225
- # Validate query_type - only CYPHER is supported
224
+ query_url = f"{self.polly_kg_neo4j_endpoint}/kg/{self.kg_id}/versions/{self.version_id}/queries/"
226
225
  if query_type != "CYPHER":
227
226
  raise InvalidParameterException(
228
227
  f"Invalid query_type: '{query_type}'. Only 'CYPHER' query type is supported."
229
228
  )
230
-
231
- query_url = f"{self.polly_kg_neo4j_endpoint}/kg/{self.kg_id}/versions/{self.version_id}/queries/"
232
229
  payload = {
233
230
  "data": {
234
231
  "type": "kg_query",
235
- "attributes": {
236
- "query_string": query,
237
- "query_type": query_type,
238
- },
232
+ "attributes": {"query_string": query, "query_type": query_type},
239
233
  }
240
234
  }
241
235
  try:
@@ -328,14 +322,11 @@ class PollyKG:
328
322
  """
329
323
  if not query or query == "":
330
324
  raise InvalidParameterException("query")
331
-
332
- # Validate query_type - only CYPHER is supported
325
+ query_url = f"{self.polly_kg_neo4j_endpoint}/kg/{self.kg_id}/versions/{self.version_id}/queries/"
333
326
  if query_type != "CYPHER":
334
327
  raise InvalidParameterException(
335
328
  f"Invalid query_type: '{query_type}'. Only 'CYPHER' query type is supported."
336
329
  )
337
-
338
- query_url = f"{self.polly_kg_neo4j_endpoint}/kg/{self.kg_id}/versions/{self.version_id}/queries/"
339
330
  is_async = True
340
331
  payload = {
341
332
  "data": {
@@ -517,9 +508,10 @@ class PollyKG:
517
508
  print(e)
518
509
  raise
519
510
 
520
- def get_summary(self) -> dict:
511
+ def get_summary(self, stats: bool = False) -> dict:
521
512
  """Retrieve a summary of the Polly Knowledge Graph.
522
-
513
+ Params:
514
+ stats: A boolean flag to retrieve the detailed counts edges.
523
515
  Returns:
524
516
  dict: A dictionary containing summary information about the graph,
525
517
  such as node counts, edge counts, and other metadata.
@@ -530,9 +522,14 @@ class PollyKG:
530
522
  RequestFailureException: Raised when the request fails due to an unexpected error.
531
523
  """
532
524
  try:
533
- response = self.session.get(
534
- f"{self.polly_kg_neo4j_endpoint}/kg/{self.kg_id}/versions/{self.version_id}/summary"
535
- )
525
+ if stats:
526
+ response = self.session.get(
527
+ f"{self.polly_kg_neo4j_endpoint}/kg/{self.kg_id}/versions/{self.version_id}/summary?stats=true"
528
+ )
529
+ else:
530
+ response = self.session.get(
531
+ f"{self.polly_kg_neo4j_endpoint}/kg/{self.kg_id}/versions/{self.version_id}/summary"
532
+ )
536
533
  return handle_success_and_error_response(response)
537
534
  except Exception as e:
538
535
  print(e)
@@ -683,6 +680,7 @@ class PollyKG:
683
680
  data = new_schema.get("data", {})
684
681
  attributes = data.get("attributes", {})
685
682
  schema = attributes.get("schema", {})
683
+ custom_attributes = attributes.get("custom_attributes", {})
686
684
 
687
685
  # Extract basic information
688
686
  node_types = schema.get("node_types", [])
@@ -761,19 +759,24 @@ class PollyKG:
761
759
  # Build legacy format response
762
760
  from datetime import datetime
763
761
 
762
+ # Build metadata with standard fields
763
+ metadata = {
764
+ "name": "schema",
765
+ "kg_id": str(kg_id),
766
+ "kg_version": str(version_id),
767
+ "last_updated": datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ"),
768
+ "computed_at": datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ"),
769
+ }
770
+
771
+ data_source = custom_attributes.get("data_source")
772
+ if data_source is not None:
773
+ metadata["data_source"] = data_source
774
+
764
775
  legacy_format = {
765
776
  "data": {
766
777
  "type": "kg_schema",
767
778
  "attributes": {
768
- "metadata": {
769
- "name": "schema",
770
- "kg_id": str(kg_id),
771
- "kg_version": str(version_id),
772
- "last_updated": datetime.utcnow().strftime(
773
- "%Y-%m-%dT%H:%M:%SZ"
774
- ),
775
- "computed_at": datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ"),
776
- },
779
+ "metadata": metadata,
777
780
  "node_types": node_types,
778
781
  "edge_types": edge_types,
779
782
  "nodes": transformed_nodes,
@@ -829,23 +832,6 @@ class PollyKG:
829
832
  ResourceNotFoundError: Raised when no knowledge graphs are found.
830
833
  AccessDeniedError: Raised when the user does not have permission to access the KGs.
831
834
  RequestFailureException: Raised when the request fails due to an unexpected error.
832
-
833
- Example:
834
- >>> kg = PollyKG()
835
- >>> # Get only published KGs
836
- >>> kgs = kg.get_all_kgs()
837
- >>> for kg_info in kgs:
838
- ... print(f"{kg_info['kg_name']} (ID: {kg_info['kg_id']})")
839
- base kg v3 (ID: 14_base_kg_v3)
840
-
841
- >>> # Get all KGs including unpublished ones with instance details
842
- >>> kgs_with_instances = kg.get_all_kgs(
843
- ... include_unpublished=True,
844
- ... include_instances=True,
845
- ... include_terminated=True
846
- ... )
847
- >>> for kg_info in kgs_with_instances:
848
- ... print(f"{kg_info['kg_name']} - {len(kg_info.get('instances', []))} instances")
849
835
  """
850
836
  try:
851
837
  kg_url = f"{self.polly_kg_neo4j_endpoint}/kg"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polly_python
3
- Version: 4.6.0
3
+ Version: 4.7.0
4
4
  Summary: Polly SDK
5
5
  Home-page: https://github.com/ElucidataInc/polly-python
6
6
  Project-URL: Documentation, https://docs.elucidata.io
@@ -1 +0,0 @@
1
- __version__ = "4.6.0"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes