arctrl 3.0.0a3__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 (456) hide show
  1. arctrl/__init__.py +18 -0
  2. arctrl/py/CWL/__init__.py +0 -0
  3. arctrl/py/CWL/cwltypes.py +150 -0
  4. arctrl/py/CWL/decode.py +973 -0
  5. arctrl/py/CWL/encode.py +1 -0
  6. arctrl/py/CWL/inputs.py +88 -0
  7. arctrl/py/CWL/outputs.py +85 -0
  8. arctrl/py/CWL/requirements.py +77 -0
  9. arctrl/py/CWL/tool_description.py +103 -0
  10. arctrl/py/CWL/workflow_description.py +104 -0
  11. arctrl/py/CWL/workflow_steps.py +113 -0
  12. arctrl/py/Contract/__init__.py +0 -0
  13. arctrl/py/Contract/arc.py +60 -0
  14. arctrl/py/Contract/arc_assay.py +125 -0
  15. arctrl/py/Contract/arc_investigation.py +88 -0
  16. arctrl/py/Contract/arc_run.py +125 -0
  17. arctrl/py/Contract/arc_study.py +126 -0
  18. arctrl/py/Contract/arc_workflow.py +125 -0
  19. arctrl/py/Contract/contract.py +153 -0
  20. arctrl/py/Contract/datamap.py +372 -0
  21. arctrl/py/Contract/git.py +118 -0
  22. arctrl/py/Contract/validation_packages_config.py +107 -0
  23. arctrl/py/ContractIO/__init__.py +0 -0
  24. arctrl/py/ContractIO/contract_io.py +344 -0
  25. arctrl/py/ContractIO/file_system_helper.py +264 -0
  26. arctrl/py/Core/Helper/__init__.py +0 -0
  27. arctrl/py/Core/Helper/collections_.py +438 -0
  28. arctrl/py/Core/Helper/date_time.py +26 -0
  29. arctrl/py/Core/Helper/hash_codes.py +60 -0
  30. arctrl/py/Core/Helper/identifier.py +248 -0
  31. arctrl/py/Core/Helper/orcid.py +42 -0
  32. arctrl/py/Core/Helper/printer.py +13 -0
  33. arctrl/py/Core/Helper/regex.py +554 -0
  34. arctrl/py/Core/Helper/sem_ver.py +71 -0
  35. arctrl/py/Core/Helper/url.py +148 -0
  36. arctrl/py/Core/Process/__init__.py +0 -0
  37. arctrl/py/Core/Process/column_index.py +280 -0
  38. arctrl/py/Core/Process/component.py +200 -0
  39. arctrl/py/Core/Process/factor.py +151 -0
  40. arctrl/py/Core/Process/factor_value.py +182 -0
  41. arctrl/py/Core/Process/material.py +74 -0
  42. arctrl/py/Core/Process/material_attribute.py +95 -0
  43. arctrl/py/Core/Process/material_attribute_value.py +184 -0
  44. arctrl/py/Core/Process/material_type.py +45 -0
  45. arctrl/py/Core/Process/process.py +477 -0
  46. arctrl/py/Core/Process/process_input.py +265 -0
  47. arctrl/py/Core/Process/process_output.py +235 -0
  48. arctrl/py/Core/Process/process_parameter_value.py +200 -0
  49. arctrl/py/Core/Process/process_sequence.py +435 -0
  50. arctrl/py/Core/Process/protocol.py +175 -0
  51. arctrl/py/Core/Process/protocol_parameter.py +98 -0
  52. arctrl/py/Core/Process/sample.py +82 -0
  53. arctrl/py/Core/Process/source.py +62 -0
  54. arctrl/py/Core/Table/__init__.py +0 -0
  55. arctrl/py/Core/Table/arc_table.py +1264 -0
  56. arctrl/py/Core/Table/arc_table_aux.py +575 -0
  57. arctrl/py/Core/Table/arc_tables.py +591 -0
  58. arctrl/py/Core/Table/composite_cell.py +319 -0
  59. arctrl/py/Core/Table/composite_column.py +73 -0
  60. arctrl/py/Core/Table/composite_header.py +739 -0
  61. arctrl/py/Core/__init__.py +0 -0
  62. arctrl/py/Core/arc_types.py +5064 -0
  63. arctrl/py/Core/comment.py +128 -0
  64. arctrl/py/Core/comment_list.py +127 -0
  65. arctrl/py/Core/conversion.py +1313 -0
  66. arctrl/py/Core/data.py +245 -0
  67. arctrl/py/Core/data_context.py +157 -0
  68. arctrl/py/Core/data_file.py +112 -0
  69. arctrl/py/Core/data_map.py +225 -0
  70. arctrl/py/Core/identifier_setters.py +31 -0
  71. arctrl/py/Core/iproperty_value.py +36 -0
  72. arctrl/py/Core/ontology_annotation.py +299 -0
  73. arctrl/py/Core/ontology_source_reference.py +114 -0
  74. arctrl/py/Core/person.py +259 -0
  75. arctrl/py/Core/publication.py +161 -0
  76. arctrl/py/Core/template.py +231 -0
  77. arctrl/py/Core/templates.py +148 -0
  78. arctrl/py/Core/uri.py +11 -0
  79. arctrl/py/Core/value.py +188 -0
  80. arctrl/py/FileSystem/__init__.py +0 -0
  81. arctrl/py/FileSystem/commit.py +21 -0
  82. arctrl/py/FileSystem/default_gitattributes.py +5 -0
  83. arctrl/py/FileSystem/default_gitignore.py +5 -0
  84. arctrl/py/FileSystem/file_system.py +58 -0
  85. arctrl/py/FileSystem/file_system_tree.py +426 -0
  86. arctrl/py/FileSystem/path.py +64 -0
  87. arctrl/py/Json/DataMap/__init__.py +0 -0
  88. arctrl/py/Json/DataMap/data_context.py +101 -0
  89. arctrl/py/Json/DataMap/data_map.py +53 -0
  90. arctrl/py/Json/Process/__init__.py +0 -0
  91. arctrl/py/Json/Process/assay_materials.py +46 -0
  92. arctrl/py/Json/Process/component.py +79 -0
  93. arctrl/py/Json/Process/factor.py +107 -0
  94. arctrl/py/Json/Process/factor_value.py +101 -0
  95. arctrl/py/Json/Process/material.py +226 -0
  96. arctrl/py/Json/Process/material_attribute.py +79 -0
  97. arctrl/py/Json/Process/material_attribute_value.py +101 -0
  98. arctrl/py/Json/Process/material_type.py +53 -0
  99. arctrl/py/Json/Process/process.py +296 -0
  100. arctrl/py/Json/Process/process_input.py +83 -0
  101. arctrl/py/Json/Process/process_output.py +67 -0
  102. arctrl/py/Json/Process/process_parameter_value.py +81 -0
  103. arctrl/py/Json/Process/protocol.py +354 -0
  104. arctrl/py/Json/Process/protocol_parameter.py +79 -0
  105. arctrl/py/Json/Process/sample.py +277 -0
  106. arctrl/py/Json/Process/source.py +214 -0
  107. arctrl/py/Json/Process/study_materials.py +52 -0
  108. arctrl/py/Json/Process/value.py +56 -0
  109. arctrl/py/Json/ROCrate/__init__.py +0 -0
  110. arctrl/py/Json/ROCrate/ldcontext.py +133 -0
  111. arctrl/py/Json/ROCrate/ldgraph.py +111 -0
  112. arctrl/py/Json/ROCrate/ldnode.py +290 -0
  113. arctrl/py/Json/ROCrate/ldref.py +44 -0
  114. arctrl/py/Json/ROCrate/ldvalue.py +102 -0
  115. arctrl/py/Json/Table/__init__.py +0 -0
  116. arctrl/py/Json/Table/arc_table.py +393 -0
  117. arctrl/py/Json/Table/cell_table.py +83 -0
  118. arctrl/py/Json/Table/composite_cell.py +136 -0
  119. arctrl/py/Json/Table/composite_header.py +67 -0
  120. arctrl/py/Json/Table/iotype.py +24 -0
  121. arctrl/py/Json/Table/oatable.py +82 -0
  122. arctrl/py/Json/Table/templates.py +281 -0
  123. arctrl/py/Json/__init__.py +0 -0
  124. arctrl/py/Json/assay.py +600 -0
  125. arctrl/py/Json/comment.py +206 -0
  126. arctrl/py/Json/context/rocrate/__init__.py +0 -0
  127. arctrl/py/Json/context/rocrate/isa_assay_context.py +101 -0
  128. arctrl/py/Json/context/rocrate/isa_comment_context.py +60 -0
  129. arctrl/py/Json/context/rocrate/isa_component_context.py +77 -0
  130. arctrl/py/Json/context/rocrate/isa_data_context.py +74 -0
  131. arctrl/py/Json/context/rocrate/isa_factor_context.py +74 -0
  132. arctrl/py/Json/context/rocrate/isa_factor_value_context.py +84 -0
  133. arctrl/py/Json/context/rocrate/isa_investigation_context.py +110 -0
  134. arctrl/py/Json/context/rocrate/isa_material_attribute_context.py +64 -0
  135. arctrl/py/Json/context/rocrate/isa_material_attribute_value_context.py +80 -0
  136. arctrl/py/Json/context/rocrate/isa_material_context.py +71 -0
  137. arctrl/py/Json/context/rocrate/isa_ontology_annotation_context.py +68 -0
  138. arctrl/py/Json/context/rocrate/isa_ontology_source_reference_context.py +75 -0
  139. arctrl/py/Json/context/rocrate/isa_organization_context.py +55 -0
  140. arctrl/py/Json/context/rocrate/isa_person_context.py +131 -0
  141. arctrl/py/Json/context/rocrate/isa_process_context.py +94 -0
  142. arctrl/py/Json/context/rocrate/isa_process_parameter_value_context.py +80 -0
  143. arctrl/py/Json/context/rocrate/isa_protocol_context.py +97 -0
  144. arctrl/py/Json/context/rocrate/isa_protocol_parameter_context.py +64 -0
  145. arctrl/py/Json/context/rocrate/isa_publication_context.py +78 -0
  146. arctrl/py/Json/context/rocrate/isa_sample_context.py +65 -0
  147. arctrl/py/Json/context/rocrate/isa_source_context.py +66 -0
  148. arctrl/py/Json/context/rocrate/isa_study_context.py +125 -0
  149. arctrl/py/Json/context/rocrate/property_value_context.py +73 -0
  150. arctrl/py/Json/context/rocrate/rocrate_context.py +81 -0
  151. arctrl/py/Json/converter_options.py +23 -0
  152. arctrl/py/Json/data.py +356 -0
  153. arctrl/py/Json/data_file.py +63 -0
  154. arctrl/py/Json/decode.py +155 -0
  155. arctrl/py/Json/encode.py +92 -0
  156. arctrl/py/Json/idtable.py +44 -0
  157. arctrl/py/Json/investigation.py +695 -0
  158. arctrl/py/Json/ontology_annotation.py +404 -0
  159. arctrl/py/Json/ontology_source_reference.py +255 -0
  160. arctrl/py/Json/person.py +658 -0
  161. arctrl/py/Json/property_value.py +359 -0
  162. arctrl/py/Json/publication.py +279 -0
  163. arctrl/py/Json/string_table.py +76 -0
  164. arctrl/py/Json/study.py +793 -0
  165. arctrl/py/JsonIO/DataMap/__init__.py +0 -0
  166. arctrl/py/JsonIO/DataMap/data_map.py +53 -0
  167. arctrl/py/JsonIO/Process/__init__.py +0 -0
  168. arctrl/py/JsonIO/Process/component.py +60 -0
  169. arctrl/py/JsonIO/Process/factor.py +36 -0
  170. arctrl/py/JsonIO/Process/factor_value.py +38 -0
  171. arctrl/py/JsonIO/Process/material.py +60 -0
  172. arctrl/py/JsonIO/Process/material_attribute.py +38 -0
  173. arctrl/py/JsonIO/Process/material_attribute_value.py +60 -0
  174. arctrl/py/JsonIO/Process/material_type.py +36 -0
  175. arctrl/py/JsonIO/Process/process.py +60 -0
  176. arctrl/py/JsonIO/Process/process_input.py +38 -0
  177. arctrl/py/JsonIO/Process/process_output.py +60 -0
  178. arctrl/py/JsonIO/Process/process_parameter_value.py +60 -0
  179. arctrl/py/JsonIO/Process/process_sequence.py +71 -0
  180. arctrl/py/JsonIO/Process/protocol.py +60 -0
  181. arctrl/py/JsonIO/Process/protocol_parameter.py +36 -0
  182. arctrl/py/JsonIO/Process/sample.py +60 -0
  183. arctrl/py/JsonIO/Process/source.py +60 -0
  184. arctrl/py/JsonIO/Process/study_materials.py +52 -0
  185. arctrl/py/JsonIO/Process/value.py +32 -0
  186. arctrl/py/JsonIO/Table/__init__.py +0 -0
  187. arctrl/py/JsonIO/Table/arc_table.py +121 -0
  188. arctrl/py/JsonIO/Table/composite_cell.py +36 -0
  189. arctrl/py/JsonIO/Table/composite_header.py +36 -0
  190. arctrl/py/JsonIO/Table/compression.py +85 -0
  191. arctrl/py/JsonIO/Table/iotype.py +36 -0
  192. arctrl/py/JsonIO/Table/templates.py +113 -0
  193. arctrl/py/JsonIO/__init__.py +0 -0
  194. arctrl/py/JsonIO/assay.py +113 -0
  195. arctrl/py/JsonIO/comment.py +80 -0
  196. arctrl/py/JsonIO/data.py +60 -0
  197. arctrl/py/JsonIO/data_file.py +58 -0
  198. arctrl/py/JsonIO/decode.py +9 -0
  199. arctrl/py/JsonIO/encode.py +1 -0
  200. arctrl/py/JsonIO/investigation.py +113 -0
  201. arctrl/py/JsonIO/ldobject.py +106 -0
  202. arctrl/py/JsonIO/ontology_annotation.py +80 -0
  203. arctrl/py/JsonIO/ontology_source_reference.py +80 -0
  204. arctrl/py/JsonIO/person.py +82 -0
  205. arctrl/py/JsonIO/publication.py +82 -0
  206. arctrl/py/JsonIO/study.py +114 -0
  207. arctrl/py/ROCrate/Generic/__init__.py +0 -0
  208. arctrl/py/ROCrate/Generic/comment.py +131 -0
  209. arctrl/py/ROCrate/Generic/dataset.py +817 -0
  210. arctrl/py/ROCrate/Generic/defined_term.py +131 -0
  211. arctrl/py/ROCrate/Generic/file.py +237 -0
  212. arctrl/py/ROCrate/Generic/lab_process.py +324 -0
  213. arctrl/py/ROCrate/Generic/lab_protocol.py +338 -0
  214. arctrl/py/ROCrate/Generic/organization.py +83 -0
  215. arctrl/py/ROCrate/Generic/person.py +484 -0
  216. arctrl/py/ROCrate/Generic/postal_address.py +195 -0
  217. arctrl/py/ROCrate/Generic/property_value.py +696 -0
  218. arctrl/py/ROCrate/Generic/sample.py +202 -0
  219. arctrl/py/ROCrate/Generic/scholarly_article.py +229 -0
  220. arctrl/py/ROCrate/ISAProfile/__init__.py +0 -0
  221. arctrl/py/ROCrate/ISAProfile/assay.py +70 -0
  222. arctrl/py/ROCrate/ISAProfile/data.py +65 -0
  223. arctrl/py/ROCrate/ISAProfile/dataset.py +24 -0
  224. arctrl/py/ROCrate/ISAProfile/investigation.py +73 -0
  225. arctrl/py/ROCrate/ISAProfile/lab_process.py +162 -0
  226. arctrl/py/ROCrate/ISAProfile/lab_protocol.py +37 -0
  227. arctrl/py/ROCrate/ISAProfile/person.py +72 -0
  228. arctrl/py/ROCrate/ISAProfile/property_value.py +98 -0
  229. arctrl/py/ROCrate/ISAProfile/sample.py +64 -0
  230. arctrl/py/ROCrate/ISAProfile/scholarly_article.py +98 -0
  231. arctrl/py/ROCrate/ISAProfile/study.py +74 -0
  232. arctrl/py/ROCrate/__init__.py +0 -0
  233. arctrl/py/ROCrate/arc_rocrate_metadata.py +39 -0
  234. arctrl/py/ROCrate/dyn_obj_extensions.py +1 -0
  235. arctrl/py/ROCrate/helper.py +8 -0
  236. arctrl/py/ROCrate/ldcontext.py +362 -0
  237. arctrl/py/ROCrate/ldobject.py +1247 -0
  238. arctrl/py/ROCrate/rocrate_context.py +51 -0
  239. arctrl/py/Spreadsheet/AnnotationTable/__init__.py +0 -0
  240. arctrl/py/Spreadsheet/AnnotationTable/arc_table.py +193 -0
  241. arctrl/py/Spreadsheet/AnnotationTable/composite_cell.py +78 -0
  242. arctrl/py/Spreadsheet/AnnotationTable/composite_column.py +210 -0
  243. arctrl/py/Spreadsheet/AnnotationTable/composite_header.py +623 -0
  244. arctrl/py/Spreadsheet/DataMapTable/__init__.py +0 -0
  245. arctrl/py/Spreadsheet/DataMapTable/data_map_column.py +114 -0
  246. arctrl/py/Spreadsheet/DataMapTable/data_map_header.py +618 -0
  247. arctrl/py/Spreadsheet/DataMapTable/data_map_table.py +119 -0
  248. arctrl/py/Spreadsheet/Metadata/__init__.py +0 -0
  249. arctrl/py/Spreadsheet/Metadata/assays.py +125 -0
  250. arctrl/py/Spreadsheet/Metadata/comment.py +77 -0
  251. arctrl/py/Spreadsheet/Metadata/contacts.py +134 -0
  252. arctrl/py/Spreadsheet/Metadata/conversions.py +190 -0
  253. arctrl/py/Spreadsheet/Metadata/design_descriptors.py +34 -0
  254. arctrl/py/Spreadsheet/Metadata/factors.py +107 -0
  255. arctrl/py/Spreadsheet/Metadata/ontology_annotation.py +88 -0
  256. arctrl/py/Spreadsheet/Metadata/ontology_source_reference.py +96 -0
  257. arctrl/py/Spreadsheet/Metadata/protocols.py +146 -0
  258. arctrl/py/Spreadsheet/Metadata/publication.py +122 -0
  259. arctrl/py/Spreadsheet/Metadata/run.py +122 -0
  260. arctrl/py/Spreadsheet/Metadata/sparse_table.py +508 -0
  261. arctrl/py/Spreadsheet/Metadata/study.py +312 -0
  262. arctrl/py/Spreadsheet/Metadata/workflow.py +151 -0
  263. arctrl/py/Spreadsheet/__init__.py +0 -0
  264. arctrl/py/Spreadsheet/arc_assay.py +233 -0
  265. arctrl/py/Spreadsheet/arc_investigation.py +418 -0
  266. arctrl/py/Spreadsheet/arc_run.py +190 -0
  267. arctrl/py/Spreadsheet/arc_study.py +144 -0
  268. arctrl/py/Spreadsheet/arc_workflow.py +176 -0
  269. arctrl/py/Spreadsheet/assembly_info.py +1 -0
  270. arctrl/py/Spreadsheet/collection_aux.py +167 -0
  271. arctrl/py/Spreadsheet/data_map.py +44 -0
  272. arctrl/py/Spreadsheet/template.py +460 -0
  273. arctrl/py/ValidationPackages/__init__.py +0 -0
  274. arctrl/py/ValidationPackages/validation_package.py +82 -0
  275. arctrl/py/ValidationPackages/validation_packages_config.py +132 -0
  276. arctrl/py/WebRequest/__init__.py +0 -0
  277. arctrl/py/WebRequest/web_request.py +9 -0
  278. arctrl/py/WebRequest/web_request_py.py +135 -0
  279. arctrl/py/Yaml/__init__.py +0 -0
  280. arctrl/py/Yaml/decode.py +1 -0
  281. arctrl/py/Yaml/encode.py +10 -0
  282. arctrl/py/Yaml/validation_package.py +77 -0
  283. arctrl/py/Yaml/validation_packages_config.py +86 -0
  284. arctrl/py/__init__.py +0 -0
  285. arctrl/py/arc.py +1400 -0
  286. arctrl/py/column_index.py +280 -0
  287. arctrl/py/conversion.py +2184 -0
  288. arctrl/py/cross_async.py +76 -0
  289. arctrl/py/fable_modules/dynamic_obj/__init__.py +0 -0
  290. arctrl/py/fable_modules/dynamic_obj/dyn_obj.py +136 -0
  291. arctrl/py/fable_modules/dynamic_obj/dynamic_obj.py +415 -0
  292. arctrl/py/fable_modules/dynamic_obj/fable_js.py +1 -0
  293. arctrl/py/fable_modules/dynamic_obj/fable_py.py +288 -0
  294. arctrl/py/fable_modules/dynamic_obj/hash_codes.py +82 -0
  295. arctrl/py/fable_modules/dynamic_obj/property_helper.py +25 -0
  296. arctrl/py/fable_modules/dynamic_obj/reflection_utils.py +87 -0
  297. arctrl/py/fable_modules/fable_library/__init__.py +0 -0
  298. arctrl/py/fable_modules/fable_library/array_.py +1528 -0
  299. arctrl/py/fable_modules/fable_library/async_.py +377 -0
  300. arctrl/py/fable_modules/fable_library/async_builder.py +379 -0
  301. arctrl/py/fable_modules/fable_library/big_int.py +330 -0
  302. arctrl/py/fable_modules/fable_library/bit_converter.py +131 -0
  303. arctrl/py/fable_modules/fable_library/boolean.py +26 -0
  304. arctrl/py/fable_modules/fable_library/char.py +237 -0
  305. arctrl/py/fable_modules/fable_library/choice.py +212 -0
  306. arctrl/py/fable_modules/fable_library/date.py +779 -0
  307. arctrl/py/fable_modules/fable_library/date_offset.py +79 -0
  308. arctrl/py/fable_modules/fable_library/decimal_.py +190 -0
  309. arctrl/py/fable_modules/fable_library/diagnostics.py +54 -0
  310. arctrl/py/fable_modules/fable_library/double.py +87 -0
  311. arctrl/py/fable_modules/fable_library/encoding.py +41 -0
  312. arctrl/py/fable_modules/fable_library/event.py +206 -0
  313. arctrl/py/fable_modules/fable_library/file.py +107 -0
  314. arctrl/py/fable_modules/fable_library/fsharp_collections.py +52 -0
  315. arctrl/py/fable_modules/fable_library/fsharp_core.py +123 -0
  316. arctrl/py/fable_modules/fable_library/global_.py +63 -0
  317. arctrl/py/fable_modules/fable_library/guid.py +41 -0
  318. arctrl/py/fable_modules/fable_library/int32.py +73 -0
  319. arctrl/py/fable_modules/fable_library/list.py +1788 -0
  320. arctrl/py/fable_modules/fable_library/long.py +240 -0
  321. arctrl/py/fable_modules/fable_library/mailbox_processor.py +179 -0
  322. arctrl/py/fable_modules/fable_library/map.py +1854 -0
  323. arctrl/py/fable_modules/fable_library/map_util.py +148 -0
  324. arctrl/py/fable_modules/fable_library/mutable_map.py +397 -0
  325. arctrl/py/fable_modules/fable_library/mutable_set.py +279 -0
  326. arctrl/py/fable_modules/fable_library/native.py +45 -0
  327. arctrl/py/fable_modules/fable_library/numeric.py +46 -0
  328. arctrl/py/fable_modules/fable_library/observable.py +222 -0
  329. arctrl/py/fable_modules/fable_library/option.py +128 -0
  330. arctrl/py/fable_modules/fable_library/path.py +62 -0
  331. arctrl/py/fable_modules/fable_library/range.py +117 -0
  332. arctrl/py/fable_modules/fable_library/reflection.py +463 -0
  333. arctrl/py/fable_modules/fable_library/reg_exp.py +137 -0
  334. arctrl/py/fable_modules/fable_library/resize_array.py +31 -0
  335. arctrl/py/fable_modules/fable_library/result.py +212 -0
  336. arctrl/py/fable_modules/fable_library/seq.py +1979 -0
  337. arctrl/py/fable_modules/fable_library/seq2.py +221 -0
  338. arctrl/py/fable_modules/fable_library/set.py +2414 -0
  339. arctrl/py/fable_modules/fable_library/singleton_local_time_zone.py +36 -0
  340. arctrl/py/fable_modules/fable_library/string_.py +573 -0
  341. arctrl/py/fable_modules/fable_library/system_collections_generic.py +462 -0
  342. arctrl/py/fable_modules/fable_library/system_text.py +237 -0
  343. arctrl/py/fable_modules/fable_library/task.py +116 -0
  344. arctrl/py/fable_modules/fable_library/task_builder.py +122 -0
  345. arctrl/py/fable_modules/fable_library/thread.py +5 -0
  346. arctrl/py/fable_modules/fable_library/time_span.py +283 -0
  347. arctrl/py/fable_modules/fable_library/timer.py +24 -0
  348. arctrl/py/fable_modules/fable_library/types.py +401 -0
  349. arctrl/py/fable_modules/fable_library/uri.py +109 -0
  350. arctrl/py/fable_modules/fable_library/util.py +2735 -0
  351. arctrl/py/fable_modules/fable_openpyxl/__init__.py +0 -0
  352. arctrl/py/fable_modules/fable_openpyxl/openpyxl.py +362 -0
  353. arctrl/py/fable_modules/fable_python/cognite-sdk/__init__.py +0 -0
  354. arctrl/py/fable_modules/fable_python/cognite-sdk/cognite_sdk.py +22 -0
  355. arctrl/py/fable_modules/fable_python/flask/__init__.py +0 -0
  356. arctrl/py/fable_modules/fable_python/flask/flask.py +34 -0
  357. arctrl/py/fable_modules/fable_python/jupyter/__init__.py +0 -0
  358. arctrl/py/fable_modules/fable_python/jupyter/ipy_widgets.py +47 -0
  359. arctrl/py/fable_modules/fable_python/jupyter/ipython.py +13 -0
  360. arctrl/py/fable_modules/fable_python/stdlib/__init__.py +0 -0
  361. arctrl/py/fable_modules/fable_python/stdlib/ast.py +1 -0
  362. arctrl/py/fable_modules/fable_python/stdlib/asyncio/__init__.py +0 -0
  363. arctrl/py/fable_modules/fable_python/stdlib/asyncio/events.py +17 -0
  364. arctrl/py/fable_modules/fable_python/stdlib/asyncio/futures.py +52 -0
  365. arctrl/py/fable_modules/fable_python/stdlib/asyncio/tasks.py +38 -0
  366. arctrl/py/fable_modules/fable_python/stdlib/base64_.py +1 -0
  367. arctrl/py/fable_modules/fable_python/stdlib/builtins_.py +38 -0
  368. arctrl/py/fable_modules/fable_python/stdlib/html.py +1 -0
  369. arctrl/py/fable_modules/fable_python/stdlib/json.py +1 -0
  370. arctrl/py/fable_modules/fable_python/stdlib/math_.py +1 -0
  371. arctrl/py/fable_modules/fable_python/stdlib/os_.py +1 -0
  372. arctrl/py/fable_modules/fable_python/stdlib/queue_.py +1 -0
  373. arctrl/py/fable_modules/fable_python/stdlib/string_.py +1 -0
  374. arctrl/py/fable_modules/fable_python/stdlib/sys_.py +30 -0
  375. arctrl/py/fable_modules/fable_python/stdlib/time_.py +1 -0
  376. arctrl/py/fable_modules/fable_python/stdlib/tk_inter.py +1 -0
  377. arctrl/py/fable_modules/fs_spreadsheet/Cells/__init__.py +0 -0
  378. arctrl/py/fable_modules/fs_spreadsheet/Cells/fs_cell.py +338 -0
  379. arctrl/py/fable_modules/fs_spreadsheet/Cells/fs_cells_collection.py +469 -0
  380. arctrl/py/fable_modules/fs_spreadsheet/DSL/__init__.py +0 -0
  381. arctrl/py/fable_modules/fs_spreadsheet/DSL/cell_builder.py +214 -0
  382. arctrl/py/fable_modules/fs_spreadsheet/DSL/column_builder.py +139 -0
  383. arctrl/py/fable_modules/fs_spreadsheet/DSL/dsl.py +50 -0
  384. arctrl/py/fable_modules/fs_spreadsheet/DSL/expression.py +65 -0
  385. arctrl/py/fable_modules/fs_spreadsheet/DSL/operators.py +9 -0
  386. arctrl/py/fable_modules/fs_spreadsheet/DSL/row_builder.py +139 -0
  387. arctrl/py/fable_modules/fs_spreadsheet/DSL/sheet_builder.py +118 -0
  388. arctrl/py/fable_modules/fs_spreadsheet/DSL/table_builder.py +122 -0
  389. arctrl/py/fable_modules/fs_spreadsheet/DSL/transform.py +464 -0
  390. arctrl/py/fable_modules/fs_spreadsheet/DSL/types.py +314 -0
  391. arctrl/py/fable_modules/fs_spreadsheet/DSL/workbook_builder.py +106 -0
  392. arctrl/py/fable_modules/fs_spreadsheet/Json/__init__.py +0 -0
  393. arctrl/py/fable_modules/fs_spreadsheet/Json/cell.py +103 -0
  394. arctrl/py/fable_modules/fs_spreadsheet/Json/column.py +70 -0
  395. arctrl/py/fable_modules/fs_spreadsheet/Json/row.py +70 -0
  396. arctrl/py/fable_modules/fs_spreadsheet/Json/table.py +57 -0
  397. arctrl/py/fable_modules/fs_spreadsheet/Json/value.py +93 -0
  398. arctrl/py/fable_modules/fs_spreadsheet/Json/workbook.py +71 -0
  399. arctrl/py/fable_modules/fs_spreadsheet/Json/worksheet.py +217 -0
  400. arctrl/py/fable_modules/fs_spreadsheet/Ranges/__init__.py +0 -0
  401. arctrl/py/fable_modules/fs_spreadsheet/Ranges/fs_range.py +47 -0
  402. arctrl/py/fable_modules/fs_spreadsheet/Ranges/fs_range_address.py +186 -0
  403. arctrl/py/fable_modules/fs_spreadsheet/Ranges/fs_range_base.py +90 -0
  404. arctrl/py/fable_modules/fs_spreadsheet/Ranges/fs_range_column.py +78 -0
  405. arctrl/py/fable_modules/fs_spreadsheet/Ranges/fs_range_row.py +48 -0
  406. arctrl/py/fable_modules/fs_spreadsheet/Tables/__init__.py +0 -0
  407. arctrl/py/fable_modules/fs_spreadsheet/Tables/fs_table.py +393 -0
  408. arctrl/py/fable_modules/fs_spreadsheet/Tables/fs_table_field.py +127 -0
  409. arctrl/py/fable_modules/fs_spreadsheet/Tables/fs_table_row.py +23 -0
  410. arctrl/py/fable_modules/fs_spreadsheet/__init__.py +0 -0
  411. arctrl/py/fable_modules/fs_spreadsheet/fs_address.py +218 -0
  412. arctrl/py/fable_modules/fs_spreadsheet/fs_column.py +172 -0
  413. arctrl/py/fable_modules/fs_spreadsheet/fs_row.py +183 -0
  414. arctrl/py/fable_modules/fs_spreadsheet/fs_workbook.py +180 -0
  415. arctrl/py/fable_modules/fs_spreadsheet/fs_worksheet.py +600 -0
  416. arctrl/py/fable_modules/fs_spreadsheet/sheet_builder.py +330 -0
  417. arctrl/py/fable_modules/fs_spreadsheet_py/__init__.py +0 -0
  418. arctrl/py/fable_modules/fs_spreadsheet_py/cell.py +63 -0
  419. arctrl/py/fable_modules/fs_spreadsheet_py/cell_type.py +50 -0
  420. arctrl/py/fable_modules/fs_spreadsheet_py/fs_extension.py +60 -0
  421. arctrl/py/fable_modules/fs_spreadsheet_py/json.py +47 -0
  422. arctrl/py/fable_modules/fs_spreadsheet_py/table.py +53 -0
  423. arctrl/py/fable_modules/fs_spreadsheet_py/workbook.py +40 -0
  424. arctrl/py/fable_modules/fs_spreadsheet_py/worksheet.py +54 -0
  425. arctrl/py/fable_modules/fs_spreadsheet_py/xlsx.py +37 -0
  426. arctrl/py/fable_modules/thoth_json_core/__init__.py +0 -0
  427. arctrl/py/fable_modules/thoth_json_core/decode.py +1588 -0
  428. arctrl/py/fable_modules/thoth_json_core/encode.py +261 -0
  429. arctrl/py/fable_modules/thoth_json_core/types.py +181 -0
  430. arctrl/py/fable_modules/thoth_json_python/__init__.py +0 -0
  431. arctrl/py/fable_modules/thoth_json_python/decode.py +112 -0
  432. arctrl/py/fable_modules/thoth_json_python/encode.py +72 -0
  433. arctrl/py/fable_modules/thoth_json_python/python.py +1 -0
  434. arctrl/py/fable_modules/yamlicious/Interop/__init__.py +0 -0
  435. arctrl/py/fable_modules/yamlicious/Interop/js_interop.py +1 -0
  436. arctrl/py/fable_modules/yamlicious/Interop/py_interop.py +7 -0
  437. arctrl/py/fable_modules/yamlicious/__init__.py +0 -0
  438. arctrl/py/fable_modules/yamlicious/decode.py +1784 -0
  439. arctrl/py/fable_modules/yamlicious/encode.py +84 -0
  440. arctrl/py/fable_modules/yamlicious/library.py +10 -0
  441. arctrl/py/fable_modules/yamlicious/persil.py +57 -0
  442. arctrl/py/fable_modules/yamlicious/preprocessing.py +99 -0
  443. arctrl/py/fable_modules/yamlicious/reader.py +665 -0
  444. arctrl/py/fable_modules/yamlicious/regex.py +21 -0
  445. arctrl/py/fable_modules/yamlicious/regex_active_patterns.py +256 -0
  446. arctrl/py/fable_modules/yamlicious/writer.py +175 -0
  447. arctrl/py/fable_modules/yamlicious/yamlicious_types.py +128 -0
  448. arctrl/py/json.py +213 -0
  449. arctrl/py/rocrate_io.py +72 -0
  450. arctrl/py/template_web.py +23 -0
  451. arctrl/py/xlsx.py +148 -0
  452. arctrl/rocrate.py +21 -0
  453. arctrl-3.0.0a3.dist-info/LICENSE +21 -0
  454. arctrl-3.0.0a3.dist-info/METADATA +119 -0
  455. arctrl-3.0.0a3.dist-info/RECORD +456 -0
  456. arctrl-3.0.0a3.dist-info/WHEEL +4 -0
@@ -0,0 +1,2414 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Callable
4
+ from dataclasses import dataclass
5
+ from typing import Any, Generic, TypeVar
6
+
7
+ from .array_ import fill
8
+ from .array_ import fold as fold_1
9
+ from .list import FSharpList, cons, head, of_array_with_tail, tail
10
+ from .list import empty as empty_1
11
+ from .list import fold as fold_2
12
+ from .list import is_empty as is_empty_1
13
+ from .list import singleton as singleton_1
14
+ from .mutable_set import HashSet, HashSet__ctor_Z6150332D, HashSet__get_Comparer
15
+ from .option import some
16
+ from .option import value as value_3
17
+ from .reflection import TypeInfo, bool_type, class_type, list_type, option_type, record_type
18
+ from .seq import cache, reduce
19
+ from .seq import exists as exists_1
20
+ from .seq import fold as fold_3
21
+ from .seq import for_all as for_all_1
22
+ from .seq import iterate as iterate_1
23
+ from .seq import map as map_1
24
+ from .string_ import join
25
+ from .types import Array, Record, to_string
26
+ from .util import (
27
+ IComparer_1,
28
+ IEnumerable_1,
29
+ IEnumerator,
30
+ get_enumerator,
31
+ ignore,
32
+ is_array_like,
33
+ structural_hash,
34
+ to_iterator,
35
+ )
36
+
37
+
38
+ _T = TypeVar("_T")
39
+
40
+ __A = TypeVar("__A")
41
+
42
+ __B = TypeVar("__B")
43
+
44
+ _A = TypeVar("_A")
45
+
46
+ _A_ = TypeVar("_A_")
47
+
48
+ _U = TypeVar("_U")
49
+
50
+ _STATE = TypeVar("_STATE")
51
+
52
+
53
+ def _expr231(gen0: TypeInfo) -> TypeInfo:
54
+ return class_type("Set.SetTreeLeaf`1", [gen0], SetTreeLeaf_1)
55
+
56
+
57
+ class SetTreeLeaf_1(Generic[_T]):
58
+ def __init__(self, k: Any | None = None) -> None:
59
+ self.k: _T = k
60
+
61
+
62
+ SetTreeLeaf_1_reflection = _expr231
63
+
64
+
65
+ def SetTreeLeaf_1__ctor_2B595(k: Any | None = None) -> SetTreeLeaf_1[_T]:
66
+ return SetTreeLeaf_1(k)
67
+
68
+
69
+ def SetTreeLeaf_1__get_Key(_: SetTreeLeaf_1[Any]) -> Any:
70
+ return _.k
71
+
72
+
73
+ def _expr232(gen0: TypeInfo) -> TypeInfo:
74
+ return class_type("Set.SetTreeNode`1", [gen0], SetTreeNode_1, SetTreeLeaf_1_reflection(gen0))
75
+
76
+
77
+ class SetTreeNode_1(SetTreeLeaf_1, Generic[_T]):
78
+ def __init__(self, v: Any, left: SetTreeLeaf_1[Any] | None, right: SetTreeLeaf_1[Any] | None, h: int) -> None:
79
+ super().__init__(v)
80
+ self.left: SetTreeLeaf_1[_T] | None = left
81
+ self.right: SetTreeLeaf_1[_T] | None = right
82
+ self.h: int = h or 0
83
+
84
+
85
+ SetTreeNode_1_reflection = _expr232
86
+
87
+
88
+ def SetTreeNode_1__ctor_5F465FC9(
89
+ v: Any, left: SetTreeLeaf_1[Any] | None, right: SetTreeLeaf_1[Any] | None, h: int
90
+ ) -> SetTreeNode_1[_T]:
91
+ return SetTreeNode_1(v, left, right, h)
92
+
93
+
94
+ def SetTreeNode_1__get_Left(_: SetTreeNode_1[Any]) -> SetTreeLeaf_1[Any] | None:
95
+ return _.left
96
+
97
+
98
+ def SetTreeNode_1__get_Right(_: SetTreeNode_1[Any]) -> SetTreeLeaf_1[Any] | None:
99
+ return _.right
100
+
101
+
102
+ def SetTreeNode_1__get_Height(_: SetTreeNode_1[Any]) -> int:
103
+ return _.h
104
+
105
+
106
+ def SetTreeModule_empty(__unit: None = None) -> SetTreeLeaf_1[Any] | None:
107
+ return None
108
+
109
+
110
+ def SetTreeModule_countAux(t_mut: SetTreeLeaf_1[Any] | None, acc_mut: int) -> int:
111
+ while True:
112
+ (t, acc) = (t_mut, acc_mut)
113
+ if t is not None:
114
+ t2: SetTreeLeaf_1[_T] = t
115
+ if isinstance(t2, SetTreeNode_1):
116
+ t_mut = SetTreeNode_1__get_Left(t2)
117
+ acc_mut = SetTreeModule_countAux(SetTreeNode_1__get_Right(t2), acc + 1)
118
+ continue
119
+
120
+ else:
121
+ return acc + 1
122
+
123
+ else:
124
+ return acc
125
+
126
+ break
127
+
128
+
129
+ def SetTreeModule_count(s: SetTreeLeaf_1[Any] | None = None) -> int:
130
+ return SetTreeModule_countAux(s, 0)
131
+
132
+
133
+ def SetTreeModule_mk(
134
+ l: SetTreeLeaf_1[Any] | None, k: Any, r: SetTreeLeaf_1[Any] | None = None
135
+ ) -> SetTreeLeaf_1[Any] | None:
136
+ hl: int
137
+ t: SetTreeLeaf_1[_T] | None = l
138
+ if t is not None:
139
+ t2: SetTreeLeaf_1[_T] = t
140
+ hl = SetTreeNode_1__get_Height(t2) if isinstance(t2, SetTreeNode_1) else 1
141
+
142
+ else:
143
+ hl = 0
144
+
145
+ hr: int
146
+ t_1: SetTreeLeaf_1[_T] | None = r
147
+ if t_1 is not None:
148
+ t2_1: SetTreeLeaf_1[_T] = t_1
149
+ hr = SetTreeNode_1__get_Height(t2_1) if isinstance(t2_1, SetTreeNode_1) else 1
150
+
151
+ else:
152
+ hr = 0
153
+
154
+ m: int = (hr if (hl < hr) else hl) or 0
155
+ if m == 0:
156
+ return SetTreeLeaf_1__ctor_2B595(k)
157
+
158
+ else:
159
+ return SetTreeNode_1__ctor_5F465FC9(k, l, r, m + 1)
160
+
161
+
162
+ def SetTreeModule_rebalance(
163
+ t1: SetTreeLeaf_1[Any] | None, v: Any, t2: SetTreeLeaf_1[Any] | None = None
164
+ ) -> SetTreeLeaf_1[Any] | None:
165
+ t1h: int
166
+ t: SetTreeLeaf_1[_T] | None = t1
167
+ if t is not None:
168
+ t2_1: SetTreeLeaf_1[_T] = t
169
+ t1h = SetTreeNode_1__get_Height(t2_1) if isinstance(t2_1, SetTreeNode_1) else 1
170
+
171
+ else:
172
+ t1h = 0
173
+
174
+ t2h: int
175
+ t_1: SetTreeLeaf_1[_T] | None = t2
176
+ if t_1 is not None:
177
+ t2_2: SetTreeLeaf_1[_T] = t_1
178
+ t2h = SetTreeNode_1__get_Height(t2_2) if isinstance(t2_2, SetTreeNode_1) else 1
179
+
180
+ else:
181
+ t2h = 0
182
+
183
+ if t2h > (t1h + 2):
184
+ match_value: SetTreeLeaf_1[_T] = value_3(t2)
185
+ if isinstance(match_value, SetTreeNode_1):
186
+
187
+ def _arrow233(__unit: None = None, t1: Any = t1, v: Any = v, t2: Any = t2) -> int:
188
+ t_2: SetTreeLeaf_1[_T] | None = SetTreeNode_1__get_Left(match_value)
189
+ if t_2 is not None:
190
+ t2_3: SetTreeLeaf_1[_T] = t_2
191
+ return SetTreeNode_1__get_Height(t2_3) if isinstance(t2_3, SetTreeNode_1) else 1
192
+
193
+ else:
194
+ return 0
195
+
196
+ if _arrow233() > (t1h + 1):
197
+ match_value_1: SetTreeLeaf_1[_T] = value_3(SetTreeNode_1__get_Left(match_value))
198
+ if isinstance(match_value_1, SetTreeNode_1):
199
+ return SetTreeModule_mk(
200
+ SetTreeModule_mk(t1, v, SetTreeNode_1__get_Left(match_value_1)),
201
+ SetTreeLeaf_1__get_Key(match_value_1),
202
+ SetTreeModule_mk(
203
+ SetTreeNode_1__get_Right(match_value_1),
204
+ SetTreeLeaf_1__get_Key(match_value),
205
+ SetTreeNode_1__get_Right(match_value),
206
+ ),
207
+ )
208
+
209
+ else:
210
+ raise Exception("internal error: Set.rebalance")
211
+
212
+ else:
213
+ return SetTreeModule_mk(
214
+ SetTreeModule_mk(t1, v, SetTreeNode_1__get_Left(match_value)),
215
+ SetTreeLeaf_1__get_Key(match_value),
216
+ SetTreeNode_1__get_Right(match_value),
217
+ )
218
+
219
+ else:
220
+ raise Exception("internal error: Set.rebalance")
221
+
222
+ elif t1h > (t2h + 2):
223
+ match_value_2: SetTreeLeaf_1[_T] = value_3(t1)
224
+ if isinstance(match_value_2, SetTreeNode_1):
225
+
226
+ def _arrow234(__unit: None = None, t1: Any = t1, v: Any = v, t2: Any = t2) -> int:
227
+ t_3: SetTreeLeaf_1[_T] | None = SetTreeNode_1__get_Right(match_value_2)
228
+ if t_3 is not None:
229
+ t2_4: SetTreeLeaf_1[_T] = t_3
230
+ return SetTreeNode_1__get_Height(t2_4) if isinstance(t2_4, SetTreeNode_1) else 1
231
+
232
+ else:
233
+ return 0
234
+
235
+ if _arrow234() > (t2h + 1):
236
+ match_value_3: SetTreeLeaf_1[_T] = value_3(SetTreeNode_1__get_Right(match_value_2))
237
+ if isinstance(match_value_3, SetTreeNode_1):
238
+ return SetTreeModule_mk(
239
+ SetTreeModule_mk(
240
+ SetTreeNode_1__get_Left(match_value_2),
241
+ SetTreeLeaf_1__get_Key(match_value_2),
242
+ SetTreeNode_1__get_Left(match_value_3),
243
+ ),
244
+ SetTreeLeaf_1__get_Key(match_value_3),
245
+ SetTreeModule_mk(SetTreeNode_1__get_Right(match_value_3), v, t2),
246
+ )
247
+
248
+ else:
249
+ raise Exception("internal error: Set.rebalance")
250
+
251
+ else:
252
+ return SetTreeModule_mk(
253
+ SetTreeNode_1__get_Left(match_value_2),
254
+ SetTreeLeaf_1__get_Key(match_value_2),
255
+ SetTreeModule_mk(SetTreeNode_1__get_Right(match_value_2), v, t2),
256
+ )
257
+
258
+ else:
259
+ raise Exception("internal error: Set.rebalance")
260
+
261
+ else:
262
+ return SetTreeModule_mk(t1, v, t2)
263
+
264
+
265
+ def SetTreeModule_add(
266
+ comparer: IComparer_1[Any], k: Any, t: SetTreeLeaf_1[Any] | None = None
267
+ ) -> SetTreeLeaf_1[Any] | None:
268
+ if t is not None:
269
+ t2: SetTreeLeaf_1[_T] = t
270
+ c: int = comparer.Compare(k, SetTreeLeaf_1__get_Key(t2)) or 0
271
+ if isinstance(t2, SetTreeNode_1):
272
+ if c < 0:
273
+ return SetTreeModule_rebalance(
274
+ SetTreeModule_add(comparer, k, SetTreeNode_1__get_Left(t2)),
275
+ SetTreeLeaf_1__get_Key(t2),
276
+ SetTreeNode_1__get_Right(t2),
277
+ )
278
+
279
+ elif c == 0:
280
+ return t
281
+
282
+ else:
283
+ return SetTreeModule_rebalance(
284
+ SetTreeNode_1__get_Left(t2),
285
+ SetTreeLeaf_1__get_Key(t2),
286
+ SetTreeModule_add(comparer, k, SetTreeNode_1__get_Right(t2)),
287
+ )
288
+
289
+ else:
290
+ c_1: int = comparer.Compare(k, SetTreeLeaf_1__get_Key(t2)) or 0
291
+ if c_1 < 0:
292
+ return SetTreeNode_1__ctor_5F465FC9(k, SetTreeModule_empty(), t, 2)
293
+
294
+ elif c_1 == 0:
295
+ return t
296
+
297
+ else:
298
+ return SetTreeNode_1__ctor_5F465FC9(k, t, SetTreeModule_empty(), 2)
299
+
300
+ else:
301
+ return SetTreeLeaf_1__ctor_2B595(k)
302
+
303
+
304
+ def SetTreeModule_balance(
305
+ comparer: IComparer_1[Any], t1: SetTreeLeaf_1[Any] | None, k: Any, t2: SetTreeLeaf_1[Any] | None = None
306
+ ) -> SetTreeLeaf_1[Any] | None:
307
+ if t1 is not None:
308
+ t1_0027: SetTreeLeaf_1[_T] = t1
309
+ if t2 is not None:
310
+ t2_0027: SetTreeLeaf_1[_T] = t2
311
+ if isinstance(t1_0027, SetTreeNode_1):
312
+ if isinstance(t2_0027, SetTreeNode_1):
313
+ if (SetTreeNode_1__get_Height(t1_0027) + 2) < SetTreeNode_1__get_Height(t2_0027):
314
+ return SetTreeModule_rebalance(
315
+ SetTreeModule_balance(comparer, t1, k, SetTreeNode_1__get_Left(t2_0027)),
316
+ SetTreeLeaf_1__get_Key(t2_0027),
317
+ SetTreeNode_1__get_Right(t2_0027),
318
+ )
319
+
320
+ elif (SetTreeNode_1__get_Height(t2_0027) + 2) < SetTreeNode_1__get_Height(t1_0027):
321
+ return SetTreeModule_rebalance(
322
+ SetTreeNode_1__get_Left(t1_0027),
323
+ SetTreeLeaf_1__get_Key(t1_0027),
324
+ SetTreeModule_balance(comparer, SetTreeNode_1__get_Right(t1_0027), k, t2),
325
+ )
326
+
327
+ else:
328
+ return SetTreeModule_mk(t1, k, t2)
329
+
330
+ else:
331
+ return SetTreeModule_add(
332
+ comparer, k, SetTreeModule_add(comparer, SetTreeLeaf_1__get_Key(t2_0027), t1)
333
+ )
334
+
335
+ else:
336
+ return SetTreeModule_add(comparer, k, SetTreeModule_add(comparer, SetTreeLeaf_1__get_Key(t1_0027), t2))
337
+
338
+ else:
339
+ return SetTreeModule_add(comparer, k, t1)
340
+
341
+ else:
342
+ return SetTreeModule_add(comparer, k, t2)
343
+
344
+
345
+ def SetTreeModule_split(
346
+ comparer: IComparer_1[Any], pivot: Any, t: SetTreeLeaf_1[Any] | None = None
347
+ ) -> tuple[SetTreeLeaf_1[_T] | None, bool, SetTreeLeaf_1[_T] | None]:
348
+ if t is not None:
349
+ t2: SetTreeLeaf_1[_T] = t
350
+ if isinstance(t2, SetTreeNode_1):
351
+ c: int = comparer.Compare(pivot, SetTreeLeaf_1__get_Key(t2)) or 0
352
+ if c < 0:
353
+ pattern_input: tuple[SetTreeLeaf_1[_T] | None, bool, SetTreeLeaf_1[_T] | None] = SetTreeModule_split(
354
+ comparer, pivot, SetTreeNode_1__get_Left(t2)
355
+ )
356
+ return (
357
+ pattern_input[0],
358
+ pattern_input[1],
359
+ SetTreeModule_balance(
360
+ comparer, pattern_input[2], SetTreeLeaf_1__get_Key(t2), SetTreeNode_1__get_Right(t2)
361
+ ),
362
+ )
363
+
364
+ elif c == 0:
365
+ return (SetTreeNode_1__get_Left(t2), True, SetTreeNode_1__get_Right(t2))
366
+
367
+ else:
368
+ pattern_input_1: tuple[SetTreeLeaf_1[_T] | None, bool, SetTreeLeaf_1[_T] | None] = SetTreeModule_split(
369
+ comparer, pivot, SetTreeNode_1__get_Right(t2)
370
+ )
371
+ return (
372
+ SetTreeModule_balance(
373
+ comparer, SetTreeNode_1__get_Left(t2), SetTreeLeaf_1__get_Key(t2), pattern_input_1[0]
374
+ ),
375
+ pattern_input_1[1],
376
+ pattern_input_1[2],
377
+ )
378
+
379
+ else:
380
+ c_1: int = comparer.Compare(SetTreeLeaf_1__get_Key(t2), pivot) or 0
381
+ if c_1 < 0:
382
+ return (t, False, SetTreeModule_empty())
383
+
384
+ elif c_1 == 0:
385
+ return (SetTreeModule_empty(), True, SetTreeModule_empty())
386
+
387
+ else:
388
+ return (SetTreeModule_empty(), False, t)
389
+
390
+ else:
391
+ return (SetTreeModule_empty(), False, SetTreeModule_empty())
392
+
393
+
394
+ def SetTreeModule_spliceOutSuccessor(t: SetTreeLeaf_1[Any] | None = None) -> tuple[_T, SetTreeLeaf_1[_T] | None]:
395
+ if t is not None:
396
+ t2: SetTreeLeaf_1[_T] = t
397
+ if isinstance(t2, SetTreeNode_1):
398
+ if SetTreeNode_1__get_Left(t2) is None:
399
+ return (SetTreeLeaf_1__get_Key(t2), SetTreeNode_1__get_Right(t2))
400
+
401
+ else:
402
+ pattern_input: tuple[_T, SetTreeLeaf_1[_T] | None] = SetTreeModule_spliceOutSuccessor(
403
+ SetTreeNode_1__get_Left(t2)
404
+ )
405
+ return (
406
+ pattern_input[0],
407
+ SetTreeModule_mk(pattern_input[1], SetTreeLeaf_1__get_Key(t2), SetTreeNode_1__get_Right(t2)),
408
+ )
409
+
410
+ else:
411
+ return (SetTreeLeaf_1__get_Key(t2), SetTreeModule_empty())
412
+
413
+ else:
414
+ raise Exception("internal error: Set.spliceOutSuccessor")
415
+
416
+
417
+ def SetTreeModule_remove(
418
+ comparer: IComparer_1[Any], k: Any, t: SetTreeLeaf_1[Any] | None = None
419
+ ) -> SetTreeLeaf_1[Any] | None:
420
+ if t is not None:
421
+ t2: SetTreeLeaf_1[_T] = t
422
+ c: int = comparer.Compare(k, SetTreeLeaf_1__get_Key(t2)) or 0
423
+ if isinstance(t2, SetTreeNode_1):
424
+ if c < 0:
425
+ return SetTreeModule_rebalance(
426
+ SetTreeModule_remove(comparer, k, SetTreeNode_1__get_Left(t2)),
427
+ SetTreeLeaf_1__get_Key(t2),
428
+ SetTreeNode_1__get_Right(t2),
429
+ )
430
+
431
+ elif c == 0:
432
+ if SetTreeNode_1__get_Left(t2) is None:
433
+ return SetTreeNode_1__get_Right(t2)
434
+
435
+ elif SetTreeNode_1__get_Right(t2) is None:
436
+ return SetTreeNode_1__get_Left(t2)
437
+
438
+ else:
439
+ pattern_input: tuple[_T, SetTreeLeaf_1[_T] | None] = SetTreeModule_spliceOutSuccessor(
440
+ SetTreeNode_1__get_Right(t2)
441
+ )
442
+ return SetTreeModule_mk(SetTreeNode_1__get_Left(t2), pattern_input[0], pattern_input[1])
443
+
444
+ else:
445
+ return SetTreeModule_rebalance(
446
+ SetTreeNode_1__get_Left(t2),
447
+ SetTreeLeaf_1__get_Key(t2),
448
+ SetTreeModule_remove(comparer, k, SetTreeNode_1__get_Right(t2)),
449
+ )
450
+
451
+ elif c == 0:
452
+ return SetTreeModule_empty()
453
+
454
+ else:
455
+ return t
456
+
457
+ else:
458
+ return t
459
+
460
+
461
+ def SetTreeModule_mem(comparer_mut: IComparer_1[Any], k_mut: Any, t_mut: SetTreeLeaf_1[Any] | None) -> bool:
462
+ while True:
463
+ (comparer, k, t) = (comparer_mut, k_mut, t_mut)
464
+ if t is not None:
465
+ t2: SetTreeLeaf_1[_T] = t
466
+ c: int = comparer.Compare(k, SetTreeLeaf_1__get_Key(t2)) or 0
467
+ if isinstance(t2, SetTreeNode_1):
468
+ if c < 0:
469
+ comparer_mut = comparer
470
+ k_mut = k
471
+ t_mut = SetTreeNode_1__get_Left(t2)
472
+ continue
473
+
474
+ elif c == 0:
475
+ return True
476
+
477
+ else:
478
+ comparer_mut = comparer
479
+ k_mut = k
480
+ t_mut = SetTreeNode_1__get_Right(t2)
481
+ continue
482
+
483
+ else:
484
+ return c == 0
485
+
486
+ else:
487
+ return False
488
+
489
+ break
490
+
491
+
492
+ def SetTreeModule_iter(f_mut: Callable[[_T], None], t_mut: SetTreeLeaf_1[Any] | None) -> None:
493
+ while True:
494
+ (f, t) = (f_mut, t_mut)
495
+ if t is not None:
496
+ t2: SetTreeLeaf_1[_T] = t
497
+ if isinstance(t2, SetTreeNode_1):
498
+ SetTreeModule_iter(f, SetTreeNode_1__get_Left(t2))
499
+ f(SetTreeLeaf_1__get_Key(t2))
500
+ f_mut = f
501
+ t_mut = SetTreeNode_1__get_Right(t2)
502
+ continue
503
+
504
+ else:
505
+ f(SetTreeLeaf_1__get_Key(t2))
506
+
507
+ break
508
+
509
+
510
+ def SetTreeModule_foldBackOpt(f_mut: Any, t_mut: SetTreeLeaf_1[Any] | None, x_mut: Any) -> Any:
511
+ while True:
512
+ (f, t, x) = (f_mut, t_mut, x_mut)
513
+ if t is not None:
514
+ t2: SetTreeLeaf_1[_T] = t
515
+ if isinstance(t2, SetTreeNode_1):
516
+ f_mut = f
517
+ t_mut = SetTreeNode_1__get_Left(t2)
518
+ x_mut = f(SetTreeLeaf_1__get_Key(t2), SetTreeModule_foldBackOpt(f, SetTreeNode_1__get_Right(t2), x))
519
+ continue
520
+
521
+ else:
522
+ return f(SetTreeLeaf_1__get_Key(t2), x)
523
+
524
+ else:
525
+ return x
526
+
527
+ break
528
+
529
+
530
+ def SetTreeModule_foldBack(f: Callable[[__A, __B], __B], m: SetTreeLeaf_1[Any] | None, x: Any) -> Any:
531
+ return SetTreeModule_foldBackOpt(f, m, x)
532
+
533
+
534
+ def SetTreeModule_foldOpt(f_mut: Any, x_mut: Any, t_mut: SetTreeLeaf_1[Any] | None) -> Any:
535
+ while True:
536
+ (f, x, t) = (f_mut, x_mut, t_mut)
537
+ if t is not None:
538
+ t2: SetTreeLeaf_1[_T] = t
539
+ if isinstance(t2, SetTreeNode_1):
540
+ f_mut = f
541
+ x_mut = f(SetTreeModule_foldOpt(f, x, SetTreeNode_1__get_Left(t2)), SetTreeLeaf_1__get_Key(t2))
542
+ t_mut = SetTreeNode_1__get_Right(t2)
543
+ continue
544
+
545
+ else:
546
+ return f(x, SetTreeLeaf_1__get_Key(t2))
547
+
548
+ else:
549
+ return x
550
+
551
+ break
552
+
553
+
554
+ def SetTreeModule_fold(f: Callable[[__A, __B], __A], x: Any, m: SetTreeLeaf_1[Any] | None = None) -> Any:
555
+ return SetTreeModule_foldOpt(f, x, m)
556
+
557
+
558
+ def SetTreeModule_forall(f_mut: Callable[[_T], bool], t_mut: SetTreeLeaf_1[Any] | None) -> bool:
559
+ while True:
560
+ (f, t) = (f_mut, t_mut)
561
+ if t is not None:
562
+ t2: SetTreeLeaf_1[_T] = t
563
+ if isinstance(t2, SetTreeNode_1):
564
+ if SetTreeModule_forall(f, SetTreeNode_1__get_Left(t2)) if f(SetTreeLeaf_1__get_Key(t2)) else False:
565
+ f_mut = f
566
+ t_mut = SetTreeNode_1__get_Right(t2)
567
+ continue
568
+
569
+ else:
570
+ return False
571
+
572
+ else:
573
+ return f(SetTreeLeaf_1__get_Key(t2))
574
+
575
+ else:
576
+ return True
577
+
578
+ break
579
+
580
+
581
+ def SetTreeModule_exists(f_mut: Callable[[_T], bool], t_mut: SetTreeLeaf_1[Any] | None) -> bool:
582
+ while True:
583
+ (f, t) = (f_mut, t_mut)
584
+ if t is not None:
585
+ t2: SetTreeLeaf_1[_T] = t
586
+ if isinstance(t2, SetTreeNode_1):
587
+ if True if f(SetTreeLeaf_1__get_Key(t2)) else SetTreeModule_exists(f, SetTreeNode_1__get_Left(t2)):
588
+ return True
589
+
590
+ else:
591
+ f_mut = f
592
+ t_mut = SetTreeNode_1__get_Right(t2)
593
+ continue
594
+
595
+ else:
596
+ return f(SetTreeLeaf_1__get_Key(t2))
597
+
598
+ else:
599
+ return False
600
+
601
+ break
602
+
603
+
604
+ def SetTreeModule_subset(
605
+ comparer: IComparer_1[Any], a: SetTreeLeaf_1[Any] | None = None, b: SetTreeLeaf_1[Any] | None = None
606
+ ) -> bool:
607
+ def _arrow235(x: __A | None = None, comparer: Any = comparer, a: Any = a, b: Any = b) -> bool:
608
+ return SetTreeModule_mem(comparer, x, b)
609
+
610
+ return SetTreeModule_forall(_arrow235, a)
611
+
612
+
613
+ def SetTreeModule_properSubset(
614
+ comparer: IComparer_1[Any], a: SetTreeLeaf_1[Any] | None = None, b: SetTreeLeaf_1[Any] | None = None
615
+ ) -> bool:
616
+ def _arrow236(x: __A | None = None, comparer: Any = comparer, a: Any = a, b: Any = b) -> bool:
617
+ return SetTreeModule_mem(comparer, x, b)
618
+
619
+ if SetTreeModule_forall(_arrow236, a):
620
+
621
+ def _arrow237(x_1: __A | None = None, comparer: Any = comparer, a: Any = a, b: Any = b) -> bool:
622
+ return not SetTreeModule_mem(comparer, x_1, a)
623
+
624
+ return SetTreeModule_exists(_arrow237, b)
625
+
626
+ else:
627
+ return False
628
+
629
+
630
+ def SetTreeModule_filterAux(
631
+ comparer_mut: IComparer_1[Any],
632
+ f_mut: Callable[[_T], bool],
633
+ t_mut: SetTreeLeaf_1[Any] | None,
634
+ acc_mut: SetTreeLeaf_1[Any] | None,
635
+ ) -> SetTreeLeaf_1[Any] | None:
636
+ while True:
637
+ (comparer, f, t, acc) = (comparer_mut, f_mut, t_mut, acc_mut)
638
+ if t is not None:
639
+ t2: SetTreeLeaf_1[_T] = t
640
+ if isinstance(t2, SetTreeNode_1):
641
+ acc_1: SetTreeLeaf_1[_T] | None = (
642
+ SetTreeModule_add(comparer, SetTreeLeaf_1__get_Key(t2), acc)
643
+ if f(SetTreeLeaf_1__get_Key(t2))
644
+ else acc
645
+ )
646
+ comparer_mut = comparer
647
+ f_mut = f
648
+ t_mut = SetTreeNode_1__get_Left(t2)
649
+ acc_mut = SetTreeModule_filterAux(comparer, f, SetTreeNode_1__get_Right(t2), acc_1)
650
+ continue
651
+
652
+ elif f(SetTreeLeaf_1__get_Key(t2)):
653
+ return SetTreeModule_add(comparer, SetTreeLeaf_1__get_Key(t2), acc)
654
+
655
+ else:
656
+ return acc
657
+
658
+ else:
659
+ return acc
660
+
661
+ break
662
+
663
+
664
+ def SetTreeModule_filter(
665
+ comparer: IComparer_1[Any], f: Callable[[__A], bool], s: SetTreeLeaf_1[Any] | None = None
666
+ ) -> SetTreeLeaf_1[Any] | None:
667
+ return SetTreeModule_filterAux(comparer, f, s, SetTreeModule_empty())
668
+
669
+
670
+ def SetTreeModule_diffAux(
671
+ comparer_mut: IComparer_1[Any], t_mut: SetTreeLeaf_1[Any] | None, acc_mut: SetTreeLeaf_1[Any] | None
672
+ ) -> SetTreeLeaf_1[Any] | None:
673
+ while True:
674
+ (comparer, t, acc) = (comparer_mut, t_mut, acc_mut)
675
+ if acc is None:
676
+ return acc
677
+
678
+ elif t is not None:
679
+ t2: SetTreeLeaf_1[_T] = t
680
+ if isinstance(t2, SetTreeNode_1):
681
+ comparer_mut = comparer
682
+ t_mut = SetTreeNode_1__get_Left(t2)
683
+ acc_mut = SetTreeModule_diffAux(
684
+ comparer,
685
+ SetTreeNode_1__get_Right(t2),
686
+ SetTreeModule_remove(comparer, SetTreeLeaf_1__get_Key(t2), acc),
687
+ )
688
+ continue
689
+
690
+ else:
691
+ return SetTreeModule_remove(comparer, SetTreeLeaf_1__get_Key(t2), acc)
692
+
693
+ else:
694
+ return acc
695
+
696
+ break
697
+
698
+
699
+ def SetTreeModule_diff(
700
+ comparer: IComparer_1[Any], a: SetTreeLeaf_1[Any] | None = None, b: SetTreeLeaf_1[Any] | None = None
701
+ ) -> SetTreeLeaf_1[Any] | None:
702
+ return SetTreeModule_diffAux(comparer, b, a)
703
+
704
+
705
+ def SetTreeModule_union(
706
+ comparer: IComparer_1[Any], t1: SetTreeLeaf_1[Any] | None = None, t2: SetTreeLeaf_1[Any] | None = None
707
+ ) -> SetTreeLeaf_1[Any] | None:
708
+ if t1 is not None:
709
+ t1_0027: SetTreeLeaf_1[_T] = t1
710
+ if t2 is not None:
711
+ t2_0027: SetTreeLeaf_1[_T] = t2
712
+ if isinstance(t1_0027, SetTreeNode_1):
713
+ if isinstance(t2_0027, SetTreeNode_1):
714
+ if SetTreeNode_1__get_Height(t1_0027) > SetTreeNode_1__get_Height(t2_0027):
715
+ pattern_input: tuple[SetTreeLeaf_1[_T] | None, bool, SetTreeLeaf_1[_T] | None] = (
716
+ SetTreeModule_split(comparer, SetTreeLeaf_1__get_Key(t1_0027), t2)
717
+ )
718
+ return SetTreeModule_balance(
719
+ comparer,
720
+ SetTreeModule_union(comparer, SetTreeNode_1__get_Left(t1_0027), pattern_input[0]),
721
+ SetTreeLeaf_1__get_Key(t1_0027),
722
+ SetTreeModule_union(comparer, SetTreeNode_1__get_Right(t1_0027), pattern_input[2]),
723
+ )
724
+
725
+ else:
726
+ pattern_input_1: tuple[SetTreeLeaf_1[_T] | None, bool, SetTreeLeaf_1[_T] | None] = (
727
+ SetTreeModule_split(comparer, SetTreeLeaf_1__get_Key(t2_0027), t1)
728
+ )
729
+ return SetTreeModule_balance(
730
+ comparer,
731
+ SetTreeModule_union(comparer, SetTreeNode_1__get_Left(t2_0027), pattern_input_1[0]),
732
+ SetTreeLeaf_1__get_Key(t2_0027),
733
+ SetTreeModule_union(comparer, SetTreeNode_1__get_Right(t2_0027), pattern_input_1[2]),
734
+ )
735
+
736
+ else:
737
+ return SetTreeModule_add(comparer, SetTreeLeaf_1__get_Key(t2_0027), t1)
738
+
739
+ else:
740
+ return SetTreeModule_add(comparer, SetTreeLeaf_1__get_Key(t1_0027), t2)
741
+
742
+ else:
743
+ return t1
744
+
745
+ else:
746
+ return t2
747
+
748
+
749
+ def SetTreeModule_intersectionAux(
750
+ comparer_mut: IComparer_1[Any],
751
+ b_mut: SetTreeLeaf_1[Any] | None,
752
+ t_mut: SetTreeLeaf_1[Any] | None,
753
+ acc_mut: SetTreeLeaf_1[Any] | None,
754
+ ) -> SetTreeLeaf_1[Any] | None:
755
+ while True:
756
+ (comparer, b, t, acc) = (comparer_mut, b_mut, t_mut, acc_mut)
757
+ if t is not None:
758
+ t2: SetTreeLeaf_1[_T] = t
759
+ if isinstance(t2, SetTreeNode_1):
760
+ acc_1: SetTreeLeaf_1[_T] | None = SetTreeModule_intersectionAux(
761
+ comparer, b, SetTreeNode_1__get_Right(t2), acc
762
+ )
763
+ acc_2: SetTreeLeaf_1[_T] | None = (
764
+ SetTreeModule_add(comparer, SetTreeLeaf_1__get_Key(t2), acc_1)
765
+ if SetTreeModule_mem(comparer, SetTreeLeaf_1__get_Key(t2), b)
766
+ else acc_1
767
+ )
768
+ comparer_mut = comparer
769
+ b_mut = b
770
+ t_mut = SetTreeNode_1__get_Left(t2)
771
+ acc_mut = acc_2
772
+ continue
773
+
774
+ elif SetTreeModule_mem(comparer, SetTreeLeaf_1__get_Key(t2), b):
775
+ return SetTreeModule_add(comparer, SetTreeLeaf_1__get_Key(t2), acc)
776
+
777
+ else:
778
+ return acc
779
+
780
+ else:
781
+ return acc
782
+
783
+ break
784
+
785
+
786
+ def SetTreeModule_intersection(
787
+ comparer: IComparer_1[Any], a: SetTreeLeaf_1[Any] | None = None, b: SetTreeLeaf_1[Any] | None = None
788
+ ) -> SetTreeLeaf_1[Any] | None:
789
+ return SetTreeModule_intersectionAux(comparer, b, a, SetTreeModule_empty())
790
+
791
+
792
+ def SetTreeModule_partition1(
793
+ comparer: IComparer_1[Any],
794
+ f: Callable[[__A], bool],
795
+ k: Any,
796
+ acc1: SetTreeLeaf_1[Any] | None = None,
797
+ acc2: SetTreeLeaf_1[Any] | None = None,
798
+ ) -> tuple[SetTreeLeaf_1[__A] | None, SetTreeLeaf_1[__A] | None]:
799
+ if f(k):
800
+ return (SetTreeModule_add(comparer, k, acc1), acc2)
801
+
802
+ else:
803
+ return (acc1, SetTreeModule_add(comparer, k, acc2))
804
+
805
+
806
+ def SetTreeModule_partitionAux(
807
+ comparer_mut: IComparer_1[Any],
808
+ f_mut: Callable[[_T], bool],
809
+ t_mut: SetTreeLeaf_1[Any] | None,
810
+ acc__mut: SetTreeLeaf_1[Any] | None,
811
+ acc__1_mut: SetTreeLeaf_1[Any] | None,
812
+ ) -> tuple[SetTreeLeaf_1[_T] | None, SetTreeLeaf_1[_T] | None]:
813
+ while True:
814
+ (comparer, f, t, acc_, acc__1) = (comparer_mut, f_mut, t_mut, acc__mut, acc__1_mut)
815
+ acc: tuple[SetTreeLeaf_1[_T] | None, SetTreeLeaf_1[_T] | None] = (acc_, acc__1)
816
+ if t is not None:
817
+ t2: SetTreeLeaf_1[_T] = t
818
+ if isinstance(t2, SetTreeNode_1):
819
+ acc_1: tuple[SetTreeLeaf_1[_T] | None, SetTreeLeaf_1[_T] | None] = SetTreeModule_partitionAux(
820
+ comparer, f, SetTreeNode_1__get_Right(t2), acc[0], acc[1]
821
+ )
822
+ acc_4: tuple[SetTreeLeaf_1[_T] | None, SetTreeLeaf_1[_T] | None] = SetTreeModule_partition1(
823
+ comparer, f, SetTreeLeaf_1__get_Key(t2), acc_1[0], acc_1[1]
824
+ )
825
+ comparer_mut = comparer
826
+ f_mut = f
827
+ t_mut = SetTreeNode_1__get_Left(t2)
828
+ acc__mut = acc_4[0]
829
+ acc__1_mut = acc_4[1]
830
+ continue
831
+
832
+ else:
833
+ return SetTreeModule_partition1(comparer, f, SetTreeLeaf_1__get_Key(t2), acc[0], acc[1])
834
+
835
+ else:
836
+ return acc
837
+
838
+ break
839
+
840
+
841
+ def SetTreeModule_partition(
842
+ comparer: IComparer_1[Any], f: Callable[[__A], bool], s: SetTreeLeaf_1[Any] | None = None
843
+ ) -> tuple[SetTreeLeaf_1[__A] | None, SetTreeLeaf_1[__A] | None]:
844
+ return SetTreeModule_partitionAux(comparer, f, s, SetTreeModule_empty(), SetTreeModule_empty())
845
+
846
+
847
+ def SetTreeModule_minimumElementAux(t_mut: SetTreeLeaf_1[Any] | None, n_mut: Any) -> Any:
848
+ while True:
849
+ (t, n) = (t_mut, n_mut)
850
+ if t is not None:
851
+ t2: SetTreeLeaf_1[_T] = t
852
+ if isinstance(t2, SetTreeNode_1):
853
+ t_mut = SetTreeNode_1__get_Left(t2)
854
+ n_mut = SetTreeLeaf_1__get_Key(t2)
855
+ continue
856
+
857
+ else:
858
+ return SetTreeLeaf_1__get_Key(t2)
859
+
860
+ else:
861
+ return n
862
+
863
+ break
864
+
865
+
866
+ def SetTreeModule_minimumElementOpt(t: SetTreeLeaf_1[Any] | None = None) -> Any | None:
867
+ if t is not None:
868
+ t2: SetTreeLeaf_1[_T] = t
869
+ if isinstance(t2, SetTreeNode_1):
870
+ return some(SetTreeModule_minimumElementAux(SetTreeNode_1__get_Left(t2), SetTreeLeaf_1__get_Key(t2)))
871
+
872
+ else:
873
+ return some(SetTreeLeaf_1__get_Key(t2))
874
+
875
+ else:
876
+ return None
877
+
878
+
879
+ def SetTreeModule_maximumElementAux(t_mut: SetTreeLeaf_1[Any] | None, n_mut: Any) -> Any:
880
+ while True:
881
+ (t, n) = (t_mut, n_mut)
882
+ if t is not None:
883
+ t2: SetTreeLeaf_1[_T] = t
884
+ if isinstance(t2, SetTreeNode_1):
885
+ t_mut = SetTreeNode_1__get_Right(t2)
886
+ n_mut = SetTreeLeaf_1__get_Key(t2)
887
+ continue
888
+
889
+ else:
890
+ return SetTreeLeaf_1__get_Key(t2)
891
+
892
+ else:
893
+ return n
894
+
895
+ break
896
+
897
+
898
+ def SetTreeModule_maximumElementOpt(t: SetTreeLeaf_1[Any] | None = None) -> Any | None:
899
+ if t is not None:
900
+ t2: SetTreeLeaf_1[_T] = t
901
+ if isinstance(t2, SetTreeNode_1):
902
+ return some(SetTreeModule_maximumElementAux(SetTreeNode_1__get_Right(t2), SetTreeLeaf_1__get_Key(t2)))
903
+
904
+ else:
905
+ return some(SetTreeLeaf_1__get_Key(t2))
906
+
907
+ else:
908
+ return None
909
+
910
+
911
+ def SetTreeModule_minimumElement(s: SetTreeLeaf_1[Any] | None = None) -> Any:
912
+ match_value: __A | None = SetTreeModule_minimumElementOpt(s)
913
+ if match_value is None:
914
+ raise Exception("Set contains no elements")
915
+
916
+ else:
917
+ return value_3(match_value)
918
+
919
+
920
+ def SetTreeModule_maximumElement(s: SetTreeLeaf_1[Any] | None = None) -> Any:
921
+ match_value: __A | None = SetTreeModule_maximumElementOpt(s)
922
+ if match_value is None:
923
+ raise Exception("Set contains no elements")
924
+
925
+ else:
926
+ return value_3(match_value)
927
+
928
+
929
+ def _expr238(gen0: TypeInfo) -> TypeInfo:
930
+ return record_type(
931
+ "Set.SetTreeModule.SetIterator`1",
932
+ [gen0],
933
+ SetTreeModule_SetIterator_1,
934
+ lambda: [("stack", list_type(option_type(SetTreeLeaf_1_reflection(gen0)))), ("started", bool_type)],
935
+ )
936
+
937
+
938
+ @dataclass(eq=False, repr=False, slots=True)
939
+ class SetTreeModule_SetIterator_1(Record, Generic[_T]):
940
+ stack: FSharpList[SetTreeLeaf_1[_T] | None]
941
+ started: bool
942
+
943
+
944
+ SetTreeModule_SetIterator_1_reflection = _expr238
945
+
946
+
947
+ def SetTreeModule_collapseLHS(
948
+ stack_mut: FSharpList[SetTreeLeaf_1[Any] | None],
949
+ ) -> FSharpList[SetTreeLeaf_1[Any] | None]:
950
+ while True:
951
+ (stack,) = (stack_mut,)
952
+ if not is_empty_1(stack):
953
+ x: SetTreeLeaf_1[_T] | None = head(stack)
954
+ rest: FSharpList[SetTreeLeaf_1[_T] | None] = tail(stack)
955
+ if x is not None:
956
+ x2: SetTreeLeaf_1[_T] = x
957
+ if isinstance(x2, SetTreeNode_1):
958
+ stack_mut = of_array_with_tail(
959
+ [
960
+ SetTreeNode_1__get_Left(x2),
961
+ SetTreeLeaf_1__ctor_2B595(SetTreeLeaf_1__get_Key(x2)),
962
+ SetTreeNode_1__get_Right(x2),
963
+ ],
964
+ rest,
965
+ )
966
+ continue
967
+
968
+ else:
969
+ return stack
970
+
971
+ else:
972
+ stack_mut = rest
973
+ continue
974
+
975
+ else:
976
+ return empty_1()
977
+
978
+ break
979
+
980
+
981
+ def SetTreeModule_mkIterator(s: SetTreeLeaf_1[Any] | None = None) -> SetTreeModule_SetIterator_1[Any]:
982
+ return SetTreeModule_SetIterator_1(SetTreeModule_collapseLHS(singleton_1(s)), False)
983
+
984
+
985
+ def SetTreeModule_notStarted(__unit: None = None) -> Any:
986
+ raise Exception("Enumeration not started")
987
+
988
+
989
+ def SetTreeModule_alreadyFinished(__unit: None = None) -> Any:
990
+ raise Exception("Enumeration already started")
991
+
992
+
993
+ def SetTreeModule_current(i: SetTreeModule_SetIterator_1[Any]) -> Any:
994
+ if i.started:
995
+ match_value: FSharpList[SetTreeLeaf_1[__A] | None] = i.stack
996
+ if is_empty_1(match_value):
997
+ return SetTreeModule_alreadyFinished()
998
+
999
+ elif head(match_value) is not None:
1000
+ t: SetTreeLeaf_1[__A] = head(match_value)
1001
+ return SetTreeLeaf_1__get_Key(t)
1002
+
1003
+ else:
1004
+ raise Exception("Please report error: Set iterator, unexpected stack for current")
1005
+
1006
+ else:
1007
+ return SetTreeModule_notStarted()
1008
+
1009
+
1010
+ def SetTreeModule_moveNext(i: SetTreeModule_SetIterator_1[Any]) -> bool:
1011
+ if i.started:
1012
+ match_value: FSharpList[SetTreeLeaf_1[_T] | None] = i.stack
1013
+ if not is_empty_1(match_value):
1014
+ if head(match_value) is not None:
1015
+ t: SetTreeLeaf_1[_T] = head(match_value)
1016
+ if isinstance(t, SetTreeNode_1):
1017
+ raise Exception("Please report error: Set iterator, unexpected stack for moveNext")
1018
+
1019
+ else:
1020
+ i.stack = SetTreeModule_collapseLHS(tail(match_value))
1021
+ return not is_empty_1(i.stack)
1022
+
1023
+ else:
1024
+ raise Exception("Please report error: Set iterator, unexpected stack for moveNext")
1025
+
1026
+ else:
1027
+ return False
1028
+
1029
+ else:
1030
+ i.started = True
1031
+ return not is_empty_1(i.stack)
1032
+
1033
+
1034
+ def SetTreeModule_mkIEnumerator(s: SetTreeLeaf_1[Any] | None = None) -> IEnumerator[Any]:
1035
+ i: SetTreeModule_SetIterator_1[_A] = SetTreeModule_mkIterator(s)
1036
+
1037
+ class ObjectExpr239(IEnumerator[_A_]):
1038
+ def System_Collections_Generic_IEnumerator_1_get_Current(self, __unit: None = None, s: Any = s) -> _A_:
1039
+ return SetTreeModule_current(i)
1040
+
1041
+ def System_Collections_IEnumerator_get_Current(self, __unit: None = None, s: Any = s) -> Any:
1042
+ return SetTreeModule_current(i)
1043
+
1044
+ def System_Collections_IEnumerator_MoveNext(self, __unit: None = None, s: Any = s) -> bool:
1045
+ return SetTreeModule_moveNext(i)
1046
+
1047
+ def System_Collections_IEnumerator_Reset(self, __unit: None = None, s: Any = s) -> None:
1048
+ nonlocal i
1049
+ i = SetTreeModule_mkIterator(s)
1050
+
1051
+ def Dispose(self, __unit: None = None, s: Any = s) -> None:
1052
+ pass
1053
+
1054
+ return ObjectExpr239()
1055
+
1056
+
1057
+ def SetTreeModule_compareStacks(
1058
+ comparer_mut: IComparer_1[Any],
1059
+ l1_mut: FSharpList[SetTreeLeaf_1[Any] | None],
1060
+ l2_mut: FSharpList[SetTreeLeaf_1[Any] | None],
1061
+ ) -> int:
1062
+ while True:
1063
+ (comparer, l1, l2) = (comparer_mut, l1_mut, l2_mut)
1064
+ if not is_empty_1(l1):
1065
+ if not is_empty_1(l2):
1066
+ if head(l2) is not None:
1067
+ if head(l1) is not None:
1068
+ x1_3: SetTreeLeaf_1[_T] = head(l1)
1069
+ x2_3: SetTreeLeaf_1[_T] = head(l2)
1070
+ if isinstance(x1_3, SetTreeNode_1):
1071
+ if SetTreeNode_1__get_Left(x1_3) is None:
1072
+ if isinstance(x2_3, SetTreeNode_1):
1073
+ if SetTreeNode_1__get_Left(x2_3) is None:
1074
+ c: int = (
1075
+ comparer.Compare(SetTreeLeaf_1__get_Key(x1_3), SetTreeLeaf_1__get_Key(x2_3))
1076
+ or 0
1077
+ )
1078
+ if c != 0:
1079
+ return c
1080
+
1081
+ else:
1082
+ comparer_mut = comparer
1083
+ l1_mut = cons(SetTreeNode_1__get_Right(x1_3), tail(l1))
1084
+ l2_mut = cons(SetTreeNode_1__get_Right(x2_3), tail(l2))
1085
+ continue
1086
+
1087
+ else:
1088
+ (pattern_matching_result, t1_6, x1_4, t2_6, x2_4) = (
1089
+ None,
1090
+ None,
1091
+ None,
1092
+ None,
1093
+ None,
1094
+ )
1095
+ if not is_empty_1(l1):
1096
+ if head(l1) is not None:
1097
+ pattern_matching_result = 0
1098
+ t1_6 = tail(l1)
1099
+ x1_4 = head(l1)
1100
+
1101
+ elif not is_empty_1(l2):
1102
+ if head(l2) is not None:
1103
+ pattern_matching_result = 1
1104
+ t2_6 = tail(l2)
1105
+ x2_4 = head(l2)
1106
+
1107
+ else:
1108
+ pattern_matching_result = 2
1109
+
1110
+ else:
1111
+ pattern_matching_result = 2
1112
+
1113
+ elif not is_empty_1(l2):
1114
+ if head(l2) is not None:
1115
+ pattern_matching_result = 1
1116
+ t2_6 = tail(l2)
1117
+ x2_4 = head(l2)
1118
+
1119
+ else:
1120
+ pattern_matching_result = 2
1121
+
1122
+ else:
1123
+ pattern_matching_result = 2
1124
+
1125
+ if pattern_matching_result == 0:
1126
+ if isinstance(x1_4, SetTreeNode_1):
1127
+ comparer_mut = comparer
1128
+ l1_mut = of_array_with_tail(
1129
+ [
1130
+ SetTreeNode_1__get_Left(x1_4),
1131
+ SetTreeNode_1__ctor_5F465FC9(
1132
+ SetTreeLeaf_1__get_Key(x1_4),
1133
+ SetTreeModule_empty(),
1134
+ SetTreeNode_1__get_Right(x1_4),
1135
+ 0,
1136
+ ),
1137
+ ],
1138
+ t1_6,
1139
+ )
1140
+ l2_mut = l2
1141
+ continue
1142
+
1143
+ else:
1144
+ comparer_mut = comparer
1145
+ l1_mut = of_array_with_tail(
1146
+ [
1147
+ SetTreeModule_empty(),
1148
+ SetTreeLeaf_1__ctor_2B595(SetTreeLeaf_1__get_Key(x1_4)),
1149
+ ],
1150
+ t1_6,
1151
+ )
1152
+ l2_mut = l2
1153
+ continue
1154
+
1155
+ elif pattern_matching_result == 1:
1156
+ if isinstance(x2_4, SetTreeNode_1):
1157
+ comparer_mut = comparer
1158
+ l1_mut = l1
1159
+ l2_mut = of_array_with_tail(
1160
+ [
1161
+ SetTreeNode_1__get_Left(x2_4),
1162
+ SetTreeNode_1__ctor_5F465FC9(
1163
+ SetTreeLeaf_1__get_Key(x2_4),
1164
+ SetTreeModule_empty(),
1165
+ SetTreeNode_1__get_Right(x2_4),
1166
+ 0,
1167
+ ),
1168
+ ],
1169
+ t2_6,
1170
+ )
1171
+ continue
1172
+
1173
+ else:
1174
+ comparer_mut = comparer
1175
+ l1_mut = l1
1176
+ l2_mut = of_array_with_tail(
1177
+ [
1178
+ SetTreeModule_empty(),
1179
+ SetTreeLeaf_1__ctor_2B595(SetTreeLeaf_1__get_Key(x2_4)),
1180
+ ],
1181
+ t2_6,
1182
+ )
1183
+ continue
1184
+
1185
+ elif pattern_matching_result == 2:
1186
+ raise Exception("unexpected state in SetTree.compareStacks")
1187
+
1188
+ else:
1189
+ c_1: int = (
1190
+ comparer.Compare(SetTreeLeaf_1__get_Key(x1_3), SetTreeLeaf_1__get_Key(x2_3))
1191
+ or 0
1192
+ )
1193
+ if c_1 != 0:
1194
+ return c_1
1195
+
1196
+ else:
1197
+ comparer_mut = comparer
1198
+ l1_mut = cons(SetTreeNode_1__get_Right(x1_3), tail(l1))
1199
+ l2_mut = cons(SetTreeModule_empty(), tail(l2))
1200
+ continue
1201
+
1202
+ else:
1203
+ (pattern_matching_result_1, t1_7, x1_5, t2_7, x2_5) = (None, None, None, None, None)
1204
+ if not is_empty_1(l1):
1205
+ if head(l1) is not None:
1206
+ pattern_matching_result_1 = 0
1207
+ t1_7 = tail(l1)
1208
+ x1_5 = head(l1)
1209
+
1210
+ elif not is_empty_1(l2):
1211
+ if head(l2) is not None:
1212
+ pattern_matching_result_1 = 1
1213
+ t2_7 = tail(l2)
1214
+ x2_5 = head(l2)
1215
+
1216
+ else:
1217
+ pattern_matching_result_1 = 2
1218
+
1219
+ else:
1220
+ pattern_matching_result_1 = 2
1221
+
1222
+ elif not is_empty_1(l2):
1223
+ if head(l2) is not None:
1224
+ pattern_matching_result_1 = 1
1225
+ t2_7 = tail(l2)
1226
+ x2_5 = head(l2)
1227
+
1228
+ else:
1229
+ pattern_matching_result_1 = 2
1230
+
1231
+ else:
1232
+ pattern_matching_result_1 = 2
1233
+
1234
+ if pattern_matching_result_1 == 0:
1235
+ if isinstance(x1_5, SetTreeNode_1):
1236
+ comparer_mut = comparer
1237
+ l1_mut = of_array_with_tail(
1238
+ [
1239
+ SetTreeNode_1__get_Left(x1_5),
1240
+ SetTreeNode_1__ctor_5F465FC9(
1241
+ SetTreeLeaf_1__get_Key(x1_5),
1242
+ SetTreeModule_empty(),
1243
+ SetTreeNode_1__get_Right(x1_5),
1244
+ 0,
1245
+ ),
1246
+ ],
1247
+ t1_7,
1248
+ )
1249
+ l2_mut = l2
1250
+ continue
1251
+
1252
+ else:
1253
+ comparer_mut = comparer
1254
+ l1_mut = of_array_with_tail(
1255
+ [
1256
+ SetTreeModule_empty(),
1257
+ SetTreeLeaf_1__ctor_2B595(SetTreeLeaf_1__get_Key(x1_5)),
1258
+ ],
1259
+ t1_7,
1260
+ )
1261
+ l2_mut = l2
1262
+ continue
1263
+
1264
+ elif pattern_matching_result_1 == 1:
1265
+ if isinstance(x2_5, SetTreeNode_1):
1266
+ comparer_mut = comparer
1267
+ l1_mut = l1
1268
+ l2_mut = of_array_with_tail(
1269
+ [
1270
+ SetTreeNode_1__get_Left(x2_5),
1271
+ SetTreeNode_1__ctor_5F465FC9(
1272
+ SetTreeLeaf_1__get_Key(x2_5),
1273
+ SetTreeModule_empty(),
1274
+ SetTreeNode_1__get_Right(x2_5),
1275
+ 0,
1276
+ ),
1277
+ ],
1278
+ t2_7,
1279
+ )
1280
+ continue
1281
+
1282
+ else:
1283
+ comparer_mut = comparer
1284
+ l1_mut = l1
1285
+ l2_mut = of_array_with_tail(
1286
+ [
1287
+ SetTreeModule_empty(),
1288
+ SetTreeLeaf_1__ctor_2B595(SetTreeLeaf_1__get_Key(x2_5)),
1289
+ ],
1290
+ t2_7,
1291
+ )
1292
+ continue
1293
+
1294
+ elif pattern_matching_result_1 == 2:
1295
+ raise Exception("unexpected state in SetTree.compareStacks")
1296
+
1297
+ elif isinstance(x2_3, SetTreeNode_1):
1298
+ if SetTreeNode_1__get_Left(x2_3) is None:
1299
+ c_2: int = (
1300
+ comparer.Compare(SetTreeLeaf_1__get_Key(x1_3), SetTreeLeaf_1__get_Key(x2_3)) or 0
1301
+ )
1302
+ if c_2 != 0:
1303
+ return c_2
1304
+
1305
+ else:
1306
+ comparer_mut = comparer
1307
+ l1_mut = cons(SetTreeModule_empty(), tail(l1))
1308
+ l2_mut = cons(SetTreeNode_1__get_Right(x2_3), tail(l2))
1309
+ continue
1310
+
1311
+ else:
1312
+ (pattern_matching_result_2, t1_8, x1_6, t2_8, x2_6) = (None, None, None, None, None)
1313
+ if not is_empty_1(l1):
1314
+ if head(l1) is not None:
1315
+ pattern_matching_result_2 = 0
1316
+ t1_8 = tail(l1)
1317
+ x1_6 = head(l1)
1318
+
1319
+ elif not is_empty_1(l2):
1320
+ if head(l2) is not None:
1321
+ pattern_matching_result_2 = 1
1322
+ t2_8 = tail(l2)
1323
+ x2_6 = head(l2)
1324
+
1325
+ else:
1326
+ pattern_matching_result_2 = 2
1327
+
1328
+ else:
1329
+ pattern_matching_result_2 = 2
1330
+
1331
+ elif not is_empty_1(l2):
1332
+ if head(l2) is not None:
1333
+ pattern_matching_result_2 = 1
1334
+ t2_8 = tail(l2)
1335
+ x2_6 = head(l2)
1336
+
1337
+ else:
1338
+ pattern_matching_result_2 = 2
1339
+
1340
+ else:
1341
+ pattern_matching_result_2 = 2
1342
+
1343
+ if pattern_matching_result_2 == 0:
1344
+ if isinstance(x1_6, SetTreeNode_1):
1345
+ comparer_mut = comparer
1346
+ l1_mut = of_array_with_tail(
1347
+ [
1348
+ SetTreeNode_1__get_Left(x1_6),
1349
+ SetTreeNode_1__ctor_5F465FC9(
1350
+ SetTreeLeaf_1__get_Key(x1_6),
1351
+ SetTreeModule_empty(),
1352
+ SetTreeNode_1__get_Right(x1_6),
1353
+ 0,
1354
+ ),
1355
+ ],
1356
+ t1_8,
1357
+ )
1358
+ l2_mut = l2
1359
+ continue
1360
+
1361
+ else:
1362
+ comparer_mut = comparer
1363
+ l1_mut = of_array_with_tail(
1364
+ [
1365
+ SetTreeModule_empty(),
1366
+ SetTreeLeaf_1__ctor_2B595(SetTreeLeaf_1__get_Key(x1_6)),
1367
+ ],
1368
+ t1_8,
1369
+ )
1370
+ l2_mut = l2
1371
+ continue
1372
+
1373
+ elif pattern_matching_result_2 == 1:
1374
+ if isinstance(x2_6, SetTreeNode_1):
1375
+ comparer_mut = comparer
1376
+ l1_mut = l1
1377
+ l2_mut = of_array_with_tail(
1378
+ [
1379
+ SetTreeNode_1__get_Left(x2_6),
1380
+ SetTreeNode_1__ctor_5F465FC9(
1381
+ SetTreeLeaf_1__get_Key(x2_6),
1382
+ SetTreeModule_empty(),
1383
+ SetTreeNode_1__get_Right(x2_6),
1384
+ 0,
1385
+ ),
1386
+ ],
1387
+ t2_8,
1388
+ )
1389
+ continue
1390
+
1391
+ else:
1392
+ comparer_mut = comparer
1393
+ l1_mut = l1
1394
+ l2_mut = of_array_with_tail(
1395
+ [
1396
+ SetTreeModule_empty(),
1397
+ SetTreeLeaf_1__ctor_2B595(SetTreeLeaf_1__get_Key(x2_6)),
1398
+ ],
1399
+ t2_8,
1400
+ )
1401
+ continue
1402
+
1403
+ elif pattern_matching_result_2 == 2:
1404
+ raise Exception("unexpected state in SetTree.compareStacks")
1405
+
1406
+ else:
1407
+ c_3: int = comparer.Compare(SetTreeLeaf_1__get_Key(x1_3), SetTreeLeaf_1__get_Key(x2_3)) or 0
1408
+ if c_3 != 0:
1409
+ return c_3
1410
+
1411
+ else:
1412
+ comparer_mut = comparer
1413
+ l1_mut = tail(l1)
1414
+ l2_mut = tail(l2)
1415
+ continue
1416
+
1417
+ else:
1418
+ x2: SetTreeLeaf_1[_T] = head(l2)
1419
+ (pattern_matching_result_3, t1_2, x1, t2_2, x2_1) = (None, None, None, None, None)
1420
+ if not is_empty_1(l1):
1421
+ if head(l1) is not None:
1422
+ pattern_matching_result_3 = 0
1423
+ t1_2 = tail(l1)
1424
+ x1 = head(l1)
1425
+
1426
+ elif not is_empty_1(l2):
1427
+ if head(l2) is not None:
1428
+ pattern_matching_result_3 = 1
1429
+ t2_2 = tail(l2)
1430
+ x2_1 = head(l2)
1431
+
1432
+ else:
1433
+ pattern_matching_result_3 = 2
1434
+
1435
+ else:
1436
+ pattern_matching_result_3 = 2
1437
+
1438
+ elif not is_empty_1(l2):
1439
+ if head(l2) is not None:
1440
+ pattern_matching_result_3 = 1
1441
+ t2_2 = tail(l2)
1442
+ x2_1 = head(l2)
1443
+
1444
+ else:
1445
+ pattern_matching_result_3 = 2
1446
+
1447
+ else:
1448
+ pattern_matching_result_3 = 2
1449
+
1450
+ if pattern_matching_result_3 == 0:
1451
+ if isinstance(x1, SetTreeNode_1):
1452
+ comparer_mut = comparer
1453
+ l1_mut = of_array_with_tail(
1454
+ [
1455
+ SetTreeNode_1__get_Left(x1),
1456
+ SetTreeNode_1__ctor_5F465FC9(
1457
+ SetTreeLeaf_1__get_Key(x1),
1458
+ SetTreeModule_empty(),
1459
+ SetTreeNode_1__get_Right(x1),
1460
+ 0,
1461
+ ),
1462
+ ],
1463
+ t1_2,
1464
+ )
1465
+ l2_mut = l2
1466
+ continue
1467
+
1468
+ else:
1469
+ comparer_mut = comparer
1470
+ l1_mut = of_array_with_tail(
1471
+ [SetTreeModule_empty(), SetTreeLeaf_1__ctor_2B595(SetTreeLeaf_1__get_Key(x1))], t1_2
1472
+ )
1473
+ l2_mut = l2
1474
+ continue
1475
+
1476
+ elif pattern_matching_result_3 == 1:
1477
+ if isinstance(x2_1, SetTreeNode_1):
1478
+ comparer_mut = comparer
1479
+ l1_mut = l1
1480
+ l2_mut = of_array_with_tail(
1481
+ [
1482
+ SetTreeNode_1__get_Left(x2_1),
1483
+ SetTreeNode_1__ctor_5F465FC9(
1484
+ SetTreeLeaf_1__get_Key(x2_1),
1485
+ SetTreeModule_empty(),
1486
+ SetTreeNode_1__get_Right(x2_1),
1487
+ 0,
1488
+ ),
1489
+ ],
1490
+ t2_2,
1491
+ )
1492
+ continue
1493
+
1494
+ else:
1495
+ comparer_mut = comparer
1496
+ l1_mut = l1
1497
+ l2_mut = of_array_with_tail(
1498
+ [SetTreeModule_empty(), SetTreeLeaf_1__ctor_2B595(SetTreeLeaf_1__get_Key(x2_1))],
1499
+ t2_2,
1500
+ )
1501
+ continue
1502
+
1503
+ elif pattern_matching_result_3 == 2:
1504
+ raise Exception("unexpected state in SetTree.compareStacks")
1505
+
1506
+ elif head(l1) is not None:
1507
+ x1_1: SetTreeLeaf_1[_T] = head(l1)
1508
+ (pattern_matching_result_4, t1_4, x1_2, t2_4, x2_2) = (None, None, None, None, None)
1509
+ if not is_empty_1(l1):
1510
+ if head(l1) is not None:
1511
+ pattern_matching_result_4 = 0
1512
+ t1_4 = tail(l1)
1513
+ x1_2 = head(l1)
1514
+
1515
+ elif not is_empty_1(l2):
1516
+ if head(l2) is not None:
1517
+ pattern_matching_result_4 = 1
1518
+ t2_4 = tail(l2)
1519
+ x2_2 = head(l2)
1520
+
1521
+ else:
1522
+ pattern_matching_result_4 = 2
1523
+
1524
+ else:
1525
+ pattern_matching_result_4 = 2
1526
+
1527
+ elif not is_empty_1(l2):
1528
+ if head(l2) is not None:
1529
+ pattern_matching_result_4 = 1
1530
+ t2_4 = tail(l2)
1531
+ x2_2 = head(l2)
1532
+
1533
+ else:
1534
+ pattern_matching_result_4 = 2
1535
+
1536
+ else:
1537
+ pattern_matching_result_4 = 2
1538
+
1539
+ if pattern_matching_result_4 == 0:
1540
+ if isinstance(x1_2, SetTreeNode_1):
1541
+ comparer_mut = comparer
1542
+ l1_mut = of_array_with_tail(
1543
+ [
1544
+ SetTreeNode_1__get_Left(x1_2),
1545
+ SetTreeNode_1__ctor_5F465FC9(
1546
+ SetTreeLeaf_1__get_Key(x1_2),
1547
+ SetTreeModule_empty(),
1548
+ SetTreeNode_1__get_Right(x1_2),
1549
+ 0,
1550
+ ),
1551
+ ],
1552
+ t1_4,
1553
+ )
1554
+ l2_mut = l2
1555
+ continue
1556
+
1557
+ else:
1558
+ comparer_mut = comparer
1559
+ l1_mut = of_array_with_tail(
1560
+ [SetTreeModule_empty(), SetTreeLeaf_1__ctor_2B595(SetTreeLeaf_1__get_Key(x1_2))], t1_4
1561
+ )
1562
+ l2_mut = l2
1563
+ continue
1564
+
1565
+ elif pattern_matching_result_4 == 1:
1566
+ if isinstance(x2_2, SetTreeNode_1):
1567
+ comparer_mut = comparer
1568
+ l1_mut = l1
1569
+ l2_mut = of_array_with_tail(
1570
+ [
1571
+ SetTreeNode_1__get_Left(x2_2),
1572
+ SetTreeNode_1__ctor_5F465FC9(
1573
+ SetTreeLeaf_1__get_Key(x2_2),
1574
+ SetTreeModule_empty(),
1575
+ SetTreeNode_1__get_Right(x2_2),
1576
+ 0,
1577
+ ),
1578
+ ],
1579
+ t2_4,
1580
+ )
1581
+ continue
1582
+
1583
+ else:
1584
+ comparer_mut = comparer
1585
+ l1_mut = l1
1586
+ l2_mut = of_array_with_tail(
1587
+ [SetTreeModule_empty(), SetTreeLeaf_1__ctor_2B595(SetTreeLeaf_1__get_Key(x2_2))], t2_4
1588
+ )
1589
+ continue
1590
+
1591
+ elif pattern_matching_result_4 == 2:
1592
+ raise Exception("unexpected state in SetTree.compareStacks")
1593
+
1594
+ else:
1595
+ comparer_mut = comparer
1596
+ l1_mut = tail(l1)
1597
+ l2_mut = tail(l2)
1598
+ continue
1599
+
1600
+ else:
1601
+ return 1
1602
+
1603
+ elif is_empty_1(l2):
1604
+ return 0
1605
+
1606
+ else:
1607
+ return -1
1608
+
1609
+ break
1610
+
1611
+
1612
+ def SetTreeModule_compare(
1613
+ comparer: IComparer_1[Any], t1: SetTreeLeaf_1[Any] | None = None, t2: SetTreeLeaf_1[Any] | None = None
1614
+ ) -> int:
1615
+ if t1 is None:
1616
+ if t2 is None:
1617
+ return 0
1618
+
1619
+ else:
1620
+ return -1
1621
+
1622
+ elif t2 is None:
1623
+ return 1
1624
+
1625
+ else:
1626
+ return SetTreeModule_compareStacks(comparer, singleton_1(t1), singleton_1(t2))
1627
+
1628
+
1629
+ def SetTreeModule_choose(s: SetTreeLeaf_1[Any] | None = None) -> Any:
1630
+ return SetTreeModule_minimumElement(s)
1631
+
1632
+
1633
+ def SetTreeModule_toList(t: SetTreeLeaf_1[Any] | None = None) -> FSharpList[Any]:
1634
+ def loop(t_0027_mut: SetTreeLeaf_1[_T] | None, acc_mut: FSharpList[_T], t: Any = t) -> FSharpList[_T]:
1635
+ while True:
1636
+ (t_0027, acc) = (t_0027_mut, acc_mut)
1637
+ if t_0027 is not None:
1638
+ t2: SetTreeLeaf_1[_T] = t_0027
1639
+ if isinstance(t2, SetTreeNode_1):
1640
+ t_0027_mut = SetTreeNode_1__get_Left(t2)
1641
+ acc_mut = cons(SetTreeLeaf_1__get_Key(t2), loop(SetTreeNode_1__get_Right(t2), acc))
1642
+ continue
1643
+
1644
+ else:
1645
+ return cons(SetTreeLeaf_1__get_Key(t2), acc)
1646
+
1647
+ else:
1648
+ return acc
1649
+
1650
+ break
1651
+
1652
+ return loop(t, empty_1())
1653
+
1654
+
1655
+ def SetTreeModule_copyToArray(s: SetTreeLeaf_1[Any] | None, arr: Array[Any], i: int) -> None:
1656
+ j: int = i or 0
1657
+
1658
+ def _arrow240(x: __A | None = None, s: Any = s, arr: Any = arr, i: Any = i) -> None:
1659
+ nonlocal j
1660
+ arr[j] = x
1661
+ j = (j + 1) or 0
1662
+
1663
+ SetTreeModule_iter(_arrow240, s)
1664
+
1665
+
1666
+ def SetTreeModule_toArray(s: SetTreeLeaf_1[Any] | None = None) -> Array[Any]:
1667
+ n: int = SetTreeModule_count(s) or 0
1668
+ res: Array[__A] = fill([0] * n, 0, n, None)
1669
+ SetTreeModule_copyToArray(s, res, 0)
1670
+ return res
1671
+
1672
+
1673
+ def SetTreeModule_mkFromEnumerator(
1674
+ comparer_mut: IComparer_1[Any], acc_mut: SetTreeLeaf_1[Any] | None, e_mut: IEnumerator[Any]
1675
+ ) -> SetTreeLeaf_1[Any] | None:
1676
+ while True:
1677
+ (comparer, acc, e) = (comparer_mut, acc_mut, e_mut)
1678
+ if e.System_Collections_IEnumerator_MoveNext():
1679
+ comparer_mut = comparer
1680
+ acc_mut = SetTreeModule_add(comparer, e.System_Collections_Generic_IEnumerator_1_get_Current(), acc)
1681
+ e_mut = e
1682
+ continue
1683
+
1684
+ else:
1685
+ return acc
1686
+
1687
+ break
1688
+
1689
+
1690
+ def SetTreeModule_ofArray(comparer: IComparer_1[Any], l: Array[Any]) -> SetTreeLeaf_1[Any] | None:
1691
+ def _arrow241(
1692
+ acc: SetTreeLeaf_1[__A] | None, k: __A, comparer: Any = comparer, l: Any = l
1693
+ ) -> SetTreeLeaf_1[__A] | None:
1694
+ return SetTreeModule_add(comparer, k, acc)
1695
+
1696
+ return fold_1(_arrow241, SetTreeModule_empty(), l)
1697
+
1698
+
1699
+ def SetTreeModule_ofList(comparer: IComparer_1[Any], l: FSharpList[Any]) -> SetTreeLeaf_1[Any] | None:
1700
+ def _arrow242(
1701
+ acc: SetTreeLeaf_1[__A] | None, k: __A, comparer: Any = comparer, l: Any = l
1702
+ ) -> SetTreeLeaf_1[__A] | None:
1703
+ return SetTreeModule_add(comparer, k, acc)
1704
+
1705
+ return fold_2(_arrow242, SetTreeModule_empty(), l)
1706
+
1707
+
1708
+ def SetTreeModule_ofSeq(comparer: IComparer_1[Any], c: IEnumerable_1[Any]) -> SetTreeLeaf_1[Any] | None:
1709
+ if is_array_like(c):
1710
+ return SetTreeModule_ofArray(comparer, c)
1711
+
1712
+ elif isinstance(c, FSharpList):
1713
+ return SetTreeModule_ofList(comparer, c)
1714
+
1715
+ else:
1716
+ with get_enumerator(c) as ie:
1717
+ return SetTreeModule_mkFromEnumerator(comparer, SetTreeModule_empty(), ie)
1718
+
1719
+
1720
+ def _expr244(gen0: TypeInfo) -> TypeInfo:
1721
+ return class_type("Set.FSharpSet", [gen0], FSharpSet)
1722
+
1723
+
1724
+ class FSharpSet(Generic[_T]):
1725
+ def __init__(self, comparer: IComparer_1[Any], tree: SetTreeLeaf_1[Any] | None = None) -> None:
1726
+ self.comparer: IComparer_1[_T] = comparer
1727
+ self.tree: SetTreeLeaf_1[_T] | None = tree
1728
+
1729
+ def __hash__(self, __unit: None = None) -> int:
1730
+ this: FSharpSet[_T] = self
1731
+ return FSharpSet__ComputeHashCode(this)
1732
+
1733
+ def __eq__(self, that: Any = None) -> bool:
1734
+ this: FSharpSet[_T] = self
1735
+ return (
1736
+ (
1737
+ SetTreeModule_compare(
1738
+ FSharpSet__get_Comparer(this), FSharpSet__get_Tree(this), FSharpSet__get_Tree(that)
1739
+ )
1740
+ == 0
1741
+ )
1742
+ if isinstance(that, FSharpSet)
1743
+ else False
1744
+ )
1745
+
1746
+ def __str__(self, __unit: None = None) -> str:
1747
+ this: FSharpSet[_T] = self
1748
+
1749
+ def _arrow243(x: _T | None = None) -> str:
1750
+ copy_of_struct: _T = x
1751
+ return to_string(copy_of_struct)
1752
+
1753
+ return ("set [" + join("; ", map_1(_arrow243, this))) + "]"
1754
+
1755
+ @property
1756
+ def Symbol_toStringTag(self, __unit: None = None) -> str:
1757
+ return "FSharpSet"
1758
+
1759
+ def to_json(self, __unit: None = None) -> Any:
1760
+ this: FSharpSet[_T] = self
1761
+ return list(this)
1762
+
1763
+ def __cmp__(self, that: Any = None) -> int:
1764
+ s: FSharpSet[_T] = self
1765
+ return SetTreeModule_compare(FSharpSet__get_Comparer(s), FSharpSet__get_Tree(s), FSharpSet__get_Tree(that))
1766
+
1767
+ def System_Collections_Generic_ICollection_1_Add2B595(self, x: _T | None = None) -> None:
1768
+ ignore(x)
1769
+ raise Exception("ReadOnlyCollection")
1770
+
1771
+ def System_Collections_Generic_ICollection_1_Clear(self, __unit: None = None) -> None:
1772
+ raise Exception("ReadOnlyCollection")
1773
+
1774
+ def System_Collections_Generic_ICollection_1_Remove2B595(self, x: _T | None = None) -> bool:
1775
+ ignore(x)
1776
+ raise Exception("ReadOnlyCollection")
1777
+
1778
+ def System_Collections_Generic_ICollection_1_Contains2B595(self, x: _T | None = None) -> bool:
1779
+ s: FSharpSet[_T] = self
1780
+ return SetTreeModule_mem(FSharpSet__get_Comparer(s), x, FSharpSet__get_Tree(s))
1781
+
1782
+ def System_Collections_Generic_ICollection_1_CopyToZ3B4C077E(self, arr: Array[_T], i: int) -> None:
1783
+ s: FSharpSet[_T] = self
1784
+ SetTreeModule_copyToArray(FSharpSet__get_Tree(s), arr, i)
1785
+
1786
+ def System_Collections_Generic_ICollection_1_get_IsReadOnly(self, __unit: None = None) -> bool:
1787
+ return True
1788
+
1789
+ def __len__(self, __unit: None = None) -> int:
1790
+ s: FSharpSet[_T] = self
1791
+ return FSharpSet__get_Count(s)
1792
+
1793
+ def __len__(self, __unit: None = None) -> int:
1794
+ s: FSharpSet[_T] = self
1795
+ return FSharpSet__get_Count(s)
1796
+
1797
+ def GetEnumerator(self, __unit: None = None) -> IEnumerator[_T]:
1798
+ s: FSharpSet[_T] = self
1799
+ return SetTreeModule_mkIEnumerator(FSharpSet__get_Tree(s))
1800
+
1801
+ def __iter__(self) -> IEnumerator[_T]:
1802
+ return to_iterator(self.GetEnumerator())
1803
+
1804
+ def System_Collections_IEnumerable_GetEnumerator(self, __unit: None = None) -> IEnumerator[Any]:
1805
+ s: FSharpSet[_T] = self
1806
+ return SetTreeModule_mkIEnumerator(FSharpSet__get_Tree(s))
1807
+
1808
+ @property
1809
+ def size(self, __unit: None = None) -> int:
1810
+ s: FSharpSet[_T] = self
1811
+ return FSharpSet__get_Count(s)
1812
+
1813
+ def add(self, k: _T | None = None) -> Set_1[_T]:
1814
+ s: FSharpSet[_T] = self
1815
+ raise Exception("Set cannot be mutated")
1816
+ return s
1817
+
1818
+ def clear(self, __unit: None = None) -> None:
1819
+ raise Exception("Set cannot be mutated")
1820
+
1821
+ def __delitem__(self, k: _T | None = None) -> bool:
1822
+ raise Exception("Set cannot be mutated")
1823
+ return False
1824
+
1825
+ def __contains__(self, k: _T | None = None) -> bool:
1826
+ s: FSharpSet[_T] = self
1827
+ return FSharpSet__Contains(s, k)
1828
+
1829
+ def keys(self, __unit: None = None) -> IEnumerable_1[_T]:
1830
+ s: FSharpSet[_T] = self
1831
+
1832
+ def mapping(x: _T | None = None) -> _T | None:
1833
+ return x
1834
+
1835
+ return map_1(mapping, s)
1836
+
1837
+ def values(self, __unit: None = None) -> IEnumerable_1[_T]:
1838
+ s: FSharpSet[_T] = self
1839
+
1840
+ def mapping(x: _T | None = None) -> _T | None:
1841
+ return x
1842
+
1843
+ return map_1(mapping, s)
1844
+
1845
+ def entries(self, __unit: None = None) -> IEnumerable_1[tuple[_T, _T]]:
1846
+ s: FSharpSet[_T] = self
1847
+
1848
+ def mapping(v: _T | None = None) -> tuple[_T, _T]:
1849
+ return (v, v)
1850
+
1851
+ return map_1(mapping, s)
1852
+
1853
+ def for_each(self, f: Callable[[_T, _T, Set_1[_T]], None], this_arg: Any | None = None) -> None:
1854
+ s: FSharpSet[_T] = self
1855
+
1856
+ def action(x: _T | None = None) -> None:
1857
+ f(x, x, s)
1858
+
1859
+ iterate_1(action, s)
1860
+
1861
+
1862
+ FSharpSet_reflection = _expr244
1863
+
1864
+
1865
+ def FSharpSet__ctor(comparer: IComparer_1[Any], tree: SetTreeLeaf_1[Any] | None = None) -> FSharpSet[_T]:
1866
+ return FSharpSet(comparer, tree)
1867
+
1868
+
1869
+ def FSharpSet__get_Comparer(set_1: FSharpSet[Any]) -> IComparer_1[Any]:
1870
+ return set_1.comparer
1871
+
1872
+
1873
+ def FSharpSet__get_Tree(set_1: FSharpSet[Any]) -> SetTreeLeaf_1[Any] | None:
1874
+ return set_1.tree
1875
+
1876
+
1877
+ def FSharpSet_Empty(comparer: IComparer_1[Any]) -> FSharpSet[Any]:
1878
+ return FSharpSet__ctor(comparer, SetTreeModule_empty())
1879
+
1880
+
1881
+ def FSharpSet__Add(s: FSharpSet[Any], value: Any) -> FSharpSet[Any]:
1882
+ return FSharpSet__ctor(
1883
+ FSharpSet__get_Comparer(s), SetTreeModule_add(FSharpSet__get_Comparer(s), value, FSharpSet__get_Tree(s))
1884
+ )
1885
+
1886
+
1887
+ def FSharpSet__Remove(s: FSharpSet[Any], value: Any) -> FSharpSet[Any]:
1888
+ return FSharpSet__ctor(
1889
+ FSharpSet__get_Comparer(s), SetTreeModule_remove(FSharpSet__get_Comparer(s), value, FSharpSet__get_Tree(s))
1890
+ )
1891
+
1892
+
1893
+ def FSharpSet__get_Count(s: FSharpSet[Any]) -> int:
1894
+ return SetTreeModule_count(FSharpSet__get_Tree(s))
1895
+
1896
+
1897
+ def FSharpSet__Contains(s: FSharpSet[Any], value: Any) -> bool:
1898
+ return SetTreeModule_mem(FSharpSet__get_Comparer(s), value, FSharpSet__get_Tree(s))
1899
+
1900
+
1901
+ def FSharpSet__Iterate(s: FSharpSet[Any], x: Callable[[_T], None]) -> None:
1902
+ SetTreeModule_iter(x, FSharpSet__get_Tree(s))
1903
+
1904
+
1905
+ def FSharpSet__Fold(s: FSharpSet[Any], f: Callable[[_T, __A], __A], z: Any) -> Any:
1906
+ f_1: Any = f
1907
+
1908
+ def _arrow245(x: __A, z_1: _T, s: Any = s, f: Any = f, z: Any = z) -> __A:
1909
+ return f_1(z_1, x)
1910
+
1911
+ return SetTreeModule_fold(_arrow245, z, FSharpSet__get_Tree(s))
1912
+
1913
+
1914
+ def FSharpSet__get_IsEmpty(s: FSharpSet[Any]) -> bool:
1915
+ return FSharpSet__get_Tree(s) is None
1916
+
1917
+
1918
+ def FSharpSet__Partition(s: FSharpSet[Any], f: Callable[[_T], bool]) -> tuple[FSharpSet[_T], FSharpSet[_T]]:
1919
+ if FSharpSet__get_Tree(s) is None:
1920
+ return (s, s)
1921
+
1922
+ else:
1923
+ pattern_input: tuple[SetTreeLeaf_1[_T] | None, SetTreeLeaf_1[_T] | None] = SetTreeModule_partition(
1924
+ FSharpSet__get_Comparer(s), f, FSharpSet__get_Tree(s)
1925
+ )
1926
+ return (
1927
+ FSharpSet__ctor(FSharpSet__get_Comparer(s), pattern_input[0]),
1928
+ FSharpSet__ctor(FSharpSet__get_Comparer(s), pattern_input[1]),
1929
+ )
1930
+
1931
+
1932
+ def FSharpSet__Filter(s: FSharpSet[Any], f: Callable[[_T], bool]) -> FSharpSet[Any]:
1933
+ if FSharpSet__get_Tree(s) is None:
1934
+ return s
1935
+
1936
+ else:
1937
+ return FSharpSet__ctor(
1938
+ FSharpSet__get_Comparer(s), SetTreeModule_filter(FSharpSet__get_Comparer(s), f, FSharpSet__get_Tree(s))
1939
+ )
1940
+
1941
+
1942
+ def FSharpSet__Map(s: FSharpSet[Any], f: Callable[[_T], _U], comparer: IComparer_1[Any]) -> FSharpSet[Any]:
1943
+ def _arrow246(
1944
+ acc: SetTreeLeaf_1[_U] | None, k: _T, s: Any = s, f: Any = f, comparer: Any = comparer
1945
+ ) -> SetTreeLeaf_1[_U] | None:
1946
+ return SetTreeModule_add(comparer, f(k), acc)
1947
+
1948
+ return FSharpSet__ctor(comparer, SetTreeModule_fold(_arrow246, SetTreeModule_empty(), FSharpSet__get_Tree(s)))
1949
+
1950
+
1951
+ def FSharpSet__Exists(s: FSharpSet[Any], f: Callable[[_T], bool]) -> bool:
1952
+ return SetTreeModule_exists(f, FSharpSet__get_Tree(s))
1953
+
1954
+
1955
+ def FSharpSet__ForAll(s: FSharpSet[Any], f: Callable[[_T], bool]) -> bool:
1956
+ return SetTreeModule_forall(f, FSharpSet__get_Tree(s))
1957
+
1958
+
1959
+ def FSharpSet_op_Subtraction(set1: FSharpSet[Any], set2: FSharpSet[Any]) -> FSharpSet[Any]:
1960
+ if FSharpSet__get_Tree(set1) is None:
1961
+ return set1
1962
+
1963
+ elif FSharpSet__get_Tree(set2) is None:
1964
+ return set1
1965
+
1966
+ else:
1967
+ return FSharpSet__ctor(
1968
+ FSharpSet__get_Comparer(set1),
1969
+ SetTreeModule_diff(FSharpSet__get_Comparer(set1), FSharpSet__get_Tree(set1), FSharpSet__get_Tree(set2)),
1970
+ )
1971
+
1972
+
1973
+ def FSharpSet_op_Addition(set1: FSharpSet[Any], set2: FSharpSet[Any]) -> FSharpSet[Any]:
1974
+ if FSharpSet__get_Tree(set2) is None:
1975
+ return set1
1976
+
1977
+ elif FSharpSet__get_Tree(set1) is None:
1978
+ return set2
1979
+
1980
+ else:
1981
+ return FSharpSet__ctor(
1982
+ FSharpSet__get_Comparer(set1),
1983
+ SetTreeModule_union(FSharpSet__get_Comparer(set1), FSharpSet__get_Tree(set1), FSharpSet__get_Tree(set2)),
1984
+ )
1985
+
1986
+
1987
+ def FSharpSet_Intersection(a: FSharpSet[Any], b: FSharpSet[Any]) -> FSharpSet[Any]:
1988
+ if FSharpSet__get_Tree(b) is None:
1989
+ return b
1990
+
1991
+ elif FSharpSet__get_Tree(a) is None:
1992
+ return a
1993
+
1994
+ else:
1995
+ return FSharpSet__ctor(
1996
+ FSharpSet__get_Comparer(a),
1997
+ SetTreeModule_intersection(FSharpSet__get_Comparer(a), FSharpSet__get_Tree(a), FSharpSet__get_Tree(b)),
1998
+ )
1999
+
2000
+
2001
+ def FSharpSet_IntersectionMany(sets: IEnumerable_1[FSharpSet[Any]]) -> FSharpSet[Any]:
2002
+ def _arrow247(s1: FSharpSet[_T], s2: FSharpSet[_T], sets: Any = sets) -> FSharpSet[_T]:
2003
+ return FSharpSet_Intersection(s1, s2)
2004
+
2005
+ return reduce(_arrow247, sets)
2006
+
2007
+
2008
+ def FSharpSet_Equality(a: FSharpSet[Any], b: FSharpSet[Any]) -> bool:
2009
+ return SetTreeModule_compare(FSharpSet__get_Comparer(a), FSharpSet__get_Tree(a), FSharpSet__get_Tree(b)) == 0
2010
+
2011
+
2012
+ def FSharpSet_Compare(a: FSharpSet[Any], b: FSharpSet[Any]) -> int:
2013
+ return SetTreeModule_compare(FSharpSet__get_Comparer(a), FSharpSet__get_Tree(a), FSharpSet__get_Tree(b))
2014
+
2015
+
2016
+ def FSharpSet__get_Choose(x: FSharpSet[Any]) -> Any:
2017
+ return SetTreeModule_choose(FSharpSet__get_Tree(x))
2018
+
2019
+
2020
+ def FSharpSet__get_MinimumElement(x: FSharpSet[Any]) -> Any:
2021
+ return SetTreeModule_minimumElement(FSharpSet__get_Tree(x))
2022
+
2023
+
2024
+ def FSharpSet__get_MaximumElement(x: FSharpSet[Any]) -> Any:
2025
+ return SetTreeModule_maximumElement(FSharpSet__get_Tree(x))
2026
+
2027
+
2028
+ def FSharpSet__IsSubsetOf(x: FSharpSet[Any], other_set: FSharpSet[Any]) -> bool:
2029
+ return SetTreeModule_subset(FSharpSet__get_Comparer(x), FSharpSet__get_Tree(x), FSharpSet__get_Tree(other_set))
2030
+
2031
+
2032
+ def FSharpSet__IsSupersetOf(x: FSharpSet[Any], other_set: FSharpSet[Any]) -> bool:
2033
+ return SetTreeModule_subset(FSharpSet__get_Comparer(x), FSharpSet__get_Tree(other_set), FSharpSet__get_Tree(x))
2034
+
2035
+
2036
+ def FSharpSet__IsProperSubsetOf(x: FSharpSet[Any], other_set: FSharpSet[Any]) -> bool:
2037
+ return SetTreeModule_properSubset(
2038
+ FSharpSet__get_Comparer(x), FSharpSet__get_Tree(x), FSharpSet__get_Tree(other_set)
2039
+ )
2040
+
2041
+
2042
+ def FSharpSet__IsProperSupersetOf(x: FSharpSet[Any], other_set: FSharpSet[Any]) -> bool:
2043
+ return SetTreeModule_properSubset(
2044
+ FSharpSet__get_Comparer(x), FSharpSet__get_Tree(other_set), FSharpSet__get_Tree(x)
2045
+ )
2046
+
2047
+
2048
+ def FSharpSet__ToList(x: FSharpSet[Any]) -> FSharpList[Any]:
2049
+ return SetTreeModule_toList(FSharpSet__get_Tree(x))
2050
+
2051
+
2052
+ def FSharpSet__ToArray(x: FSharpSet[Any]) -> Array[Any]:
2053
+ return SetTreeModule_toArray(FSharpSet__get_Tree(x))
2054
+
2055
+
2056
+ def FSharpSet__ComputeHashCode(this: FSharpSet[Any]) -> int:
2057
+ res: int = 0
2058
+ with get_enumerator(this) as enumerator:
2059
+ while enumerator.System_Collections_IEnumerator_MoveNext():
2060
+ x_1: _T = enumerator.System_Collections_Generic_IEnumerator_1_get_Current()
2061
+ res = (((res << 1) + structural_hash(x_1)) + 631) or 0
2062
+ return abs(res)
2063
+
2064
+
2065
+ def is_empty(set_1: FSharpSet[Any]) -> bool:
2066
+ return FSharpSet__get_IsEmpty(set_1)
2067
+
2068
+
2069
+ def contains(element: Any, set_1: FSharpSet[Any]) -> bool:
2070
+ return FSharpSet__Contains(set_1, element)
2071
+
2072
+
2073
+ def add(value: Any, set_1: FSharpSet[Any]) -> FSharpSet[Any]:
2074
+ return FSharpSet__Add(set_1, value)
2075
+
2076
+
2077
+ def singleton(value: Any, comparer: IComparer_1[Any]) -> FSharpSet[Any]:
2078
+ return FSharpSet__Add(FSharpSet_Empty(comparer), value)
2079
+
2080
+
2081
+ def remove(value: Any, set_1: FSharpSet[Any]) -> FSharpSet[Any]:
2082
+ return FSharpSet__Remove(set_1, value)
2083
+
2084
+
2085
+ def union(set1: FSharpSet[Any], set2: FSharpSet[Any]) -> FSharpSet[Any]:
2086
+ return FSharpSet_op_Addition(set1, set2)
2087
+
2088
+
2089
+ def union_many(sets: IEnumerable_1[FSharpSet[Any]], comparer: IComparer_1[Any]) -> FSharpSet[Any]:
2090
+ def _arrow248(x: FSharpSet[_T], y: FSharpSet[_T], sets: Any = sets, comparer: Any = comparer) -> FSharpSet[_T]:
2091
+ return FSharpSet_op_Addition(x, y)
2092
+
2093
+ return fold_3(_arrow248, FSharpSet_Empty(comparer), sets)
2094
+
2095
+
2096
+ def intersect(set1: FSharpSet[Any], set2: FSharpSet[Any]) -> FSharpSet[Any]:
2097
+ return FSharpSet_Intersection(set1, set2)
2098
+
2099
+
2100
+ def intersect_many(sets: IEnumerable_1[FSharpSet[Any]]) -> FSharpSet[Any]:
2101
+ return FSharpSet_IntersectionMany(sets)
2102
+
2103
+
2104
+ def iterate(action: Callable[[_T], None], set_1: FSharpSet[Any]) -> None:
2105
+ FSharpSet__Iterate(set_1, action)
2106
+
2107
+
2108
+ def empty(comparer: IComparer_1[Any]) -> FSharpSet[Any]:
2109
+ return FSharpSet_Empty(comparer)
2110
+
2111
+
2112
+ def for_all(predicate: Callable[[_T], bool], set_1: FSharpSet[Any]) -> bool:
2113
+ return FSharpSet__ForAll(set_1, predicate)
2114
+
2115
+
2116
+ def exists(predicate: Callable[[_T], bool], set_1: FSharpSet[Any]) -> bool:
2117
+ return FSharpSet__Exists(set_1, predicate)
2118
+
2119
+
2120
+ def filter(predicate: Callable[[_T], bool], set_1: FSharpSet[Any]) -> FSharpSet[Any]:
2121
+ return FSharpSet__Filter(set_1, predicate)
2122
+
2123
+
2124
+ def partition(predicate: Callable[[_T], bool], set_1: FSharpSet[Any]) -> tuple[FSharpSet[_T], FSharpSet[_T]]:
2125
+ return FSharpSet__Partition(set_1, predicate)
2126
+
2127
+
2128
+ def fold(folder: Callable[[_STATE, _T], _STATE], state: Any, set_1: FSharpSet[Any]) -> Any:
2129
+ return SetTreeModule_fold(folder, state, FSharpSet__get_Tree(set_1))
2130
+
2131
+
2132
+ def fold_back(folder: Callable[[_T, _STATE], _STATE], set_1: FSharpSet[Any], state: Any) -> Any:
2133
+ return SetTreeModule_foldBack(folder, FSharpSet__get_Tree(set_1), state)
2134
+
2135
+
2136
+ def map(mapping: Callable[[_T], _U], set_1: FSharpSet[Any], comparer: IComparer_1[Any]) -> FSharpSet[Any]:
2137
+ return FSharpSet__Map(set_1, mapping, comparer)
2138
+
2139
+
2140
+ def count(set_1: FSharpSet[Any]) -> int:
2141
+ return FSharpSet__get_Count(set_1)
2142
+
2143
+
2144
+ def of_list(elements: IEnumerable_1[Any], comparer: IComparer_1[Any]) -> FSharpSet[Any]:
2145
+ return FSharpSet__ctor(comparer, SetTreeModule_ofSeq(comparer, elements))
2146
+
2147
+
2148
+ def of_array(array: Array[Any], comparer: IComparer_1[Any]) -> FSharpSet[Any]:
2149
+ return FSharpSet__ctor(comparer, SetTreeModule_ofArray(comparer, array))
2150
+
2151
+
2152
+ def to_list(set_1: FSharpSet[Any]) -> FSharpList[Any]:
2153
+ return FSharpSet__ToList(set_1)
2154
+
2155
+
2156
+ def to_array(set_1: FSharpSet[Any]) -> Array[Any]:
2157
+ return FSharpSet__ToArray(set_1)
2158
+
2159
+
2160
+ def to_seq(set_1: FSharpSet[Any]) -> IEnumerable_1[Any]:
2161
+ def mapping(x: _T | None = None, set_1: Any = set_1) -> _T | None:
2162
+ return x
2163
+
2164
+ return map_1(mapping, set_1)
2165
+
2166
+
2167
+ def of_seq(elements: IEnumerable_1[Any], comparer: IComparer_1[Any]) -> FSharpSet[Any]:
2168
+ return FSharpSet__ctor(comparer, SetTreeModule_ofSeq(comparer, elements))
2169
+
2170
+
2171
+ def difference(set1: FSharpSet[Any], set2: FSharpSet[Any]) -> FSharpSet[Any]:
2172
+ return FSharpSet_op_Subtraction(set1, set2)
2173
+
2174
+
2175
+ def is_subset(set1: FSharpSet[Any], set2: FSharpSet[Any]) -> bool:
2176
+ return SetTreeModule_subset(FSharpSet__get_Comparer(set1), FSharpSet__get_Tree(set1), FSharpSet__get_Tree(set2))
2177
+
2178
+
2179
+ def is_superset(set1: FSharpSet[Any], set2: FSharpSet[Any]) -> bool:
2180
+ return SetTreeModule_subset(FSharpSet__get_Comparer(set1), FSharpSet__get_Tree(set2), FSharpSet__get_Tree(set1))
2181
+
2182
+
2183
+ def is_proper_subset(set1: FSharpSet[Any], set2: FSharpSet[Any]) -> bool:
2184
+ return SetTreeModule_properSubset(
2185
+ FSharpSet__get_Comparer(set1), FSharpSet__get_Tree(set1), FSharpSet__get_Tree(set2)
2186
+ )
2187
+
2188
+
2189
+ def is_proper_superset(set1: FSharpSet[Any], set2: FSharpSet[Any]) -> bool:
2190
+ return SetTreeModule_properSubset(
2191
+ FSharpSet__get_Comparer(set1), FSharpSet__get_Tree(set2), FSharpSet__get_Tree(set1)
2192
+ )
2193
+
2194
+
2195
+ def min_element(set_1: FSharpSet[Any]) -> Any:
2196
+ return FSharpSet__get_MinimumElement(set_1)
2197
+
2198
+
2199
+ def max_element(set_1: FSharpSet[Any]) -> Any:
2200
+ return FSharpSet__get_MaximumElement(set_1)
2201
+
2202
+
2203
+ def union_with(s1: Set_1[Any], s2: IEnumerable_1[Any]) -> Set_1[Any]:
2204
+ def folder(acc: Set_1[_T], x: _T, s1: Any = s1, s2: Any = s2) -> Set_1[_T]:
2205
+ return acc.add(x)
2206
+
2207
+ return fold_3(folder, s1, s2)
2208
+
2209
+
2210
+ def new_mutable_set_with(s1: Set_1[Any], s2: IEnumerable_1[Any]) -> Set_1[Any]:
2211
+ if isinstance(s1, HashSet):
2212
+ return HashSet__ctor_Z6150332D(s2, HashSet__get_Comparer(s1))
2213
+
2214
+ else:
2215
+ return Set(s2)
2216
+
2217
+
2218
+ def intersect_with(s1: Set_1[Any], s2: IEnumerable_1[Any]) -> None:
2219
+ s2_1: Set_1[_T] = new_mutable_set_with(s1, s2)
2220
+
2221
+ def action(x: _T | None = None, s1: Any = s1, s2: Any = s2) -> None:
2222
+ if not (x in s2_1):
2223
+ ignore(s1.delete(x))
2224
+
2225
+ iterate_1(action, s1.values())
2226
+
2227
+
2228
+ def except_with(s1: Set_1[Any], s2: IEnumerable_1[Any]) -> None:
2229
+ def action(x: _T | None = None, s1: Any = s1, s2: Any = s2) -> None:
2230
+ ignore(s1.delete(x))
2231
+
2232
+ iterate_1(action, s2)
2233
+
2234
+
2235
+ def is_subset_of(s1: Set_1[Any], s2: IEnumerable_1[Any]) -> bool:
2236
+ s2_1: Set_1[_T] = new_mutable_set_with(s1, s2)
2237
+
2238
+ def predicate(value: _T | None = None, s1: Any = s1, s2: Any = s2) -> bool:
2239
+ return value in s2_1
2240
+
2241
+ return for_all_1(predicate, s1.values())
2242
+
2243
+
2244
+ def is_superset_of(s1: Set_1[Any], s2: IEnumerable_1[Any]) -> bool:
2245
+ def predicate(value: _T | None = None, s1: Any = s1, s2: Any = s2) -> bool:
2246
+ return value in s1
2247
+
2248
+ return for_all_1(predicate, s2)
2249
+
2250
+
2251
+ def is_proper_subset_of(s1: Set_1[Any], s2: IEnumerable_1[Any]) -> bool:
2252
+ s2_1: Set_1[_T] = new_mutable_set_with(s1, s2)
2253
+ if s2_1.size > s1.size:
2254
+
2255
+ def predicate(value: _T | None = None, s1: Any = s1, s2: Any = s2) -> bool:
2256
+ return value in s2_1
2257
+
2258
+ return for_all_1(predicate, s1.values())
2259
+
2260
+ else:
2261
+ return False
2262
+
2263
+
2264
+ def is_proper_superset_of(s1: Set_1[Any], s2: IEnumerable_1[Any]) -> bool:
2265
+ s2_1: IEnumerable_1[_T] = cache(s2)
2266
+
2267
+ def predicate(arg: _T | None = None, s1: Any = s1, s2: Any = s2) -> bool:
2268
+ return not (arg in s1)
2269
+
2270
+ if exists_1(predicate, s2_1):
2271
+
2272
+ def predicate_1(value_2: _T | None = None, s1: Any = s1, s2: Any = s2) -> bool:
2273
+ return value_2 in s1
2274
+
2275
+ return for_all_1(predicate_1, s2_1)
2276
+
2277
+ else:
2278
+ return False
2279
+
2280
+
2281
+ __all__ = [
2282
+ "SetTreeLeaf_1_reflection",
2283
+ "SetTreeLeaf_1__get_Key",
2284
+ "SetTreeNode_1_reflection",
2285
+ "SetTreeNode_1__get_Left",
2286
+ "SetTreeNode_1__get_Right",
2287
+ "SetTreeNode_1__get_Height",
2288
+ "SetTreeModule_empty",
2289
+ "SetTreeModule_countAux",
2290
+ "SetTreeModule_count",
2291
+ "SetTreeModule_mk",
2292
+ "SetTreeModule_rebalance",
2293
+ "SetTreeModule_add",
2294
+ "SetTreeModule_balance",
2295
+ "SetTreeModule_split",
2296
+ "SetTreeModule_spliceOutSuccessor",
2297
+ "SetTreeModule_remove",
2298
+ "SetTreeModule_mem",
2299
+ "SetTreeModule_iter",
2300
+ "SetTreeModule_foldBackOpt",
2301
+ "SetTreeModule_foldBack",
2302
+ "SetTreeModule_foldOpt",
2303
+ "SetTreeModule_fold",
2304
+ "SetTreeModule_forall",
2305
+ "SetTreeModule_exists",
2306
+ "SetTreeModule_subset",
2307
+ "SetTreeModule_properSubset",
2308
+ "SetTreeModule_filterAux",
2309
+ "SetTreeModule_filter",
2310
+ "SetTreeModule_diffAux",
2311
+ "SetTreeModule_diff",
2312
+ "SetTreeModule_union",
2313
+ "SetTreeModule_intersectionAux",
2314
+ "SetTreeModule_intersection",
2315
+ "SetTreeModule_partition1",
2316
+ "SetTreeModule_partitionAux",
2317
+ "SetTreeModule_partition",
2318
+ "SetTreeModule_minimumElementAux",
2319
+ "SetTreeModule_minimumElementOpt",
2320
+ "SetTreeModule_maximumElementAux",
2321
+ "SetTreeModule_maximumElementOpt",
2322
+ "SetTreeModule_minimumElement",
2323
+ "SetTreeModule_maximumElement",
2324
+ "SetTreeModule_SetIterator_1_reflection",
2325
+ "SetTreeModule_collapseLHS",
2326
+ "SetTreeModule_mkIterator",
2327
+ "SetTreeModule_notStarted",
2328
+ "SetTreeModule_alreadyFinished",
2329
+ "SetTreeModule_current",
2330
+ "SetTreeModule_moveNext",
2331
+ "SetTreeModule_mkIEnumerator",
2332
+ "SetTreeModule_compareStacks",
2333
+ "SetTreeModule_compare",
2334
+ "SetTreeModule_choose",
2335
+ "SetTreeModule_toList",
2336
+ "SetTreeModule_copyToArray",
2337
+ "SetTreeModule_toArray",
2338
+ "SetTreeModule_mkFromEnumerator",
2339
+ "SetTreeModule_ofArray",
2340
+ "SetTreeModule_ofList",
2341
+ "SetTreeModule_ofSeq",
2342
+ "FSharpSet_reflection",
2343
+ "FSharpSet__get_Comparer",
2344
+ "FSharpSet__get_Tree",
2345
+ "FSharpSet_Empty",
2346
+ "FSharpSet__Add",
2347
+ "FSharpSet__Remove",
2348
+ "FSharpSet__get_Count",
2349
+ "FSharpSet__Contains",
2350
+ "FSharpSet__Iterate",
2351
+ "FSharpSet__Fold",
2352
+ "FSharpSet__get_IsEmpty",
2353
+ "FSharpSet__Partition",
2354
+ "FSharpSet__Filter",
2355
+ "FSharpSet__Map",
2356
+ "FSharpSet__Exists",
2357
+ "FSharpSet__ForAll",
2358
+ "FSharpSet_op_Subtraction",
2359
+ "FSharpSet_op_Addition",
2360
+ "FSharpSet_Intersection",
2361
+ "FSharpSet_IntersectionMany",
2362
+ "FSharpSet_Equality",
2363
+ "FSharpSet_Compare",
2364
+ "FSharpSet__get_Choose",
2365
+ "FSharpSet__get_MinimumElement",
2366
+ "FSharpSet__get_MaximumElement",
2367
+ "FSharpSet__IsSubsetOf",
2368
+ "FSharpSet__IsSupersetOf",
2369
+ "FSharpSet__IsProperSubsetOf",
2370
+ "FSharpSet__IsProperSupersetOf",
2371
+ "FSharpSet__ToList",
2372
+ "FSharpSet__ToArray",
2373
+ "FSharpSet__ComputeHashCode",
2374
+ "is_empty",
2375
+ "contains",
2376
+ "add",
2377
+ "singleton",
2378
+ "remove",
2379
+ "union",
2380
+ "union_many",
2381
+ "intersect",
2382
+ "intersect_many",
2383
+ "iterate",
2384
+ "empty",
2385
+ "for_all",
2386
+ "exists",
2387
+ "filter",
2388
+ "partition",
2389
+ "fold",
2390
+ "fold_back",
2391
+ "map",
2392
+ "count",
2393
+ "of_list",
2394
+ "of_array",
2395
+ "to_list",
2396
+ "to_array",
2397
+ "to_seq",
2398
+ "of_seq",
2399
+ "difference",
2400
+ "is_subset",
2401
+ "is_superset",
2402
+ "is_proper_subset",
2403
+ "is_proper_superset",
2404
+ "min_element",
2405
+ "max_element",
2406
+ "union_with",
2407
+ "new_mutable_set_with",
2408
+ "intersect_with",
2409
+ "except_with",
2410
+ "is_subset_of",
2411
+ "is_superset_of",
2412
+ "is_proper_subset_of",
2413
+ "is_proper_superset_of",
2414
+ ]