xbrlkit 0.7.2__tar.gz → 0.7.3__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 (114) hide show
  1. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/PKG-INFO +1 -1
  2. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/pyproject.toml +1 -1
  3. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/tests/test_serialize.py +31 -0
  4. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/deserialize/holon.py +4 -0
  5. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/serialize/_kernel/context.py +6 -2
  6. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/serialize/graph.py +8 -4
  7. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/.gitignore +0 -0
  8. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/LICENSE +0 -0
  9. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/README.md +0 -0
  10. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/pytest.ini +0 -0
  11. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/ruff.toml +0 -0
  12. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/tests/__init__.py +0 -0
  13. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/tests/conftest.py +0 -0
  14. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/tests/test_arelle_cache.py +0 -0
  15. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/tests/test_config.py +0 -0
  16. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/tests/test_deserialize.py +0 -0
  17. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/tests/test_documents.py +0 -0
  18. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/tests/test_edgar.py +0 -0
  19. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/tests/test_efts.py +0 -0
  20. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/tests/test_lpg.py +0 -0
  21. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/tests/test_oim.py +0 -0
  22. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/tests/test_parity.py +0 -0
  23. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/tests/test_parse.py +0 -0
  24. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/tests/test_query.py +0 -0
  25. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/tests/test_serve.py +0 -0
  26. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/tests/test_tavi.py +0 -0
  27. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/tests/test_text_ixbrl.py +0 -0
  28. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/tests/test_text_narrative.py +0 -0
  29. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/tests/test_text_parts.py +0 -0
  30. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/tests/test_text_tables.py +0 -0
  31. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/__init__.py +0 -0
  32. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/__init__.py +0 -0
  33. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/__init__.py +0 -0
  34. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/conf/README.md +0 -0
  35. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/conf/extractTestcase.sh +0 -0
  36. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/conf/extractTestcase.xsl +0 -0
  37. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/conf/runIxtSecTests.sh +0 -0
  38. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/conf/saxon9.jar +0 -0
  39. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/conf/testcase.xml +0 -0
  40. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/conf/tests.xml +0 -0
  41. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/conf/tests.xsd +0 -0
  42. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/text2num.py +0 -0
  43. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/transformationRegistry/registry/ixt-sec-boolballotbox.xml +0 -0
  44. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/transformationRegistry/registry/ixt-sec-countrynameen.xml +0 -0
  45. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/transformationRegistry/registry/ixt-sec-datequarterend.xml +0 -0
  46. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/transformationRegistry/registry/ixt-sec-durday.xml +0 -0
  47. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/transformationRegistry/registry/ixt-sec-durhour.xml +0 -0
  48. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/transformationRegistry/registry/ixt-sec-durmonth.xml +0 -0
  49. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/transformationRegistry/registry/ixt-sec-durweek.xml +0 -0
  50. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/transformationRegistry/registry/ixt-sec-durwordsen.xml +0 -0
  51. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/transformationRegistry/registry/ixt-sec-duryear.xml +0 -0
  52. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/transformationRegistry/registry/ixt-sec-edgarprovcountryen.xml +0 -0
  53. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/transformationRegistry/registry/ixt-sec-entityfilercategoryen.xml +0 -0
  54. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/transformationRegistry/registry/ixt-sec-exchnameen.xml +0 -0
  55. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/transformationRegistry/registry/ixt-sec-numwordsen.xml +0 -0
  56. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/transformationRegistry/registry/ixt-sec-stateprovnameen.xml +0 -0
  57. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/transformationRegistry/registry/ixt-sec-yesnoballotbox.xml +0 -0
  58. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/transformationRegistry/registry/transform-registry.xml +0 -0
  59. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/arelle_plugins/EDGAR/transform/transformationRegistry/schema/inlinexbrl-sec-transformation.xsd +0 -0
  60. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/ontology/v1/context.jsonld +0 -0
  61. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/_vendor/ontology/v1/shapes.ttl +0 -0
  62. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/cli.py +0 -0
  63. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/config.py +0 -0
  64. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/deserialize/README.md +0 -0
  65. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/deserialize/__init__.py +0 -0
  66. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/deserialize/tavi.py +0 -0
  67. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/edgar/README.md +0 -0
  68. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/edgar/__init__.py +0 -0
  69. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/edgar/client.py +0 -0
  70. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/edgar/download.py +0 -0
  71. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/edgar/efts.py +0 -0
  72. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/edgar/filing_index.py +0 -0
  73. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/edgar/rate_limit.py +0 -0
  74. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/edgar/submission.py +0 -0
  75. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/filings_org/README.md +0 -0
  76. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/filings_org/__init__.py +0 -0
  77. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/filings_org/client.py +0 -0
  78. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/filings_org/download.py +0 -0
  79. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/model.py +0 -0
  80. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/namespaces.py +0 -0
  81. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/parse/README.md +0 -0
  82. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/parse/__init__.py +0 -0
  83. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/parse/arelle_load.py +0 -0
  84. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/parse/cache.py +0 -0
  85. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/parse/ids.py +0 -0
  86. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/parse/to_model.py +0 -0
  87. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/periods.py +0 -0
  88. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/py.typed +0 -0
  89. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/query.py +0 -0
  90. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/schema/__init__.py +0 -0
  91. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/serialize/README.md +0 -0
  92. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/serialize/__init__.py +0 -0
  93. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/serialize/_kernel/__init__.py +0 -0
  94. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/serialize/_kernel/bundle.py +0 -0
  95. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/serialize/_kernel/holon.py +0 -0
  96. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/serialize/_kernel/jsonld.py +0 -0
  97. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/serialize/_values.py +0 -0
  98. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/serialize/classify.py +0 -0
  99. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/serialize/holon.py +0 -0
  100. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/serialize/lpg.py +0 -0
  101. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/serialize/oim.py +0 -0
  102. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/serialize/tavi.py +0 -0
  103. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/serve/README.md +0 -0
  104. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/serve/__init__.py +0 -0
  105. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/serve/server.py +0 -0
  106. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/serve/session.py +0 -0
  107. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/serve/tools.py +0 -0
  108. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/text/README.md +0 -0
  109. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/text/__init__.py +0 -0
  110. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/text/ixbrl.py +0 -0
  111. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/text/narrative.py +0 -0
  112. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/text/parts.py +0 -0
  113. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/text/tables.py +0 -0
  114. {xbrlkit-0.7.2 → xbrlkit-0.7.3}/xbrlkit/text/xml.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: xbrlkit
3
- Version: 0.7.2
3
+ Version: 0.7.3
4
4
  Summary: Work with XBRL filings above Arelle: one parse, portable models
5
5
  Project-URL: Repository, https://github.com/RoboFinSystems/xbrlkit
6
6
  Project-URL: Homepage, https://github.com/RoboFinSystems/xbrlkit#readme
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "xbrlkit"
3
- version = "0.7.2"
3
+ version = "0.7.3"
4
4
  description = "Work with XBRL filings above Arelle: one parse, portable models"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -27,6 +27,7 @@ from xbrlkit.model import (
27
27
  )
28
28
  from rdflib import RDF
29
29
 
30
+ from xbrlkit.serialize._kernel import context
30
31
  from xbrlkit.serialize import (
31
32
  build_holon_graph,
32
33
  classify_network,
@@ -472,3 +473,33 @@ def test_holon_serialization_is_deterministic() -> None:
472
473
  if isinstance(entry, dict) and isinstance(entry.get("@graph"), list):
473
474
  ids = [n.get("@id", "") for n in entry["@graph"] if isinstance(n, dict)]
474
475
  assert ids == sorted(ids)
476
+
477
+
478
+ def test_the_canonical_context_declares_each_term_once() -> None:
479
+ """A repeated key in the context silently rebinds a term.
480
+
481
+ `serialize/_kernel/` is a vendored fork and is excluded from ruff, so F601 —
482
+ which is enabled and does catch this — never runs on it. That is how a second
483
+ `"label"` key shipped in 0.7.0 and shadowed `rdfs:label` with `rs:label`,
484
+ leaving one term meaning two predicates across two documents that both call
485
+ themselves holons. Lint cannot reach the file; this can.
486
+ """
487
+ import ast
488
+ from pathlib import Path
489
+
490
+ source = Path(context.__file__).read_text()
491
+ tree = ast.parse(source)
492
+ for node in ast.walk(tree):
493
+ if not isinstance(node, ast.Dict):
494
+ continue
495
+ keys = [k.value for k in node.keys if isinstance(k, ast.Constant)]
496
+ duplicates = {k for k in keys if keys.count(k) > 1}
497
+ assert not duplicates, f"repeated context keys: {sorted(duplicates)}"
498
+
499
+
500
+ def test_the_standard_label_term_does_not_shadow_rdfs_label() -> None:
501
+ """`label` is `rdfs:label` — the platform's holon context binds it that way
502
+ too, and the two must not disagree. XBRL's standard-role label is written
503
+ under its own name."""
504
+ assert context.CANONICAL_CONTEXT["label"] == "rdfs:label"
505
+ assert context.CANONICAL_CONTEXT["standardLabel"]["@id"].endswith("standardLabel")
@@ -81,6 +81,10 @@ LABEL_TERM_ROLES: dict[str, str] = {
81
81
  label_type.split(":", 1)[-1]: role for role, label_type in LABEL_ROLE_TYPES.items()
82
82
  }
83
83
  STANDARD_LABEL_ROLE_URI = "http://www.xbrl.org/2003/role/label"
84
+ # The emitter names the standard-role label `standardLabel`; `label` is read as
85
+ # well, because holons written by 0.7.0-0.7.2 used it.
86
+ LABEL_TERM_ROLES["standardLabel"] = STANDARD_LABEL_ROLE_URI
87
+ LABEL_TERM_ROLES["label"] = STANDARD_LABEL_ROLE_URI
84
88
  DOCUMENTATION_LABEL_ROLE = "http://www.xbrl.org/2003/role/documentation"
85
89
 
86
90
  PARENT_CHILD_ARCROLE = "http://www.xbrl.org/2003/arcrole/parent-child"
@@ -140,8 +140,12 @@ CANONICAL_CONTEXT: dict = {
140
140
  "prefLabel": "skos:prefLabel",
141
141
  "documentation": "rdfs:comment",
142
142
  # The standard-role label, written beside `skos:prefLabel` because only
143
- # this one can carry the language the label was authored in.
144
- "label": {"@id": f"{RS_VOCAB}label"},
143
+ # this one can carry the language the label was authored in. Named
144
+ # `standardLabel` — XBRL's own name for the role — because `label` is bound
145
+ # to `rdfs:label` by the platform's holon context, and one key meaning two
146
+ # predicates across two documents that both call themselves holons is worse
147
+ # than a longer name.
148
+ "standardLabel": {"@id": f"{RS_VOCAB}standardLabel"},
145
149
  # Every other XBRL label role, one term each. A label is a literal with a
146
150
  # role, so it is one triple rather than a node: reifying them would add a
147
151
  # node per label, half again as many nodes as a report has.
@@ -58,13 +58,17 @@ _FACTSET_BASE = FACTSET_BASE
58
58
  # Label role URI -> the vocabulary term its labels are written under. Derived
59
59
  # from the Tavi emitter's role map so the two projections name a role the same
60
60
  # way and neither can drift: Tavi's `xbrl:terseLabel` is this `rs:terseLabel`.
61
+ STANDARD_LABEL_ROLE = "http://www.xbrl.org/2003/role/label"
62
+ DOCUMENTATION_LABEL_ROLE = "http://www.xbrl.org/2003/role/documentation"
61
63
  LABEL_ROLE_TERMS: dict[str, str] = {
62
64
  role: label_type.split(":", 1)[-1] for role, label_type in LABEL_ROLE_TYPES.items()
63
65
  }
64
- # The two roles that already have a predicate: the standard label is what
65
- # `skos:prefLabel` means, and a documentation label is `rdfs:comment`.
66
- STANDARD_LABEL_ROLE = "http://www.xbrl.org/2003/role/label"
67
- DOCUMENTATION_LABEL_ROLE = "http://www.xbrl.org/2003/role/documentation"
66
+ # XBRL's own name for the `…/role/label` role is the *standard* label, and that
67
+ # is what the term is called here. `label` would collide: the platform's
68
+ # holon context binds it to `rdfs:label`, so one key would mean two predicates
69
+ # across two documents that both call themselves holons.
70
+ LABEL_ROLE_TERMS[STANDARD_LABEL_ROLE] = "standardLabel"
71
+ # A documentation label is `rdfs:comment` and needs no term of its own.
68
72
 
69
73
 
70
74
  def _slug(value: str) -> str:
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