cognite-neat 0.123.2__py3-none-any.whl → 0.127.30__py3-none-any.whl

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 (333) hide show
  1. cognite/neat/__init__.py +2 -2
  2. cognite/neat/_client/__init__.py +4 -0
  3. cognite/neat/_client/api.py +8 -0
  4. cognite/neat/_client/client.py +21 -0
  5. cognite/neat/_client/config.py +40 -0
  6. cognite/neat/_client/containers_api.py +125 -0
  7. cognite/neat/_client/data_classes.py +44 -0
  8. cognite/neat/_client/data_model_api.py +115 -0
  9. cognite/neat/_client/spaces_api.py +115 -0
  10. cognite/neat/_client/statistics_api.py +24 -0
  11. cognite/neat/_client/views_api.py +129 -0
  12. cognite/neat/_config.py +185 -0
  13. cognite/neat/_data_model/_analysis.py +196 -0
  14. cognite/neat/_data_model/_constants.py +67 -0
  15. cognite/neat/_data_model/_identifiers.py +61 -0
  16. cognite/neat/_data_model/_shared.py +41 -0
  17. cognite/neat/_data_model/deployer/_differ.py +140 -0
  18. cognite/neat/_data_model/deployer/_differ_container.py +360 -0
  19. cognite/neat/_data_model/deployer/_differ_data_model.py +54 -0
  20. cognite/neat/_data_model/deployer/_differ_space.py +9 -0
  21. cognite/neat/_data_model/deployer/_differ_view.py +299 -0
  22. cognite/neat/_data_model/deployer/data_classes.py +529 -0
  23. cognite/neat/_data_model/deployer/deployer.py +401 -0
  24. cognite/neat/_data_model/exporters/__init__.py +15 -0
  25. cognite/neat/_data_model/exporters/_api_exporter.py +37 -0
  26. cognite/neat/_data_model/exporters/_base.py +24 -0
  27. cognite/neat/_data_model/exporters/_table_exporter/exporter.py +128 -0
  28. cognite/neat/_data_model/exporters/_table_exporter/workbook.py +409 -0
  29. cognite/neat/_data_model/exporters/_table_exporter/writer.py +421 -0
  30. cognite/neat/_data_model/importers/__init__.py +5 -0
  31. cognite/neat/_data_model/importers/_api_importer.py +166 -0
  32. cognite/neat/_data_model/importers/_base.py +16 -0
  33. cognite/neat/_data_model/importers/_table_importer/data_classes.py +295 -0
  34. cognite/neat/_data_model/importers/_table_importer/importer.py +192 -0
  35. cognite/neat/_data_model/importers/_table_importer/reader.py +1063 -0
  36. cognite/neat/_data_model/importers/_table_importer/source.py +94 -0
  37. cognite/neat/_data_model/models/conceptual/_base.py +18 -0
  38. cognite/neat/_data_model/models/conceptual/_concept.py +67 -0
  39. cognite/neat/_data_model/models/conceptual/_data_model.py +51 -0
  40. cognite/neat/_data_model/models/conceptual/_properties.py +104 -0
  41. cognite/neat/_data_model/models/conceptual/_property.py +105 -0
  42. cognite/neat/_data_model/models/dms/__init__.py +206 -0
  43. cognite/neat/_data_model/models/dms/_base.py +31 -0
  44. cognite/neat/_data_model/models/dms/_constants.py +48 -0
  45. cognite/neat/_data_model/models/dms/_constraints.py +42 -0
  46. cognite/neat/_data_model/models/dms/_container.py +159 -0
  47. cognite/neat/_data_model/models/dms/_data_model.py +95 -0
  48. cognite/neat/_data_model/models/dms/_data_types.py +195 -0
  49. cognite/neat/_data_model/models/dms/_http.py +28 -0
  50. cognite/neat/_data_model/models/dms/_indexes.py +30 -0
  51. cognite/neat/_data_model/models/dms/_limits.py +96 -0
  52. cognite/neat/_data_model/models/dms/_references.py +135 -0
  53. cognite/neat/_data_model/models/dms/_schema.py +18 -0
  54. cognite/neat/_data_model/models/dms/_space.py +48 -0
  55. cognite/neat/_data_model/models/dms/_types.py +17 -0
  56. cognite/neat/_data_model/models/dms/_view_filter.py +282 -0
  57. cognite/neat/_data_model/models/dms/_view_property.py +235 -0
  58. cognite/neat/_data_model/models/dms/_views.py +210 -0
  59. cognite/neat/_data_model/models/entities/__init__.py +50 -0
  60. cognite/neat/_data_model/models/entities/_base.py +101 -0
  61. cognite/neat/_data_model/models/entities/_constants.py +22 -0
  62. cognite/neat/_data_model/models/entities/_data_types.py +144 -0
  63. cognite/neat/_data_model/models/entities/_identifiers.py +61 -0
  64. cognite/neat/_data_model/models/entities/_parser.py +226 -0
  65. cognite/neat/_data_model/validation/dms/__init__.py +75 -0
  66. cognite/neat/_data_model/validation/dms/_ai_readiness.py +364 -0
  67. cognite/neat/_data_model/validation/dms/_base.py +307 -0
  68. cognite/neat/_data_model/validation/dms/_connections.py +638 -0
  69. cognite/neat/_data_model/validation/dms/_consistency.py +57 -0
  70. cognite/neat/_data_model/validation/dms/_containers.py +174 -0
  71. cognite/neat/_data_model/validation/dms/_limits.py +420 -0
  72. cognite/neat/_data_model/validation/dms/_orchestrator.py +222 -0
  73. cognite/neat/_data_model/validation/dms/_views.py +103 -0
  74. cognite/neat/_exceptions.py +56 -0
  75. cognite/neat/_issues.py +68 -0
  76. cognite/neat/_session/__init__.py +3 -0
  77. cognite/neat/_session/_html/_render.py +30 -0
  78. cognite/neat/_session/_html/static/__init__.py +8 -0
  79. cognite/neat/_session/_html/static/deployment.css +303 -0
  80. cognite/neat/_session/_html/static/deployment.js +150 -0
  81. cognite/neat/_session/_html/static/issues.css +211 -0
  82. cognite/neat/_session/_html/static/issues.js +168 -0
  83. cognite/neat/_session/_html/static/shared.css +186 -0
  84. cognite/neat/_session/_html/templates/__init__.py +4 -0
  85. cognite/neat/_session/_html/templates/deployment.html +75 -0
  86. cognite/neat/_session/_html/templates/issues.html +45 -0
  87. cognite/neat/_session/_issues.py +81 -0
  88. cognite/neat/_session/_opt.py +35 -0
  89. cognite/neat/_session/_physical.py +261 -0
  90. cognite/neat/_session/_result.py +236 -0
  91. cognite/neat/_session/_session.py +88 -0
  92. cognite/neat/_session/_usage_analytics/__init__.py +0 -0
  93. cognite/neat/_session/_usage_analytics/_collector.py +131 -0
  94. cognite/neat/_session/_usage_analytics/_constants.py +23 -0
  95. cognite/neat/_session/_usage_analytics/_storage.py +240 -0
  96. cognite/neat/_session/_wrappers.py +82 -0
  97. cognite/neat/_state_machine/__init__.py +10 -0
  98. cognite/neat/_state_machine/_base.py +37 -0
  99. cognite/neat/_state_machine/_states.py +52 -0
  100. cognite/neat/_store/__init__.py +3 -0
  101. cognite/neat/_store/_provenance.py +81 -0
  102. cognite/neat/_store/_store.py +156 -0
  103. cognite/neat/_utils/__init__.py +0 -0
  104. cognite/neat/_utils/_reader.py +194 -0
  105. cognite/neat/_utils/auxiliary.py +39 -0
  106. cognite/neat/_utils/collection.py +11 -0
  107. cognite/neat/_utils/http_client/__init__.py +39 -0
  108. cognite/neat/_utils/http_client/_client.py +245 -0
  109. cognite/neat/_utils/http_client/_config.py +19 -0
  110. cognite/neat/_utils/http_client/_data_classes.py +294 -0
  111. cognite/neat/_utils/http_client/_tracker.py +31 -0
  112. cognite/neat/_utils/text.py +71 -0
  113. cognite/neat/_utils/useful_types.py +37 -0
  114. cognite/neat/_utils/validation.py +154 -0
  115. cognite/neat/_version.py +1 -1
  116. cognite/neat/v0/__init__.py +0 -0
  117. cognite/neat/v0/core/__init__.py +0 -0
  118. cognite/neat/v0/core/_client/_api/__init__.py +0 -0
  119. cognite/neat/{core → v0/core}/_client/_api/data_modeling_loaders.py +86 -7
  120. cognite/neat/{core → v0/core}/_client/_api/neat_instances.py +5 -5
  121. cognite/neat/{core → v0/core}/_client/_api/schema.py +5 -5
  122. cognite/neat/{core → v0/core}/_client/_api/statistics.py +3 -3
  123. cognite/neat/{core → v0/core}/_client/_api_client.py +1 -1
  124. cognite/neat/v0/core/_client/data_classes/__init__.py +0 -0
  125. cognite/neat/{core → v0/core}/_client/data_classes/schema.py +4 -4
  126. cognite/neat/{core → v0/core}/_client/testing.py +1 -1
  127. cognite/neat/{core → v0/core}/_constants.py +10 -3
  128. cognite/neat/v0/core/_data_model/__init__.py +0 -0
  129. cognite/neat/{core → v0/core}/_data_model/_constants.py +9 -6
  130. cognite/neat/{core → v0/core}/_data_model/_shared.py +5 -5
  131. cognite/neat/{core → v0/core}/_data_model/analysis/_base.py +12 -8
  132. cognite/neat/{core → v0/core}/_data_model/exporters/__init__.py +1 -2
  133. cognite/neat/{core → v0/core}/_data_model/exporters/_base.py +7 -7
  134. cognite/neat/{core → v0/core}/_data_model/exporters/_data_model2dms.py +9 -9
  135. cognite/neat/{core → v0/core}/_data_model/exporters/_data_model2excel.py +13 -13
  136. cognite/neat/{core → v0/core}/_data_model/exporters/_data_model2instance_template.py +4 -4
  137. cognite/neat/{core/_data_model/exporters/_data_model2ontology.py → v0/core/_data_model/exporters/_data_model2semantic_model.py} +126 -133
  138. cognite/neat/{core → v0/core}/_data_model/exporters/_data_model2yaml.py +1 -1
  139. cognite/neat/{core → v0/core}/_data_model/importers/__init__.py +4 -6
  140. cognite/neat/{core → v0/core}/_data_model/importers/_base.py +5 -5
  141. cognite/neat/{core → v0/core}/_data_model/importers/_base_file_reader.py +2 -2
  142. cognite/neat/{core → v0/core}/_data_model/importers/_dict2data_model.py +6 -6
  143. cognite/neat/{core → v0/core}/_data_model/importers/_dms2data_model.py +19 -16
  144. cognite/neat/v0/core/_data_model/importers/_graph2data_model.py +299 -0
  145. cognite/neat/v0/core/_data_model/importers/_rdf/__init__.py +4 -0
  146. cognite/neat/{core → v0/core}/_data_model/importers/_rdf/_base.py +13 -13
  147. cognite/neat/{core → v0/core}/_data_model/importers/_rdf/_inference2rdata_model.py +14 -14
  148. cognite/neat/v0/core/_data_model/importers/_rdf/_owl2data_model.py +144 -0
  149. cognite/neat/v0/core/_data_model/importers/_rdf/_shared.py +255 -0
  150. cognite/neat/{core → v0/core}/_data_model/importers/_spreadsheet2data_model.py +94 -13
  151. cognite/neat/{core → v0/core}/_data_model/models/__init__.py +3 -3
  152. cognite/neat/{core → v0/core}/_data_model/models/_base_verified.py +5 -5
  153. cognite/neat/v0/core/_data_model/models/_import_contexts.py +82 -0
  154. cognite/neat/{core → v0/core}/_data_model/models/_types.py +5 -5
  155. cognite/neat/{core → v0/core}/_data_model/models/conceptual/_unverified.py +18 -12
  156. cognite/neat/v0/core/_data_model/models/conceptual/_validation.py +308 -0
  157. cognite/neat/{core → v0/core}/_data_model/models/conceptual/_verified.py +13 -11
  158. cognite/neat/{core → v0/core}/_data_model/models/data_types.py +14 -4
  159. cognite/neat/{core → v0/core}/_data_model/models/entities/__init__.py +6 -0
  160. cognite/neat/v0/core/_data_model/models/entities/_loaders.py +155 -0
  161. cognite/neat/{core → v0/core}/_data_model/models/entities/_multi_value.py +2 -2
  162. cognite/neat/v0/core/_data_model/models/entities/_restrictions.py +230 -0
  163. cognite/neat/{core → v0/core}/_data_model/models/entities/_single_value.py +121 -16
  164. cognite/neat/{core → v0/core}/_data_model/models/entities/_types.py +10 -0
  165. cognite/neat/{core → v0/core}/_data_model/models/mapping/_classic2core.py +5 -5
  166. cognite/neat/{core → v0/core}/_data_model/models/physical/__init__.py +1 -1
  167. cognite/neat/{core → v0/core}/_data_model/models/physical/_exporter.py +28 -21
  168. cognite/neat/{core → v0/core}/_data_model/models/physical/_unverified.py +141 -38
  169. cognite/neat/{core → v0/core}/_data_model/models/physical/_validation.py +190 -24
  170. cognite/neat/{core → v0/core}/_data_model/models/physical/_verified.py +135 -15
  171. cognite/neat/{core → v0/core}/_data_model/transformers/__init__.py +2 -0
  172. cognite/neat/{core → v0/core}/_data_model/transformers/_base.py +4 -4
  173. cognite/neat/{core → v0/core}/_data_model/transformers/_converters.py +39 -32
  174. cognite/neat/{core → v0/core}/_data_model/transformers/_mapping.py +7 -7
  175. cognite/neat/v0/core/_data_model/transformers/_union_conceptual.py +208 -0
  176. cognite/neat/{core → v0/core}/_data_model/transformers/_verification.py +7 -7
  177. cognite/neat/v0/core/_instances/__init__.py +0 -0
  178. cognite/neat/{core → v0/core}/_instances/_tracking/base.py +1 -1
  179. cognite/neat/{core → v0/core}/_instances/_tracking/log.py +1 -1
  180. cognite/neat/{core → v0/core}/_instances/extractors/__init__.py +1 -1
  181. cognite/neat/{core → v0/core}/_instances/extractors/_base.py +6 -6
  182. cognite/neat/v0/core/_instances/extractors/_classic_cdf/__init__.py +0 -0
  183. cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_base.py +7 -7
  184. cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_classic.py +12 -12
  185. cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_relationships.py +3 -3
  186. cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_sequences.py +2 -2
  187. cognite/neat/{core → v0/core}/_instances/extractors/_dict.py +6 -3
  188. cognite/neat/{core → v0/core}/_instances/extractors/_dms.py +6 -6
  189. cognite/neat/{core → v0/core}/_instances/extractors/_dms_graph.py +11 -11
  190. cognite/neat/{core → v0/core}/_instances/extractors/_mock_graph_generator.py +10 -10
  191. cognite/neat/{core → v0/core}/_instances/extractors/_raw.py +3 -3
  192. cognite/neat/{core → v0/core}/_instances/extractors/_rdf_file.py +7 -7
  193. cognite/neat/{core → v0/core}/_instances/loaders/_base.py +5 -5
  194. cognite/neat/{core → v0/core}/_instances/loaders/_rdf2dms.py +17 -17
  195. cognite/neat/{core → v0/core}/_instances/loaders/_rdf_to_instance_space.py +11 -11
  196. cognite/neat/{core → v0/core}/_instances/queries/_select.py +29 -3
  197. cognite/neat/{core → v0/core}/_instances/queries/_update.py +1 -1
  198. cognite/neat/{core → v0/core}/_instances/transformers/_base.py +4 -4
  199. cognite/neat/{core → v0/core}/_instances/transformers/_classic_cdf.py +6 -6
  200. cognite/neat/{core → v0/core}/_instances/transformers/_prune_graph.py +4 -4
  201. cognite/neat/{core → v0/core}/_instances/transformers/_rdfpath.py +1 -1
  202. cognite/neat/{core → v0/core}/_instances/transformers/_value_type.py +4 -4
  203. cognite/neat/{core → v0/core}/_issues/_base.py +11 -6
  204. cognite/neat/{core → v0/core}/_issues/_contextmanagers.py +8 -6
  205. cognite/neat/{core → v0/core}/_issues/_factory.py +11 -8
  206. cognite/neat/{core → v0/core}/_issues/errors/__init__.py +3 -1
  207. cognite/neat/{core → v0/core}/_issues/errors/_external.py +1 -1
  208. cognite/neat/{core → v0/core}/_issues/errors/_general.py +1 -1
  209. cognite/neat/{core → v0/core}/_issues/errors/_properties.py +12 -1
  210. cognite/neat/{core → v0/core}/_issues/errors/_resources.py +2 -2
  211. cognite/neat/{core → v0/core}/_issues/errors/_wrapper.py +7 -3
  212. cognite/neat/{core → v0/core}/_issues/warnings/__init__.py +5 -1
  213. cognite/neat/{core → v0/core}/_issues/warnings/_external.py +1 -1
  214. cognite/neat/{core → v0/core}/_issues/warnings/_general.py +1 -1
  215. cognite/neat/{core → v0/core}/_issues/warnings/_models.py +39 -4
  216. cognite/neat/{core → v0/core}/_issues/warnings/_properties.py +13 -2
  217. cognite/neat/{core → v0/core}/_issues/warnings/_resources.py +1 -1
  218. cognite/neat/{core → v0/core}/_issues/warnings/user_modeling.py +1 -1
  219. cognite/neat/{core → v0/core}/_store/_data_model.py +13 -12
  220. cognite/neat/{core → v0/core}/_store/_instance.py +45 -12
  221. cognite/neat/{core → v0/core}/_store/_provenance.py +3 -3
  222. cognite/neat/{core → v0/core}/_store/exceptions.py +4 -4
  223. cognite/neat/v0/core/_utils/__init__.py +0 -0
  224. cognite/neat/{core → v0/core}/_utils/auth.py +1 -1
  225. cognite/neat/{core → v0/core}/_utils/auxiliary.py +7 -1
  226. cognite/neat/{core → v0/core}/_utils/collection_.py +2 -2
  227. cognite/neat/{core → v0/core}/_utils/graph_transformations_report.py +1 -1
  228. cognite/neat/{core → v0/core}/_utils/rdf_.py +38 -14
  229. cognite/neat/{core → v0/core}/_utils/reader/_base.py +1 -1
  230. cognite/neat/{core → v0/core}/_utils/spreadsheet.py +22 -4
  231. cognite/neat/v0/core/_utils/tarjan.py +44 -0
  232. cognite/neat/{core → v0/core}/_utils/text.py +1 -1
  233. cognite/neat/{core → v0/core}/_utils/upload.py +3 -3
  234. cognite/neat/v0/plugins/__init__.py +4 -0
  235. cognite/neat/v0/plugins/_base.py +9 -0
  236. cognite/neat/v0/plugins/_data_model.py +48 -0
  237. cognite/neat/{plugins → v0/plugins}/_issues.py +1 -1
  238. cognite/neat/{plugins → v0/plugins}/_manager.py +7 -16
  239. cognite/neat/{session → v0/session}/_base.py +13 -10
  240. cognite/neat/{session → v0/session}/_collector.py +1 -1
  241. cognite/neat/v0/session/_diff.py +51 -0
  242. cognite/neat/{session → v0/session}/_drop.py +3 -3
  243. cognite/neat/{session → v0/session}/_explore.py +2 -2
  244. cognite/neat/{session → v0/session}/_fix.py +2 -2
  245. cognite/neat/{session → v0/session}/_inspect.py +3 -3
  246. cognite/neat/{session → v0/session}/_mapping.py +3 -3
  247. cognite/neat/{session → v0/session}/_plugin.py +4 -5
  248. cognite/neat/{session → v0/session}/_prepare.py +8 -8
  249. cognite/neat/{session → v0/session}/_read.py +33 -43
  250. cognite/neat/{session → v0/session}/_set.py +8 -8
  251. cognite/neat/{session → v0/session}/_show.py +5 -5
  252. cognite/neat/{session → v0/session}/_state.py +22 -8
  253. cognite/neat/{session → v0/session}/_subset.py +4 -4
  254. cognite/neat/{session → v0/session}/_template.py +11 -11
  255. cognite/neat/{session → v0/session}/_to.py +12 -12
  256. cognite/neat/{session → v0/session}/_wizard.py +1 -1
  257. cognite/neat/{session → v0/session}/engine/_load.py +1 -1
  258. cognite/neat/{session → v0/session}/exceptions.py +5 -5
  259. cognite/neat/v1.py +3 -0
  260. {cognite_neat-0.123.2.dist-info → cognite_neat-0.127.30.dist-info}/METADATA +9 -8
  261. cognite_neat-0.127.30.dist-info/RECORD +319 -0
  262. {cognite_neat-0.123.2.dist-info → cognite_neat-0.127.30.dist-info}/WHEEL +1 -1
  263. cognite/neat/core/_data_model/importers/_dtdl2data_model/__init__.py +0 -3
  264. cognite/neat/core/_data_model/importers/_dtdl2data_model/_unit_lookup.py +0 -224
  265. cognite/neat/core/_data_model/importers/_dtdl2data_model/dtdl_converter.py +0 -320
  266. cognite/neat/core/_data_model/importers/_dtdl2data_model/dtdl_importer.py +0 -155
  267. cognite/neat/core/_data_model/importers/_dtdl2data_model/spec.py +0 -363
  268. cognite/neat/core/_data_model/importers/_rdf/__init__.py +0 -5
  269. cognite/neat/core/_data_model/importers/_rdf/_imf2data_model.py +0 -98
  270. cognite/neat/core/_data_model/importers/_rdf/_owl2data_model.py +0 -87
  271. cognite/neat/core/_data_model/importers/_rdf/_shared.py +0 -168
  272. cognite/neat/core/_data_model/models/conceptual/_validation.py +0 -294
  273. cognite/neat/core/_data_model/models/entities/_loaders.py +0 -75
  274. cognite/neat/plugins/__init__.py +0 -3
  275. cognite/neat/plugins/data_model/importers/__init__.py +0 -5
  276. cognite/neat/plugins/data_model/importers/_base.py +0 -28
  277. cognite_neat-0.123.2.dist-info/RECORD +0 -197
  278. /cognite/neat/{core → _data_model}/__init__.py +0 -0
  279. /cognite/neat/{core/_client/_api → _data_model/deployer}/__init__.py +0 -0
  280. /cognite/neat/{core/_client/data_classes → _data_model/exporters/_table_exporter}/__init__.py +0 -0
  281. /cognite/neat/{core/_data_model → _data_model/importers/_table_importer}/__init__.py +0 -0
  282. /cognite/neat/{core/_instances → _data_model/models}/__init__.py +0 -0
  283. /cognite/neat/{core/_instances/extractors/_classic_cdf → _data_model/models/conceptual}/__init__.py +0 -0
  284. /cognite/neat/{core/_utils → _data_model/validation}/__init__.py +0 -0
  285. /cognite/neat/{plugins/data_model → _session/_html}/__init__.py +0 -0
  286. /cognite/neat/{core → v0/core}/_client/__init__.py +0 -0
  287. /cognite/neat/{core → v0/core}/_client/data_classes/data_modeling.py +0 -0
  288. /cognite/neat/{core → v0/core}/_client/data_classes/neat_sequence.py +0 -0
  289. /cognite/neat/{core → v0/core}/_client/data_classes/statistics.py +0 -0
  290. /cognite/neat/{core → v0/core}/_config.py +0 -0
  291. /cognite/neat/{core → v0/core}/_data_model/analysis/__init__.py +0 -0
  292. /cognite/neat/{core → v0/core}/_data_model/catalog/__init__.py +0 -0
  293. /cognite/neat/{core → v0/core}/_data_model/catalog/classic_model.xlsx +0 -0
  294. /cognite/neat/{core → v0/core}/_data_model/catalog/conceptual-imf-data-model.xlsx +0 -0
  295. /cognite/neat/{core → v0/core}/_data_model/catalog/hello_world_pump.xlsx +0 -0
  296. /cognite/neat/{core → v0/core}/_data_model/models/_base_unverified.py +0 -0
  297. /cognite/neat/{core → v0/core}/_data_model/models/conceptual/__init__.py +0 -0
  298. /cognite/neat/{core → v0/core}/_data_model/models/entities/_constants.py +0 -0
  299. /cognite/neat/{core → v0/core}/_data_model/models/entities/_wrapped.py +0 -0
  300. /cognite/neat/{core → v0/core}/_data_model/models/mapping/__init__.py +0 -0
  301. /cognite/neat/{core → v0/core}/_data_model/models/mapping/_classic2core.yaml +0 -0
  302. /cognite/neat/{core → v0/core}/_instances/_shared.py +0 -0
  303. /cognite/neat/{core → v0/core}/_instances/_tracking/__init__.py +0 -0
  304. /cognite/neat/{core → v0/core}/_instances/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
  305. /cognite/neat/{core → v0/core}/_instances/examples/Knowledge-Graph-Nordic44.xml +0 -0
  306. /cognite/neat/{core → v0/core}/_instances/examples/__init__.py +0 -0
  307. /cognite/neat/{core → v0/core}/_instances/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
  308. /cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_assets.py +0 -0
  309. /cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_data_sets.py +0 -0
  310. /cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_events.py +0 -0
  311. /cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_files.py +0 -0
  312. /cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_labels.py +0 -0
  313. /cognite/neat/{core → v0/core}/_instances/extractors/_classic_cdf/_timeseries.py +0 -0
  314. /cognite/neat/{core → v0/core}/_instances/loaders/__init__.py +0 -0
  315. /cognite/neat/{core → v0/core}/_instances/queries/__init__.py +0 -0
  316. /cognite/neat/{core → v0/core}/_instances/queries/_base.py +0 -0
  317. /cognite/neat/{core → v0/core}/_instances/queries/_queries.py +0 -0
  318. /cognite/neat/{core → v0/core}/_instances/transformers/__init__.py +0 -0
  319. /cognite/neat/{core → v0/core}/_issues/__init__.py +0 -0
  320. /cognite/neat/{core → v0/core}/_issues/formatters.py +0 -0
  321. /cognite/neat/{core → v0/core}/_shared.py +0 -0
  322. /cognite/neat/{core → v0/core}/_store/__init__.py +0 -0
  323. /cognite/neat/{core → v0/core}/_utils/io_.py +0 -0
  324. /cognite/neat/{core → v0/core}/_utils/reader/__init__.py +0 -0
  325. /cognite/neat/{core → v0/core}/_utils/time_.py +0 -0
  326. /cognite/neat/{core → v0/core}/_utils/xml_.py +0 -0
  327. /cognite/neat/{session → v0/session}/__init__.py +0 -0
  328. /cognite/neat/{session → v0/session}/_experimental.py +0 -0
  329. /cognite/neat/{session → v0/session}/_state/README.md +0 -0
  330. /cognite/neat/{session → v0/session}/engine/__init__.py +0 -0
  331. /cognite/neat/{session → v0/session}/engine/_import.py +0 -0
  332. /cognite/neat/{session → v0/session}/engine/_interface.py +0 -0
  333. {cognite_neat-0.123.2.dist-info → cognite_neat-0.127.30.dist-info}/licenses/LICENSE +0 -0
cognite/neat/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
- from cognite.neat.core._utils.auth import get_cognite_client
1
+ from cognite.neat.v0.core._utils.auth import get_cognite_client
2
+ from cognite.neat.v0.session import NeatSession
2
3
 
3
4
  from ._version import __version__
4
- from .session import NeatSession
5
5
 
6
6
  __all__ = ["NeatSession", "__version__", "get_cognite_client"]
@@ -0,0 +1,4 @@
1
+ from .client import NeatClient
2
+ from .config import NeatClientConfig
3
+
4
+ __all__ = ["NeatClient", "NeatClientConfig"]
@@ -0,0 +1,8 @@
1
+ from cognite.neat._client.config import NeatClientConfig
2
+ from cognite.neat._utils.http_client import HTTPClient
3
+
4
+
5
+ class NeatAPI:
6
+ def __init__(self, neat_config: NeatClientConfig, http_client: HTTPClient) -> None:
7
+ self._config = neat_config
8
+ self._http_client = http_client
@@ -0,0 +1,21 @@
1
+ from cognite.client import ClientConfig, CogniteClient
2
+
3
+ from cognite.neat._utils.http_client import HTTPClient
4
+
5
+ from .config import NeatClientConfig
6
+ from .containers_api import ContainersAPI
7
+ from .data_model_api import DataModelsAPI
8
+ from .spaces_api import SpacesAPI
9
+ from .statistics_api import StatisticsAPI
10
+ from .views_api import ViewsAPI
11
+
12
+
13
+ class NeatClient:
14
+ def __init__(self, cognite_client_or_config: CogniteClient | ClientConfig) -> None:
15
+ self.config = NeatClientConfig(cognite_client_or_config)
16
+ self.http_client = HTTPClient(self.config)
17
+ self.data_models = DataModelsAPI(self.config, self.http_client)
18
+ self.views = ViewsAPI(self.config, self.http_client)
19
+ self.containers = ContainersAPI(self.config, self.http_client)
20
+ self.spaces = SpacesAPI(self.config, self.http_client)
21
+ self.statistics = StatisticsAPI(self.config, self.http_client)
@@ -0,0 +1,40 @@
1
+ from cognite.client import ClientConfig, CogniteClient
2
+
3
+
4
+ class NeatClientConfig(ClientConfig):
5
+ def __init__(self, cognite_client_or_config: CogniteClient | ClientConfig):
6
+ config = (
7
+ cognite_client_or_config.config
8
+ if isinstance(cognite_client_or_config, CogniteClient)
9
+ else cognite_client_or_config
10
+ )
11
+ super().__init__(
12
+ client_name=config.client_name,
13
+ project=config.project,
14
+ credentials=config.credentials,
15
+ api_subversion=config.api_subversion,
16
+ base_url=config.base_url,
17
+ max_workers=config.max_workers,
18
+ headers=config.headers,
19
+ timeout=config.timeout,
20
+ file_transfer_timeout=config.file_transfer_timeout,
21
+ debug=config.debug,
22
+ )
23
+
24
+ def create_api_url(self, endpoint: str) -> str:
25
+ """Create a full API URL for the given endpoint.
26
+
27
+ Args:
28
+ endpoint (str): The API endpoint to append to the base URL.
29
+
30
+ Returns:
31
+ str: The full API URL.
32
+
33
+ Examples:
34
+ >>> config = NeatClientConfig(cluster="bluefield", project="my_project", ...)
35
+ >>> config.create_api_url("/models/instances")
36
+ "https://bluefield.cognitedata.com/api/v1/my_project/models/instances"
37
+ """
38
+ if not endpoint.startswith("/"):
39
+ endpoint = f"/{endpoint}"
40
+ return f"{self.base_url}/api/v1/projects/{self.project}{endpoint}"
@@ -0,0 +1,125 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Sequence
4
+
5
+ from cognite.neat._data_model.models.dms import ContainerReference, ContainerRequest, ContainerResponse, DataModelBody
6
+ from cognite.neat._utils.http_client import ItemIDBody, ItemsRequest, ParametersRequest
7
+ from cognite.neat._utils.useful_types import PrimitiveType
8
+
9
+ from .api import NeatAPI
10
+ from .data_classes import PagedResponse
11
+
12
+
13
+ class ContainersAPI(NeatAPI):
14
+ ENDPOINT = "/models/containers"
15
+
16
+ def apply(self, items: Sequence[ContainerRequest]) -> list[ContainerResponse]:
17
+ """Apply (create or update) containers in CDF.
18
+
19
+ Args:
20
+ items: List of ContainerRequest objects to apply.
21
+ Returns:
22
+ List of ContainerResponse objects.
23
+ """
24
+ if not items:
25
+ return []
26
+ if len(items) > 100:
27
+ raise ValueError("Cannot apply more than 100 containers at once.")
28
+ result = self._http_client.request_with_retries(
29
+ ItemsRequest(
30
+ endpoint_url=self._config.create_api_url(self.ENDPOINT),
31
+ method="POST",
32
+ body=DataModelBody(items=items),
33
+ )
34
+ )
35
+ result.raise_for_status()
36
+ result = PagedResponse[ContainerResponse].model_validate_json(result.success_response.body)
37
+ return result.items
38
+
39
+ def retrieve(
40
+ self,
41
+ items: list[ContainerReference],
42
+ ) -> list[ContainerResponse]:
43
+ """Retrieve containers by their identifiers.
44
+
45
+ Args:
46
+ items: List of (space, external_id) tuples identifying the containers to retrieve.
47
+
48
+ Returns:
49
+ List of ContainerResponse objects.
50
+ """
51
+ if not items:
52
+ return []
53
+ if len(items) > 1000:
54
+ raise ValueError("Cannot retrieve more than 1000 containers at once.")
55
+
56
+ result = self._http_client.request_with_retries(
57
+ ItemsRequest(
58
+ endpoint_url=self._config.create_api_url(f"{self.ENDPOINT}/byids"),
59
+ method="POST",
60
+ body=ItemIDBody(items=items),
61
+ )
62
+ )
63
+ result.raise_for_status()
64
+ result = PagedResponse[ContainerResponse].model_validate_json(result.success_response.body)
65
+ return result.items
66
+
67
+ def delete(self, items: list[ContainerReference]) -> list[ContainerReference]:
68
+ """Delete containers by their identifiers.
69
+
70
+ Args:
71
+ items: List of ContainerReference objects identifying the containers to delete.
72
+
73
+ Returns:
74
+ List of ContainerReference objects representing the deleted containers.
75
+ """
76
+ if not items:
77
+ return []
78
+ if len(items) > 100:
79
+ raise ValueError("Cannot delete more than 100 containers at once.")
80
+
81
+ result = self._http_client.request_with_retries(
82
+ ItemsRequest(
83
+ endpoint_url=self._config.create_api_url(f"{self.ENDPOINT}/delete"),
84
+ method="POST",
85
+ body=ItemIDBody(items=items),
86
+ )
87
+ )
88
+ result.raise_for_status()
89
+ result = PagedResponse[ContainerReference].model_validate_json(result.success_response.body)
90
+ return result.items
91
+
92
+ def list(
93
+ self,
94
+ space: str | None = None,
95
+ include_global: bool = False,
96
+ limit: int = 10,
97
+ ) -> list[ContainerResponse]:
98
+ """List containers in CDF Project.
99
+
100
+ Args:
101
+ space: If specified, only containers in this space are returned.
102
+ include_global: If True, include global containers.
103
+ limit: Maximum number of containers to return. Max is 1000.
104
+
105
+ Returns:
106
+ List of ContainerResponse objects.
107
+ """
108
+ if limit > 1000:
109
+ raise ValueError("Pagination is not (yet) supported for listing containers. The maximum limit is 1000.")
110
+ parameters: dict[str, PrimitiveType] = {
111
+ "includeGlobal": include_global,
112
+ "limit": limit,
113
+ }
114
+ if space is not None:
115
+ parameters["space"] = space
116
+ result = self._http_client.request_with_retries(
117
+ ParametersRequest(
118
+ endpoint_url=self._config.create_api_url(self.ENDPOINT),
119
+ method="GET",
120
+ parameters=parameters,
121
+ )
122
+ )
123
+ result.raise_for_status()
124
+ result = PagedResponse[ContainerResponse].model_validate_json(result.success_response.body)
125
+ return result.items
@@ -0,0 +1,44 @@
1
+ from typing import Generic, TypeVar
2
+
3
+ from pydantic import BaseModel, Field
4
+
5
+ T = TypeVar("T", bound=BaseModel)
6
+
7
+
8
+ class PagedResponse(BaseModel, Generic[T]):
9
+ items: list[T]
10
+ next_cursor: str | None = Field(None, alias="nextCursor")
11
+
12
+
13
+ class ResourceLimit(BaseModel):
14
+ """Model for resources with count and limit."""
15
+
16
+ count: int
17
+ limit: int
18
+
19
+
20
+ class InstancesDetail(BaseModel, populate_by_name=True):
21
+ """Model for instances with detailed metrics."""
22
+
23
+ edges: int
24
+ soft_deleted_edges: int = Field(alias="softDeletedEdges")
25
+ nodes: int
26
+ soft_deleted_nodes: int = Field(alias="softDeletedNodes")
27
+ instances: int
28
+ instances_limit: int = Field(alias="instancesLimit")
29
+ soft_deleted_instances: int = Field(alias="softDeletedInstances")
30
+ soft_deleted_instances_limit: int = Field(alias="softDeletedInstancesLimit")
31
+
32
+
33
+ class StatisticsResponse(BaseModel, populate_by_name=True):
34
+ """Main API response model."""
35
+
36
+ spaces: ResourceLimit
37
+ containers: ResourceLimit
38
+ views: ResourceLimit
39
+ data_models: ResourceLimit = Field(alias="dataModels")
40
+ container_properties: ResourceLimit = Field(alias="containerProperties")
41
+ instances: InstancesDetail
42
+ concurrent_read_limit: int = Field(alias="concurrentReadLimit")
43
+ concurrent_write_limit: int = Field(alias="concurrentWriteLimit")
44
+ concurrent_delete_limit: int = Field(alias="concurrentDeleteLimit")
@@ -0,0 +1,115 @@
1
+ from collections.abc import Sequence
2
+
3
+ from cognite.neat._data_model.models.dms import DataModelBody, DataModelReference, DataModelRequest, DataModelResponse
4
+ from cognite.neat._utils.http_client import ItemIDBody, ItemsRequest, ParametersRequest
5
+ from cognite.neat._utils.useful_types import PrimitiveType
6
+
7
+ from .api import NeatAPI
8
+ from .data_classes import PagedResponse
9
+
10
+
11
+ class DataModelsAPI(NeatAPI):
12
+ ENDPOINT = "/models/datamodels"
13
+
14
+ def apply(self, data_models: Sequence[DataModelRequest]) -> list[DataModelResponse]:
15
+ """Apply (create or update) data models in CDF.
16
+
17
+ Args:
18
+ data_models: List of DataModelRequest objects to apply.
19
+ Returns:
20
+ List of DataModelResponse objects.
21
+ """
22
+ if not data_models:
23
+ return []
24
+ if len(data_models) > 100:
25
+ raise ValueError("Cannot apply more than 100 data models at once.")
26
+
27
+ result = self._http_client.request_with_retries(
28
+ ItemsRequest(
29
+ endpoint_url=self._config.create_api_url(self.ENDPOINT),
30
+ method="POST",
31
+ body=DataModelBody(items=data_models),
32
+ )
33
+ )
34
+ result.raise_for_status()
35
+ result = PagedResponse[DataModelResponse].model_validate_json(result.success_response.body)
36
+ return result.items
37
+
38
+ def retrieve(
39
+ self,
40
+ items: list[DataModelReference],
41
+ ) -> list[DataModelResponse]:
42
+ """Retrieve data models by their identifiers.
43
+
44
+ Args:
45
+ items: List of data models references identifying the data models to retrieve.
46
+ Returns:
47
+ List of DataModelResponse objects.
48
+ """
49
+ if not items:
50
+ return []
51
+ if len(items) > 100:
52
+ raise ValueError("Cannot retrieve more than 1000 containers at once.")
53
+
54
+ result = self._http_client.request_with_retries(
55
+ ItemsRequest(
56
+ endpoint_url=self._config.create_api_url(f"{self.ENDPOINT}/byids"),
57
+ method="POST",
58
+ body=ItemIDBody(items=items),
59
+ )
60
+ )
61
+ result.raise_for_status()
62
+ result = PagedResponse[DataModelResponse].model_validate_json(result.success_response.body)
63
+ return result.items
64
+
65
+ def delete(self, items: list[DataModelReference]) -> list[DataModelReference]:
66
+ """Delete data models by their identifiers.
67
+
68
+ Args:
69
+ items: List of data model references identifying the data models to delete.
70
+ Returns:
71
+ List of DataModelReference objects representing the deleted data models.
72
+ """
73
+ if not items:
74
+ return []
75
+ if len(items) > 100:
76
+ raise ValueError("Cannot delete more than 100 data models at once.")
77
+
78
+ result = self._http_client.request_with_retries(
79
+ ItemsRequest(
80
+ endpoint_url=self._config.create_api_url(f"{self.ENDPOINT}/delete"),
81
+ method="POST",
82
+ body=ItemIDBody(items=items),
83
+ )
84
+ )
85
+ result.raise_for_status()
86
+ result = PagedResponse[DataModelReference].model_validate_json(result.success_response.body)
87
+ return result.items
88
+
89
+ def list(
90
+ self,
91
+ space: str | None = None,
92
+ all_versions: bool = False,
93
+ include_global: bool = False,
94
+ limit: int = 10,
95
+ ) -> list[DataModelResponse]:
96
+ """List data models in CDF Project."""
97
+ if limit > 1000:
98
+ raise ValueError("Pagination is not (yet) supported for listing data models. The maximum limit is 1000.")
99
+ parameters: dict[str, PrimitiveType] = {
100
+ "allVersions": all_versions,
101
+ "includeGlobal": include_global,
102
+ "limit": limit,
103
+ }
104
+ if space is not None:
105
+ parameters["space"] = space
106
+ result = self._http_client.request_with_retries(
107
+ ParametersRequest(
108
+ endpoint_url=self._config.create_api_url(self.ENDPOINT),
109
+ method="GET",
110
+ parameters=parameters,
111
+ )
112
+ )
113
+ result.raise_for_status()
114
+ result = PagedResponse[DataModelResponse].model_validate_json(result.success_response.body)
115
+ return result.items
@@ -0,0 +1,115 @@
1
+ from __future__ import annotations
2
+
3
+ from cognite.neat._data_model.models.dms import DataModelBody, SpaceRequest, SpaceResponse
4
+ from cognite.neat._data_model.models.dms._references import SpaceReference
5
+ from cognite.neat._utils.http_client import ItemIDBody, ItemsRequest, ParametersRequest
6
+ from cognite.neat._utils.useful_types import PrimitiveType
7
+
8
+ from .api import NeatAPI
9
+ from .data_classes import PagedResponse
10
+
11
+
12
+ class SpacesAPI(NeatAPI):
13
+ ENDPOINT = "/models/spaces"
14
+
15
+ def apply(self, spaces: list[SpaceRequest]) -> list[SpaceResponse]:
16
+ """Apply (create or update) spaces in CDF.
17
+
18
+ Args:
19
+ spaces: List of SpaceRequest objects to apply.
20
+ Returns:
21
+ List of SpaceResponse objects.
22
+ """
23
+ if not spaces:
24
+ return []
25
+ if len(spaces) > 100:
26
+ raise ValueError("Cannot apply more than 100 spaces at once.")
27
+ result = self._http_client.request_with_retries(
28
+ ItemsRequest(
29
+ endpoint_url=self._config.create_api_url(self.ENDPOINT),
30
+ method="POST",
31
+ body=DataModelBody(items=spaces),
32
+ )
33
+ )
34
+ result.raise_for_status()
35
+ result = PagedResponse[SpaceResponse].model_validate_json(result.success_response.body)
36
+ return result.items
37
+
38
+ def retrieve(self, spaces: list[SpaceReference]) -> list[SpaceResponse]:
39
+ """Retrieve spaces by their identifiers.
40
+
41
+ Args:
42
+ spaces: List of space identifiers to retrieve.
43
+
44
+ Returns:
45
+ List of SpaceResponse objects.
46
+ """
47
+ if not spaces:
48
+ return []
49
+ if len(spaces) > 1000:
50
+ raise ValueError("Cannot retrieve more than 1000 spaces at once.")
51
+
52
+ result = self._http_client.request_with_retries(
53
+ ItemsRequest(
54
+ endpoint_url=self._config.create_api_url(f"{self.ENDPOINT}/byids"),
55
+ method="POST",
56
+ body=ItemIDBody(items=spaces),
57
+ )
58
+ )
59
+ result.raise_for_status()
60
+ result = PagedResponse[SpaceResponse].model_validate_json(result.success_response.body)
61
+ return result.items
62
+
63
+ def delete(self, spaces: list[SpaceReference]) -> list[SpaceReference]:
64
+ """Delete spaces by their identifiers.
65
+
66
+ Args:
67
+ spaces: List of space identifiers to delete.
68
+ Returns:
69
+ List of SpaceReference objects representing the deleted spaces.
70
+ """
71
+ if not spaces:
72
+ return []
73
+ if len(spaces) > 100:
74
+ raise ValueError("Cannot delete more than 100 spaces at once.")
75
+ result = self._http_client.request_with_retries(
76
+ ItemsRequest(
77
+ endpoint_url=self._config.create_api_url(f"{self.ENDPOINT}/delete"),
78
+ method="POST",
79
+ body=ItemIDBody(items=spaces),
80
+ )
81
+ )
82
+ result.raise_for_status()
83
+ result = PagedResponse[SpaceReference].model_validate_json(result.success_response.body)
84
+ return result.items
85
+
86
+ def list(
87
+ self,
88
+ include_global: bool = False,
89
+ limit: int = 10,
90
+ ) -> list[SpaceResponse]:
91
+ """List spaces in CDF Project.
92
+
93
+ Args:
94
+ include_global: If True, include global spaces.
95
+ limit: Maximum number of spaces to return. Max is 1000.
96
+
97
+ Returns:
98
+ List of SpaceResponse objects.
99
+ """
100
+ if limit > 1000:
101
+ raise ValueError("Pagination is not (yet) supported for listing spaces. The maximum limit is 1000.")
102
+ parameters: dict[str, PrimitiveType] = {
103
+ "includeGlobal": include_global,
104
+ "limit": limit,
105
+ }
106
+ result = self._http_client.request_with_retries(
107
+ ParametersRequest(
108
+ endpoint_url=self._config.create_api_url(self.ENDPOINT),
109
+ method="GET",
110
+ parameters=parameters,
111
+ )
112
+ )
113
+ result.raise_for_status()
114
+ result = PagedResponse[SpaceResponse].model_validate_json(result.success_response.body)
115
+ return result.items
@@ -0,0 +1,24 @@
1
+ from cognite.neat._client.api import NeatAPI
2
+ from cognite.neat._client.data_classes import StatisticsResponse
3
+ from cognite.neat._utils.http_client import ParametersRequest
4
+
5
+
6
+ class StatisticsAPI(NeatAPI):
7
+ def project(self) -> StatisticsResponse:
8
+ """Retrieve project-wide usage data and limits.
9
+
10
+ Returns:
11
+ StatisticsResponse object.
12
+ """
13
+
14
+ result = self._http_client.request_with_retries(
15
+ ParametersRequest(
16
+ endpoint_url=self._config.create_api_url("/models/statistics"),
17
+ method="GET",
18
+ parameters=None,
19
+ )
20
+ )
21
+
22
+ result.raise_for_status()
23
+ result = StatisticsResponse.model_validate_json(result.success_response.body)
24
+ return result
@@ -0,0 +1,129 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Sequence
4
+
5
+ from cognite.neat._data_model.models.dms import DataModelBody, ViewReference, ViewRequest, ViewResponse
6
+ from cognite.neat._utils.collection import chunker_sequence
7
+ from cognite.neat._utils.http_client import ItemIDBody, ItemsRequest, ParametersRequest
8
+ from cognite.neat._utils.useful_types import PrimitiveType
9
+
10
+ from .api import NeatAPI
11
+ from .data_classes import PagedResponse
12
+
13
+
14
+ class ViewsAPI(NeatAPI):
15
+ ENDPOINT = "/models/views"
16
+
17
+ def apply(self, items: Sequence[ViewRequest]) -> list[ViewResponse]:
18
+ """Create or update views in CDF Project.
19
+ Args:
20
+ items: List of ViewRequest objects to create or update.
21
+ Returns:
22
+ List of ViewResponse objects.
23
+ """
24
+ if not items:
25
+ return []
26
+ if len(items) > 100:
27
+ raise ValueError("Cannot apply more than 100 views at once.")
28
+ result = self._http_client.request_with_retries(
29
+ ItemsRequest(
30
+ endpoint_url=self._config.create_api_url(self.ENDPOINT),
31
+ method="POST",
32
+ body=DataModelBody(items=items),
33
+ )
34
+ )
35
+ result.raise_for_status()
36
+ result = PagedResponse[ViewResponse].model_validate_json(result.success_response.body)
37
+ return result.items
38
+
39
+ def retrieve(
40
+ self,
41
+ items: list[ViewReference],
42
+ include_inherited_properties: bool = True,
43
+ ) -> list[ViewResponse]:
44
+ """Retrieve views by their identifiers.
45
+
46
+ Args:
47
+ items: List of (space, external_id, version) tuples identifying the views to retrieve.
48
+ include_inherited_properties: If True, include properties inherited from parent views.
49
+
50
+ Returns:
51
+ List of ViewResponse objects.
52
+ """
53
+ results: list[ViewResponse] = []
54
+ for chunk in chunker_sequence(items, 100):
55
+ batch = self._http_client.request_with_retries(
56
+ ItemsRequest(
57
+ endpoint_url=self._config.create_api_url(f"{self.ENDPOINT}/byids"),
58
+ method="POST",
59
+ body=ItemIDBody(items=chunk),
60
+ parameters={"includeInheritedProperties": include_inherited_properties},
61
+ )
62
+ )
63
+ batch.raise_for_status()
64
+ result = PagedResponse[ViewResponse].model_validate_json(batch.success_response.body)
65
+ results.extend(result.items)
66
+ return results
67
+
68
+ def delete(self, items: list[ViewReference]) -> list[ViewReference]:
69
+ """Delete views by their identifiers.
70
+
71
+ Args:
72
+ items: List of (space, external_id, version) tuples identifying the views to delete.
73
+ """
74
+ if not items:
75
+ return []
76
+ if len(items) > 100:
77
+ raise ValueError("Cannot delete more than 100 views at once.")
78
+
79
+ result = self._http_client.request_with_retries(
80
+ ItemsRequest(
81
+ endpoint_url=self._config.create_api_url(f"{self.ENDPOINT}/delete"),
82
+ method="POST",
83
+ body=ItemIDBody(items=items),
84
+ )
85
+ )
86
+ result.raise_for_status()
87
+ result = PagedResponse[ViewReference].model_validate_json(result.success_response.body)
88
+ return result.items
89
+
90
+ def list(
91
+ self,
92
+ space: str | None = None,
93
+ all_versions: bool = False,
94
+ include_inherited_properties: bool = True,
95
+ include_global: bool = False,
96
+ limit: int = 10,
97
+ ) -> list[ViewResponse]:
98
+ """List views in CDF Project.
99
+
100
+ Args:
101
+ space: If specified, only views in this space are returned.
102
+ all_versions: If True, return all versions. If False, only return the latest version.
103
+ include_inherited_properties: If True, include properties inherited from parent views.
104
+ include_global: If True, include global views.
105
+ limit: Maximum number of views to return. Max is 1000.
106
+
107
+ Returns:
108
+ List of ViewResponse objects.
109
+ """
110
+ if limit > 1000:
111
+ raise ValueError("Pagination is not (yet) supported for listing views. The maximum limit is 1000.")
112
+ parameters: dict[str, PrimitiveType] = {
113
+ "allVersions": all_versions,
114
+ "includeInheritedProperties": include_inherited_properties,
115
+ "includeGlobal": include_global,
116
+ "limit": limit,
117
+ }
118
+ if space is not None:
119
+ parameters["space"] = space
120
+ result = self._http_client.request_with_retries(
121
+ ParametersRequest(
122
+ endpoint_url=self._config.create_api_url(self.ENDPOINT),
123
+ method="GET",
124
+ parameters=parameters,
125
+ )
126
+ )
127
+ result.raise_for_status()
128
+ result = PagedResponse[ViewResponse].model_validate_json(result.success_response.body)
129
+ return result.items