arctrl 3.0.0__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 (511) hide show
  1. arctrl/__init__.py +23 -0
  2. arctrl/cwl.py +12 -0
  3. arctrl/py/CWL/__init__.py +0 -0
  4. arctrl/py/CWL/cwlprocessing_unit.py +221 -0
  5. arctrl/py/CWL/cwltypes.py +364 -0
  6. arctrl/py/CWL/decode.py +3532 -0
  7. arctrl/py/CWL/encode.py +1905 -0
  8. arctrl/py/CWL/expression_tool_description.py +192 -0
  9. arctrl/py/CWL/hash_helpers.py +60 -0
  10. arctrl/py/CWL/inputs.py +122 -0
  11. arctrl/py/CWL/operation_description.py +169 -0
  12. arctrl/py/CWL/outputs.py +171 -0
  13. arctrl/py/CWL/parameter_reference.py +74 -0
  14. arctrl/py/CWL/requirements.py +350 -0
  15. arctrl/py/CWL/tool_description.py +192 -0
  16. arctrl/py/CWL/workflow_description.py +181 -0
  17. arctrl/py/CWL/workflow_steps.py +354 -0
  18. arctrl/py/Contract/__init__.py +0 -0
  19. arctrl/py/Contract/arc.py +89 -0
  20. arctrl/py/Contract/arc_assay.py +125 -0
  21. arctrl/py/Contract/arc_investigation.py +88 -0
  22. arctrl/py/Contract/arc_run.py +291 -0
  23. arctrl/py/Contract/arc_study.py +126 -0
  24. arctrl/py/Contract/arc_workflow.py +213 -0
  25. arctrl/py/Contract/contract.py +153 -0
  26. arctrl/py/Contract/datamap.py +396 -0
  27. arctrl/py/Contract/git.py +116 -0
  28. arctrl/py/Contract/license.py +58 -0
  29. arctrl/py/Contract/validation_packages_config.py +107 -0
  30. arctrl/py/ContractIO/__init__.py +0 -0
  31. arctrl/py/ContractIO/contract_io.py +350 -0
  32. arctrl/py/ContractIO/file_system_helper.py +264 -0
  33. arctrl/py/Conversion/__init__.py +0 -0
  34. arctrl/py/Conversion/assay.py +151 -0
  35. arctrl/py/Conversion/basic.py +559 -0
  36. arctrl/py/Conversion/column_index.py +91 -0
  37. arctrl/py/Conversion/datamap.py +36 -0
  38. arctrl/py/Conversion/date_time.py +32 -0
  39. arctrl/py/Conversion/investigation.py +171 -0
  40. arctrl/py/Conversion/person.py +148 -0
  41. arctrl/py/Conversion/process.py +828 -0
  42. arctrl/py/Conversion/run.py +367 -0
  43. arctrl/py/Conversion/scholarly_article.py +163 -0
  44. arctrl/py/Conversion/study.py +99 -0
  45. arctrl/py/Conversion/table.py +229 -0
  46. arctrl/py/Conversion/workflow.py +680 -0
  47. arctrl/py/Core/Helper/__init__.py +0 -0
  48. arctrl/py/Core/Helper/collections_.py +512 -0
  49. arctrl/py/Core/Helper/date_time.py +26 -0
  50. arctrl/py/Core/Helper/hash_codes.py +60 -0
  51. arctrl/py/Core/Helper/identifier.py +290 -0
  52. arctrl/py/Core/Helper/orcid.py +42 -0
  53. arctrl/py/Core/Helper/printer.py +13 -0
  54. arctrl/py/Core/Helper/regex.py +554 -0
  55. arctrl/py/Core/Helper/sem_ver.py +71 -0
  56. arctrl/py/Core/Helper/url.py +148 -0
  57. arctrl/py/Core/Process/__init__.py +0 -0
  58. arctrl/py/Core/Process/column_index.py +280 -0
  59. arctrl/py/Core/Process/component.py +200 -0
  60. arctrl/py/Core/Process/factor.py +151 -0
  61. arctrl/py/Core/Process/factor_value.py +182 -0
  62. arctrl/py/Core/Process/material.py +74 -0
  63. arctrl/py/Core/Process/material_attribute.py +95 -0
  64. arctrl/py/Core/Process/material_attribute_value.py +184 -0
  65. arctrl/py/Core/Process/material_type.py +45 -0
  66. arctrl/py/Core/Process/process.py +477 -0
  67. arctrl/py/Core/Process/process_input.py +265 -0
  68. arctrl/py/Core/Process/process_output.py +235 -0
  69. arctrl/py/Core/Process/process_parameter_value.py +200 -0
  70. arctrl/py/Core/Process/process_sequence.py +435 -0
  71. arctrl/py/Core/Process/protocol.py +175 -0
  72. arctrl/py/Core/Process/protocol_parameter.py +98 -0
  73. arctrl/py/Core/Process/sample.py +82 -0
  74. arctrl/py/Core/Process/source.py +62 -0
  75. arctrl/py/Core/Table/__init__.py +0 -0
  76. arctrl/py/Core/Table/arc_table.py +1206 -0
  77. arctrl/py/Core/Table/arc_table_aux.py +1308 -0
  78. arctrl/py/Core/Table/arc_tables.py +574 -0
  79. arctrl/py/Core/Table/composite_cell.py +319 -0
  80. arctrl/py/Core/Table/composite_column.py +73 -0
  81. arctrl/py/Core/Table/composite_header.py +739 -0
  82. arctrl/py/Core/__init__.py +0 -0
  83. arctrl/py/Core/arc_types.py +5312 -0
  84. arctrl/py/Core/comment.py +128 -0
  85. arctrl/py/Core/comment_list.py +127 -0
  86. arctrl/py/Core/conversion.py +1375 -0
  87. arctrl/py/Core/data.py +247 -0
  88. arctrl/py/Core/data_context.py +157 -0
  89. arctrl/py/Core/data_file.py +112 -0
  90. arctrl/py/Core/datamap.py +217 -0
  91. arctrl/py/Core/identifier_setters.py +43 -0
  92. arctrl/py/Core/iproperty_value.py +36 -0
  93. arctrl/py/Core/ontology_annotation.py +298 -0
  94. arctrl/py/Core/ontology_source_reference.py +114 -0
  95. arctrl/py/Core/person.py +259 -0
  96. arctrl/py/Core/publication.py +161 -0
  97. arctrl/py/Core/template.py +231 -0
  98. arctrl/py/Core/templates.py +148 -0
  99. arctrl/py/Core/uri.py +11 -0
  100. arctrl/py/Core/value.py +188 -0
  101. arctrl/py/FileSystem/__init__.py +0 -0
  102. arctrl/py/FileSystem/commit.py +21 -0
  103. arctrl/py/FileSystem/default_gitattributes.py +1 -0
  104. arctrl/py/FileSystem/default_gitignore.py +1 -0
  105. arctrl/py/FileSystem/default_license.py +1 -0
  106. arctrl/py/FileSystem/file_system.py +58 -0
  107. arctrl/py/FileSystem/file_system_tree.py +483 -0
  108. arctrl/py/FileSystem/path.py +266 -0
  109. arctrl/py/Json/Datamap/__init__.py +0 -0
  110. arctrl/py/Json/Datamap/data_context.py +101 -0
  111. arctrl/py/Json/Datamap/datamap.py +53 -0
  112. arctrl/py/Json/Process/__init__.py +0 -0
  113. arctrl/py/Json/Process/assay_materials.py +46 -0
  114. arctrl/py/Json/Process/component.py +125 -0
  115. arctrl/py/Json/Process/factor.py +107 -0
  116. arctrl/py/Json/Process/factor_value.py +101 -0
  117. arctrl/py/Json/Process/material.py +226 -0
  118. arctrl/py/Json/Process/material_attribute.py +79 -0
  119. arctrl/py/Json/Process/material_attribute_value.py +101 -0
  120. arctrl/py/Json/Process/material_type.py +53 -0
  121. arctrl/py/Json/Process/process.py +296 -0
  122. arctrl/py/Json/Process/process_input.py +83 -0
  123. arctrl/py/Json/Process/process_output.py +67 -0
  124. arctrl/py/Json/Process/process_parameter_value.py +81 -0
  125. arctrl/py/Json/Process/protocol.py +354 -0
  126. arctrl/py/Json/Process/protocol_parameter.py +91 -0
  127. arctrl/py/Json/Process/sample.py +277 -0
  128. arctrl/py/Json/Process/source.py +214 -0
  129. arctrl/py/Json/Process/study_materials.py +52 -0
  130. arctrl/py/Json/Process/value.py +56 -0
  131. arctrl/py/Json/ROCrate/__init__.py +0 -0
  132. arctrl/py/Json/ROCrate/ldcontext.py +143 -0
  133. arctrl/py/Json/ROCrate/ldgraph.py +117 -0
  134. arctrl/py/Json/ROCrate/ldnode.py +304 -0
  135. arctrl/py/Json/ROCrate/ldref.py +44 -0
  136. arctrl/py/Json/ROCrate/ldvalue.py +102 -0
  137. arctrl/py/Json/Table/__init__.py +0 -0
  138. arctrl/py/Json/Table/arc_table.py +375 -0
  139. arctrl/py/Json/Table/cell_table.py +83 -0
  140. arctrl/py/Json/Table/composite_cell.py +136 -0
  141. arctrl/py/Json/Table/composite_header.py +67 -0
  142. arctrl/py/Json/Table/iotype.py +24 -0
  143. arctrl/py/Json/Table/oatable.py +82 -0
  144. arctrl/py/Json/Table/templates.py +281 -0
  145. arctrl/py/Json/__init__.py +0 -0
  146. arctrl/py/Json/assay.py +600 -0
  147. arctrl/py/Json/comment.py +206 -0
  148. arctrl/py/Json/context/rocrate/__init__.py +0 -0
  149. arctrl/py/Json/context/rocrate/isa_assay_context.py +101 -0
  150. arctrl/py/Json/context/rocrate/isa_comment_context.py +60 -0
  151. arctrl/py/Json/context/rocrate/isa_component_context.py +77 -0
  152. arctrl/py/Json/context/rocrate/isa_data_context.py +74 -0
  153. arctrl/py/Json/context/rocrate/isa_factor_context.py +74 -0
  154. arctrl/py/Json/context/rocrate/isa_factor_value_context.py +84 -0
  155. arctrl/py/Json/context/rocrate/isa_investigation_context.py +110 -0
  156. arctrl/py/Json/context/rocrate/isa_material_attribute_context.py +64 -0
  157. arctrl/py/Json/context/rocrate/isa_material_attribute_value_context.py +80 -0
  158. arctrl/py/Json/context/rocrate/isa_material_context.py +71 -0
  159. arctrl/py/Json/context/rocrate/isa_ontology_annotation_context.py +68 -0
  160. arctrl/py/Json/context/rocrate/isa_ontology_source_reference_context.py +75 -0
  161. arctrl/py/Json/context/rocrate/isa_organization_context.py +55 -0
  162. arctrl/py/Json/context/rocrate/isa_person_context.py +131 -0
  163. arctrl/py/Json/context/rocrate/isa_process_context.py +94 -0
  164. arctrl/py/Json/context/rocrate/isa_process_parameter_value_context.py +80 -0
  165. arctrl/py/Json/context/rocrate/isa_protocol_context.py +97 -0
  166. arctrl/py/Json/context/rocrate/isa_protocol_parameter_context.py +64 -0
  167. arctrl/py/Json/context/rocrate/isa_publication_context.py +78 -0
  168. arctrl/py/Json/context/rocrate/isa_sample_context.py +65 -0
  169. arctrl/py/Json/context/rocrate/isa_source_context.py +66 -0
  170. arctrl/py/Json/context/rocrate/isa_study_context.py +125 -0
  171. arctrl/py/Json/context/rocrate/property_value_context.py +73 -0
  172. arctrl/py/Json/context/rocrate/rocrate_context.py +81 -0
  173. arctrl/py/Json/converter_options.py +23 -0
  174. arctrl/py/Json/data.py +356 -0
  175. arctrl/py/Json/data_file.py +63 -0
  176. arctrl/py/Json/decode.py +271 -0
  177. arctrl/py/Json/encode.py +140 -0
  178. arctrl/py/Json/idtable.py +44 -0
  179. arctrl/py/Json/investigation.py +695 -0
  180. arctrl/py/Json/ontology_annotation.py +404 -0
  181. arctrl/py/Json/ontology_source_reference.py +255 -0
  182. arctrl/py/Json/person.py +658 -0
  183. arctrl/py/Json/property_value.py +359 -0
  184. arctrl/py/Json/publication.py +279 -0
  185. arctrl/py/Json/run.py +275 -0
  186. arctrl/py/Json/string_table.py +87 -0
  187. arctrl/py/Json/study.py +793 -0
  188. arctrl/py/Json/workflow.py +307 -0
  189. arctrl/py/JsonIO/Process/__init__.py +0 -0
  190. arctrl/py/JsonIO/Process/component.py +60 -0
  191. arctrl/py/JsonIO/Process/factor.py +36 -0
  192. arctrl/py/JsonIO/Process/factor_value.py +38 -0
  193. arctrl/py/JsonIO/Process/material.py +60 -0
  194. arctrl/py/JsonIO/Process/material_attribute.py +38 -0
  195. arctrl/py/JsonIO/Process/material_attribute_value.py +60 -0
  196. arctrl/py/JsonIO/Process/material_type.py +36 -0
  197. arctrl/py/JsonIO/Process/process.py +60 -0
  198. arctrl/py/JsonIO/Process/process_input.py +38 -0
  199. arctrl/py/JsonIO/Process/process_output.py +60 -0
  200. arctrl/py/JsonIO/Process/process_parameter_value.py +60 -0
  201. arctrl/py/JsonIO/Process/process_sequence.py +71 -0
  202. arctrl/py/JsonIO/Process/protocol.py +60 -0
  203. arctrl/py/JsonIO/Process/protocol_parameter.py +36 -0
  204. arctrl/py/JsonIO/Process/sample.py +60 -0
  205. arctrl/py/JsonIO/Process/source.py +60 -0
  206. arctrl/py/JsonIO/Process/study_materials.py +52 -0
  207. arctrl/py/JsonIO/Process/value.py +32 -0
  208. arctrl/py/JsonIO/Table/__init__.py +0 -0
  209. arctrl/py/JsonIO/Table/arc_table.py +103 -0
  210. arctrl/py/JsonIO/Table/composite_cell.py +36 -0
  211. arctrl/py/JsonIO/Table/composite_header.py +36 -0
  212. arctrl/py/JsonIO/Table/compression.py +67 -0
  213. arctrl/py/JsonIO/Table/iotype.py +36 -0
  214. arctrl/py/JsonIO/Table/templates.py +113 -0
  215. arctrl/py/JsonIO/__init__.py +0 -0
  216. arctrl/py/JsonIO/assay.py +113 -0
  217. arctrl/py/JsonIO/comment.py +80 -0
  218. arctrl/py/JsonIO/data.py +60 -0
  219. arctrl/py/JsonIO/data_file.py +58 -0
  220. arctrl/py/JsonIO/datamap.py +36 -0
  221. arctrl/py/JsonIO/decode.py +9 -0
  222. arctrl/py/JsonIO/encode.py +1 -0
  223. arctrl/py/JsonIO/investigation.py +91 -0
  224. arctrl/py/JsonIO/ldobject.py +106 -0
  225. arctrl/py/JsonIO/ontology_annotation.py +80 -0
  226. arctrl/py/JsonIO/ontology_source_reference.py +80 -0
  227. arctrl/py/JsonIO/person.py +82 -0
  228. arctrl/py/JsonIO/publication.py +82 -0
  229. arctrl/py/JsonIO/run.py +68 -0
  230. arctrl/py/JsonIO/study.py +114 -0
  231. arctrl/py/JsonIO/workflow.py +68 -0
  232. arctrl/py/ROCrate/ISAProfile/__init__.py +0 -0
  233. arctrl/py/ROCrate/ISAProfile/assay.py +70 -0
  234. arctrl/py/ROCrate/ISAProfile/data.py +65 -0
  235. arctrl/py/ROCrate/ISAProfile/dataset.py +24 -0
  236. arctrl/py/ROCrate/ISAProfile/investigation.py +73 -0
  237. arctrl/py/ROCrate/ISAProfile/lab_process.py +162 -0
  238. arctrl/py/ROCrate/ISAProfile/lab_protocol.py +37 -0
  239. arctrl/py/ROCrate/ISAProfile/person.py +72 -0
  240. arctrl/py/ROCrate/ISAProfile/property_value.py +98 -0
  241. arctrl/py/ROCrate/ISAProfile/sample.py +64 -0
  242. arctrl/py/ROCrate/ISAProfile/scholarly_article.py +98 -0
  243. arctrl/py/ROCrate/ISAProfile/study.py +74 -0
  244. arctrl/py/ROCrate/LDTypes/__init__.py +0 -0
  245. arctrl/py/ROCrate/LDTypes/comment.py +131 -0
  246. arctrl/py/ROCrate/LDTypes/computational_workflow.py +455 -0
  247. arctrl/py/ROCrate/LDTypes/computer_language.py +269 -0
  248. arctrl/py/ROCrate/LDTypes/create_action.py +303 -0
  249. arctrl/py/ROCrate/LDTypes/creative_work.py +566 -0
  250. arctrl/py/ROCrate/LDTypes/dataset.py +943 -0
  251. arctrl/py/ROCrate/LDTypes/defined_term.py +131 -0
  252. arctrl/py/ROCrate/LDTypes/file.py +281 -0
  253. arctrl/py/ROCrate/LDTypes/formal_parameter.py +431 -0
  254. arctrl/py/ROCrate/LDTypes/lab_process.py +352 -0
  255. arctrl/py/ROCrate/LDTypes/lab_protocol.py +395 -0
  256. arctrl/py/ROCrate/LDTypes/organization.py +83 -0
  257. arctrl/py/ROCrate/LDTypes/person.py +484 -0
  258. arctrl/py/ROCrate/LDTypes/postal_address.py +195 -0
  259. arctrl/py/ROCrate/LDTypes/property_value.py +952 -0
  260. arctrl/py/ROCrate/LDTypes/sample.py +202 -0
  261. arctrl/py/ROCrate/LDTypes/scholarly_article.py +229 -0
  262. arctrl/py/ROCrate/LDTypes/software_source_code.py +310 -0
  263. arctrl/py/ROCrate/LDTypes/workflow_invocation.py +48 -0
  264. arctrl/py/ROCrate/LDTypes/workflow_protocol.py +52 -0
  265. arctrl/py/ROCrate/__init__.py +0 -0
  266. arctrl/py/ROCrate/arc_rocrate_metadata.py +39 -0
  267. arctrl/py/ROCrate/dyn_obj_extensions.py +1 -0
  268. arctrl/py/ROCrate/helper.py +8 -0
  269. arctrl/py/ROCrate/ldcontext.py +406 -0
  270. arctrl/py/ROCrate/ldobject.py +1247 -0
  271. arctrl/py/ROCrate/rocrate_context.py +51 -0
  272. arctrl/py/Spreadsheet/AnnotationTable/__init__.py +0 -0
  273. arctrl/py/Spreadsheet/AnnotationTable/arc_table.py +203 -0
  274. arctrl/py/Spreadsheet/AnnotationTable/composite_cell.py +78 -0
  275. arctrl/py/Spreadsheet/AnnotationTable/composite_column.py +305 -0
  276. arctrl/py/Spreadsheet/AnnotationTable/composite_header.py +623 -0
  277. arctrl/py/Spreadsheet/DatamapTable/__init__.py +0 -0
  278. arctrl/py/Spreadsheet/DatamapTable/datamap_column.py +114 -0
  279. arctrl/py/Spreadsheet/DatamapTable/datamap_header.py +621 -0
  280. arctrl/py/Spreadsheet/DatamapTable/datamap_table.py +118 -0
  281. arctrl/py/Spreadsheet/Metadata/__init__.py +0 -0
  282. arctrl/py/Spreadsheet/Metadata/assays.py +125 -0
  283. arctrl/py/Spreadsheet/Metadata/comment.py +77 -0
  284. arctrl/py/Spreadsheet/Metadata/contacts.py +134 -0
  285. arctrl/py/Spreadsheet/Metadata/conversions.py +190 -0
  286. arctrl/py/Spreadsheet/Metadata/design_descriptors.py +34 -0
  287. arctrl/py/Spreadsheet/Metadata/factors.py +107 -0
  288. arctrl/py/Spreadsheet/Metadata/ontology_annotation.py +88 -0
  289. arctrl/py/Spreadsheet/Metadata/ontology_source_reference.py +96 -0
  290. arctrl/py/Spreadsheet/Metadata/protocols.py +146 -0
  291. arctrl/py/Spreadsheet/Metadata/publication.py +122 -0
  292. arctrl/py/Spreadsheet/Metadata/run.py +122 -0
  293. arctrl/py/Spreadsheet/Metadata/sparse_table.py +499 -0
  294. arctrl/py/Spreadsheet/Metadata/study.py +312 -0
  295. arctrl/py/Spreadsheet/Metadata/workflow.py +159 -0
  296. arctrl/py/Spreadsheet/__init__.py +0 -0
  297. arctrl/py/Spreadsheet/arc_assay.py +233 -0
  298. arctrl/py/Spreadsheet/arc_investigation.py +435 -0
  299. arctrl/py/Spreadsheet/arc_run.py +190 -0
  300. arctrl/py/Spreadsheet/arc_study.py +144 -0
  301. arctrl/py/Spreadsheet/arc_workflow.py +177 -0
  302. arctrl/py/Spreadsheet/assembly_info.py +1 -0
  303. arctrl/py/Spreadsheet/collection_aux.py +167 -0
  304. arctrl/py/Spreadsheet/datamap.py +43 -0
  305. arctrl/py/Spreadsheet/template.py +460 -0
  306. arctrl/py/ValidationPackages/__init__.py +0 -0
  307. arctrl/py/ValidationPackages/validation_package.py +82 -0
  308. arctrl/py/ValidationPackages/validation_packages_config.py +132 -0
  309. arctrl/py/WebRequest/__init__.py +0 -0
  310. arctrl/py/WebRequest/web_request.py +9 -0
  311. arctrl/py/WebRequest/web_request_py.py +135 -0
  312. arctrl/py/WorkflowGraph/__init__.py +0 -0
  313. arctrl/py/WorkflowGraph/adapters.py +141 -0
  314. arctrl/py/WorkflowGraph/build_options.py +45 -0
  315. arctrl/py/WorkflowGraph/builder.py +720 -0
  316. arctrl/py/WorkflowGraph/graph_types.py +260 -0
  317. arctrl/py/WorkflowGraph/query_helpers.py +76 -0
  318. arctrl/py/WorkflowGraph/reference_parsing.py +59 -0
  319. arctrl/py/WorkflowGraph/visualization_siren.py +574 -0
  320. arctrl/py/WorkflowGraph/workflow_graph.py +119 -0
  321. arctrl/py/Yaml/__init__.py +0 -0
  322. arctrl/py/Yaml/decode.py +1 -0
  323. arctrl/py/Yaml/encode.py +10 -0
  324. arctrl/py/Yaml/validation_package.py +77 -0
  325. arctrl/py/Yaml/validation_packages_config.py +86 -0
  326. arctrl/py/__init__.py +0 -0
  327. arctrl/py/arc.py +1891 -0
  328. arctrl/py/column_index.py +280 -0
  329. arctrl/py/conversion.py +142 -0
  330. arctrl/py/cross_async.py +76 -0
  331. arctrl/py/cwlrun_resolver.py +228 -0
  332. arctrl/py/fable_modules/dynamic_obj/__init__.py +0 -0
  333. arctrl/py/fable_modules/dynamic_obj/dyn_obj.py +136 -0
  334. arctrl/py/fable_modules/dynamic_obj/dynamic_obj.py +415 -0
  335. arctrl/py/fable_modules/dynamic_obj/fable_js.py +1 -0
  336. arctrl/py/fable_modules/dynamic_obj/fable_py.py +288 -0
  337. arctrl/py/fable_modules/dynamic_obj/hash_codes.py +82 -0
  338. arctrl/py/fable_modules/dynamic_obj/property_helper.py +25 -0
  339. arctrl/py/fable_modules/dynamic_obj/reflection_utils.py +87 -0
  340. arctrl/py/fable_modules/fable_library/__init__.py +0 -0
  341. arctrl/py/fable_modules/fable_library/array_.py +1528 -0
  342. arctrl/py/fable_modules/fable_library/async_.py +377 -0
  343. arctrl/py/fable_modules/fable_library/async_builder.py +379 -0
  344. arctrl/py/fable_modules/fable_library/big_int.py +330 -0
  345. arctrl/py/fable_modules/fable_library/bit_converter.py +131 -0
  346. arctrl/py/fable_modules/fable_library/boolean.py +26 -0
  347. arctrl/py/fable_modules/fable_library/char.py +237 -0
  348. arctrl/py/fable_modules/fable_library/choice.py +212 -0
  349. arctrl/py/fable_modules/fable_library/date.py +779 -0
  350. arctrl/py/fable_modules/fable_library/date_offset.py +79 -0
  351. arctrl/py/fable_modules/fable_library/decimal_.py +190 -0
  352. arctrl/py/fable_modules/fable_library/diagnostics.py +54 -0
  353. arctrl/py/fable_modules/fable_library/double.py +87 -0
  354. arctrl/py/fable_modules/fable_library/encoding.py +41 -0
  355. arctrl/py/fable_modules/fable_library/event.py +206 -0
  356. arctrl/py/fable_modules/fable_library/file.py +107 -0
  357. arctrl/py/fable_modules/fable_library/fsharp_collections.py +52 -0
  358. arctrl/py/fable_modules/fable_library/fsharp_core.py +123 -0
  359. arctrl/py/fable_modules/fable_library/global_.py +63 -0
  360. arctrl/py/fable_modules/fable_library/guid.py +41 -0
  361. arctrl/py/fable_modules/fable_library/int32.py +73 -0
  362. arctrl/py/fable_modules/fable_library/list.py +1788 -0
  363. arctrl/py/fable_modules/fable_library/long.py +240 -0
  364. arctrl/py/fable_modules/fable_library/mailbox_processor.py +179 -0
  365. arctrl/py/fable_modules/fable_library/map.py +1854 -0
  366. arctrl/py/fable_modules/fable_library/map_util.py +148 -0
  367. arctrl/py/fable_modules/fable_library/mutable_map.py +397 -0
  368. arctrl/py/fable_modules/fable_library/mutable_set.py +279 -0
  369. arctrl/py/fable_modules/fable_library/native.py +45 -0
  370. arctrl/py/fable_modules/fable_library/numeric.py +46 -0
  371. arctrl/py/fable_modules/fable_library/observable.py +222 -0
  372. arctrl/py/fable_modules/fable_library/option.py +128 -0
  373. arctrl/py/fable_modules/fable_library/path.py +62 -0
  374. arctrl/py/fable_modules/fable_library/range.py +117 -0
  375. arctrl/py/fable_modules/fable_library/reflection.py +463 -0
  376. arctrl/py/fable_modules/fable_library/reg_exp.py +137 -0
  377. arctrl/py/fable_modules/fable_library/resize_array.py +31 -0
  378. arctrl/py/fable_modules/fable_library/result.py +212 -0
  379. arctrl/py/fable_modules/fable_library/seq.py +1979 -0
  380. arctrl/py/fable_modules/fable_library/seq2.py +221 -0
  381. arctrl/py/fable_modules/fable_library/set.py +2414 -0
  382. arctrl/py/fable_modules/fable_library/singleton_local_time_zone.py +36 -0
  383. arctrl/py/fable_modules/fable_library/string_.py +573 -0
  384. arctrl/py/fable_modules/fable_library/system_collections_generic.py +462 -0
  385. arctrl/py/fable_modules/fable_library/system_text.py +237 -0
  386. arctrl/py/fable_modules/fable_library/task.py +116 -0
  387. arctrl/py/fable_modules/fable_library/task_builder.py +122 -0
  388. arctrl/py/fable_modules/fable_library/thread.py +5 -0
  389. arctrl/py/fable_modules/fable_library/time_span.py +283 -0
  390. arctrl/py/fable_modules/fable_library/timer.py +24 -0
  391. arctrl/py/fable_modules/fable_library/types.py +401 -0
  392. arctrl/py/fable_modules/fable_library/uri.py +109 -0
  393. arctrl/py/fable_modules/fable_library/util.py +2735 -0
  394. arctrl/py/fable_modules/fable_openpyxl/__init__.py +0 -0
  395. arctrl/py/fable_modules/fable_openpyxl/openpyxl.py +362 -0
  396. arctrl/py/fable_modules/fable_python/cognite-sdk/__init__.py +0 -0
  397. arctrl/py/fable_modules/fable_python/cognite-sdk/cognite_sdk.py +22 -0
  398. arctrl/py/fable_modules/fable_python/flask/__init__.py +0 -0
  399. arctrl/py/fable_modules/fable_python/flask/flask.py +34 -0
  400. arctrl/py/fable_modules/fable_python/jupyter/__init__.py +0 -0
  401. arctrl/py/fable_modules/fable_python/jupyter/ipy_widgets.py +47 -0
  402. arctrl/py/fable_modules/fable_python/jupyter/ipython.py +13 -0
  403. arctrl/py/fable_modules/fable_python/stdlib/__init__.py +0 -0
  404. arctrl/py/fable_modules/fable_python/stdlib/ast.py +1 -0
  405. arctrl/py/fable_modules/fable_python/stdlib/asyncio/__init__.py +0 -0
  406. arctrl/py/fable_modules/fable_python/stdlib/asyncio/events.py +17 -0
  407. arctrl/py/fable_modules/fable_python/stdlib/asyncio/futures.py +52 -0
  408. arctrl/py/fable_modules/fable_python/stdlib/asyncio/tasks.py +38 -0
  409. arctrl/py/fable_modules/fable_python/stdlib/base64_.py +1 -0
  410. arctrl/py/fable_modules/fable_python/stdlib/builtins_.py +38 -0
  411. arctrl/py/fable_modules/fable_python/stdlib/html.py +1 -0
  412. arctrl/py/fable_modules/fable_python/stdlib/json.py +1 -0
  413. arctrl/py/fable_modules/fable_python/stdlib/math_.py +1 -0
  414. arctrl/py/fable_modules/fable_python/stdlib/os_.py +1 -0
  415. arctrl/py/fable_modules/fable_python/stdlib/queue_.py +1 -0
  416. arctrl/py/fable_modules/fable_python/stdlib/string_.py +1 -0
  417. arctrl/py/fable_modules/fable_python/stdlib/sys_.py +30 -0
  418. arctrl/py/fable_modules/fable_python/stdlib/time_.py +1 -0
  419. arctrl/py/fable_modules/fable_python/stdlib/tk_inter.py +1 -0
  420. arctrl/py/fable_modules/fs_spreadsheet/Cells/__init__.py +0 -0
  421. arctrl/py/fable_modules/fs_spreadsheet/Cells/fs_cell.py +340 -0
  422. arctrl/py/fable_modules/fs_spreadsheet/Cells/fs_cells_collection.py +466 -0
  423. arctrl/py/fable_modules/fs_spreadsheet/DSL/__init__.py +0 -0
  424. arctrl/py/fable_modules/fs_spreadsheet/DSL/cell_builder.py +214 -0
  425. arctrl/py/fable_modules/fs_spreadsheet/DSL/column_builder.py +139 -0
  426. arctrl/py/fable_modules/fs_spreadsheet/DSL/dsl.py +50 -0
  427. arctrl/py/fable_modules/fs_spreadsheet/DSL/expression.py +65 -0
  428. arctrl/py/fable_modules/fs_spreadsheet/DSL/operators.py +9 -0
  429. arctrl/py/fable_modules/fs_spreadsheet/DSL/row_builder.py +139 -0
  430. arctrl/py/fable_modules/fs_spreadsheet/DSL/sheet_builder.py +118 -0
  431. arctrl/py/fable_modules/fs_spreadsheet/DSL/table_builder.py +122 -0
  432. arctrl/py/fable_modules/fs_spreadsheet/DSL/transform.py +463 -0
  433. arctrl/py/fable_modules/fs_spreadsheet/DSL/types.py +314 -0
  434. arctrl/py/fable_modules/fs_spreadsheet/DSL/workbook_builder.py +106 -0
  435. arctrl/py/fable_modules/fs_spreadsheet/Json/__init__.py +0 -0
  436. arctrl/py/fable_modules/fs_spreadsheet/Json/cell.py +103 -0
  437. arctrl/py/fable_modules/fs_spreadsheet/Json/column.py +70 -0
  438. arctrl/py/fable_modules/fs_spreadsheet/Json/row.py +70 -0
  439. arctrl/py/fable_modules/fs_spreadsheet/Json/table.py +54 -0
  440. arctrl/py/fable_modules/fs_spreadsheet/Json/value.py +93 -0
  441. arctrl/py/fable_modules/fs_spreadsheet/Json/workbook.py +71 -0
  442. arctrl/py/fable_modules/fs_spreadsheet/Json/worksheet.py +216 -0
  443. arctrl/py/fable_modules/fs_spreadsheet/Ranges/__init__.py +0 -0
  444. arctrl/py/fable_modules/fs_spreadsheet/Ranges/fs_range.py +43 -0
  445. arctrl/py/fable_modules/fs_spreadsheet/Ranges/fs_range_address.py +190 -0
  446. arctrl/py/fable_modules/fs_spreadsheet/Ranges/fs_range_base.py +92 -0
  447. arctrl/py/fable_modules/fs_spreadsheet/Ranges/fs_range_column.py +77 -0
  448. arctrl/py/fable_modules/fs_spreadsheet/Ranges/fs_range_row.py +48 -0
  449. arctrl/py/fable_modules/fs_spreadsheet/Tables/__init__.py +0 -0
  450. arctrl/py/fable_modules/fs_spreadsheet/Tables/fs_table.py +461 -0
  451. arctrl/py/fable_modules/fs_spreadsheet/Tables/fs_table_field.py +117 -0
  452. arctrl/py/fable_modules/fs_spreadsheet/Tables/fs_table_row.py +23 -0
  453. arctrl/py/fable_modules/fs_spreadsheet/__init__.py +0 -0
  454. arctrl/py/fable_modules/fs_spreadsheet/fs_address.py +236 -0
  455. arctrl/py/fable_modules/fs_spreadsheet/fs_column.py +172 -0
  456. arctrl/py/fable_modules/fs_spreadsheet/fs_row.py +183 -0
  457. arctrl/py/fable_modules/fs_spreadsheet/fs_workbook.py +192 -0
  458. arctrl/py/fable_modules/fs_spreadsheet/fs_worksheet.py +610 -0
  459. arctrl/py/fable_modules/fs_spreadsheet/hash_codes.py +60 -0
  460. arctrl/py/fable_modules/fs_spreadsheet/sheet_builder.py +329 -0
  461. arctrl/py/fable_modules/fs_spreadsheet_py/__init__.py +0 -0
  462. arctrl/py/fable_modules/fs_spreadsheet_py/cell.py +60 -0
  463. arctrl/py/fable_modules/fs_spreadsheet_py/cell_type.py +50 -0
  464. arctrl/py/fable_modules/fs_spreadsheet_py/fs_extension.py +60 -0
  465. arctrl/py/fable_modules/fs_spreadsheet_py/json.py +47 -0
  466. arctrl/py/fable_modules/fs_spreadsheet_py/table.py +54 -0
  467. arctrl/py/fable_modules/fs_spreadsheet_py/workbook.py +41 -0
  468. arctrl/py/fable_modules/fs_spreadsheet_py/worksheet.py +52 -0
  469. arctrl/py/fable_modules/fs_spreadsheet_py/xlsx.py +37 -0
  470. arctrl/py/fable_modules/siren/__init__.py +0 -0
  471. arctrl/py/fable_modules/siren/config.py +1038 -0
  472. arctrl/py/fable_modules/siren/formatting.py +1121 -0
  473. arctrl/py/fable_modules/siren/siren.py +1941 -0
  474. arctrl/py/fable_modules/siren/siren_types.py +1229 -0
  475. arctrl/py/fable_modules/siren/theme_variables.py +517 -0
  476. arctrl/py/fable_modules/siren/util.py +37 -0
  477. arctrl/py/fable_modules/siren/yaml.py +101 -0
  478. arctrl/py/fable_modules/thoth_json_core/__init__.py +0 -0
  479. arctrl/py/fable_modules/thoth_json_core/decode.py +1614 -0
  480. arctrl/py/fable_modules/thoth_json_core/encode.py +305 -0
  481. arctrl/py/fable_modules/thoth_json_core/types.py +181 -0
  482. arctrl/py/fable_modules/thoth_json_python/__init__.py +0 -0
  483. arctrl/py/fable_modules/thoth_json_python/decode.py +112 -0
  484. arctrl/py/fable_modules/thoth_json_python/encode.py +72 -0
  485. arctrl/py/fable_modules/thoth_json_python/python.py +1 -0
  486. arctrl/py/fable_modules/yamlicious/Interop/__init__.py +0 -0
  487. arctrl/py/fable_modules/yamlicious/Interop/js_interop.py +1 -0
  488. arctrl/py/fable_modules/yamlicious/Interop/py_interop.py +7 -0
  489. arctrl/py/fable_modules/yamlicious/__init__.py +0 -0
  490. arctrl/py/fable_modules/yamlicious/decode.py +1784 -0
  491. arctrl/py/fable_modules/yamlicious/encode.py +84 -0
  492. arctrl/py/fable_modules/yamlicious/flow_to_block.py +994 -0
  493. arctrl/py/fable_modules/yamlicious/library.py +10 -0
  494. arctrl/py/fable_modules/yamlicious/persil.py +57 -0
  495. arctrl/py/fable_modules/yamlicious/preprocessing.py +99 -0
  496. arctrl/py/fable_modules/yamlicious/reader.py +739 -0
  497. arctrl/py/fable_modules/yamlicious/regex.py +29 -0
  498. arctrl/py/fable_modules/yamlicious/regex_active_patterns.py +265 -0
  499. arctrl/py/fable_modules/yamlicious/writer.py +175 -0
  500. arctrl/py/fable_modules/yamlicious/yamlicious_types.py +128 -0
  501. arctrl/py/json.py +389 -0
  502. arctrl/py/license.py +169 -0
  503. arctrl/py/rocrate_io.py +242 -0
  504. arctrl/py/template_web.py +23 -0
  505. arctrl/py/xlsx.py +212 -0
  506. arctrl/py/yaml.py +79 -0
  507. arctrl/rocrate.py +21 -0
  508. arctrl-3.0.0.dist-info/METADATA +157 -0
  509. arctrl-3.0.0.dist-info/RECORD +511 -0
  510. arctrl-3.0.0.dist-info/WHEEL +4 -0
  511. arctrl-3.0.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,2735 @@
1
+ from __future__ import annotations
2
+
3
+ import builtins
4
+ import functools
5
+ import math
6
+ import platform
7
+ import random
8
+ import re
9
+ import weakref
10
+ from abc import ABC, abstractmethod
11
+ from array import array
12
+ from collections.abc import (
13
+ Callable,
14
+ Iterable,
15
+ Iterator,
16
+ MutableSequence,
17
+ Sequence,
18
+ Sized,
19
+ )
20
+ from contextlib import AbstractContextManager
21
+ from enum import IntEnum
22
+ from threading import RLock
23
+ from types import TracebackType
24
+ from typing import (
25
+ Any,
26
+ ClassVar,
27
+ Generic,
28
+ Protocol,
29
+ TypeVar,
30
+ cast,
31
+ )
32
+ from urllib.parse import quote, unquote
33
+
34
+
35
+ class SupportsLessThan(Protocol):
36
+ @abstractmethod
37
+ def __lt__(self, __other: Any) -> bool:
38
+ raise NotImplementedError
39
+
40
+
41
+ _T = TypeVar("_T")
42
+ _T_in = TypeVar("_T_in", contravariant=True)
43
+ _T_out = TypeVar("_T_out", covariant=True)
44
+ _Key = TypeVar("_Key")
45
+ _Value = TypeVar("_Value")
46
+ _TSupportsLessThan = TypeVar("_TSupportsLessThan", bound=SupportsLessThan)
47
+
48
+ Array = MutableSequence
49
+
50
+
51
+ class ObjectDisposedException(Exception):
52
+ def __init__(self):
53
+ super().__init__("Cannot access a disposed object")
54
+
55
+
56
+ class IDisposable(ABC):
57
+ """IDisposable interface.
58
+
59
+ Note currently not a protocol since it also impmelents resource
60
+ management and needs to be inherited from.
61
+ """
62
+
63
+ __slots__ = ()
64
+
65
+ @abstractmethod
66
+ def Dispose(self) -> None: ...
67
+
68
+ def __enter__(self):
69
+ """Enter context management."""
70
+ return self
71
+
72
+ def __exit__(
73
+ self,
74
+ exctype: type[BaseException] | None,
75
+ excinst: BaseException | None,
76
+ exctb: TracebackType | None,
77
+ ) -> bool:
78
+ """Exit context management."""
79
+
80
+ self.Dispose()
81
+ return False
82
+
83
+ @staticmethod
84
+ def create(action: Callable[[], None]):
85
+ """Create disposable from action. Will call action when
86
+ disposed."""
87
+ return AnonymousDisposable(action)
88
+
89
+
90
+ Disposable = TypeVar("Disposable", bound=IDisposable)
91
+
92
+
93
+ class AnonymousDisposable(IDisposable):
94
+ __slots__ = "_is_disposed", "_action", "_lock"
95
+
96
+ def __init__(self, action: Callable[[], None]):
97
+ self._is_disposed = False
98
+ self._action = action
99
+ self._lock = RLock()
100
+
101
+ def Dispose(self) -> None:
102
+ """Performs the task of cleaning up resources."""
103
+
104
+ dispose = False
105
+ with self._lock:
106
+ if not self._is_disposed:
107
+ dispose = True
108
+ self._is_disposed = True
109
+
110
+ if dispose:
111
+ self._action()
112
+
113
+ def __enter__(self):
114
+ if self._is_disposed:
115
+ raise ObjectDisposedException()
116
+ return self
117
+
118
+
119
+ class IEquatable(Protocol):
120
+ @abstractmethod
121
+ def __eq__(self, other: Any) -> bool:
122
+ raise NotImplementedError
123
+
124
+ @abstractmethod
125
+ def __hash__(self) -> int:
126
+ raise NotImplementedError
127
+
128
+
129
+ class IComparable(IEquatable, Protocol):
130
+ @abstractmethod
131
+ def __cmp__(self, __other: Any) -> int:
132
+ raise NotImplementedError
133
+
134
+ @abstractmethod
135
+ def __lt__(self, other: Any) -> bool:
136
+ raise NotImplementedError
137
+
138
+
139
+ class IComparable_1(Generic[_T_in], IEquatable, Protocol):
140
+ @abstractmethod
141
+ def __cmp__(self, __other: _T_in) -> int:
142
+ raise NotImplementedError
143
+
144
+ @abstractmethod
145
+ def __lt__(self, other: Any) -> bool:
146
+ raise NotImplementedError
147
+
148
+
149
+ class IComparer(Protocol):
150
+ """Defines a method that a type implements to compare two objects.
151
+
152
+ https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.icomparer-1
153
+ """
154
+
155
+ @property
156
+ @abstractmethod
157
+ def Compare(self) -> Callable[[_T_in, _T_in], int]: ...
158
+
159
+
160
+ class IComparer_1(Generic[_T_in], Protocol):
161
+ """Defines a method that a type implements to compare two objects.
162
+
163
+ https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.icomparer-1
164
+ """
165
+
166
+ @property
167
+ @abstractmethod
168
+ def Compare(self) -> Callable[[_T_in, _T_in], int]: ...
169
+
170
+
171
+ class IEqualityComparer(Protocol):
172
+ def Equals(self, __x: _T_in, __y: _T_in) -> bool:
173
+ return self.System_Collections_IEqualityComparer_Equals541DA560(__x, __y)
174
+
175
+ def GetHashCode(self) -> int:
176
+ return self.System_Collections_IEqualityComparer_GetHashCode4E60E31B()
177
+
178
+ @abstractmethod
179
+ def System_Collections_IEqualityComparer_Equals541DA560(self, x: Any = None, y: Any = None) -> bool:
180
+ raise NotImplementedError
181
+
182
+ @abstractmethod
183
+ def System_Collections_IEqualityComparer_GetHashCode4E60E31B(self, x_1: Any = None) -> int:
184
+ raise NotImplementedError
185
+
186
+
187
+ class IEqualityComparer_1(Generic[_T_in], Protocol):
188
+ def Equals(self, __x: _T_in, __y: _T_in) -> bool:
189
+ raise NotImplementedError
190
+
191
+ def GetHashCode(self) -> int:
192
+ raise NotImplementedError
193
+
194
+
195
+ class IStructuralEquatable(Protocol):
196
+ @abstractmethod
197
+ def Equals(self, other: Any, comparer: IEqualityComparer) -> bool:
198
+ return NotImplemented
199
+
200
+ @abstractmethod
201
+ def __hash__(self) -> int:
202
+ raise NotImplementedError
203
+
204
+
205
+ class IStructuralComparable(Protocol):
206
+ @abstractmethod
207
+ def __cmp__(self, other: Any, comparer: IComparer) -> int:
208
+ raise NotImplementedError
209
+
210
+
211
+ class DateKind(IntEnum):
212
+ Unspecified = 0
213
+ UTC = 1
214
+ Local = 2
215
+
216
+
217
+ def equals(a: Any, b: Any) -> bool:
218
+ match (a, b):
219
+ case (a, b) if a is b:
220
+ return True
221
+ # Don't test (None, None) here, because a is b already covers that
222
+ # case (None, None):
223
+ # return True
224
+ case (None, _):
225
+ return False
226
+ case (_, None):
227
+ return False
228
+ case (a, b) if is_array_like(a):
229
+ return equal_arrays(a, b)
230
+ case _:
231
+ return a == b
232
+
233
+
234
+ def is_comparable(x: Any) -> bool:
235
+ return hasattr(x, "__cmp__") and callable(x.__cmp__)
236
+
237
+
238
+ def is_equatable(x: Any) -> bool:
239
+ return hasattr(x, "__eq__") and callable(x.__eq__)
240
+
241
+
242
+ def is_iterable(x: Any) -> bool:
243
+ return isinstance(x, Iterable)
244
+
245
+
246
+ def compare_dicts(x: dict[str, Any], y: dict[str, Any]) -> int:
247
+ """Compare Python dicts with string keys.
248
+
249
+ Python cannot do this natively.
250
+ """
251
+ x_keys = x.keys()
252
+ y_keys = y.keys()
253
+
254
+ if len(x_keys) != len(y_keys):
255
+ return -1 if len(x_keys) < len(y_keys) else 1
256
+
257
+ x_keys = sorted(x_keys)
258
+ y_keys = sorted(y_keys)
259
+
260
+ j = 0
261
+ for i, key in enumerate(x_keys):
262
+ if key != y_keys[i]:
263
+ return -1 if key < y_keys[i] else 1
264
+ else:
265
+ j = compare(x[key], y[key])
266
+ if j != 0:
267
+ return j
268
+
269
+ return 0
270
+
271
+
272
+ def compare_arrays(xs: list[Any] | None, ys: list[Any] | None):
273
+ if xs is None:
274
+ return 0 if ys is None else 1
275
+
276
+ if ys is None:
277
+ return -1
278
+
279
+ if len(xs) != len(ys):
280
+ return -1 if len(xs) < len(ys) else 1
281
+
282
+ j = 0
283
+ for i, x in enumerate(xs):
284
+ j = compare(x, ys[i])
285
+ if j != 0:
286
+ return j
287
+
288
+ return 0
289
+
290
+
291
+ def compare(a: Any, b: Any) -> int:
292
+ if a is b:
293
+ return 0
294
+
295
+ if a is None:
296
+ return -1 if b else 0
297
+
298
+ if b is None:
299
+ return 1 if a else 0
300
+
301
+ if is_comparable(a):
302
+ return a.__cmp__(b)
303
+
304
+ if isinstance(a, dict):
305
+ return compare_dicts(cast(dict[str, Any], a), b)
306
+
307
+ if isinstance(a, list):
308
+ return compare_arrays(cast(list[Any], a), b)
309
+
310
+ if is_equatable(a) and a == b:
311
+ return 0
312
+
313
+ if hasattr(a, "__lt__") and callable(a.__lt__) and a < b:
314
+ return -1
315
+
316
+ return 1
317
+
318
+
319
+ def equal_arrays_with(xs: Sequence[_T] | None, ys: Sequence[_T] | None, eq: Callable[[_T, _T], bool]) -> bool:
320
+ if xs is None:
321
+ return ys is None
322
+
323
+ if ys is None:
324
+ return False
325
+
326
+ if len(xs) != len(ys):
327
+ return False
328
+
329
+ for i, x in enumerate(xs):
330
+ if not eq(x, ys[i]):
331
+ return False
332
+
333
+ return True
334
+
335
+
336
+ def equal_arrays(x: Sequence[_T], y: Sequence[_T]) -> bool:
337
+ return equal_arrays_with(x, y, equals)
338
+
339
+
340
+ def compare_primitives(x: _TSupportsLessThan, y: _TSupportsLessThan) -> int:
341
+ return 0 if x == y else (-1 if x < y else 1)
342
+
343
+
344
+ def min(comparer: Callable[[_T, _T], int], x: _T, y: _T) -> _T:
345
+ return x if comparer(x, y) < 0 else y
346
+
347
+
348
+ def max(comparer: Callable[[_T, _T], int], x: _T, y: _T) -> _T:
349
+ return x if comparer(x, y) > 0 else y
350
+
351
+
352
+ def clamp(comparer: Callable[[_T, _T], int], value: _T, min: _T, max: _T):
353
+ return min if (comparer(value, min) < 0) else max if comparer(value, max) > 0 else value
354
+
355
+
356
+ def assert_equal(actual: Any, expected: Any, msg: str | None = None) -> None:
357
+ if not equals(actual, expected):
358
+ raise Exception(msg or f"Expected: {expected} - Actual: {actual}")
359
+
360
+
361
+ def assert_not_equal(actual: _T, expected: _T, msg: str | None = None) -> None:
362
+ if equals(actual, expected):
363
+ raise Exception(msg or f"Expected: {expected} - Actual: {actual}")
364
+
365
+
366
+ MAX_LOCKS = 1024
367
+
368
+
369
+ def lock(lock_obj: Any, fn: Callable[[], _T]) -> _T:
370
+ @functools.lru_cache(maxsize=MAX_LOCKS)
371
+ def get_lock(n: int) -> RLock:
372
+ return RLock()
373
+
374
+ lock = get_lock(id(lock_obj))
375
+ with lock:
376
+ return fn()
377
+
378
+
379
+ class Lazy(Generic[_T]):
380
+ def __init__(self, factory: Callable[[], _T]):
381
+ self.factory = factory
382
+ self.is_value_created: bool = False
383
+ self.created_value: _T | None = None
384
+
385
+ @property
386
+ def Value(self) -> _T:
387
+ if not self.is_value_created:
388
+ self.created_value = self.factory()
389
+ self.is_value_created = True
390
+
391
+ assert self.created_value is not None
392
+ return self.created_value
393
+
394
+ @property
395
+ def IsValueCreated(self):
396
+ return self.is_value_created
397
+
398
+
399
+ def lazy_from_value(v: _T) -> Lazy[_T]:
400
+ return Lazy(lambda: v)
401
+
402
+
403
+ def pad_with_zeros(i: int, length: int) -> str:
404
+ string = str(i)
405
+ while len(string) < length:
406
+ string = "0" + string
407
+ return string
408
+
409
+
410
+ def pad_left_and_right_with_zeros(i: int, length_left: int, length_right: int) -> str:
411
+ string = str(i)
412
+ while len(string) < length_left:
413
+ string = "0" + string
414
+ while len(string) < length_right:
415
+ string = string + "0"
416
+ return string
417
+
418
+
419
+ class Atom(Generic[_T], Protocol):
420
+ def __call__(self, *value: _T) -> _T | None: ...
421
+
422
+
423
+ def create_atom(value: _T) -> Atom[_T]:
424
+ atom = value
425
+
426
+ def wrapper(*value: _T) -> _T | None:
427
+ nonlocal atom
428
+
429
+ if len(value) == 0:
430
+ return atom
431
+
432
+ atom = value[0]
433
+ return None
434
+
435
+ return wrapper
436
+
437
+
438
+ def create_obj(fields: list[tuple[Any, Any]]):
439
+ return dict(fields)
440
+
441
+
442
+ def tohex(val: int, nbits: int | None = None) -> str:
443
+ if nbits:
444
+ val = (val + (1 << nbits)) % (1 << nbits)
445
+ return f"{val:x}"
446
+
447
+
448
+ def int_to_string(i: int, radix: int = 10, bitsize: int | None = None) -> str:
449
+ if radix == 10:
450
+ return f"{i:d}"
451
+ if radix == 16:
452
+ return tohex(i, bitsize)
453
+ if radix == 2:
454
+ return f"{i:b}"
455
+ if radix == 8:
456
+ return f"{i:o}"
457
+ return str(i)
458
+
459
+
460
+ def int8_to_string(i: int, radix: int = 10, bitsize: int | None = None) -> str:
461
+ return int_to_string(i, radix, 8)
462
+
463
+
464
+ def int16_to_string(i: int, radix: int = 10, bitsize: int | None = None) -> str:
465
+ return int_to_string(i, radix, 16)
466
+
467
+
468
+ def int32_to_string(i: int, radix: int = 10, bitsize: int | None = None) -> str:
469
+ return int_to_string(i, radix, 32)
470
+
471
+
472
+ def int64_to_string(i: int, radix: int = 10, bitsize: int | None = None) -> str:
473
+ return int_to_string(i, radix, 64)
474
+
475
+
476
+ def count(col: Iterable[Any]) -> int:
477
+ if isinstance(col, Sized):
478
+ return len(col)
479
+
480
+ count = 0
481
+ for _ in col:
482
+ count += 1
483
+
484
+ return count
485
+
486
+
487
+ def clear(col: dict[Any, Any] | list[Any] | None) -> None:
488
+ if isinstance(col, list | dict):
489
+ col.clear()
490
+
491
+
492
+ class IEnumerator(Iterator[_T], IDisposable):
493
+ __slots__ = ()
494
+
495
+ def Current(self) -> _T:
496
+ return self.System_Collections_Generic_IEnumerator_1_get_Current()
497
+
498
+ def MoveNext(self) -> bool:
499
+ return self.System_Collections_IEnumerator_MoveNext()
500
+
501
+ def Reset(self) -> None:
502
+ return self.System_Collections_IEnumerator_Reset()
503
+
504
+ @abstractmethod
505
+ def System_Collections_Generic_IEnumerator_1_get_Current(self) -> _T: ...
506
+
507
+ def System_Collections_IEnumerator_get_Current(self) -> Any:
508
+ return self.System_Collections_Generic_IEnumerator_1_get_Current()
509
+
510
+ @abstractmethod
511
+ def System_Collections_IEnumerator_MoveNext(self) -> bool: ...
512
+
513
+ @abstractmethod
514
+ def System_Collections_IEnumerator_Reset(self) -> None: ...
515
+
516
+ def __iter__(self) -> Iterator[_T]:
517
+ return self
518
+
519
+ def __next__(self) -> _T:
520
+ if not self.MoveNext():
521
+ raise StopIteration
522
+ return self.Current()
523
+
524
+
525
+ class IEnumerable(Iterable[Any], Protocol):
526
+ __slots__ = ()
527
+
528
+ @abstractmethod
529
+ def GetEnumerator(self) -> IEnumerator[Any]: ...
530
+
531
+ def __iter__(self) -> Iterator[Any]:
532
+ return self.GetEnumerator()
533
+
534
+
535
+ class IEnumerable_1(Iterable[_T], Protocol):
536
+ __slots__ = ()
537
+
538
+ @abstractmethod
539
+ def GetEnumerator(self) -> IEnumerator[_T]: ...
540
+
541
+ def __iter__(self) -> Iterator[_T]:
542
+ return self.GetEnumerator()
543
+
544
+
545
+ class ICollection(IEnumerable_1[_T], Protocol): ...
546
+
547
+
548
+ class IDictionary(ICollection[tuple[_Key, _Value]], Protocol):
549
+ @abstractmethod
550
+ def keys(self) -> IEnumerable_1[_Key]: ...
551
+
552
+ def values(self) -> IEnumerable_1[_Value]: ...
553
+
554
+
555
+ class Enumerator(IEnumerator[_T]):
556
+ __slots__ = "iter", "current"
557
+
558
+ def __init__(self, iter: Iterator[_T]) -> None:
559
+ self.iter = iter
560
+ self.current = None
561
+
562
+ def System_Collections_Generic_IEnumerator_1_get_Current(self) -> _T:
563
+ if self.current is not None:
564
+ return self.current
565
+ return None # type: ignore
566
+
567
+ def System_Collections_IEnumerator_MoveNext(self) -> bool:
568
+ try:
569
+ cur = next(self.iter)
570
+ self.current = cur
571
+ return True
572
+ except StopIteration:
573
+ return False
574
+
575
+ def System_Collections_IEnumerator_Reset(self) -> None:
576
+ raise Exception("Python iterators cannot be reset")
577
+
578
+ def Dispose(self) -> None:
579
+ return
580
+
581
+ def __next__(self) -> _T:
582
+ return next(self.iter)
583
+
584
+ def __iter__(self) -> Iterator[_T]:
585
+ return self
586
+
587
+
588
+ class Enumerable(IEnumerable_1[_T]):
589
+ __slots__ = "xs"
590
+
591
+ def __init__(self, xs: Iterable[_T]) -> None:
592
+ self.xs = xs
593
+
594
+ def GetEnumerator(self) -> IEnumerator[_T]:
595
+ return Enumerator(iter(self.xs))
596
+
597
+ def __iter__(self) -> Iterator[_T]:
598
+ return iter(self.xs)
599
+
600
+
601
+ def to_enumerable(e: Iterable[_T]) -> IEnumerable_1[_T]:
602
+ return Enumerable(e)
603
+
604
+
605
+ def get_enumerator(o: Iterable[Any]) -> Enumerator[Any]:
606
+ attr = getattr(o, "GetEnumerator", None)
607
+ if attr:
608
+ return attr()
609
+ elif isinstance(o, dict):
610
+ # Dictionaries should produce tuples
611
+ return Enumerator(iter(cast(Any, o.items())))
612
+ else:
613
+ return Enumerator(iter(o))
614
+
615
+
616
+ _T1 = TypeVar("_T1")
617
+ _T2 = TypeVar("_T2")
618
+ _T3 = TypeVar("_T3")
619
+ _T4 = TypeVar("_T4")
620
+ _T5 = TypeVar("_T5")
621
+ _T6 = TypeVar("_T6")
622
+ _T7 = TypeVar("_T7")
623
+ _T8 = TypeVar("_T8")
624
+ _T9 = TypeVar("_T9")
625
+ _T10 = TypeVar("_T10")
626
+ _T11 = TypeVar("_T11")
627
+ _T12 = TypeVar("_T12")
628
+ _T13 = TypeVar("_T13")
629
+ _T14 = TypeVar("_T14")
630
+ _T15 = TypeVar("_T15")
631
+ _T16 = TypeVar("_T16")
632
+ _T17 = TypeVar("_T17")
633
+ _T18 = TypeVar("_T18")
634
+ _T19 = TypeVar("_T19")
635
+ _T20 = TypeVar("_T20")
636
+ _TResult = TypeVar("_TResult")
637
+
638
+ _curried = weakref.WeakKeyDictionary[Any, Any]()
639
+
640
+
641
+ def uncurry2(f: Callable[[_T1], Callable[[_T2], _TResult]]) -> Callable[[_T1, _T2], _TResult]:
642
+ def f2(a1: _T1, a2: _T2) -> _TResult:
643
+ return f(a1)(a2)
644
+
645
+ _curried[f2] = f
646
+ return f2
647
+
648
+
649
+ def curry2(f: Callable[[_T1, _T2], _TResult]) -> Callable[[_T1], Callable[[_T2], _TResult]]:
650
+ f2 = _curried.get(f)
651
+ if f2 is None:
652
+ return lambda a1: lambda a2: f(a1, a2)
653
+ else:
654
+ return f2
655
+
656
+
657
+ def uncurry3(f: Callable[[_T1], Callable[[_T2], Callable[[_T3], _TResult]]]) -> Callable[[_T1, _T2, _T3], _TResult]:
658
+ def f2(a1: _T1, a2: _T2, a3: _T3) -> _TResult:
659
+ return f(a1)(a2)(a3)
660
+
661
+ _curried[f2] = f
662
+ return f2
663
+
664
+
665
+ def curry3(f: Callable[[_T1, _T2, _T3], _TResult]) -> Callable[[_T1], Callable[[_T2], Callable[[_T3], _TResult]]]:
666
+ f2 = _curried.get(f)
667
+ if f2 is None:
668
+ return lambda a1: lambda a2: lambda a3: f(a1, a2, a3)
669
+ else:
670
+ return f2
671
+
672
+
673
+ def uncurry4(
674
+ f: Callable[[_T1], Callable[[_T2], Callable[[_T3], Callable[[_T4], _TResult]]]],
675
+ ) -> Callable[[_T1, _T2, _T3, _T4], _TResult]:
676
+ def f2(a1: _T1, a2: _T2, a3: _T3, a4: _T4) -> _TResult:
677
+ return f(a1)(a2)(a3)(a4)
678
+
679
+ _curried[f2] = f
680
+ return f2
681
+
682
+
683
+ def curry4(
684
+ f: Callable[[_T1, _T2, _T3, _T4], _TResult],
685
+ ) -> Callable[[_T1], Callable[[_T2], Callable[[_T3], Callable[[_T4], _TResult]]]]:
686
+ f2 = _curried.get(f)
687
+ if f2 is None:
688
+ return lambda a1: lambda a2: lambda a3: lambda a4: f(a1, a2, a3, a4)
689
+ else:
690
+ return f2
691
+
692
+
693
+ def uncurry5(
694
+ f: Callable[
695
+ [_T1],
696
+ Callable[[_T2], Callable[[_T3], Callable[[_T4], Callable[[_T5], _TResult]]]],
697
+ ],
698
+ ) -> Callable[[_T1, _T2, _T3, _T4, _T5], _TResult]:
699
+ def f2(a1: _T1, a2: _T2, a3: _T3, a4: _T4, a5: _T5) -> _TResult:
700
+ return f(a1)(a2)(a3)(a4)(a5)
701
+
702
+ _curried[f2] = f
703
+ return f2
704
+
705
+
706
+ def curry5(
707
+ f: Callable[[_T1, _T2, _T3, _T4, _T5], _TResult],
708
+ ) -> Callable[[_T1], Callable[[_T2], Callable[[_T3], Callable[[_T4], Callable[[_T5], _TResult]]]]]:
709
+ f2 = _curried.get(f)
710
+ if f2 is None:
711
+ return lambda a1: lambda a2: lambda a3: lambda a4: lambda a5: f(a1, a2, a3, a4, a5)
712
+ else:
713
+ return f2
714
+
715
+
716
+ def uncurry6(
717
+ f: Callable[
718
+ [_T1],
719
+ Callable[
720
+ [_T2],
721
+ Callable[[_T3], Callable[[_T4], Callable[[_T5], Callable[[_T6], _TResult]]]],
722
+ ],
723
+ ],
724
+ ) -> Callable[[_T1, _T2, _T3, _T4, _T5, _T6], _TResult]:
725
+ def f2(a1: _T1, a2: _T2, a3: _T3, a4: _T4, a5: _T5, a6: _T6) -> _TResult:
726
+ return f(a1)(a2)(a3)(a4)(a5)(a6)
727
+
728
+ _curried[f2] = f
729
+ return f2
730
+
731
+
732
+ def curry6(
733
+ f: Callable[[_T1, _T2, _T3, _T4, _T5, _T6], _TResult],
734
+ ) -> Callable[
735
+ [_T1],
736
+ Callable[
737
+ [_T2],
738
+ Callable[[_T3], Callable[[_T4], Callable[[_T5], Callable[[_T6], _TResult]]]],
739
+ ],
740
+ ]:
741
+ f2 = _curried.get(f)
742
+ if f2 is None:
743
+ return lambda a1: lambda a2: lambda a3: lambda a4: lambda a5: lambda a6: f(a1, a2, a3, a4, a5, a6)
744
+ else:
745
+ return f2
746
+
747
+
748
+ def uncurry7(
749
+ f: Callable[
750
+ [_T1],
751
+ Callable[
752
+ [_T2],
753
+ Callable[
754
+ [_T3],
755
+ Callable[[_T4], Callable[[_T5], Callable[[_T6], Callable[[_T7], _TResult]]]],
756
+ ],
757
+ ],
758
+ ],
759
+ ) -> Callable[[_T1, _T2, _T3, _T4, _T5, _T6, _T7], _TResult]:
760
+ def f2(a1: _T1, a2: _T2, a3: _T3, a4: _T4, a5: _T5, a6: _T6, a7: _T7) -> _TResult:
761
+ return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)
762
+
763
+ _curried[f2] = f
764
+ return f2
765
+
766
+
767
+ def curry7(
768
+ f: Callable[[_T1, _T2, _T3, _T4, _T5, _T6, _T7], _TResult],
769
+ ) -> Callable[
770
+ [_T1],
771
+ Callable[
772
+ [_T2],
773
+ Callable[
774
+ [_T3],
775
+ Callable[[_T4], Callable[[_T5], Callable[[_T6], Callable[[_T7], _TResult]]]],
776
+ ],
777
+ ],
778
+ ]:
779
+ f2 = _curried.get(f)
780
+ if f2 is None:
781
+ return lambda a1: lambda a2: lambda a3: lambda a4: lambda a5: lambda a6: lambda a7: f(
782
+ a1, a2, a3, a4, a5, a6, a7
783
+ )
784
+ else:
785
+ return f2
786
+
787
+
788
+ def uncurry8(
789
+ f: Callable[
790
+ [_T1],
791
+ Callable[
792
+ [_T2],
793
+ Callable[
794
+ [_T3],
795
+ Callable[
796
+ [_T4],
797
+ Callable[
798
+ [_T5],
799
+ Callable[[_T6], Callable[[_T7], Callable[[_T8], _TResult]]],
800
+ ],
801
+ ],
802
+ ],
803
+ ],
804
+ ],
805
+ ) -> Callable[[_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8], _TResult]:
806
+ def f2(a1: _T1, a2: _T2, a3: _T3, a4: _T4, a5: _T5, a6: _T6, a7: _T7, a8: _T8) -> _TResult:
807
+ return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)
808
+
809
+ _curried[f2] = f
810
+ return f2
811
+
812
+
813
+ def curry8(
814
+ f: Callable[[_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8], _TResult],
815
+ ) -> Callable[
816
+ [_T1],
817
+ Callable[
818
+ [_T2],
819
+ Callable[
820
+ [_T3],
821
+ Callable[
822
+ [_T4],
823
+ Callable[[_T5], Callable[[_T6], Callable[[_T7], Callable[[_T8], _TResult]]]],
824
+ ],
825
+ ],
826
+ ],
827
+ ]:
828
+ f2 = _curried.get(f)
829
+ if f2 is None:
830
+ return lambda a1: lambda a2: lambda a3: lambda a4: lambda a5: lambda a6: lambda a7: lambda a8: f(
831
+ a1, a2, a3, a4, a5, a6, a7, a8
832
+ )
833
+ else:
834
+ return f2
835
+
836
+
837
+ def uncurry9(
838
+ f: Callable[
839
+ [_T1],
840
+ Callable[
841
+ [_T2],
842
+ Callable[
843
+ [_T3],
844
+ Callable[
845
+ [_T4],
846
+ Callable[
847
+ [_T5],
848
+ Callable[
849
+ [_T6],
850
+ Callable[[_T7], Callable[[_T8], Callable[[_T9], _TResult]]],
851
+ ],
852
+ ],
853
+ ],
854
+ ],
855
+ ],
856
+ ],
857
+ ) -> Callable[[_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9], _TResult]:
858
+ def f2(a1: _T1, a2: _T2, a3: _T3, a4: _T4, a5: _T5, a6: _T6, a7: _T7, a8: _T8, a9: _T9) -> _TResult:
859
+ return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)
860
+
861
+ _curried[f2] = f
862
+ return f2
863
+
864
+
865
+ def curry9(
866
+ f: Callable[[_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9], _TResult],
867
+ ) -> Callable[
868
+ [_T1],
869
+ Callable[
870
+ [_T2],
871
+ Callable[
872
+ [_T3],
873
+ Callable[
874
+ [_T4],
875
+ Callable[
876
+ [_T5],
877
+ Callable[
878
+ [_T6],
879
+ Callable[[_T7], Callable[[_T8], Callable[[_T9], _TResult]]],
880
+ ],
881
+ ],
882
+ ],
883
+ ],
884
+ ],
885
+ ]:
886
+ f2 = _curried.get(f)
887
+ if f2 is None:
888
+ return lambda a1: lambda a2: lambda a3: lambda a4: lambda a5: lambda a6: lambda a7: lambda a8: lambda a9: f(
889
+ a1, a2, a3, a4, a5, a6, a7, a8, a9
890
+ )
891
+ else:
892
+ return f2
893
+
894
+
895
+ def uncurry10(
896
+ f: Callable[
897
+ [_T1],
898
+ Callable[
899
+ [_T2],
900
+ Callable[
901
+ [_T3],
902
+ Callable[
903
+ [_T4],
904
+ Callable[
905
+ [_T5],
906
+ Callable[
907
+ [_T6],
908
+ Callable[
909
+ [_T7],
910
+ Callable[[_T8], Callable[[_T9], Callable[[_T10], _TResult]]],
911
+ ],
912
+ ],
913
+ ],
914
+ ],
915
+ ],
916
+ ],
917
+ ],
918
+ ) -> Callable[[_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10], _TResult]:
919
+ def f2(
920
+ a1: _T1,
921
+ a2: _T2,
922
+ a3: _T3,
923
+ a4: _T4,
924
+ a5: _T5,
925
+ a6: _T6,
926
+ a7: _T7,
927
+ a8: _T8,
928
+ a9: _T9,
929
+ a10: _T10,
930
+ ) -> _TResult:
931
+ return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)(a10)
932
+
933
+ _curried[f2] = f
934
+ return f2
935
+
936
+
937
+ def curry10(
938
+ f: Callable[[_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10], _TResult],
939
+ ) -> Callable[
940
+ [_T1],
941
+ Callable[
942
+ [_T2],
943
+ Callable[
944
+ [_T3],
945
+ Callable[
946
+ [_T4],
947
+ Callable[
948
+ [_T5],
949
+ Callable[
950
+ [_T6],
951
+ Callable[
952
+ [_T7],
953
+ Callable[[_T8], Callable[[_T9], Callable[[_T10], _TResult]]],
954
+ ],
955
+ ],
956
+ ],
957
+ ],
958
+ ],
959
+ ],
960
+ ]:
961
+ f2 = _curried.get(f)
962
+ if f2 is None:
963
+ return (
964
+ lambda a1: lambda a2: lambda a3: lambda a4: lambda a5: lambda a6: lambda a7: lambda a8: lambda a9: lambda a10: f(
965
+ a1, a2, a3, a4, a5, a6, a7, a8, a9, a10
966
+ )
967
+ )
968
+ else:
969
+ return f2
970
+
971
+
972
+ def uncurry11(
973
+ f: Callable[
974
+ [_T1],
975
+ Callable[
976
+ [_T2],
977
+ Callable[
978
+ [_T3],
979
+ Callable[
980
+ [_T4],
981
+ Callable[
982
+ [_T5],
983
+ Callable[
984
+ [_T6],
985
+ Callable[
986
+ [_T7],
987
+ Callable[
988
+ [_T8],
989
+ Callable[
990
+ [_T9],
991
+ Callable[[_T10], Callable[[_T11], _TResult]],
992
+ ],
993
+ ],
994
+ ],
995
+ ],
996
+ ],
997
+ ],
998
+ ],
999
+ ],
1000
+ ],
1001
+ ) -> Callable[[_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11], _TResult]:
1002
+ def f2(
1003
+ a1: Any,
1004
+ a2: Any,
1005
+ a3: Any,
1006
+ a4: Any,
1007
+ a5: Any,
1008
+ a6: Any,
1009
+ a7: Any,
1010
+ a8: Any,
1011
+ a9: Any,
1012
+ a10: Any,
1013
+ a11: Any,
1014
+ ) -> Any:
1015
+ return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)(a10)(a11)
1016
+
1017
+ _curried[f2] = f
1018
+ return f2
1019
+
1020
+
1021
+ def curry11(
1022
+ f: Callable[[_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11], _TResult],
1023
+ ) -> Callable[
1024
+ [_T1],
1025
+ Callable[
1026
+ [_T2],
1027
+ Callable[
1028
+ [_T3],
1029
+ Callable[
1030
+ [_T4],
1031
+ Callable[
1032
+ [_T5],
1033
+ Callable[
1034
+ [_T6],
1035
+ Callable[
1036
+ [_T7],
1037
+ Callable[
1038
+ [_T8],
1039
+ Callable[[_T9], Callable[[_T10], Callable[[_T11], _TResult]]],
1040
+ ],
1041
+ ],
1042
+ ],
1043
+ ],
1044
+ ],
1045
+ ],
1046
+ ],
1047
+ ]:
1048
+ f2 = _curried.get(f)
1049
+ if f2 is None:
1050
+ return (
1051
+ lambda a1: lambda a2: lambda a3: lambda a4: lambda a5: lambda a6: lambda a7: lambda a8: lambda a9: lambda a10: lambda a11: f(
1052
+ a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11
1053
+ )
1054
+ )
1055
+ else:
1056
+ return f2
1057
+
1058
+
1059
+ def uncurry12(
1060
+ f: Callable[
1061
+ [_T1],
1062
+ Callable[
1063
+ [_T2],
1064
+ Callable[
1065
+ [_T3],
1066
+ Callable[
1067
+ [_T4],
1068
+ Callable[
1069
+ [_T5],
1070
+ Callable[
1071
+ [_T6],
1072
+ Callable[
1073
+ [_T7],
1074
+ Callable[
1075
+ [_T8],
1076
+ Callable[
1077
+ [_T9],
1078
+ Callable[
1079
+ [_T10],
1080
+ Callable[[_T11], Callable[[_T12], _TResult]],
1081
+ ],
1082
+ ],
1083
+ ],
1084
+ ],
1085
+ ],
1086
+ ],
1087
+ ],
1088
+ ],
1089
+ ],
1090
+ ],
1091
+ ) -> Callable[[_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12], _TResult]:
1092
+ def f2(
1093
+ a1: Any,
1094
+ a2: Any,
1095
+ a3: Any,
1096
+ a4: Any,
1097
+ a5: Any,
1098
+ a6: Any,
1099
+ a7: Any,
1100
+ a8: Any,
1101
+ a9: Any,
1102
+ a10: Any,
1103
+ a11: Any,
1104
+ a12: Any,
1105
+ ) -> Any:
1106
+ return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)(a10)(a11)(a12)
1107
+
1108
+ _curried[f2] = f
1109
+ return f2
1110
+
1111
+
1112
+ def curry12(
1113
+ f: Callable[[_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12], _TResult],
1114
+ ) -> Callable[
1115
+ [_T1],
1116
+ Callable[
1117
+ [_T2],
1118
+ Callable[
1119
+ [_T3],
1120
+ Callable[
1121
+ [_T4],
1122
+ Callable[
1123
+ [_T5],
1124
+ Callable[
1125
+ [_T6],
1126
+ Callable[
1127
+ [_T7],
1128
+ Callable[
1129
+ [_T8],
1130
+ Callable[
1131
+ [_T9],
1132
+ Callable[
1133
+ [_T10],
1134
+ Callable[[_T11], Callable[[_T12], _TResult]],
1135
+ ],
1136
+ ],
1137
+ ],
1138
+ ],
1139
+ ],
1140
+ ],
1141
+ ],
1142
+ ],
1143
+ ],
1144
+ ]:
1145
+ f2 = _curried.get(f)
1146
+ if f2 is None:
1147
+ return (
1148
+ lambda a1: lambda a2: lambda a3: lambda a4: lambda a5: lambda a6: lambda a7: lambda a8: lambda a9: lambda a10: lambda a11: lambda a12: f(
1149
+ a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12
1150
+ )
1151
+ )
1152
+ else:
1153
+ return f2
1154
+
1155
+
1156
+ def uncurry13(
1157
+ f: Callable[
1158
+ [_T1],
1159
+ Callable[
1160
+ [_T2],
1161
+ Callable[
1162
+ [_T3],
1163
+ Callable[
1164
+ [_T4],
1165
+ Callable[
1166
+ [_T5],
1167
+ Callable[
1168
+ [_T6],
1169
+ Callable[
1170
+ [_T7],
1171
+ Callable[
1172
+ [_T8],
1173
+ Callable[
1174
+ [_T9],
1175
+ Callable[
1176
+ [_T10],
1177
+ Callable[
1178
+ [_T11],
1179
+ Callable[[_T12], Callable[[_T13], _TResult]],
1180
+ ],
1181
+ ],
1182
+ ],
1183
+ ],
1184
+ ],
1185
+ ],
1186
+ ],
1187
+ ],
1188
+ ],
1189
+ ],
1190
+ ],
1191
+ ) -> Callable[[_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13], _TResult]:
1192
+ def f2(
1193
+ a1: Any,
1194
+ a2: Any,
1195
+ a3: Any,
1196
+ a4: Any,
1197
+ a5: Any,
1198
+ a6: Any,
1199
+ a7: Any,
1200
+ a8: Any,
1201
+ a9: Any,
1202
+ a10: Any,
1203
+ a11: Any,
1204
+ a12: Any,
1205
+ a13: Any,
1206
+ ) -> Any:
1207
+ return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)(a10)(a11)(a12)(a13)
1208
+
1209
+ _curried[f2] = f
1210
+ return f2
1211
+
1212
+
1213
+ def curry13(
1214
+ f: Callable[[_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13], _TResult],
1215
+ ) -> Callable[
1216
+ [_T1],
1217
+ Callable[
1218
+ [_T2],
1219
+ Callable[
1220
+ [_T3],
1221
+ Callable[
1222
+ [_T4],
1223
+ Callable[
1224
+ [_T5],
1225
+ Callable[
1226
+ [_T6],
1227
+ Callable[
1228
+ [_T7],
1229
+ Callable[
1230
+ [_T8],
1231
+ Callable[
1232
+ [_T9],
1233
+ Callable[
1234
+ [_T10],
1235
+ Callable[
1236
+ [_T11],
1237
+ Callable[[_T12], Callable[[_T13], _TResult]],
1238
+ ],
1239
+ ],
1240
+ ],
1241
+ ],
1242
+ ],
1243
+ ],
1244
+ ],
1245
+ ],
1246
+ ],
1247
+ ],
1248
+ ]:
1249
+ f2 = _curried.get(f)
1250
+ if f2 is None:
1251
+ return (
1252
+ lambda a1: lambda a2: lambda a3: lambda a4: lambda a5: lambda a6: lambda a7: lambda a8: lambda a9: lambda a10: lambda a11: lambda a12: lambda a13: f(
1253
+ a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13
1254
+ )
1255
+ )
1256
+ else:
1257
+ return f2
1258
+
1259
+
1260
+ def uncurry14(
1261
+ f: Callable[
1262
+ [_T1],
1263
+ Callable[
1264
+ [_T2],
1265
+ Callable[
1266
+ [_T3],
1267
+ Callable[
1268
+ [_T4],
1269
+ Callable[
1270
+ [_T5],
1271
+ Callable[
1272
+ [_T6],
1273
+ Callable[
1274
+ [_T7],
1275
+ Callable[
1276
+ [_T8],
1277
+ Callable[
1278
+ [_T9],
1279
+ Callable[
1280
+ [_T10],
1281
+ Callable[
1282
+ [_T11],
1283
+ Callable[
1284
+ [_T12],
1285
+ Callable[
1286
+ [_T13],
1287
+ Callable[[_T14], _TResult],
1288
+ ],
1289
+ ],
1290
+ ],
1291
+ ],
1292
+ ],
1293
+ ],
1294
+ ],
1295
+ ],
1296
+ ],
1297
+ ],
1298
+ ],
1299
+ ],
1300
+ ],
1301
+ ) -> Callable[
1302
+ [
1303
+ _T1,
1304
+ _T2,
1305
+ _T3,
1306
+ _T4,
1307
+ _T5,
1308
+ _T6,
1309
+ _T7,
1310
+ _T8,
1311
+ _T9,
1312
+ _T10,
1313
+ _T11,
1314
+ _T12,
1315
+ _T13,
1316
+ _T14,
1317
+ ],
1318
+ _TResult,
1319
+ ]:
1320
+ def f2(
1321
+ a1: Any,
1322
+ a2: Any,
1323
+ a3: Any,
1324
+ a4: Any,
1325
+ a5: Any,
1326
+ a6: Any,
1327
+ a7: Any,
1328
+ a8: Any,
1329
+ a9: Any,
1330
+ a10: Any,
1331
+ a11: Any,
1332
+ a12: Any,
1333
+ a13: Any,
1334
+ a14: Any,
1335
+ ) -> Any:
1336
+ return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)(a10)(a11)(a12)(a13)(a14)
1337
+
1338
+ _curried[f2] = f
1339
+ return f2
1340
+
1341
+
1342
+ def curry14(
1343
+ f: Callable[
1344
+ [_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13, _T14],
1345
+ _TResult,
1346
+ ],
1347
+ ) -> Callable[
1348
+ [_T1],
1349
+ Callable[
1350
+ [_T2],
1351
+ Callable[
1352
+ [_T3],
1353
+ Callable[
1354
+ [_T4],
1355
+ Callable[
1356
+ [_T5],
1357
+ Callable[
1358
+ [_T6],
1359
+ Callable[
1360
+ [_T7],
1361
+ Callable[
1362
+ [_T8],
1363
+ Callable[
1364
+ [_T9],
1365
+ Callable[
1366
+ [_T10],
1367
+ Callable[
1368
+ [_T11],
1369
+ Callable[
1370
+ [_T12],
1371
+ Callable[[_T13], Callable[[_T14], _TResult]],
1372
+ ],
1373
+ ],
1374
+ ],
1375
+ ],
1376
+ ],
1377
+ ],
1378
+ ],
1379
+ ],
1380
+ ],
1381
+ ],
1382
+ ],
1383
+ ]:
1384
+ f2 = _curried.get(f)
1385
+ if f2 is None:
1386
+ return (
1387
+ lambda a1: lambda a2: lambda a3: lambda a4: lambda a5: lambda a6: lambda a7: lambda a8: lambda a9: lambda a10: lambda a11: lambda a12: lambda a13: lambda a14: f(
1388
+ a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14
1389
+ )
1390
+ )
1391
+ else:
1392
+ return f2
1393
+
1394
+
1395
+ def uncurry15(
1396
+ f: Callable[
1397
+ [_T1],
1398
+ Callable[
1399
+ [_T2],
1400
+ Callable[
1401
+ [_T3],
1402
+ Callable[
1403
+ [_T4],
1404
+ Callable[
1405
+ [_T5],
1406
+ Callable[
1407
+ [_T6],
1408
+ Callable[
1409
+ [_T7],
1410
+ Callable[
1411
+ [_T8],
1412
+ Callable[
1413
+ [_T9],
1414
+ Callable[
1415
+ [_T10],
1416
+ Callable[
1417
+ [_T11],
1418
+ Callable[
1419
+ [_T12],
1420
+ Callable[
1421
+ [_T13],
1422
+ Callable[
1423
+ [_T14],
1424
+ Callable[[_T15], _TResult],
1425
+ ],
1426
+ ],
1427
+ ],
1428
+ ],
1429
+ ],
1430
+ ],
1431
+ ],
1432
+ ],
1433
+ ],
1434
+ ],
1435
+ ],
1436
+ ],
1437
+ ],
1438
+ ],
1439
+ ) -> Callable[
1440
+ [_T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13, _T14, _T15],
1441
+ _TResult,
1442
+ ]:
1443
+ def f2(
1444
+ a1: Any,
1445
+ a2: Any,
1446
+ a3: Any,
1447
+ a4: Any,
1448
+ a5: Any,
1449
+ a6: Any,
1450
+ a7: Any,
1451
+ a8: Any,
1452
+ a9: Any,
1453
+ a10: Any,
1454
+ a11: Any,
1455
+ a12: Any,
1456
+ a13: Any,
1457
+ a14: Any,
1458
+ a15: Any,
1459
+ ) -> Any:
1460
+ return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)(a10)(a11)(a12)(a13)(a14)(a15)
1461
+
1462
+ _curried[f2] = f
1463
+ return f2
1464
+
1465
+
1466
+ def curry15(
1467
+ f: Callable[
1468
+ [
1469
+ _T1,
1470
+ _T2,
1471
+ _T3,
1472
+ _T4,
1473
+ _T5,
1474
+ _T6,
1475
+ _T7,
1476
+ _T8,
1477
+ _T9,
1478
+ _T10,
1479
+ _T11,
1480
+ _T12,
1481
+ _T13,
1482
+ _T14,
1483
+ _T15,
1484
+ ],
1485
+ _TResult,
1486
+ ],
1487
+ ) -> Callable[
1488
+ [_T1],
1489
+ Callable[
1490
+ [_T2],
1491
+ Callable[
1492
+ [_T3],
1493
+ Callable[
1494
+ [_T4],
1495
+ Callable[
1496
+ [_T5],
1497
+ Callable[
1498
+ [_T6],
1499
+ Callable[
1500
+ [_T7],
1501
+ Callable[
1502
+ [_T8],
1503
+ Callable[
1504
+ [_T9],
1505
+ Callable[
1506
+ [_T10],
1507
+ Callable[
1508
+ [_T11],
1509
+ Callable[
1510
+ [_T12],
1511
+ Callable[
1512
+ [_T13],
1513
+ Callable[
1514
+ [_T14],
1515
+ Callable[[_T15], _TResult],
1516
+ ],
1517
+ ],
1518
+ ],
1519
+ ],
1520
+ ],
1521
+ ],
1522
+ ],
1523
+ ],
1524
+ ],
1525
+ ],
1526
+ ],
1527
+ ],
1528
+ ],
1529
+ ]:
1530
+ f2 = _curried.get(f)
1531
+ if f2 is None:
1532
+ return (
1533
+ lambda a1: lambda a2: lambda a3: lambda a4: lambda a5: lambda a6: lambda a7: lambda a8: lambda a9: lambda a10: lambda a11: lambda a12: lambda a13: lambda a14: lambda a15: f(
1534
+ a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15
1535
+ )
1536
+ )
1537
+ else:
1538
+ return f2
1539
+
1540
+
1541
+ def uncurry16(
1542
+ f: Callable[
1543
+ [_T1],
1544
+ Callable[
1545
+ [_T2],
1546
+ Callable[
1547
+ [_T3],
1548
+ Callable[
1549
+ [_T4],
1550
+ Callable[
1551
+ [_T5],
1552
+ Callable[
1553
+ [_T6],
1554
+ Callable[
1555
+ [_T7],
1556
+ Callable[
1557
+ [_T8],
1558
+ Callable[
1559
+ [_T9],
1560
+ Callable[
1561
+ [_T10],
1562
+ Callable[
1563
+ [_T11],
1564
+ Callable[
1565
+ [_T12],
1566
+ Callable[
1567
+ [_T13],
1568
+ Callable[
1569
+ [_T14],
1570
+ Callable[
1571
+ [_T15],
1572
+ Callable[[_T16], _TResult],
1573
+ ],
1574
+ ],
1575
+ ],
1576
+ ],
1577
+ ],
1578
+ ],
1579
+ ],
1580
+ ],
1581
+ ],
1582
+ ],
1583
+ ],
1584
+ ],
1585
+ ],
1586
+ ],
1587
+ ],
1588
+ ) -> Callable[
1589
+ [
1590
+ _T1,
1591
+ _T2,
1592
+ _T3,
1593
+ _T4,
1594
+ _T5,
1595
+ _T6,
1596
+ _T7,
1597
+ _T8,
1598
+ _T9,
1599
+ _T10,
1600
+ _T11,
1601
+ _T12,
1602
+ _T13,
1603
+ _T14,
1604
+ _T15,
1605
+ _T16,
1606
+ ],
1607
+ _TResult,
1608
+ ]:
1609
+ def f2(
1610
+ a1: Any,
1611
+ a2: Any,
1612
+ a3: Any,
1613
+ a4: Any,
1614
+ a5: Any,
1615
+ a6: Any,
1616
+ a7: Any,
1617
+ a8: Any,
1618
+ a9: Any,
1619
+ a10: Any,
1620
+ a11: Any,
1621
+ a12: Any,
1622
+ a13: Any,
1623
+ a14: Any,
1624
+ a15: Any,
1625
+ a16: Any,
1626
+ ) -> Any:
1627
+ return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)(a10)(a11)(a12)(a13)(a14)(a15)(a16)
1628
+
1629
+ _curried[f2] = f
1630
+ return f2
1631
+
1632
+
1633
+ def curry16(
1634
+ f: Callable[
1635
+ [
1636
+ _T1,
1637
+ _T2,
1638
+ _T3,
1639
+ _T4,
1640
+ _T5,
1641
+ _T6,
1642
+ _T7,
1643
+ _T8,
1644
+ _T9,
1645
+ _T10,
1646
+ _T11,
1647
+ _T12,
1648
+ _T13,
1649
+ _T14,
1650
+ _T15,
1651
+ _T16,
1652
+ ],
1653
+ _TResult,
1654
+ ],
1655
+ ) -> Callable[
1656
+ [_T1],
1657
+ Callable[
1658
+ [_T2],
1659
+ Callable[
1660
+ [_T3],
1661
+ Callable[
1662
+ [_T4],
1663
+ Callable[
1664
+ [_T5],
1665
+ Callable[
1666
+ [_T6],
1667
+ Callable[
1668
+ [_T7],
1669
+ Callable[
1670
+ [_T8],
1671
+ Callable[
1672
+ [_T9],
1673
+ Callable[
1674
+ [_T10],
1675
+ Callable[
1676
+ [_T11],
1677
+ Callable[
1678
+ [_T12],
1679
+ Callable[
1680
+ [_T13],
1681
+ Callable[
1682
+ [_T14],
1683
+ Callable[
1684
+ [_T15],
1685
+ Callable[[_T16], _TResult],
1686
+ ],
1687
+ ],
1688
+ ],
1689
+ ],
1690
+ ],
1691
+ ],
1692
+ ],
1693
+ ],
1694
+ ],
1695
+ ],
1696
+ ],
1697
+ ],
1698
+ ],
1699
+ ],
1700
+ ]:
1701
+ f2 = _curried.get(f)
1702
+ if f2 is None:
1703
+ return (
1704
+ lambda a1: lambda a2: lambda a3: lambda a4: lambda a5: lambda a6: lambda a7: lambda a8: lambda a9: lambda a10: lambda a11: lambda a12: lambda a13: lambda a14: lambda a15: lambda a16: f(
1705
+ a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16
1706
+ )
1707
+ )
1708
+ else:
1709
+ return f2
1710
+
1711
+
1712
+ def uncurry17(
1713
+ f: Callable[
1714
+ [_T1],
1715
+ Callable[
1716
+ [_T2],
1717
+ Callable[
1718
+ [_T3],
1719
+ Callable[
1720
+ [_T4],
1721
+ Callable[
1722
+ [_T5],
1723
+ Callable[
1724
+ [_T6],
1725
+ Callable[
1726
+ [_T7],
1727
+ Callable[
1728
+ [_T8],
1729
+ Callable[
1730
+ [_T9],
1731
+ Callable[
1732
+ [_T10],
1733
+ Callable[
1734
+ [_T11],
1735
+ Callable[
1736
+ [_T12],
1737
+ Callable[
1738
+ [_T13],
1739
+ Callable[
1740
+ [_T14],
1741
+ Callable[
1742
+ [_T15],
1743
+ Callable[
1744
+ [_T16],
1745
+ Callable[[_T17], _TResult],
1746
+ ],
1747
+ ],
1748
+ ],
1749
+ ],
1750
+ ],
1751
+ ],
1752
+ ],
1753
+ ],
1754
+ ],
1755
+ ],
1756
+ ],
1757
+ ],
1758
+ ],
1759
+ ],
1760
+ ],
1761
+ ],
1762
+ ) -> Callable[
1763
+ [
1764
+ _T1,
1765
+ _T2,
1766
+ _T3,
1767
+ _T4,
1768
+ _T5,
1769
+ _T6,
1770
+ _T7,
1771
+ _T8,
1772
+ _T9,
1773
+ _T10,
1774
+ _T11,
1775
+ _T12,
1776
+ _T13,
1777
+ _T14,
1778
+ _T15,
1779
+ _T16,
1780
+ _T17,
1781
+ ],
1782
+ _TResult,
1783
+ ]:
1784
+ def f2(
1785
+ a1: Any,
1786
+ a2: Any,
1787
+ a3: Any,
1788
+ a4: Any,
1789
+ a5: Any,
1790
+ a6: Any,
1791
+ a7: Any,
1792
+ a8: Any,
1793
+ a9: Any,
1794
+ a10: Any,
1795
+ a11: Any,
1796
+ a12: Any,
1797
+ a13: Any,
1798
+ a14: Any,
1799
+ a15: Any,
1800
+ a16: Any,
1801
+ a17: Any,
1802
+ ) -> Any:
1803
+ return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)(a10)(a11)(a12)(a13)(a14)(a15)(a16)(a17)
1804
+
1805
+ _curried[f2] = f
1806
+ return f2
1807
+
1808
+
1809
+ def curry17(
1810
+ f: Callable[
1811
+ [
1812
+ _T1,
1813
+ _T2,
1814
+ _T3,
1815
+ _T4,
1816
+ _T5,
1817
+ _T6,
1818
+ _T7,
1819
+ _T8,
1820
+ _T9,
1821
+ _T10,
1822
+ _T11,
1823
+ _T12,
1824
+ _T13,
1825
+ _T14,
1826
+ _T15,
1827
+ _T16,
1828
+ _T17,
1829
+ ],
1830
+ _TResult,
1831
+ ],
1832
+ ) -> Callable[
1833
+ [_T1],
1834
+ Callable[
1835
+ [_T2],
1836
+ Callable[
1837
+ [_T3],
1838
+ Callable[
1839
+ [_T4],
1840
+ Callable[
1841
+ [_T5],
1842
+ Callable[
1843
+ [_T6],
1844
+ Callable[
1845
+ [_T7],
1846
+ Callable[
1847
+ [_T8],
1848
+ Callable[
1849
+ [_T9],
1850
+ Callable[
1851
+ [_T10],
1852
+ Callable[
1853
+ [_T11],
1854
+ Callable[
1855
+ [_T12],
1856
+ Callable[
1857
+ [_T13],
1858
+ Callable[
1859
+ [_T14],
1860
+ Callable[
1861
+ [_T15],
1862
+ Callable[
1863
+ [_T16],
1864
+ Callable[[_T17], _TResult],
1865
+ ],
1866
+ ],
1867
+ ],
1868
+ ],
1869
+ ],
1870
+ ],
1871
+ ],
1872
+ ],
1873
+ ],
1874
+ ],
1875
+ ],
1876
+ ],
1877
+ ],
1878
+ ],
1879
+ ],
1880
+ ]:
1881
+ f2 = _curried.get(f)
1882
+ if f2 is None:
1883
+ return (
1884
+ lambda a1: lambda a2: lambda a3: lambda a4: lambda a5: lambda a6: lambda a7: lambda a8: lambda a9: lambda a10: lambda a11: lambda a12: lambda a13: lambda a14: lambda a15: lambda a16: lambda a17: f(
1885
+ a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17
1886
+ )
1887
+ )
1888
+ else:
1889
+ return f2
1890
+
1891
+
1892
+ def uncurry18(
1893
+ f: Callable[
1894
+ [_T1],
1895
+ Callable[
1896
+ [_T2],
1897
+ Callable[
1898
+ [_T3],
1899
+ Callable[
1900
+ [_T4],
1901
+ Callable[
1902
+ [_T5],
1903
+ Callable[
1904
+ [_T6],
1905
+ Callable[
1906
+ [_T7],
1907
+ Callable[
1908
+ [_T8],
1909
+ Callable[
1910
+ [_T9],
1911
+ Callable[
1912
+ [_T10],
1913
+ Callable[
1914
+ [_T11],
1915
+ Callable[
1916
+ [_T12],
1917
+ Callable[
1918
+ [_T13],
1919
+ Callable[
1920
+ [_T14],
1921
+ Callable[
1922
+ [_T15],
1923
+ Callable[
1924
+ [_T16],
1925
+ Callable[
1926
+ [_T17],
1927
+ Callable[
1928
+ [_T18],
1929
+ _TResult,
1930
+ ],
1931
+ ],
1932
+ ],
1933
+ ],
1934
+ ],
1935
+ ],
1936
+ ],
1937
+ ],
1938
+ ],
1939
+ ],
1940
+ ],
1941
+ ],
1942
+ ],
1943
+ ],
1944
+ ],
1945
+ ],
1946
+ ],
1947
+ ],
1948
+ ) -> Callable[
1949
+ [
1950
+ _T1,
1951
+ _T2,
1952
+ _T3,
1953
+ _T4,
1954
+ _T5,
1955
+ _T6,
1956
+ _T7,
1957
+ _T8,
1958
+ _T9,
1959
+ _T10,
1960
+ _T11,
1961
+ _T12,
1962
+ _T13,
1963
+ _T14,
1964
+ _T15,
1965
+ _T16,
1966
+ _T17,
1967
+ _T18,
1968
+ ],
1969
+ _TResult,
1970
+ ]:
1971
+ def f2(
1972
+ a1: Any,
1973
+ a2: Any,
1974
+ a3: Any,
1975
+ a4: Any,
1976
+ a5: Any,
1977
+ a6: Any,
1978
+ a7: Any,
1979
+ a8: Any,
1980
+ a9: Any,
1981
+ a10: Any,
1982
+ a11: Any,
1983
+ a12: Any,
1984
+ a13: Any,
1985
+ a14: Any,
1986
+ a15: Any,
1987
+ a16: Any,
1988
+ a17: Any,
1989
+ a18: Any,
1990
+ ) -> Any:
1991
+ return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)(a10)(a11)(a12)(a13)(a14)(a15)(a16)(a17)(a18)
1992
+
1993
+ _curried[f2] = f
1994
+ return f2
1995
+
1996
+
1997
+ def curry18(
1998
+ f: Callable[
1999
+ [
2000
+ _T1,
2001
+ _T2,
2002
+ _T3,
2003
+ _T4,
2004
+ _T5,
2005
+ _T6,
2006
+ _T7,
2007
+ _T8,
2008
+ _T9,
2009
+ _T10,
2010
+ _T11,
2011
+ _T12,
2012
+ _T13,
2013
+ _T14,
2014
+ _T15,
2015
+ _T16,
2016
+ _T17,
2017
+ _T18,
2018
+ ],
2019
+ _TResult,
2020
+ ],
2021
+ ) -> Callable[
2022
+ [_T1],
2023
+ Callable[
2024
+ [_T2],
2025
+ Callable[
2026
+ [_T3],
2027
+ Callable[
2028
+ [_T4],
2029
+ Callable[
2030
+ [_T5],
2031
+ Callable[
2032
+ [_T6],
2033
+ Callable[
2034
+ [_T7],
2035
+ Callable[
2036
+ [_T8],
2037
+ Callable[
2038
+ [_T9],
2039
+ Callable[
2040
+ [_T10],
2041
+ Callable[
2042
+ [_T11],
2043
+ Callable[
2044
+ [_T12],
2045
+ Callable[
2046
+ [_T13],
2047
+ Callable[
2048
+ [_T14],
2049
+ Callable[
2050
+ [_T15],
2051
+ Callable[
2052
+ [_T16],
2053
+ Callable[
2054
+ [_T17],
2055
+ Callable[[_T18], _TResult],
2056
+ ],
2057
+ ],
2058
+ ],
2059
+ ],
2060
+ ],
2061
+ ],
2062
+ ],
2063
+ ],
2064
+ ],
2065
+ ],
2066
+ ],
2067
+ ],
2068
+ ],
2069
+ ],
2070
+ ],
2071
+ ],
2072
+ ]:
2073
+ f2 = _curried.get(f)
2074
+ if f2 is None:
2075
+ return (
2076
+ lambda a1: lambda a2: lambda a3: lambda a4: lambda a5: lambda a6: lambda a7: lambda a8: lambda a9: lambda a10: lambda a11: lambda a12: lambda a13: lambda a14: lambda a15: lambda a16: lambda a17: lambda a18: f(
2077
+ a1,
2078
+ a2,
2079
+ a3,
2080
+ a4,
2081
+ a5,
2082
+ a6,
2083
+ a7,
2084
+ a8,
2085
+ a9,
2086
+ a10,
2087
+ a11,
2088
+ a12,
2089
+ a13,
2090
+ a14,
2091
+ a15,
2092
+ a16,
2093
+ a17,
2094
+ a18,
2095
+ )
2096
+ )
2097
+ else:
2098
+ return f2
2099
+
2100
+
2101
+ def uncurry19(
2102
+ f: Callable[
2103
+ [_T1],
2104
+ Callable[
2105
+ [_T2],
2106
+ Callable[
2107
+ [_T3],
2108
+ Callable[
2109
+ [_T4],
2110
+ Callable[
2111
+ [_T5],
2112
+ Callable[
2113
+ [_T6],
2114
+ Callable[
2115
+ [_T7],
2116
+ Callable[
2117
+ [_T8],
2118
+ Callable[
2119
+ [_T9],
2120
+ Callable[
2121
+ [_T10],
2122
+ Callable[
2123
+ [_T11],
2124
+ Callable[
2125
+ [_T12],
2126
+ Callable[
2127
+ [_T13],
2128
+ Callable[
2129
+ [_T14],
2130
+ Callable[
2131
+ [_T15],
2132
+ Callable[
2133
+ [_T16],
2134
+ Callable[
2135
+ [_T17],
2136
+ Callable[
2137
+ [_T18],
2138
+ Callable[
2139
+ [_T19],
2140
+ _TResult,
2141
+ ],
2142
+ ],
2143
+ ],
2144
+ ],
2145
+ ],
2146
+ ],
2147
+ ],
2148
+ ],
2149
+ ],
2150
+ ],
2151
+ ],
2152
+ ],
2153
+ ],
2154
+ ],
2155
+ ],
2156
+ ],
2157
+ ],
2158
+ ],
2159
+ ],
2160
+ ) -> Callable[
2161
+ [
2162
+ _T1,
2163
+ _T2,
2164
+ _T3,
2165
+ _T4,
2166
+ _T5,
2167
+ _T6,
2168
+ _T7,
2169
+ _T8,
2170
+ _T9,
2171
+ _T10,
2172
+ _T11,
2173
+ _T12,
2174
+ _T13,
2175
+ _T14,
2176
+ _T15,
2177
+ _T16,
2178
+ _T17,
2179
+ _T18,
2180
+ _T19,
2181
+ ],
2182
+ _TResult,
2183
+ ]:
2184
+ def f2(
2185
+ a1: Any,
2186
+ a2: Any,
2187
+ a3: Any,
2188
+ a4: Any,
2189
+ a5: Any,
2190
+ a6: Any,
2191
+ a7: Any,
2192
+ a8: Any,
2193
+ a9: Any,
2194
+ a10: Any,
2195
+ a11: Any,
2196
+ a12: Any,
2197
+ a13: Any,
2198
+ a14: Any,
2199
+ a15: Any,
2200
+ a16: Any,
2201
+ a17: Any,
2202
+ a18: Any,
2203
+ a19: Any,
2204
+ ) -> Any:
2205
+ return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)(a10)(a11)(a12)(a13)(a14)(a15)(a16)(a17)(a18)(a19)
2206
+
2207
+ _curried[f2] = f
2208
+ return f2
2209
+
2210
+
2211
+ def curry19(
2212
+ f: Callable[
2213
+ [
2214
+ _T1,
2215
+ _T2,
2216
+ _T3,
2217
+ _T4,
2218
+ _T5,
2219
+ _T6,
2220
+ _T7,
2221
+ _T8,
2222
+ _T9,
2223
+ _T10,
2224
+ _T11,
2225
+ _T12,
2226
+ _T13,
2227
+ _T14,
2228
+ _T15,
2229
+ _T16,
2230
+ _T17,
2231
+ _T18,
2232
+ _T19,
2233
+ ],
2234
+ _TResult,
2235
+ ],
2236
+ ) -> Callable[
2237
+ [_T1],
2238
+ Callable[
2239
+ [_T2],
2240
+ Callable[
2241
+ [_T3],
2242
+ Callable[
2243
+ [_T4],
2244
+ Callable[
2245
+ [_T5],
2246
+ Callable[
2247
+ [_T6],
2248
+ Callable[
2249
+ [_T7],
2250
+ Callable[
2251
+ [_T8],
2252
+ Callable[
2253
+ [_T9],
2254
+ Callable[
2255
+ [_T10],
2256
+ Callable[
2257
+ [_T11],
2258
+ Callable[
2259
+ [_T12],
2260
+ Callable[
2261
+ [_T13],
2262
+ Callable[
2263
+ [_T14],
2264
+ Callable[
2265
+ [_T15],
2266
+ Callable[
2267
+ [_T16],
2268
+ Callable[
2269
+ [_T17],
2270
+ Callable[
2271
+ [_T18],
2272
+ Callable[
2273
+ [_T19],
2274
+ _TResult,
2275
+ ],
2276
+ ],
2277
+ ],
2278
+ ],
2279
+ ],
2280
+ ],
2281
+ ],
2282
+ ],
2283
+ ],
2284
+ ],
2285
+ ],
2286
+ ],
2287
+ ],
2288
+ ],
2289
+ ],
2290
+ ],
2291
+ ],
2292
+ ],
2293
+ ]:
2294
+ f2 = _curried.get(f)
2295
+ if f2 is None:
2296
+ return (
2297
+ lambda a1: lambda a2: lambda a3: lambda a4: lambda a5: lambda a6: lambda a7: lambda a8: lambda a9: lambda a10: lambda a11: lambda a12: lambda a13: lambda a14: lambda a15: lambda a16: lambda a17: lambda a18: lambda a19: f(
2298
+ a1,
2299
+ a2,
2300
+ a3,
2301
+ a4,
2302
+ a5,
2303
+ a6,
2304
+ a7,
2305
+ a8,
2306
+ a9,
2307
+ a10,
2308
+ a11,
2309
+ a12,
2310
+ a13,
2311
+ a14,
2312
+ a15,
2313
+ a16,
2314
+ a17,
2315
+ a18,
2316
+ a19,
2317
+ )
2318
+ )
2319
+ else:
2320
+ return f2
2321
+
2322
+
2323
+ def uncurry20(
2324
+ f: Callable[
2325
+ [_T1],
2326
+ Callable[
2327
+ [_T2],
2328
+ Callable[
2329
+ [_T3],
2330
+ Callable[
2331
+ [_T4],
2332
+ Callable[
2333
+ [_T5],
2334
+ Callable[
2335
+ [_T6],
2336
+ Callable[
2337
+ [_T7],
2338
+ Callable[
2339
+ [_T8],
2340
+ Callable[
2341
+ [_T9],
2342
+ Callable[
2343
+ [_T10],
2344
+ Callable[
2345
+ [_T11],
2346
+ Callable[
2347
+ [_T12],
2348
+ Callable[
2349
+ [_T13],
2350
+ Callable[
2351
+ [_T14],
2352
+ Callable[
2353
+ [_T15],
2354
+ Callable[
2355
+ [_T16],
2356
+ Callable[
2357
+ [_T17],
2358
+ Callable[
2359
+ [_T18],
2360
+ Callable[
2361
+ [_T19],
2362
+ Callable[
2363
+ [_T20],
2364
+ _TResult,
2365
+ ],
2366
+ ],
2367
+ ],
2368
+ ],
2369
+ ],
2370
+ ],
2371
+ ],
2372
+ ],
2373
+ ],
2374
+ ],
2375
+ ],
2376
+ ],
2377
+ ],
2378
+ ],
2379
+ ],
2380
+ ],
2381
+ ],
2382
+ ],
2383
+ ],
2384
+ ],
2385
+ ) -> Callable[
2386
+ [
2387
+ _T1,
2388
+ _T2,
2389
+ _T3,
2390
+ _T4,
2391
+ _T5,
2392
+ _T6,
2393
+ _T7,
2394
+ _T8,
2395
+ _T9,
2396
+ _T10,
2397
+ _T11,
2398
+ _T12,
2399
+ _T13,
2400
+ _T14,
2401
+ _T15,
2402
+ _T16,
2403
+ _T17,
2404
+ _T18,
2405
+ _T19,
2406
+ _T20,
2407
+ ],
2408
+ _TResult,
2409
+ ]:
2410
+ def f2(
2411
+ a1: Any,
2412
+ a2: Any,
2413
+ a3: Any,
2414
+ a4: Any,
2415
+ a5: Any,
2416
+ a6: Any,
2417
+ a7: Any,
2418
+ a8: Any,
2419
+ a9: Any,
2420
+ a10: Any,
2421
+ a11: Any,
2422
+ a12: Any,
2423
+ a13: Any,
2424
+ a14: Any,
2425
+ a15: Any,
2426
+ a16: Any,
2427
+ a17: Any,
2428
+ a18: Any,
2429
+ a19: Any,
2430
+ a20: Any,
2431
+ ) -> Any:
2432
+ return f(a1)(a2)(a3)(a4)(a5)(a6)(a7)(a8)(a9)(a10)(a11)(a12)(a13)(a14)(a15)(a16)(a17)(a18)(a19)(a20)
2433
+
2434
+ _curried[f2] = f
2435
+ return f2
2436
+
2437
+
2438
+ def curry20(
2439
+ f: Callable[
2440
+ [
2441
+ _T1,
2442
+ _T2,
2443
+ _T3,
2444
+ _T4,
2445
+ _T5,
2446
+ _T6,
2447
+ _T7,
2448
+ _T8,
2449
+ _T9,
2450
+ _T10,
2451
+ _T11,
2452
+ _T12,
2453
+ _T13,
2454
+ _T14,
2455
+ _T15,
2456
+ _T16,
2457
+ _T17,
2458
+ _T18,
2459
+ _T19,
2460
+ _T20,
2461
+ ],
2462
+ _TResult,
2463
+ ],
2464
+ ) -> Callable[
2465
+ [_T1],
2466
+ Callable[
2467
+ [_T2],
2468
+ Callable[
2469
+ [_T3],
2470
+ Callable[
2471
+ [_T4],
2472
+ Callable[
2473
+ [_T5],
2474
+ Callable[
2475
+ [_T6],
2476
+ Callable[
2477
+ [_T7],
2478
+ Callable[
2479
+ [_T8],
2480
+ Callable[
2481
+ [_T9],
2482
+ Callable[
2483
+ [_T10],
2484
+ Callable[
2485
+ [_T11],
2486
+ Callable[
2487
+ [_T12],
2488
+ Callable[
2489
+ [_T13],
2490
+ Callable[
2491
+ [_T14],
2492
+ Callable[
2493
+ [_T15],
2494
+ Callable[
2495
+ [_T16],
2496
+ Callable[
2497
+ [_T17],
2498
+ Callable[
2499
+ [_T18],
2500
+ Callable[
2501
+ [_T19],
2502
+ Callable[
2503
+ [_T20],
2504
+ _TResult,
2505
+ ],
2506
+ ],
2507
+ ],
2508
+ ],
2509
+ ],
2510
+ ],
2511
+ ],
2512
+ ],
2513
+ ],
2514
+ ],
2515
+ ],
2516
+ ],
2517
+ ],
2518
+ ],
2519
+ ],
2520
+ ],
2521
+ ],
2522
+ ],
2523
+ ],
2524
+ ]:
2525
+ f2 = _curried.get(f)
2526
+ if f2 is None:
2527
+ return (
2528
+ lambda a1: lambda a2: lambda a3: lambda a4: lambda a5: lambda a6: lambda a7: lambda a8: lambda a9: lambda a10: lambda a11: lambda a12: lambda a13: lambda a14: lambda a15: lambda a16: lambda a17: lambda a18: lambda a19: lambda a20: f(
2529
+ a1,
2530
+ a2,
2531
+ a3,
2532
+ a4,
2533
+ a5,
2534
+ a6,
2535
+ a7,
2536
+ a8,
2537
+ a9,
2538
+ a10,
2539
+ a11,
2540
+ a12,
2541
+ a13,
2542
+ a14,
2543
+ a15,
2544
+ a16,
2545
+ a17,
2546
+ a18,
2547
+ a19,
2548
+ a20,
2549
+ )
2550
+ )
2551
+ else:
2552
+ return f2
2553
+
2554
+
2555
+ def is_array_like(x: Any) -> bool:
2556
+ return isinstance(x, list | tuple | set | array | bytes | bytearray)
2557
+
2558
+
2559
+ def is_disposable(x: Any) -> bool:
2560
+ return x is not None and isinstance(x, IDisposable)
2561
+
2562
+
2563
+ def dispose(x: Disposable | AbstractContextManager[Any]) -> None:
2564
+ """Helper to dispose objects.
2565
+
2566
+ Also tries to call `__exit__` if the object turns out to be a Python resource manager.
2567
+ For more info see: https://www.python.org/dev/peps/pep-0310/
2568
+ """
2569
+ try:
2570
+ x.Dispose() # type: ignore
2571
+ except AttributeError as ex:
2572
+ try:
2573
+ x.__exit__(None, None, None)
2574
+ except AttributeError:
2575
+ raise ex
2576
+
2577
+
2578
+ def is_hashable(x: Any) -> bool:
2579
+ return hasattr(x, "GetHashCode")
2580
+
2581
+
2582
+ def is_hashable_py(x: Any) -> bool:
2583
+ return hasattr(x, "__hash__") and callable(x.__hash__)
2584
+
2585
+
2586
+ def to_iterator(en: IEnumerator[_T]) -> IEnumerator[_T]:
2587
+ class Iterator:
2588
+ def __iter__(self):
2589
+ return self
2590
+
2591
+ def __next__(self):
2592
+ has_next = en.System_Collections_IEnumerator_MoveNext()
2593
+ if not has_next:
2594
+ raise StopIteration
2595
+ return en.System_Collections_IEnumerator_get_Current()
2596
+
2597
+ return Enumerator(Iterator())
2598
+
2599
+
2600
+ class ObjectRef:
2601
+ id_map: ClassVar = dict[int, int]()
2602
+ count: ClassVar = 0
2603
+
2604
+ @staticmethod
2605
+ def id(o: Any) -> int:
2606
+ _id = id(o)
2607
+ if _id not in ObjectRef.id_map:
2608
+ ObjectRef.count += 1
2609
+ ObjectRef.id_map[_id] = ObjectRef.count
2610
+
2611
+ return ObjectRef.id_map[_id]
2612
+
2613
+
2614
+ def safe_hash(x: Any) -> int:
2615
+ return (
2616
+ 0
2617
+ if x is None
2618
+ else hash(x)
2619
+ if is_hashable_py(x)
2620
+ else x.GetHashCode()
2621
+ if is_hashable(x)
2622
+ else number_hash(ObjectRef.id(x))
2623
+ )
2624
+
2625
+
2626
+ def string_hash(s: str) -> int:
2627
+ h = 5381
2628
+ for c in s:
2629
+ h = (h * 33) ^ ord(c)
2630
+
2631
+ return h
2632
+
2633
+
2634
+ def number_hash(x: int) -> int:
2635
+ return x * 2654435761 | 0
2636
+
2637
+
2638
+ def identity_hash(x: Any) -> int:
2639
+ if x is None:
2640
+ return 0
2641
+
2642
+ if is_hashable(x):
2643
+ return x.GetHashCode()
2644
+
2645
+ if is_hashable_py(x):
2646
+ return hash(x)
2647
+
2648
+ return physical_hash(x)
2649
+
2650
+
2651
+ def combine_hash_codes(hashes: list[int]) -> int:
2652
+ if not hashes:
2653
+ return 0
2654
+
2655
+ return functools.reduce(lambda h1, h2: ((h1 << 5) + h1) ^ h2, hashes)
2656
+
2657
+
2658
+ def structural_hash(x: Any) -> int:
2659
+ return hash(x)
2660
+
2661
+
2662
+ def array_hash(xs: list[Any]) -> int:
2663
+ hashes: list[int] = []
2664
+ for x in xs:
2665
+ hashes.append(structural_hash(x))
2666
+
2667
+ return combine_hash_codes(hashes)
2668
+
2669
+
2670
+ def physical_hash(x: Any) -> int:
2671
+ if hasattr(x, "__hash__") and callable(x.__hash__):
2672
+ return hash(x)
2673
+
2674
+ return number_hash(ObjectRef.id(x))
2675
+
2676
+
2677
+ def round(value: float, digits: int = 0):
2678
+ m = pow(10, digits)
2679
+ n = +(value * m if digits else value)
2680
+ i = math.floor(n)
2681
+ f = n - i
2682
+ e = 1e-8
2683
+ r = (i if (i % 2 == 0) else i + 1) if (f > 0.5 - e and f < 0.5 + e) else builtins.round(n)
2684
+ return r / m if digits else r
2685
+
2686
+
2687
+ def randint(a: int, b: int) -> int:
2688
+ return random.randint(a, b - 1)
2689
+
2690
+
2691
+ def unescape_data_string(s: str) -> str:
2692
+ # https://stackoverflow.com/a/4458580/524236
2693
+ return unquote(re.sub(r"\+", "%20", s))
2694
+
2695
+
2696
+ def escape_data_string(s: str) -> str:
2697
+ return quote(s, safe="")
2698
+
2699
+
2700
+ def escape_uri_string(s: str) -> str:
2701
+ return quote(s, safe="&?:/!=")
2702
+
2703
+
2704
+ def ignore(a: Any = None) -> None:
2705
+ """Ignore argument, returns None."""
2706
+ return
2707
+
2708
+
2709
+ def copy_to_array(src: Array[_T], srci: int, trg: Array[_T], trgi: int, cnt: int) -> None:
2710
+ for i in range(0, cnt, 1):
2711
+ trg[trgi + i] = src[srci + i]
2712
+
2713
+
2714
+ class PlatformID(IntEnum):
2715
+ Win32S = 0
2716
+ Win32Windows = 1
2717
+ Win32NT = 2
2718
+ WinCE = 3
2719
+ Unix = 4
2720
+ Xbox = 5
2721
+ MacOSX = 6
2722
+ Other = 7
2723
+
2724
+
2725
+ def get_platform() -> PlatformID:
2726
+ name = platform.platform(terse=True).lower()
2727
+
2728
+ if name.startswith("windows"):
2729
+ return PlatformID.Win32NT
2730
+ elif name.startswith("linux"):
2731
+ return PlatformID.Unix
2732
+ elif name.startswith("macos"):
2733
+ return PlatformID.MacOSX
2734
+
2735
+ return PlatformID.Other