arctrl 3.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (511) hide show
  1. arctrl/__init__.py +23 -0
  2. arctrl/cwl.py +12 -0
  3. arctrl/py/CWL/__init__.py +0 -0
  4. arctrl/py/CWL/cwlprocessing_unit.py +221 -0
  5. arctrl/py/CWL/cwltypes.py +364 -0
  6. arctrl/py/CWL/decode.py +3532 -0
  7. arctrl/py/CWL/encode.py +1905 -0
  8. arctrl/py/CWL/expression_tool_description.py +192 -0
  9. arctrl/py/CWL/hash_helpers.py +60 -0
  10. arctrl/py/CWL/inputs.py +122 -0
  11. arctrl/py/CWL/operation_description.py +169 -0
  12. arctrl/py/CWL/outputs.py +171 -0
  13. arctrl/py/CWL/parameter_reference.py +74 -0
  14. arctrl/py/CWL/requirements.py +350 -0
  15. arctrl/py/CWL/tool_description.py +192 -0
  16. arctrl/py/CWL/workflow_description.py +181 -0
  17. arctrl/py/CWL/workflow_steps.py +354 -0
  18. arctrl/py/Contract/__init__.py +0 -0
  19. arctrl/py/Contract/arc.py +89 -0
  20. arctrl/py/Contract/arc_assay.py +125 -0
  21. arctrl/py/Contract/arc_investigation.py +88 -0
  22. arctrl/py/Contract/arc_run.py +291 -0
  23. arctrl/py/Contract/arc_study.py +126 -0
  24. arctrl/py/Contract/arc_workflow.py +213 -0
  25. arctrl/py/Contract/contract.py +153 -0
  26. arctrl/py/Contract/datamap.py +396 -0
  27. arctrl/py/Contract/git.py +116 -0
  28. arctrl/py/Contract/license.py +58 -0
  29. arctrl/py/Contract/validation_packages_config.py +107 -0
  30. arctrl/py/ContractIO/__init__.py +0 -0
  31. arctrl/py/ContractIO/contract_io.py +350 -0
  32. arctrl/py/ContractIO/file_system_helper.py +264 -0
  33. arctrl/py/Conversion/__init__.py +0 -0
  34. arctrl/py/Conversion/assay.py +151 -0
  35. arctrl/py/Conversion/basic.py +559 -0
  36. arctrl/py/Conversion/column_index.py +91 -0
  37. arctrl/py/Conversion/datamap.py +36 -0
  38. arctrl/py/Conversion/date_time.py +32 -0
  39. arctrl/py/Conversion/investigation.py +171 -0
  40. arctrl/py/Conversion/person.py +148 -0
  41. arctrl/py/Conversion/process.py +828 -0
  42. arctrl/py/Conversion/run.py +367 -0
  43. arctrl/py/Conversion/scholarly_article.py +163 -0
  44. arctrl/py/Conversion/study.py +99 -0
  45. arctrl/py/Conversion/table.py +229 -0
  46. arctrl/py/Conversion/workflow.py +680 -0
  47. arctrl/py/Core/Helper/__init__.py +0 -0
  48. arctrl/py/Core/Helper/collections_.py +512 -0
  49. arctrl/py/Core/Helper/date_time.py +26 -0
  50. arctrl/py/Core/Helper/hash_codes.py +60 -0
  51. arctrl/py/Core/Helper/identifier.py +290 -0
  52. arctrl/py/Core/Helper/orcid.py +42 -0
  53. arctrl/py/Core/Helper/printer.py +13 -0
  54. arctrl/py/Core/Helper/regex.py +554 -0
  55. arctrl/py/Core/Helper/sem_ver.py +71 -0
  56. arctrl/py/Core/Helper/url.py +148 -0
  57. arctrl/py/Core/Process/__init__.py +0 -0
  58. arctrl/py/Core/Process/column_index.py +280 -0
  59. arctrl/py/Core/Process/component.py +200 -0
  60. arctrl/py/Core/Process/factor.py +151 -0
  61. arctrl/py/Core/Process/factor_value.py +182 -0
  62. arctrl/py/Core/Process/material.py +74 -0
  63. arctrl/py/Core/Process/material_attribute.py +95 -0
  64. arctrl/py/Core/Process/material_attribute_value.py +184 -0
  65. arctrl/py/Core/Process/material_type.py +45 -0
  66. arctrl/py/Core/Process/process.py +477 -0
  67. arctrl/py/Core/Process/process_input.py +265 -0
  68. arctrl/py/Core/Process/process_output.py +235 -0
  69. arctrl/py/Core/Process/process_parameter_value.py +200 -0
  70. arctrl/py/Core/Process/process_sequence.py +435 -0
  71. arctrl/py/Core/Process/protocol.py +175 -0
  72. arctrl/py/Core/Process/protocol_parameter.py +98 -0
  73. arctrl/py/Core/Process/sample.py +82 -0
  74. arctrl/py/Core/Process/source.py +62 -0
  75. arctrl/py/Core/Table/__init__.py +0 -0
  76. arctrl/py/Core/Table/arc_table.py +1206 -0
  77. arctrl/py/Core/Table/arc_table_aux.py +1308 -0
  78. arctrl/py/Core/Table/arc_tables.py +574 -0
  79. arctrl/py/Core/Table/composite_cell.py +319 -0
  80. arctrl/py/Core/Table/composite_column.py +73 -0
  81. arctrl/py/Core/Table/composite_header.py +739 -0
  82. arctrl/py/Core/__init__.py +0 -0
  83. arctrl/py/Core/arc_types.py +5312 -0
  84. arctrl/py/Core/comment.py +128 -0
  85. arctrl/py/Core/comment_list.py +127 -0
  86. arctrl/py/Core/conversion.py +1375 -0
  87. arctrl/py/Core/data.py +247 -0
  88. arctrl/py/Core/data_context.py +157 -0
  89. arctrl/py/Core/data_file.py +112 -0
  90. arctrl/py/Core/datamap.py +217 -0
  91. arctrl/py/Core/identifier_setters.py +43 -0
  92. arctrl/py/Core/iproperty_value.py +36 -0
  93. arctrl/py/Core/ontology_annotation.py +298 -0
  94. arctrl/py/Core/ontology_source_reference.py +114 -0
  95. arctrl/py/Core/person.py +259 -0
  96. arctrl/py/Core/publication.py +161 -0
  97. arctrl/py/Core/template.py +231 -0
  98. arctrl/py/Core/templates.py +148 -0
  99. arctrl/py/Core/uri.py +11 -0
  100. arctrl/py/Core/value.py +188 -0
  101. arctrl/py/FileSystem/__init__.py +0 -0
  102. arctrl/py/FileSystem/commit.py +21 -0
  103. arctrl/py/FileSystem/default_gitattributes.py +1 -0
  104. arctrl/py/FileSystem/default_gitignore.py +1 -0
  105. arctrl/py/FileSystem/default_license.py +1 -0
  106. arctrl/py/FileSystem/file_system.py +58 -0
  107. arctrl/py/FileSystem/file_system_tree.py +483 -0
  108. arctrl/py/FileSystem/path.py +266 -0
  109. arctrl/py/Json/Datamap/__init__.py +0 -0
  110. arctrl/py/Json/Datamap/data_context.py +101 -0
  111. arctrl/py/Json/Datamap/datamap.py +53 -0
  112. arctrl/py/Json/Process/__init__.py +0 -0
  113. arctrl/py/Json/Process/assay_materials.py +46 -0
  114. arctrl/py/Json/Process/component.py +125 -0
  115. arctrl/py/Json/Process/factor.py +107 -0
  116. arctrl/py/Json/Process/factor_value.py +101 -0
  117. arctrl/py/Json/Process/material.py +226 -0
  118. arctrl/py/Json/Process/material_attribute.py +79 -0
  119. arctrl/py/Json/Process/material_attribute_value.py +101 -0
  120. arctrl/py/Json/Process/material_type.py +53 -0
  121. arctrl/py/Json/Process/process.py +296 -0
  122. arctrl/py/Json/Process/process_input.py +83 -0
  123. arctrl/py/Json/Process/process_output.py +67 -0
  124. arctrl/py/Json/Process/process_parameter_value.py +81 -0
  125. arctrl/py/Json/Process/protocol.py +354 -0
  126. arctrl/py/Json/Process/protocol_parameter.py +91 -0
  127. arctrl/py/Json/Process/sample.py +277 -0
  128. arctrl/py/Json/Process/source.py +214 -0
  129. arctrl/py/Json/Process/study_materials.py +52 -0
  130. arctrl/py/Json/Process/value.py +56 -0
  131. arctrl/py/Json/ROCrate/__init__.py +0 -0
  132. arctrl/py/Json/ROCrate/ldcontext.py +143 -0
  133. arctrl/py/Json/ROCrate/ldgraph.py +117 -0
  134. arctrl/py/Json/ROCrate/ldnode.py +304 -0
  135. arctrl/py/Json/ROCrate/ldref.py +44 -0
  136. arctrl/py/Json/ROCrate/ldvalue.py +102 -0
  137. arctrl/py/Json/Table/__init__.py +0 -0
  138. arctrl/py/Json/Table/arc_table.py +375 -0
  139. arctrl/py/Json/Table/cell_table.py +83 -0
  140. arctrl/py/Json/Table/composite_cell.py +136 -0
  141. arctrl/py/Json/Table/composite_header.py +67 -0
  142. arctrl/py/Json/Table/iotype.py +24 -0
  143. arctrl/py/Json/Table/oatable.py +82 -0
  144. arctrl/py/Json/Table/templates.py +281 -0
  145. arctrl/py/Json/__init__.py +0 -0
  146. arctrl/py/Json/assay.py +600 -0
  147. arctrl/py/Json/comment.py +206 -0
  148. arctrl/py/Json/context/rocrate/__init__.py +0 -0
  149. arctrl/py/Json/context/rocrate/isa_assay_context.py +101 -0
  150. arctrl/py/Json/context/rocrate/isa_comment_context.py +60 -0
  151. arctrl/py/Json/context/rocrate/isa_component_context.py +77 -0
  152. arctrl/py/Json/context/rocrate/isa_data_context.py +74 -0
  153. arctrl/py/Json/context/rocrate/isa_factor_context.py +74 -0
  154. arctrl/py/Json/context/rocrate/isa_factor_value_context.py +84 -0
  155. arctrl/py/Json/context/rocrate/isa_investigation_context.py +110 -0
  156. arctrl/py/Json/context/rocrate/isa_material_attribute_context.py +64 -0
  157. arctrl/py/Json/context/rocrate/isa_material_attribute_value_context.py +80 -0
  158. arctrl/py/Json/context/rocrate/isa_material_context.py +71 -0
  159. arctrl/py/Json/context/rocrate/isa_ontology_annotation_context.py +68 -0
  160. arctrl/py/Json/context/rocrate/isa_ontology_source_reference_context.py +75 -0
  161. arctrl/py/Json/context/rocrate/isa_organization_context.py +55 -0
  162. arctrl/py/Json/context/rocrate/isa_person_context.py +131 -0
  163. arctrl/py/Json/context/rocrate/isa_process_context.py +94 -0
  164. arctrl/py/Json/context/rocrate/isa_process_parameter_value_context.py +80 -0
  165. arctrl/py/Json/context/rocrate/isa_protocol_context.py +97 -0
  166. arctrl/py/Json/context/rocrate/isa_protocol_parameter_context.py +64 -0
  167. arctrl/py/Json/context/rocrate/isa_publication_context.py +78 -0
  168. arctrl/py/Json/context/rocrate/isa_sample_context.py +65 -0
  169. arctrl/py/Json/context/rocrate/isa_source_context.py +66 -0
  170. arctrl/py/Json/context/rocrate/isa_study_context.py +125 -0
  171. arctrl/py/Json/context/rocrate/property_value_context.py +73 -0
  172. arctrl/py/Json/context/rocrate/rocrate_context.py +81 -0
  173. arctrl/py/Json/converter_options.py +23 -0
  174. arctrl/py/Json/data.py +356 -0
  175. arctrl/py/Json/data_file.py +63 -0
  176. arctrl/py/Json/decode.py +271 -0
  177. arctrl/py/Json/encode.py +140 -0
  178. arctrl/py/Json/idtable.py +44 -0
  179. arctrl/py/Json/investigation.py +695 -0
  180. arctrl/py/Json/ontology_annotation.py +404 -0
  181. arctrl/py/Json/ontology_source_reference.py +255 -0
  182. arctrl/py/Json/person.py +658 -0
  183. arctrl/py/Json/property_value.py +359 -0
  184. arctrl/py/Json/publication.py +279 -0
  185. arctrl/py/Json/run.py +275 -0
  186. arctrl/py/Json/string_table.py +87 -0
  187. arctrl/py/Json/study.py +793 -0
  188. arctrl/py/Json/workflow.py +307 -0
  189. arctrl/py/JsonIO/Process/__init__.py +0 -0
  190. arctrl/py/JsonIO/Process/component.py +60 -0
  191. arctrl/py/JsonIO/Process/factor.py +36 -0
  192. arctrl/py/JsonIO/Process/factor_value.py +38 -0
  193. arctrl/py/JsonIO/Process/material.py +60 -0
  194. arctrl/py/JsonIO/Process/material_attribute.py +38 -0
  195. arctrl/py/JsonIO/Process/material_attribute_value.py +60 -0
  196. arctrl/py/JsonIO/Process/material_type.py +36 -0
  197. arctrl/py/JsonIO/Process/process.py +60 -0
  198. arctrl/py/JsonIO/Process/process_input.py +38 -0
  199. arctrl/py/JsonIO/Process/process_output.py +60 -0
  200. arctrl/py/JsonIO/Process/process_parameter_value.py +60 -0
  201. arctrl/py/JsonIO/Process/process_sequence.py +71 -0
  202. arctrl/py/JsonIO/Process/protocol.py +60 -0
  203. arctrl/py/JsonIO/Process/protocol_parameter.py +36 -0
  204. arctrl/py/JsonIO/Process/sample.py +60 -0
  205. arctrl/py/JsonIO/Process/source.py +60 -0
  206. arctrl/py/JsonIO/Process/study_materials.py +52 -0
  207. arctrl/py/JsonIO/Process/value.py +32 -0
  208. arctrl/py/JsonIO/Table/__init__.py +0 -0
  209. arctrl/py/JsonIO/Table/arc_table.py +103 -0
  210. arctrl/py/JsonIO/Table/composite_cell.py +36 -0
  211. arctrl/py/JsonIO/Table/composite_header.py +36 -0
  212. arctrl/py/JsonIO/Table/compression.py +67 -0
  213. arctrl/py/JsonIO/Table/iotype.py +36 -0
  214. arctrl/py/JsonIO/Table/templates.py +113 -0
  215. arctrl/py/JsonIO/__init__.py +0 -0
  216. arctrl/py/JsonIO/assay.py +113 -0
  217. arctrl/py/JsonIO/comment.py +80 -0
  218. arctrl/py/JsonIO/data.py +60 -0
  219. arctrl/py/JsonIO/data_file.py +58 -0
  220. arctrl/py/JsonIO/datamap.py +36 -0
  221. arctrl/py/JsonIO/decode.py +9 -0
  222. arctrl/py/JsonIO/encode.py +1 -0
  223. arctrl/py/JsonIO/investigation.py +91 -0
  224. arctrl/py/JsonIO/ldobject.py +106 -0
  225. arctrl/py/JsonIO/ontology_annotation.py +80 -0
  226. arctrl/py/JsonIO/ontology_source_reference.py +80 -0
  227. arctrl/py/JsonIO/person.py +82 -0
  228. arctrl/py/JsonIO/publication.py +82 -0
  229. arctrl/py/JsonIO/run.py +68 -0
  230. arctrl/py/JsonIO/study.py +114 -0
  231. arctrl/py/JsonIO/workflow.py +68 -0
  232. arctrl/py/ROCrate/ISAProfile/__init__.py +0 -0
  233. arctrl/py/ROCrate/ISAProfile/assay.py +70 -0
  234. arctrl/py/ROCrate/ISAProfile/data.py +65 -0
  235. arctrl/py/ROCrate/ISAProfile/dataset.py +24 -0
  236. arctrl/py/ROCrate/ISAProfile/investigation.py +73 -0
  237. arctrl/py/ROCrate/ISAProfile/lab_process.py +162 -0
  238. arctrl/py/ROCrate/ISAProfile/lab_protocol.py +37 -0
  239. arctrl/py/ROCrate/ISAProfile/person.py +72 -0
  240. arctrl/py/ROCrate/ISAProfile/property_value.py +98 -0
  241. arctrl/py/ROCrate/ISAProfile/sample.py +64 -0
  242. arctrl/py/ROCrate/ISAProfile/scholarly_article.py +98 -0
  243. arctrl/py/ROCrate/ISAProfile/study.py +74 -0
  244. arctrl/py/ROCrate/LDTypes/__init__.py +0 -0
  245. arctrl/py/ROCrate/LDTypes/comment.py +131 -0
  246. arctrl/py/ROCrate/LDTypes/computational_workflow.py +455 -0
  247. arctrl/py/ROCrate/LDTypes/computer_language.py +269 -0
  248. arctrl/py/ROCrate/LDTypes/create_action.py +303 -0
  249. arctrl/py/ROCrate/LDTypes/creative_work.py +566 -0
  250. arctrl/py/ROCrate/LDTypes/dataset.py +943 -0
  251. arctrl/py/ROCrate/LDTypes/defined_term.py +131 -0
  252. arctrl/py/ROCrate/LDTypes/file.py +281 -0
  253. arctrl/py/ROCrate/LDTypes/formal_parameter.py +431 -0
  254. arctrl/py/ROCrate/LDTypes/lab_process.py +352 -0
  255. arctrl/py/ROCrate/LDTypes/lab_protocol.py +395 -0
  256. arctrl/py/ROCrate/LDTypes/organization.py +83 -0
  257. arctrl/py/ROCrate/LDTypes/person.py +484 -0
  258. arctrl/py/ROCrate/LDTypes/postal_address.py +195 -0
  259. arctrl/py/ROCrate/LDTypes/property_value.py +952 -0
  260. arctrl/py/ROCrate/LDTypes/sample.py +202 -0
  261. arctrl/py/ROCrate/LDTypes/scholarly_article.py +229 -0
  262. arctrl/py/ROCrate/LDTypes/software_source_code.py +310 -0
  263. arctrl/py/ROCrate/LDTypes/workflow_invocation.py +48 -0
  264. arctrl/py/ROCrate/LDTypes/workflow_protocol.py +52 -0
  265. arctrl/py/ROCrate/__init__.py +0 -0
  266. arctrl/py/ROCrate/arc_rocrate_metadata.py +39 -0
  267. arctrl/py/ROCrate/dyn_obj_extensions.py +1 -0
  268. arctrl/py/ROCrate/helper.py +8 -0
  269. arctrl/py/ROCrate/ldcontext.py +406 -0
  270. arctrl/py/ROCrate/ldobject.py +1247 -0
  271. arctrl/py/ROCrate/rocrate_context.py +51 -0
  272. arctrl/py/Spreadsheet/AnnotationTable/__init__.py +0 -0
  273. arctrl/py/Spreadsheet/AnnotationTable/arc_table.py +203 -0
  274. arctrl/py/Spreadsheet/AnnotationTable/composite_cell.py +78 -0
  275. arctrl/py/Spreadsheet/AnnotationTable/composite_column.py +305 -0
  276. arctrl/py/Spreadsheet/AnnotationTable/composite_header.py +623 -0
  277. arctrl/py/Spreadsheet/DatamapTable/__init__.py +0 -0
  278. arctrl/py/Spreadsheet/DatamapTable/datamap_column.py +114 -0
  279. arctrl/py/Spreadsheet/DatamapTable/datamap_header.py +621 -0
  280. arctrl/py/Spreadsheet/DatamapTable/datamap_table.py +118 -0
  281. arctrl/py/Spreadsheet/Metadata/__init__.py +0 -0
  282. arctrl/py/Spreadsheet/Metadata/assays.py +125 -0
  283. arctrl/py/Spreadsheet/Metadata/comment.py +77 -0
  284. arctrl/py/Spreadsheet/Metadata/contacts.py +134 -0
  285. arctrl/py/Spreadsheet/Metadata/conversions.py +190 -0
  286. arctrl/py/Spreadsheet/Metadata/design_descriptors.py +34 -0
  287. arctrl/py/Spreadsheet/Metadata/factors.py +107 -0
  288. arctrl/py/Spreadsheet/Metadata/ontology_annotation.py +88 -0
  289. arctrl/py/Spreadsheet/Metadata/ontology_source_reference.py +96 -0
  290. arctrl/py/Spreadsheet/Metadata/protocols.py +146 -0
  291. arctrl/py/Spreadsheet/Metadata/publication.py +122 -0
  292. arctrl/py/Spreadsheet/Metadata/run.py +122 -0
  293. arctrl/py/Spreadsheet/Metadata/sparse_table.py +499 -0
  294. arctrl/py/Spreadsheet/Metadata/study.py +312 -0
  295. arctrl/py/Spreadsheet/Metadata/workflow.py +159 -0
  296. arctrl/py/Spreadsheet/__init__.py +0 -0
  297. arctrl/py/Spreadsheet/arc_assay.py +233 -0
  298. arctrl/py/Spreadsheet/arc_investigation.py +435 -0
  299. arctrl/py/Spreadsheet/arc_run.py +190 -0
  300. arctrl/py/Spreadsheet/arc_study.py +144 -0
  301. arctrl/py/Spreadsheet/arc_workflow.py +177 -0
  302. arctrl/py/Spreadsheet/assembly_info.py +1 -0
  303. arctrl/py/Spreadsheet/collection_aux.py +167 -0
  304. arctrl/py/Spreadsheet/datamap.py +43 -0
  305. arctrl/py/Spreadsheet/template.py +460 -0
  306. arctrl/py/ValidationPackages/__init__.py +0 -0
  307. arctrl/py/ValidationPackages/validation_package.py +82 -0
  308. arctrl/py/ValidationPackages/validation_packages_config.py +132 -0
  309. arctrl/py/WebRequest/__init__.py +0 -0
  310. arctrl/py/WebRequest/web_request.py +9 -0
  311. arctrl/py/WebRequest/web_request_py.py +135 -0
  312. arctrl/py/WorkflowGraph/__init__.py +0 -0
  313. arctrl/py/WorkflowGraph/adapters.py +141 -0
  314. arctrl/py/WorkflowGraph/build_options.py +45 -0
  315. arctrl/py/WorkflowGraph/builder.py +720 -0
  316. arctrl/py/WorkflowGraph/graph_types.py +260 -0
  317. arctrl/py/WorkflowGraph/query_helpers.py +76 -0
  318. arctrl/py/WorkflowGraph/reference_parsing.py +59 -0
  319. arctrl/py/WorkflowGraph/visualization_siren.py +574 -0
  320. arctrl/py/WorkflowGraph/workflow_graph.py +119 -0
  321. arctrl/py/Yaml/__init__.py +0 -0
  322. arctrl/py/Yaml/decode.py +1 -0
  323. arctrl/py/Yaml/encode.py +10 -0
  324. arctrl/py/Yaml/validation_package.py +77 -0
  325. arctrl/py/Yaml/validation_packages_config.py +86 -0
  326. arctrl/py/__init__.py +0 -0
  327. arctrl/py/arc.py +1891 -0
  328. arctrl/py/column_index.py +280 -0
  329. arctrl/py/conversion.py +142 -0
  330. arctrl/py/cross_async.py +76 -0
  331. arctrl/py/cwlrun_resolver.py +228 -0
  332. arctrl/py/fable_modules/dynamic_obj/__init__.py +0 -0
  333. arctrl/py/fable_modules/dynamic_obj/dyn_obj.py +136 -0
  334. arctrl/py/fable_modules/dynamic_obj/dynamic_obj.py +415 -0
  335. arctrl/py/fable_modules/dynamic_obj/fable_js.py +1 -0
  336. arctrl/py/fable_modules/dynamic_obj/fable_py.py +288 -0
  337. arctrl/py/fable_modules/dynamic_obj/hash_codes.py +82 -0
  338. arctrl/py/fable_modules/dynamic_obj/property_helper.py +25 -0
  339. arctrl/py/fable_modules/dynamic_obj/reflection_utils.py +87 -0
  340. arctrl/py/fable_modules/fable_library/__init__.py +0 -0
  341. arctrl/py/fable_modules/fable_library/array_.py +1528 -0
  342. arctrl/py/fable_modules/fable_library/async_.py +377 -0
  343. arctrl/py/fable_modules/fable_library/async_builder.py +379 -0
  344. arctrl/py/fable_modules/fable_library/big_int.py +330 -0
  345. arctrl/py/fable_modules/fable_library/bit_converter.py +131 -0
  346. arctrl/py/fable_modules/fable_library/boolean.py +26 -0
  347. arctrl/py/fable_modules/fable_library/char.py +237 -0
  348. arctrl/py/fable_modules/fable_library/choice.py +212 -0
  349. arctrl/py/fable_modules/fable_library/date.py +779 -0
  350. arctrl/py/fable_modules/fable_library/date_offset.py +79 -0
  351. arctrl/py/fable_modules/fable_library/decimal_.py +190 -0
  352. arctrl/py/fable_modules/fable_library/diagnostics.py +54 -0
  353. arctrl/py/fable_modules/fable_library/double.py +87 -0
  354. arctrl/py/fable_modules/fable_library/encoding.py +41 -0
  355. arctrl/py/fable_modules/fable_library/event.py +206 -0
  356. arctrl/py/fable_modules/fable_library/file.py +107 -0
  357. arctrl/py/fable_modules/fable_library/fsharp_collections.py +52 -0
  358. arctrl/py/fable_modules/fable_library/fsharp_core.py +123 -0
  359. arctrl/py/fable_modules/fable_library/global_.py +63 -0
  360. arctrl/py/fable_modules/fable_library/guid.py +41 -0
  361. arctrl/py/fable_modules/fable_library/int32.py +73 -0
  362. arctrl/py/fable_modules/fable_library/list.py +1788 -0
  363. arctrl/py/fable_modules/fable_library/long.py +240 -0
  364. arctrl/py/fable_modules/fable_library/mailbox_processor.py +179 -0
  365. arctrl/py/fable_modules/fable_library/map.py +1854 -0
  366. arctrl/py/fable_modules/fable_library/map_util.py +148 -0
  367. arctrl/py/fable_modules/fable_library/mutable_map.py +397 -0
  368. arctrl/py/fable_modules/fable_library/mutable_set.py +279 -0
  369. arctrl/py/fable_modules/fable_library/native.py +45 -0
  370. arctrl/py/fable_modules/fable_library/numeric.py +46 -0
  371. arctrl/py/fable_modules/fable_library/observable.py +222 -0
  372. arctrl/py/fable_modules/fable_library/option.py +128 -0
  373. arctrl/py/fable_modules/fable_library/path.py +62 -0
  374. arctrl/py/fable_modules/fable_library/range.py +117 -0
  375. arctrl/py/fable_modules/fable_library/reflection.py +463 -0
  376. arctrl/py/fable_modules/fable_library/reg_exp.py +137 -0
  377. arctrl/py/fable_modules/fable_library/resize_array.py +31 -0
  378. arctrl/py/fable_modules/fable_library/result.py +212 -0
  379. arctrl/py/fable_modules/fable_library/seq.py +1979 -0
  380. arctrl/py/fable_modules/fable_library/seq2.py +221 -0
  381. arctrl/py/fable_modules/fable_library/set.py +2414 -0
  382. arctrl/py/fable_modules/fable_library/singleton_local_time_zone.py +36 -0
  383. arctrl/py/fable_modules/fable_library/string_.py +573 -0
  384. arctrl/py/fable_modules/fable_library/system_collections_generic.py +462 -0
  385. arctrl/py/fable_modules/fable_library/system_text.py +237 -0
  386. arctrl/py/fable_modules/fable_library/task.py +116 -0
  387. arctrl/py/fable_modules/fable_library/task_builder.py +122 -0
  388. arctrl/py/fable_modules/fable_library/thread.py +5 -0
  389. arctrl/py/fable_modules/fable_library/time_span.py +283 -0
  390. arctrl/py/fable_modules/fable_library/timer.py +24 -0
  391. arctrl/py/fable_modules/fable_library/types.py +401 -0
  392. arctrl/py/fable_modules/fable_library/uri.py +109 -0
  393. arctrl/py/fable_modules/fable_library/util.py +2735 -0
  394. arctrl/py/fable_modules/fable_openpyxl/__init__.py +0 -0
  395. arctrl/py/fable_modules/fable_openpyxl/openpyxl.py +362 -0
  396. arctrl/py/fable_modules/fable_python/cognite-sdk/__init__.py +0 -0
  397. arctrl/py/fable_modules/fable_python/cognite-sdk/cognite_sdk.py +22 -0
  398. arctrl/py/fable_modules/fable_python/flask/__init__.py +0 -0
  399. arctrl/py/fable_modules/fable_python/flask/flask.py +34 -0
  400. arctrl/py/fable_modules/fable_python/jupyter/__init__.py +0 -0
  401. arctrl/py/fable_modules/fable_python/jupyter/ipy_widgets.py +47 -0
  402. arctrl/py/fable_modules/fable_python/jupyter/ipython.py +13 -0
  403. arctrl/py/fable_modules/fable_python/stdlib/__init__.py +0 -0
  404. arctrl/py/fable_modules/fable_python/stdlib/ast.py +1 -0
  405. arctrl/py/fable_modules/fable_python/stdlib/asyncio/__init__.py +0 -0
  406. arctrl/py/fable_modules/fable_python/stdlib/asyncio/events.py +17 -0
  407. arctrl/py/fable_modules/fable_python/stdlib/asyncio/futures.py +52 -0
  408. arctrl/py/fable_modules/fable_python/stdlib/asyncio/tasks.py +38 -0
  409. arctrl/py/fable_modules/fable_python/stdlib/base64_.py +1 -0
  410. arctrl/py/fable_modules/fable_python/stdlib/builtins_.py +38 -0
  411. arctrl/py/fable_modules/fable_python/stdlib/html.py +1 -0
  412. arctrl/py/fable_modules/fable_python/stdlib/json.py +1 -0
  413. arctrl/py/fable_modules/fable_python/stdlib/math_.py +1 -0
  414. arctrl/py/fable_modules/fable_python/stdlib/os_.py +1 -0
  415. arctrl/py/fable_modules/fable_python/stdlib/queue_.py +1 -0
  416. arctrl/py/fable_modules/fable_python/stdlib/string_.py +1 -0
  417. arctrl/py/fable_modules/fable_python/stdlib/sys_.py +30 -0
  418. arctrl/py/fable_modules/fable_python/stdlib/time_.py +1 -0
  419. arctrl/py/fable_modules/fable_python/stdlib/tk_inter.py +1 -0
  420. arctrl/py/fable_modules/fs_spreadsheet/Cells/__init__.py +0 -0
  421. arctrl/py/fable_modules/fs_spreadsheet/Cells/fs_cell.py +340 -0
  422. arctrl/py/fable_modules/fs_spreadsheet/Cells/fs_cells_collection.py +466 -0
  423. arctrl/py/fable_modules/fs_spreadsheet/DSL/__init__.py +0 -0
  424. arctrl/py/fable_modules/fs_spreadsheet/DSL/cell_builder.py +214 -0
  425. arctrl/py/fable_modules/fs_spreadsheet/DSL/column_builder.py +139 -0
  426. arctrl/py/fable_modules/fs_spreadsheet/DSL/dsl.py +50 -0
  427. arctrl/py/fable_modules/fs_spreadsheet/DSL/expression.py +65 -0
  428. arctrl/py/fable_modules/fs_spreadsheet/DSL/operators.py +9 -0
  429. arctrl/py/fable_modules/fs_spreadsheet/DSL/row_builder.py +139 -0
  430. arctrl/py/fable_modules/fs_spreadsheet/DSL/sheet_builder.py +118 -0
  431. arctrl/py/fable_modules/fs_spreadsheet/DSL/table_builder.py +122 -0
  432. arctrl/py/fable_modules/fs_spreadsheet/DSL/transform.py +463 -0
  433. arctrl/py/fable_modules/fs_spreadsheet/DSL/types.py +314 -0
  434. arctrl/py/fable_modules/fs_spreadsheet/DSL/workbook_builder.py +106 -0
  435. arctrl/py/fable_modules/fs_spreadsheet/Json/__init__.py +0 -0
  436. arctrl/py/fable_modules/fs_spreadsheet/Json/cell.py +103 -0
  437. arctrl/py/fable_modules/fs_spreadsheet/Json/column.py +70 -0
  438. arctrl/py/fable_modules/fs_spreadsheet/Json/row.py +70 -0
  439. arctrl/py/fable_modules/fs_spreadsheet/Json/table.py +54 -0
  440. arctrl/py/fable_modules/fs_spreadsheet/Json/value.py +93 -0
  441. arctrl/py/fable_modules/fs_spreadsheet/Json/workbook.py +71 -0
  442. arctrl/py/fable_modules/fs_spreadsheet/Json/worksheet.py +216 -0
  443. arctrl/py/fable_modules/fs_spreadsheet/Ranges/__init__.py +0 -0
  444. arctrl/py/fable_modules/fs_spreadsheet/Ranges/fs_range.py +43 -0
  445. arctrl/py/fable_modules/fs_spreadsheet/Ranges/fs_range_address.py +190 -0
  446. arctrl/py/fable_modules/fs_spreadsheet/Ranges/fs_range_base.py +92 -0
  447. arctrl/py/fable_modules/fs_spreadsheet/Ranges/fs_range_column.py +77 -0
  448. arctrl/py/fable_modules/fs_spreadsheet/Ranges/fs_range_row.py +48 -0
  449. arctrl/py/fable_modules/fs_spreadsheet/Tables/__init__.py +0 -0
  450. arctrl/py/fable_modules/fs_spreadsheet/Tables/fs_table.py +461 -0
  451. arctrl/py/fable_modules/fs_spreadsheet/Tables/fs_table_field.py +117 -0
  452. arctrl/py/fable_modules/fs_spreadsheet/Tables/fs_table_row.py +23 -0
  453. arctrl/py/fable_modules/fs_spreadsheet/__init__.py +0 -0
  454. arctrl/py/fable_modules/fs_spreadsheet/fs_address.py +236 -0
  455. arctrl/py/fable_modules/fs_spreadsheet/fs_column.py +172 -0
  456. arctrl/py/fable_modules/fs_spreadsheet/fs_row.py +183 -0
  457. arctrl/py/fable_modules/fs_spreadsheet/fs_workbook.py +192 -0
  458. arctrl/py/fable_modules/fs_spreadsheet/fs_worksheet.py +610 -0
  459. arctrl/py/fable_modules/fs_spreadsheet/hash_codes.py +60 -0
  460. arctrl/py/fable_modules/fs_spreadsheet/sheet_builder.py +329 -0
  461. arctrl/py/fable_modules/fs_spreadsheet_py/__init__.py +0 -0
  462. arctrl/py/fable_modules/fs_spreadsheet_py/cell.py +60 -0
  463. arctrl/py/fable_modules/fs_spreadsheet_py/cell_type.py +50 -0
  464. arctrl/py/fable_modules/fs_spreadsheet_py/fs_extension.py +60 -0
  465. arctrl/py/fable_modules/fs_spreadsheet_py/json.py +47 -0
  466. arctrl/py/fable_modules/fs_spreadsheet_py/table.py +54 -0
  467. arctrl/py/fable_modules/fs_spreadsheet_py/workbook.py +41 -0
  468. arctrl/py/fable_modules/fs_spreadsheet_py/worksheet.py +52 -0
  469. arctrl/py/fable_modules/fs_spreadsheet_py/xlsx.py +37 -0
  470. arctrl/py/fable_modules/siren/__init__.py +0 -0
  471. arctrl/py/fable_modules/siren/config.py +1038 -0
  472. arctrl/py/fable_modules/siren/formatting.py +1121 -0
  473. arctrl/py/fable_modules/siren/siren.py +1941 -0
  474. arctrl/py/fable_modules/siren/siren_types.py +1229 -0
  475. arctrl/py/fable_modules/siren/theme_variables.py +517 -0
  476. arctrl/py/fable_modules/siren/util.py +37 -0
  477. arctrl/py/fable_modules/siren/yaml.py +101 -0
  478. arctrl/py/fable_modules/thoth_json_core/__init__.py +0 -0
  479. arctrl/py/fable_modules/thoth_json_core/decode.py +1614 -0
  480. arctrl/py/fable_modules/thoth_json_core/encode.py +305 -0
  481. arctrl/py/fable_modules/thoth_json_core/types.py +181 -0
  482. arctrl/py/fable_modules/thoth_json_python/__init__.py +0 -0
  483. arctrl/py/fable_modules/thoth_json_python/decode.py +112 -0
  484. arctrl/py/fable_modules/thoth_json_python/encode.py +72 -0
  485. arctrl/py/fable_modules/thoth_json_python/python.py +1 -0
  486. arctrl/py/fable_modules/yamlicious/Interop/__init__.py +0 -0
  487. arctrl/py/fable_modules/yamlicious/Interop/js_interop.py +1 -0
  488. arctrl/py/fable_modules/yamlicious/Interop/py_interop.py +7 -0
  489. arctrl/py/fable_modules/yamlicious/__init__.py +0 -0
  490. arctrl/py/fable_modules/yamlicious/decode.py +1784 -0
  491. arctrl/py/fable_modules/yamlicious/encode.py +84 -0
  492. arctrl/py/fable_modules/yamlicious/flow_to_block.py +994 -0
  493. arctrl/py/fable_modules/yamlicious/library.py +10 -0
  494. arctrl/py/fable_modules/yamlicious/persil.py +57 -0
  495. arctrl/py/fable_modules/yamlicious/preprocessing.py +99 -0
  496. arctrl/py/fable_modules/yamlicious/reader.py +739 -0
  497. arctrl/py/fable_modules/yamlicious/regex.py +29 -0
  498. arctrl/py/fable_modules/yamlicious/regex_active_patterns.py +265 -0
  499. arctrl/py/fable_modules/yamlicious/writer.py +175 -0
  500. arctrl/py/fable_modules/yamlicious/yamlicious_types.py +128 -0
  501. arctrl/py/json.py +389 -0
  502. arctrl/py/license.py +169 -0
  503. arctrl/py/rocrate_io.py +242 -0
  504. arctrl/py/template_web.py +23 -0
  505. arctrl/py/xlsx.py +212 -0
  506. arctrl/py/yaml.py +79 -0
  507. arctrl/rocrate.py +21 -0
  508. arctrl-3.0.0.dist-info/METADATA +157 -0
  509. arctrl-3.0.0.dist-info/RECORD +511 -0
  510. arctrl-3.0.0.dist-info/WHEEL +4 -0
  511. arctrl-3.0.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,1905 @@
1
+ from __future__ import annotations
2
+ from collections.abc import Callable
3
+ from typing import Any
4
+ from ..fable_modules.dynamic_obj.dynamic_obj import DynamicObj
5
+ from ..fable_modules.fable_library.choice import FSharpChoice_2
6
+ from ..fable_modules.fable_library.list import (FSharpList, is_empty, head, tail, map as map_1, singleton, of_array, empty, append, of_seq, choose, exists, cons, filter as filter_1, contains, try_find, reverse, length)
7
+ from ..fable_modules.fable_library.option import (map, bind, filter)
8
+ from ..fable_modules.fable_library.seq import (to_list, map as map_2, choose as choose_1, fold, delay, append as append_1, singleton as singleton_1, empty as empty_1)
9
+ from ..fable_modules.fable_library.set import (of_list, FSharpSet__Contains)
10
+ from ..fable_modules.fable_library.string_ import (trim_end, replace, to_text, interpolate, trim_start, join, split)
11
+ from ..fable_modules.fable_library.types import (Array, to_string)
12
+ from ..fable_modules.fable_library.util import (int64_to_string, curry2, string_hash, compare_primitives, IEnumerable_1)
13
+ from ..fable_modules.yamlicious.encode import (string, int_1, float_1)
14
+ from ..fable_modules.yamlicious.writer import write
15
+ from ..fable_modules.yamlicious.yamlicious_types import (YAMLContent, YAMLElement, Config)
16
+ from .cwlprocessing_unit import (WorkflowStepRunOps_tryGetTool, WorkflowStepRunOps_tryGetWorkflow, WorkflowStepRunOps_tryGetExpressionTool, WorkflowStepRunOps_tryGetOperation, CWLProcessingUnit)
17
+ from .cwltypes import (CWLType, SchemaSaladString, SoftwarePackage, DirentInstance, InputArraySchema, InputRecordField, InputRecordSchema, InputEnumSchema, SchemaDefRequirementType)
18
+ from .expression_tool_description import CWLExpressionToolDescription
19
+ from .inputs import (InputBinding, CWLInput)
20
+ from .operation_description import CWLOperationDescription
21
+ from .outputs import (OutputBinding, OutputSource, CWLOutput)
22
+ from .requirements import (EnvironmentDef, DockerRequirement, LoadListingEnum_get_toCwlString, InitialWorkDirEntry, ToolTimeLimitValue, Requirement, HintEntry)
23
+ from .tool_description import CWLToolDescription
24
+ from .workflow_description import CWLWorkflowDescription
25
+ from .workflow_steps import (LinkMergeMethod, PickValueMethod, ScatterMethod, StepInput, StepOutputParameter, StepOutput, WorkflowStepRun, WorkflowStep)
26
+
27
+ def _007CPrimitiveType_007CComplexType_007C(t: CWLType) -> Any:
28
+ if t.tag == 1:
29
+ return FSharpChoice_2(0, "Directory")
30
+
31
+ elif t.tag == 2:
32
+ return FSharpChoice_2(0, "Dirent")
33
+
34
+ elif t.tag == 3:
35
+ return FSharpChoice_2(0, "string")
36
+
37
+ elif t.tag == 4:
38
+ return FSharpChoice_2(0, "int")
39
+
40
+ elif t.tag == 5:
41
+ return FSharpChoice_2(0, "long")
42
+
43
+ elif t.tag == 6:
44
+ return FSharpChoice_2(0, "float")
45
+
46
+ elif t.tag == 7:
47
+ return FSharpChoice_2(0, "double")
48
+
49
+ elif t.tag == 8:
50
+ return FSharpChoice_2(0, "boolean")
51
+
52
+ elif t.tag == 10:
53
+ return FSharpChoice_2(0, "null")
54
+
55
+ elif t.tag == 9:
56
+ return FSharpChoice_2(0, "stdout")
57
+
58
+ elif ((t.tag == 12) or (t.tag == 13)) or (t.tag == 14):
59
+ return FSharpChoice_2(1, None)
60
+
61
+ elif t.tag == 11:
62
+ if _007CPrimitiveType_007CComplexType_007C(t.fields[0].Items).tag == 1:
63
+ return FSharpChoice_2(1, None)
64
+
65
+ else:
66
+ return FSharpChoice_2(0, "array")
67
+
68
+
69
+ else:
70
+ return FSharpChoice_2(0, "File")
71
+
72
+
73
+
74
+ def try_get_array_shorthand(cwl_type: CWLType) -> str | None:
75
+ (pattern_matching_result, name_1, array_schema) = (None, None, None)
76
+ active_pattern_result: Any = _007CPrimitiveType_007CComplexType_007C(cwl_type)
77
+ if active_pattern_result.tag == 0:
78
+ if active_pattern_result.fields[0] != "array":
79
+ pattern_matching_result = 0
80
+ name_1 = active_pattern_result.fields[0]
81
+
82
+ elif cwl_type.tag == 11:
83
+ pattern_matching_result = 1
84
+ array_schema = cwl_type.fields[0]
85
+
86
+ else:
87
+ pattern_matching_result = 2
88
+
89
+
90
+ elif cwl_type.tag == 11:
91
+ pattern_matching_result = 1
92
+ array_schema = cwl_type.fields[0]
93
+
94
+ else:
95
+ pattern_matching_result = 2
96
+
97
+ if pattern_matching_result == 0:
98
+ return name_1
99
+
100
+ elif pattern_matching_result == 1:
101
+ def mapping(s: str, cwl_type: Any=cwl_type) -> str:
102
+ return s + "[]"
103
+
104
+ return map(mapping, try_get_array_shorthand(array_schema.Items))
105
+
106
+ elif pattern_matching_result == 2:
107
+ return None
108
+
109
+
110
+
111
+ def is_complex_type(t_mut: CWLType) -> bool:
112
+ while True:
113
+ (t,) = (t_mut,)
114
+ if (t.tag == 12) or (t.tag == 13):
115
+ return True
116
+
117
+ elif t.tag == 11:
118
+ return try_get_array_shorthand(t.fields[0].Items) is None
119
+
120
+ elif t.tag == 14:
121
+ types_list: FSharpList[CWLType] = to_list(t.fields[0])
122
+ (pattern_matching_result, other_type) = (None, None)
123
+ if not is_empty(types_list):
124
+ if head(types_list).tag == 10:
125
+ if not is_empty(tail(types_list)):
126
+ if is_empty(tail(tail(types_list))):
127
+ pattern_matching_result = 0
128
+ other_type = head(tail(types_list))
129
+
130
+ else:
131
+ pattern_matching_result = 1
132
+
133
+
134
+ else:
135
+ pattern_matching_result = 1
136
+
137
+
138
+ elif not is_empty(tail(types_list)):
139
+ if head(tail(types_list)).tag == 10:
140
+ if is_empty(tail(tail(types_list))):
141
+ pattern_matching_result = 0
142
+ other_type = head(types_list)
143
+
144
+ else:
145
+ pattern_matching_result = 1
146
+
147
+
148
+ else:
149
+ pattern_matching_result = 1
150
+
151
+
152
+ else:
153
+ pattern_matching_result = 1
154
+
155
+
156
+ else:
157
+ pattern_matching_result = 1
158
+
159
+ if pattern_matching_result == 0:
160
+ t_mut = other_type
161
+ continue
162
+
163
+ elif pattern_matching_result == 1:
164
+ return True
165
+
166
+
167
+ else:
168
+ return False
169
+
170
+ break
171
+
172
+
173
+ def y_bool(b: bool) -> YAMLElement:
174
+ return YAMLElement(1, YAMLContent("true" if b else "false", None))
175
+
176
+
177
+ def y_map(pairs: FSharpList[tuple[str, YAMLElement]]) -> YAMLElement:
178
+ def mapping(tupled_arg: tuple[str, YAMLElement], pairs: Any=pairs) -> YAMLElement:
179
+ def _arrow984(__unit: None=None, tupled_arg: Any=tupled_arg) -> YAMLElement:
180
+ _arg: YAMLElement = tupled_arg[1]
181
+ (pattern_matching_result, single, other) = (None, None, None)
182
+ if _arg.tag == 3:
183
+ if not is_empty(_arg.fields[0]):
184
+ if is_empty(tail(_arg.fields[0])):
185
+ pattern_matching_result = 1
186
+ single = head(_arg.fields[0])
187
+
188
+ else:
189
+ pattern_matching_result = 2
190
+ other = _arg
191
+
192
+
193
+ else:
194
+ pattern_matching_result = 0
195
+
196
+
197
+ else:
198
+ pattern_matching_result = 2
199
+ other = _arg
200
+
201
+ if pattern_matching_result == 0:
202
+ return YAMLElement(1, YAMLContent("{}", None))
203
+
204
+ elif pattern_matching_result == 1:
205
+ return single
206
+
207
+ elif pattern_matching_result == 2:
208
+ return other
209
+
210
+
211
+ return YAMLElement(0, YAMLContent(tupled_arg[0], None), _arrow984())
212
+
213
+ return YAMLElement(3, map_1(mapping, pairs))
214
+
215
+
216
+ def normalize_doc_string(doc: str) -> str:
217
+ return trim_end(trim_end(replace(doc, "\r\n", "\n"), "\n"), "\r")
218
+
219
+
220
+ def encode_schema_salad_string(value: SchemaSaladString) -> YAMLElement:
221
+ if value.tag == 1:
222
+ return y_map(singleton(("$include", string(value.fields[0]))))
223
+
224
+ elif value.tag == 2:
225
+ return y_map(singleton(("$import", string(value.fields[0]))))
226
+
227
+ else:
228
+ return string(value.fields[0])
229
+
230
+
231
+
232
+ def normalize_env_value_for_encode(env_value: str) -> str:
233
+ if True if (env_value == "true") else (env_value == "false"):
234
+ return ("\"" + env_value) + "\""
235
+
236
+ else:
237
+ return env_value
238
+
239
+
240
+
241
+ def encode_env_var_requirement_compact_map(envs: Array[EnvironmentDef]) -> YAMLElement:
242
+ def mapping(env: EnvironmentDef, envs: Any=envs) -> tuple[str, YAMLElement]:
243
+ return (env.EnvName, string(normalize_env_value_for_encode(env.EnvValue)))
244
+
245
+ env_def_map: YAMLElement = y_map(to_list(map_2(mapping, envs)))
246
+ return y_map(of_array([("class", string("EnvVarRequirement")), ("envDef", env_def_map)]))
247
+
248
+
249
+ def encode_software_requirement_compact_map(packages: Array[SoftwarePackage]) -> YAMLElement:
250
+ def mapping(package_1: SoftwarePackage, packages: Any=packages) -> tuple[str, YAMLElement]:
251
+ def _arrow986(__unit: None=None, package_1: Any=package_1) -> YAMLElement:
252
+ package: SoftwarePackage = package_1
253
+ match_value_1: Array[str] | None = package.Specs
254
+ def _arrow985(__unit: None=None) -> FSharpList[tuple[str, YAMLElement]]:
255
+ value_6: Array[str] | None = package.Specs
256
+ acc_3: FSharpList[tuple[str, YAMLElement]]
257
+ value_3: Array[str] | None = package.Version
258
+ acc_1: FSharpList[tuple[str, YAMLElement]] = empty()
259
+ acc_3 = acc_1 if (value_3 is None) else append(acc_1, singleton(("version", YAMLElement(2, to_list(map_2(string, value_3))))))
260
+ return acc_3 if (value_6 is None) else append(acc_3, singleton(("specs", YAMLElement(2, to_list(map_2(string, value_6))))))
261
+
262
+ return (YAMLElement(2, to_list(map_2(string, match_value_1))) if (match_value_1 is not None) else y_map(empty())) if (package.Version is None) else y_map(_arrow985())
263
+
264
+ return (package_1.Package, _arrow986())
265
+
266
+ packages_map: YAMLElement = y_map(to_list(map_2(mapping, packages)))
267
+ return y_map(of_array([("class", string("SoftwareRequirement")), ("packages", packages_map)]))
268
+
269
+
270
+ def encode_label(label: str) -> tuple[str, YAMLElement]:
271
+ return ("label", string(label))
272
+
273
+
274
+ def encode_doc(doc: str) -> tuple[str, YAMLElement]:
275
+ return ("doc", string(normalize_doc_string(doc)))
276
+
277
+
278
+ def encode_intent(intent: Array[str]) -> tuple[str, YAMLElement]:
279
+ def _arrow987(value: str, intent: Any=intent) -> YAMLElement:
280
+ return string(value)
281
+
282
+ return ("intent", YAMLElement(2, of_seq(map_2(_arrow987, intent))))
283
+
284
+
285
+ def encode_cwltype(t: CWLType) -> YAMLElement:
286
+ if t.tag == 1:
287
+ return string("Directory")
288
+
289
+ elif t.tag == 2:
290
+ d: DirentInstance = t.fields[0]
291
+ def _arrow988(__unit: None=None, t: Any=t) -> FSharpList[tuple[str, YAMLElement]]:
292
+ value_4: bool | None = d.Writable
293
+ acc_3: FSharpList[tuple[str, YAMLElement]]
294
+ value_2: SchemaSaladString | None = d.Entryname
295
+ acc_1: FSharpList[tuple[str, YAMLElement]] = singleton(("entry", encode_schema_salad_string(d.Entry)))
296
+ acc_3 = acc_1 if (value_2 is None) else append(acc_1, singleton(("entryname", encode_schema_salad_string(value_2))))
297
+ return acc_3 if (value_4 is None) else append(acc_3, singleton(("writable", y_bool(value_4))))
298
+
299
+ return y_map(_arrow988())
300
+
301
+ elif t.tag == 3:
302
+ return string("string")
303
+
304
+ elif t.tag == 4:
305
+ return string("int")
306
+
307
+ elif t.tag == 5:
308
+ return string("long")
309
+
310
+ elif t.tag == 6:
311
+ return string("float")
312
+
313
+ elif t.tag == 7:
314
+ return string("double")
315
+
316
+ elif t.tag == 8:
317
+ return string("boolean")
318
+
319
+ elif t.tag == 9:
320
+ return string("stdout")
321
+
322
+ elif t.tag == 10:
323
+ return string("null")
324
+
325
+ elif t.tag == 14:
326
+ types_list: FSharpList[CWLType] = to_list(t.fields[0])
327
+ (pattern_matching_result, other_type) = (None, None)
328
+ if not is_empty(types_list):
329
+ if head(types_list).tag == 10:
330
+ if not is_empty(tail(types_list)):
331
+ if is_empty(tail(tail(types_list))):
332
+ pattern_matching_result = 0
333
+ other_type = head(tail(types_list))
334
+
335
+ else:
336
+ pattern_matching_result = 1
337
+
338
+
339
+ else:
340
+ pattern_matching_result = 1
341
+
342
+
343
+ elif not is_empty(tail(types_list)):
344
+ if head(tail(types_list)).tag == 10:
345
+ if is_empty(tail(tail(types_list))):
346
+ pattern_matching_result = 0
347
+ other_type = head(types_list)
348
+
349
+ else:
350
+ pattern_matching_result = 1
351
+
352
+
353
+ else:
354
+ pattern_matching_result = 1
355
+
356
+
357
+ else:
358
+ pattern_matching_result = 1
359
+
360
+
361
+ else:
362
+ pattern_matching_result = 1
363
+
364
+ if pattern_matching_result == 0:
365
+ if other_type.tag == 0:
366
+ return string("File?")
367
+
368
+ elif other_type.tag == 1:
369
+ return string("Directory?")
370
+
371
+ elif other_type.tag == 3:
372
+ return string("string?")
373
+
374
+ elif other_type.tag == 4:
375
+ return string("int?")
376
+
377
+ elif other_type.tag == 5:
378
+ return string("long?")
379
+
380
+ elif other_type.tag == 6:
381
+ return string("float?")
382
+
383
+ elif other_type.tag == 7:
384
+ return string("double?")
385
+
386
+ elif other_type.tag == 8:
387
+ return string("boolean?")
388
+
389
+ elif other_type.tag == 11:
390
+ array_schema: InputArraySchema = other_type.fields[0]
391
+ match_value: str | None = try_get_array_shorthand(array_schema.Items)
392
+ if match_value is None:
393
+ return YAMLElement(2, of_array([string("null"), encode_input_array_schema(array_schema)]))
394
+
395
+ else:
396
+ return string(match_value + "[]?")
397
+
398
+
399
+ else:
400
+ def mapping(t_1: CWLType, t: Any=t) -> YAMLElement:
401
+ return encode_cwltype(t_1)
402
+
403
+ return YAMLElement(2, map_1(mapping, types_list))
404
+
405
+
406
+ elif pattern_matching_result == 1:
407
+ def mapping_1(t_2: CWLType, t: Any=t) -> YAMLElement:
408
+ return encode_cwltype(t_2)
409
+
410
+ return YAMLElement(2, map_1(mapping_1, types_list))
411
+
412
+
413
+ elif t.tag == 11:
414
+ array_schema_1: InputArraySchema = t.fields[0]
415
+ match_value_1: str | None = try_get_array_shorthand(array_schema_1.Items)
416
+ if match_value_1 is None:
417
+ return encode_input_array_schema(array_schema_1)
418
+
419
+ else:
420
+ return string(match_value_1 + "[]")
421
+
422
+
423
+ elif t.tag == 12:
424
+ return encode_input_record_schema(t.fields[0])
425
+
426
+ elif t.tag == 13:
427
+ return encode_input_enum_schema(t.fields[0])
428
+
429
+ else:
430
+ return string("File")
431
+
432
+
433
+
434
+ def encode_input_record_field(field: InputRecordField) -> tuple[str, YAMLElement]:
435
+ return (field.Name, y_map(singleton(("type", encode_cwltype(field.Type)))))
436
+
437
+
438
+ def encode_input_record_schema(schema: InputRecordSchema) -> YAMLElement:
439
+ fields_element: YAMLElement
440
+ match_value: Array[InputRecordField] | None = schema.Fields
441
+ def mapping(field: InputRecordField, schema: Any=schema) -> tuple[str, YAMLElement]:
442
+ return encode_input_record_field(field)
443
+
444
+ fields_element = y_map(empty()) if (match_value is None) else y_map(to_list(map_2(mapping, match_value)))
445
+ return y_map(of_array([("type", string("record")), ("fields", fields_element)]))
446
+
447
+
448
+ def encode_input_enum_schema(schema: InputEnumSchema) -> YAMLElement:
449
+ def _arrow1002(value: str, schema: Any=schema) -> YAMLElement:
450
+ return string(value)
451
+
452
+ return y_map(append(singleton(("type", string("enum"))), singleton(("symbols", YAMLElement(2, of_seq(map_2(_arrow1002, schema.Symbols)))))))
453
+
454
+
455
+ def encode_input_array_schema(schema: InputArraySchema) -> YAMLElement:
456
+ return y_map(of_array([("type", string("array")), ("items", encode_cwltype(schema.Items))]))
457
+
458
+
459
+ def encode_output_binding(ob: OutputBinding) -> YAMLElement:
460
+ def chooser(x: tuple[str, YAMLElement] | None=None, ob: Any=ob) -> tuple[str, YAMLElement] | None:
461
+ return x
462
+
463
+ def mapping(g: str, ob: Any=ob) -> tuple[str, YAMLElement]:
464
+ return ("glob", string(g))
465
+
466
+ return y_map(choose(chooser, singleton(map(mapping, ob.Glob))))
467
+
468
+
469
+ def encode_string_array_or_scalar(values: Array[str]) -> YAMLElement:
470
+ if len(values) == 1:
471
+ return string(values[0])
472
+
473
+ else:
474
+ def _arrow1003(value: str, values: Any=values) -> YAMLElement:
475
+ return string(value)
476
+
477
+ return YAMLElement(2, of_seq(map_2(_arrow1003, values)))
478
+
479
+
480
+
481
+ def encode_cwloutput(o: CWLOutput) -> tuple[str, YAMLElement]:
482
+ def mapping(t: CWLType, o: Any=o) -> YAMLElement:
483
+ if t.tag == 14:
484
+ types_list: FSharpList[CWLType] = to_list(t.fields[0])
485
+ (pattern_matching_result, other_type) = (None, None)
486
+ if not is_empty(types_list):
487
+ if head(types_list).tag == 10:
488
+ if not is_empty(tail(types_list)):
489
+ if is_empty(tail(tail(types_list))):
490
+ pattern_matching_result = 0
491
+ other_type = head(tail(types_list))
492
+
493
+ else:
494
+ pattern_matching_result = 1
495
+
496
+
497
+ else:
498
+ pattern_matching_result = 1
499
+
500
+
501
+ elif not is_empty(tail(types_list)):
502
+ if head(tail(types_list)).tag == 10:
503
+ if is_empty(tail(tail(types_list))):
504
+ pattern_matching_result = 0
505
+ other_type = head(types_list)
506
+
507
+ else:
508
+ pattern_matching_result = 1
509
+
510
+
511
+ else:
512
+ pattern_matching_result = 1
513
+
514
+
515
+ else:
516
+ pattern_matching_result = 1
517
+
518
+
519
+ else:
520
+ pattern_matching_result = 1
521
+
522
+ if pattern_matching_result == 0:
523
+ if (((((((other_type.tag == 0) or (other_type.tag == 1)) or (other_type.tag == 3)) or (other_type.tag == 4)) or (other_type.tag == 5)) or (other_type.tag == 6)) or (other_type.tag == 7)) or (other_type.tag == 8):
524
+ return encode_cwltype(t)
525
+
526
+ elif other_type.tag == 11:
527
+ match_value: CWLType = other_type.fields[0].Items
528
+ if (((((((match_value.tag == 0) or (match_value.tag == 1)) or (match_value.tag == 3)) or (match_value.tag == 4)) or (match_value.tag == 5)) or (match_value.tag == 6)) or (match_value.tag == 7)) or (match_value.tag == 8):
529
+ return encode_cwltype(t)
530
+
531
+ else:
532
+ return encode_cwltype(t)
533
+
534
+
535
+ else:
536
+ return encode_cwltype(t)
537
+
538
+
539
+ elif pattern_matching_result == 1:
540
+ return encode_cwltype(t)
541
+
542
+
543
+ elif t.tag == 11:
544
+ array_schema_1: InputArraySchema = t.fields[0]
545
+ match_value_1: CWLType = array_schema_1.Items
546
+ if ((((((((match_value_1.tag == 0) or (match_value_1.tag == 1)) or (match_value_1.tag == 2)) or (match_value_1.tag == 3)) or (match_value_1.tag == 4)) or (match_value_1.tag == 5)) or (match_value_1.tag == 6)) or (match_value_1.tag == 7)) or (match_value_1.tag == 8):
547
+ return encode_cwltype(t)
548
+
549
+ else:
550
+ return y_map(singleton(("type", encode_input_array_schema(array_schema_1))))
551
+
552
+
553
+ elif t.tag == 12:
554
+ return y_map(singleton(("type", encode_input_record_schema(t.fields[0]))))
555
+
556
+ elif t.tag == 13:
557
+ return y_map(singleton(("type", encode_input_enum_schema(t.fields[0]))))
558
+
559
+ else:
560
+ return encode_cwltype(t)
561
+
562
+
563
+ type_element: YAMLElement | None = map(mapping, o.Type_)
564
+ pairs: FSharpList[tuple[str, YAMLElement]]
565
+ value_4: YAMLElement | None
566
+ match_value_2: OutputSource | None = o.OutputSource
567
+ (pattern_matching_result_1, value, values_1) = (None, None, None)
568
+ if match_value_2 is not None:
569
+ if match_value_2.tag == 1:
570
+ if len(match_value_2.fields[0]) > 0:
571
+ pattern_matching_result_1 = 1
572
+ values_1 = match_value_2.fields[0]
573
+
574
+ else:
575
+ pattern_matching_result_1 = 2
576
+
577
+
578
+ else:
579
+ pattern_matching_result_1 = 0
580
+ value = match_value_2.fields[0]
581
+
582
+
583
+ else:
584
+ pattern_matching_result_1 = 2
585
+
586
+ if pattern_matching_result_1 == 0:
587
+ value_4 = string(value)
588
+
589
+ elif pattern_matching_result_1 == 1:
590
+ value_4 = encode_string_array_or_scalar(values_1)
591
+
592
+ elif pattern_matching_result_1 == 2:
593
+ value_4 = None
594
+
595
+ acc_5: FSharpList[tuple[str, YAMLElement]]
596
+ acc_2: FSharpList[tuple[str, YAMLElement]]
597
+ value_1: YAMLElement | None = type_element
598
+ acc_1: FSharpList[tuple[str, YAMLElement]] = empty()
599
+ acc_2 = acc_1 if (value_1 is None) else append(acc_1, singleton(("type", value_1)))
600
+ value_3: OutputBinding | None = o.OutputBinding
601
+ acc_3: FSharpList[tuple[str, YAMLElement]] = acc_2
602
+ acc_5 = acc_3 if (value_3 is None) else append(acc_3, singleton(("outputBinding", encode_output_binding(value_3))))
603
+ pairs = acc_5 if (value_4 is None) else append(acc_5, singleton(("outputSource", value_4)))
604
+ (pattern_matching_result_2, t_1) = (None, None)
605
+ if not is_empty(pairs):
606
+ if head(pairs)[0] == "type":
607
+ if is_empty(tail(pairs)):
608
+ pattern_matching_result_2 = 0
609
+ t_1 = head(pairs)[1]
610
+
611
+ else:
612
+ pattern_matching_result_2 = 1
613
+
614
+
615
+ else:
616
+ pattern_matching_result_2 = 1
617
+
618
+
619
+ else:
620
+ pattern_matching_result_2 = 1
621
+
622
+ if pattern_matching_result_2 == 0:
623
+ return (o.Name, t_1)
624
+
625
+ elif pattern_matching_result_2 == 1:
626
+ return (o.Name, y_map(pairs))
627
+
628
+
629
+
630
+ def encode_input_binding(ib: InputBinding) -> YAMLElement:
631
+ def _arrow1005(__unit: None=None, ib: Any=ib) -> FSharpList[tuple[str, YAMLElement]]:
632
+ value_9: bool | None = ib.Separate
633
+ acc_7: FSharpList[tuple[str, YAMLElement]]
634
+ value_7: str | None = ib.ItemSeparator
635
+ acc_5: FSharpList[tuple[str, YAMLElement]]
636
+ value_4: int | None = ib.Position
637
+ acc_3: FSharpList[tuple[str, YAMLElement]]
638
+ value_2: str | None = ib.Prefix
639
+ acc_1: FSharpList[tuple[str, YAMLElement]] = empty()
640
+ acc_3 = acc_1 if (value_2 is None) else append(acc_1, singleton(("prefix", string(value_2))))
641
+ acc_5 = acc_3 if (value_4 is None) else append(acc_3, singleton(("position", int_1(value_4))))
642
+ acc_7 = acc_5 if (value_7 is None) else append(acc_5, singleton(("itemSeparator", string(value_7))))
643
+ return acc_7 if (value_9 is None) else append(acc_7, singleton(("separate", y_bool(value_9))))
644
+
645
+ return y_map(_arrow1005())
646
+
647
+
648
+ def encode_cwlinput(i: CWLInput) -> tuple[str, YAMLElement]:
649
+ pairs: FSharpList[tuple[str, YAMLElement]]
650
+ acc_4: FSharpList[tuple[str, YAMLElement]]
651
+ acc_2: FSharpList[tuple[str, YAMLElement]]
652
+ def mapping(t: CWLType, i: Any=i) -> YAMLElement:
653
+ if t.tag == 14:
654
+ types_list: FSharpList[CWLType] = to_list(t.fields[0])
655
+ (pattern_matching_result, other_type) = (None, None)
656
+ if not is_empty(types_list):
657
+ if head(types_list).tag == 10:
658
+ if not is_empty(tail(types_list)):
659
+ if is_empty(tail(tail(types_list))):
660
+ pattern_matching_result = 0
661
+ other_type = head(tail(types_list))
662
+
663
+ else:
664
+ pattern_matching_result = 1
665
+
666
+
667
+ else:
668
+ pattern_matching_result = 1
669
+
670
+
671
+ elif not is_empty(tail(types_list)):
672
+ if head(tail(types_list)).tag == 10:
673
+ if is_empty(tail(tail(types_list))):
674
+ pattern_matching_result = 0
675
+ other_type = head(types_list)
676
+
677
+ else:
678
+ pattern_matching_result = 1
679
+
680
+
681
+ else:
682
+ pattern_matching_result = 1
683
+
684
+
685
+ else:
686
+ pattern_matching_result = 1
687
+
688
+
689
+ else:
690
+ pattern_matching_result = 1
691
+
692
+ if pattern_matching_result == 0:
693
+ if (((((((other_type.tag == 0) or (other_type.tag == 1)) or (other_type.tag == 3)) or (other_type.tag == 4)) or (other_type.tag == 5)) or (other_type.tag == 6)) or (other_type.tag == 7)) or (other_type.tag == 8):
694
+ return encode_cwltype(t)
695
+
696
+ elif other_type.tag == 11:
697
+ match_value: CWLType = other_type.fields[0].Items
698
+ if (((((((match_value.tag == 0) or (match_value.tag == 1)) or (match_value.tag == 3)) or (match_value.tag == 4)) or (match_value.tag == 5)) or (match_value.tag == 6)) or (match_value.tag == 7)) or (match_value.tag == 8):
699
+ return encode_cwltype(t)
700
+
701
+ else:
702
+ return encode_cwltype(t)
703
+
704
+
705
+ else:
706
+ return encode_cwltype(t)
707
+
708
+
709
+ elif pattern_matching_result == 1:
710
+ return encode_cwltype(t)
711
+
712
+
713
+ elif t.tag == 11:
714
+ array_schema_1: InputArraySchema = t.fields[0]
715
+ match_value_1: CWLType = array_schema_1.Items
716
+ if ((((((((match_value_1.tag == 0) or (match_value_1.tag == 1)) or (match_value_1.tag == 2)) or (match_value_1.tag == 3)) or (match_value_1.tag == 4)) or (match_value_1.tag == 5)) or (match_value_1.tag == 6)) or (match_value_1.tag == 7)) or (match_value_1.tag == 8):
717
+ return encode_cwltype(t)
718
+
719
+ else:
720
+ return y_map(singleton(("type", encode_input_array_schema(array_schema_1))))
721
+
722
+
723
+ elif t.tag == 12:
724
+ return y_map(singleton(("type", encode_input_record_schema(t.fields[0]))))
725
+
726
+ elif t.tag == 13:
727
+ return y_map(singleton(("type", encode_input_enum_schema(t.fields[0]))))
728
+
729
+ else:
730
+ return encode_cwltype(t)
731
+
732
+
733
+ value: YAMLElement | None = map(mapping, i.Type_)
734
+ acc_1: FSharpList[tuple[str, YAMLElement]] = empty()
735
+ acc_2 = acc_1 if (value is None) else append(acc_1, singleton(("type", value)))
736
+ value_2: InputBinding | None = i.InputBinding
737
+ acc_3: FSharpList[tuple[str, YAMLElement]] = acc_2
738
+ acc_4 = acc_3 if (value_2 is None) else append(acc_3, singleton(("inputBinding", encode_input_binding(value_2))))
739
+ value_4: bool | None = i.Optional
740
+ acc_5: FSharpList[tuple[str, YAMLElement]] = acc_4
741
+ pairs = acc_5 if (value_4 is None) else append(acc_5, singleton(("optional", y_bool(value_4))))
742
+ (pattern_matching_result_1, t_1) = (None, None)
743
+ if not is_empty(pairs):
744
+ if head(pairs)[0] == "type":
745
+ if is_empty(tail(pairs)):
746
+ pattern_matching_result_1 = 0
747
+ t_1 = head(pairs)[1]
748
+
749
+ else:
750
+ pattern_matching_result_1 = 1
751
+
752
+
753
+ else:
754
+ pattern_matching_result_1 = 1
755
+
756
+
757
+ else:
758
+ pattern_matching_result_1 = 1
759
+
760
+ if pattern_matching_result_1 == 0:
761
+ return (i.Name, t_1)
762
+
763
+ elif pattern_matching_result_1 == 1:
764
+ return (i.Name, y_map(pairs))
765
+
766
+
767
+
768
+ def encode_schema_def_requirement_type(s: SchemaDefRequirementType) -> YAMLElement:
769
+ return y_map(of_array([("name", string(s.Name)), ("type", encode_cwltype(s.Type_))]))
770
+
771
+
772
+ def encode_requirement(r: Requirement) -> YAMLElement:
773
+ if r.tag == 1:
774
+ def _arrow1006(s: SchemaDefRequirementType, r: Any=r) -> YAMLElement:
775
+ return encode_schema_def_requirement_type(s)
776
+
777
+ return y_map(of_array([("class", string("SchemaDefRequirement")), ("types", YAMLElement(2, of_seq(map_2(_arrow1006, r.fields[0]))))]))
778
+
779
+ elif r.tag == 2:
780
+ dr: DockerRequirement = r.fields[0]
781
+ def _arrow1007(__unit: None=None, r: Any=r) -> FSharpList[tuple[str, YAMLElement]]:
782
+ value_20: str | None = dr.DockerOutputDirectory
783
+ acc_13: FSharpList[tuple[str, YAMLElement]]
784
+ value_17: str | None = dr.DockerImport
785
+ acc_11: FSharpList[tuple[str, YAMLElement]]
786
+ value_14: str | None = dr.DockerLoad
787
+ acc_9: FSharpList[tuple[str, YAMLElement]]
788
+ value_11: str | None = dr.DockerImageId
789
+ acc_7: FSharpList[tuple[str, YAMLElement]]
790
+ value_8: SchemaSaladString | None = dr.DockerFile
791
+ acc_5: FSharpList[tuple[str, YAMLElement]]
792
+ value_5: str | None = dr.DockerPull
793
+ acc_3: FSharpList[tuple[str, YAMLElement]] = singleton(("class", string("DockerRequirement")))
794
+ acc_5 = acc_3 if (value_5 is None) else append(acc_3, singleton(("dockerPull", string(value_5))))
795
+ acc_7 = acc_5 if (value_8 is None) else append(acc_5, singleton(("dockerFile", encode_schema_salad_string(value_8))))
796
+ acc_9 = acc_7 if (value_11 is None) else append(acc_7, singleton(("dockerImageId", string(value_11))))
797
+ acc_11 = acc_9 if (value_14 is None) else append(acc_9, singleton(("dockerLoad", string(value_14))))
798
+ acc_13 = acc_11 if (value_17 is None) else append(acc_11, singleton(("dockerImport", string(value_17))))
799
+ return acc_13 if (value_20 is None) else append(acc_13, singleton(("dockerOutputDirectory", string(value_20))))
800
+
801
+ return y_map(_arrow1007())
802
+
803
+ elif r.tag == 3:
804
+ def encode_pkg(p: SoftwarePackage, r: Any=r) -> YAMLElement:
805
+ def _arrow1008(__unit: None=None, p: Any=p) -> FSharpList[tuple[str, YAMLElement]]:
806
+ value_26: Array[str] | None = p.Specs
807
+ acc_18: FSharpList[tuple[str, YAMLElement]]
808
+ value_23: Array[str] | None = p.Version
809
+ acc_16: FSharpList[tuple[str, YAMLElement]] = append(empty(), singleton(("package", string(p.Package))))
810
+ acc_18 = acc_16 if (value_23 is None) else append(acc_16, singleton(("version", YAMLElement(2, of_seq(map_2(string, value_23))))))
811
+ return acc_18 if (value_26 is None) else append(acc_18, singleton(("specs", YAMLElement(2, of_seq(map_2(string, value_26))))))
812
+
813
+ return y_map(_arrow1008())
814
+
815
+ return y_map(of_array([("class", string("SoftwareRequirement")), ("packages", YAMLElement(2, of_seq(map_2(encode_pkg, r.fields[0]))))]))
816
+
817
+ elif r.tag == 4:
818
+ return y_map(of_array([("class", string("LoadListingRequirement")), ("loadListing", string(LoadListingEnum_get_toCwlString()(r.fields[0].LoadListing)))]))
819
+
820
+ elif r.tag == 5:
821
+ def encode_dynamic_obj_with_class(class_name: str, dyn_obj: DynamicObj, r: Any=r) -> YAMLElement:
822
+ def chooser(kvp: Any, class_name: Any=class_name, dyn_obj: Any=dyn_obj) -> tuple[str, YAMLElement] | None:
823
+ match_value: Any = kvp[1]
824
+ if str(type(match_value)) == "<class \'str\'>":
825
+ return (kvp[0], string(match_value))
826
+
827
+ elif str(type(match_value)) == "<class \'bool\'>":
828
+ return (kvp[0], y_bool(match_value))
829
+
830
+ elif str(type(match_value)) == "<class \'int\'>":
831
+ return (kvp[0], int_1(match_value))
832
+
833
+ elif str(type(match_value)) == "<class \'fable_modules.fable_library.types.int64\'>":
834
+ return (kvp[0], string(int64_to_string(match_value)))
835
+
836
+ elif str(type(match_value)) == "<class \'float\'>":
837
+ return (kvp[0], float_1(match_value))
838
+
839
+ elif isinstance(match_value, YAMLElement):
840
+ return (kvp[0], match_value)
841
+
842
+ else:
843
+ return None
844
+
845
+
846
+ dynamic_pairs: FSharpList[tuple[str, YAMLElement]] = to_list(choose_1(chooser, dyn_obj.GetProperties(False)))
847
+ def predicate(tupled_arg: tuple[str, YAMLElement], class_name: Any=class_name, dyn_obj: Any=dyn_obj) -> bool:
848
+ return tupled_arg[0] == "class"
849
+
850
+ if exists(predicate, dynamic_pairs):
851
+ return y_map(dynamic_pairs)
852
+
853
+ else:
854
+ return y_map(cons(("class", string(class_name)), dynamic_pairs))
855
+
856
+
857
+ encode_dynamic_obj_with_class: Callable[[str, DynamicObj], YAMLElement] = encode_dynamic_obj_with_class
858
+ def encode_initial_work_dir_entry(_arg_1: InitialWorkDirEntry, r: Any=r) -> YAMLElement:
859
+ if _arg_1.tag == 1:
860
+ return encode_schema_salad_string(_arg_1.fields[0])
861
+
862
+ elif _arg_1.tag == 2:
863
+ return encode_dynamic_obj_with_class("File", _arg_1.fields[0])
864
+
865
+ elif _arg_1.tag == 3:
866
+ return encode_dynamic_obj_with_class("Directory", _arg_1.fields[0])
867
+
868
+ else:
869
+ d: DirentInstance = _arg_1.fields[0]
870
+ def _arrow1010(__unit: None=None, _arg_1: Any=_arg_1) -> FSharpList[tuple[str, YAMLElement]]:
871
+ value_31: bool | None = d.Writable
872
+ def _arrow1009(__unit: None=None) -> FSharpList[tuple[str, YAMLElement]]:
873
+ value_29: SchemaSaladString | None = d.Entryname
874
+ acc_20: FSharpList[tuple[str, YAMLElement]] = empty()
875
+ return acc_20 if (value_29 is None) else append(acc_20, singleton(("entryname", encode_schema_salad_string(value_29))))
876
+
877
+ acc_23: FSharpList[tuple[str, YAMLElement]] = append(_arrow1009(), singleton(("entry", encode_schema_salad_string(d.Entry))))
878
+ return acc_23 if (value_31 is None) else append(acc_23, singleton(("writable", y_bool(value_31))))
879
+
880
+ return y_map(_arrow1010())
881
+
882
+
883
+ return y_map(of_array([("class", string("InitialWorkDirRequirement")), ("listing", YAMLElement(2, of_seq(map_2(encode_initial_work_dir_entry, r.fields[0]))))]))
884
+
885
+ elif r.tag == 6:
886
+ def encode_env(e: EnvironmentDef, r: Any=r) -> YAMLElement:
887
+ v_11: str = normalize_env_value_for_encode(e.EnvValue)
888
+ return y_map(of_array([("envName", string(e.EnvName)), ("envValue", string(v_11))]))
889
+
890
+ return y_map(of_array([("class", string("EnvVarRequirement")), ("envDef", YAMLElement(2, of_seq(map_2(encode_env, r.fields[0]))))]))
891
+
892
+ elif r.tag == 7:
893
+ return y_map(singleton(("class", string("ShellCommandRequirement"))))
894
+
895
+ elif r.tag == 8:
896
+ def try_encode_scalar(key: str, value_32: Any=None, r: Any=r) -> tuple[str, YAMLElement] | None:
897
+ if str(type(value_32)) == "<class \'int\'>":
898
+ return (key, int_1(value_32))
899
+
900
+ elif str(type(value_32)) == "<class \'fable_modules.fable_library.types.int64\'>":
901
+ return (key, YAMLElement(1, YAMLContent(int64_to_string(value_32), None)))
902
+
903
+ elif str(type(value_32)) == "<class \'float\'>":
904
+ return (key, float_1(value_32))
905
+
906
+ elif str(type(value_32)) == "<class \'str\'>":
907
+ return (key, string(value_32))
908
+
909
+ elif str(type(value_32)) == "<class \'bool\'>":
910
+ return (key, y_bool(value_32))
911
+
912
+ else:
913
+ return None
914
+
915
+
916
+ try_encode_scalar: Callable[[str, Any], tuple[str, YAMLElement] | None] = try_encode_scalar
917
+ def chooser_1(kvp_1: Any, r: Any=r) -> tuple[str, YAMLElement] | None:
918
+ match_value_1: Any = kvp_1[1]
919
+ return bind(curry2(try_encode_scalar)(kvp_1[0]), match_value_1)
920
+
921
+ dynamic_pairs_1: FSharpList[tuple[str, YAMLElement]] = to_list(choose_1(chooser_1, r.fields[0].GetProperties(False)))
922
+ return y_map(append(singleton(("class", string("ResourceRequirement"))), dynamic_pairs_1))
923
+
924
+ elif r.tag == 9:
925
+ return y_map(of_array([("class", string("WorkReuse")), ("enableReuse", y_bool(r.fields[0].EnableReuse))]))
926
+
927
+ elif r.tag == 10:
928
+ return y_map(of_array([("class", string("WorkReuse")), ("enableReuse", string(r.fields[0]))]))
929
+
930
+ elif r.tag == 11:
931
+ return y_map(of_array([("class", string("NetworkAccess")), ("networkAccess", y_bool(r.fields[0].NetworkAccess))]))
932
+
933
+ elif r.tag == 12:
934
+ return y_map(of_array([("class", string("NetworkAccess")), ("networkAccess", string(r.fields[0]))]))
935
+
936
+ elif r.tag == 13:
937
+ return y_map(of_array([("class", string("InplaceUpdateRequirement")), ("inplaceUpdate", y_bool(r.fields[0].InplaceUpdate))]))
938
+
939
+ elif r.tag == 14:
940
+ tl: ToolTimeLimitValue = r.fields[0]
941
+ timelimit: YAMLElement = string(tl.fields[0]) if (tl.tag == 1) else YAMLElement(1, YAMLContent(int64_to_string(tl.fields[0]), None))
942
+ return y_map(of_array([("class", string("ToolTimeLimit")), ("timelimit", timelimit)]))
943
+
944
+ elif r.tag == 15:
945
+ return y_map(singleton(("class", string("SubworkflowFeatureRequirement"))))
946
+
947
+ elif r.tag == 16:
948
+ return y_map(singleton(("class", string("ScatterFeatureRequirement"))))
949
+
950
+ elif r.tag == 17:
951
+ return y_map(singleton(("class", string("MultipleInputFeatureRequirement"))))
952
+
953
+ elif r.tag == 18:
954
+ return y_map(singleton(("class", string("StepInputExpressionRequirement"))))
955
+
956
+ else:
957
+ def _arrow1011(__unit: None=None, r: Any=r) -> FSharpList[tuple[str, YAMLElement]]:
958
+ def binder(entries: Array[str]) -> Array[str] | None:
959
+ if len(entries) > 0:
960
+ return entries
961
+
962
+ else:
963
+ return None
964
+
965
+
966
+ value_2: Array[str] | None = bind(binder, r.fields[0].ExpressionLib)
967
+ acc_1: FSharpList[tuple[str, YAMLElement]] = singleton(("class", string("InlineJavascriptRequirement")))
968
+ return acc_1 if (value_2 is None) else append(acc_1, singleton(("expressionLib", YAMLElement(2, of_seq(map_2(string, value_2))))))
969
+
970
+ return y_map(_arrow1011())
971
+
972
+
973
+
974
+ def encode_hint_entry(hint: HintEntry) -> YAMLElement:
975
+ if hint.tag == 1:
976
+ return hint.fields[0].Raw
977
+
978
+ else:
979
+ return encode_requirement(hint.fields[0])
980
+
981
+
982
+
983
+ def encode_source_array(sources: Array[str]) -> YAMLElement:
984
+ if len(sources) == 1:
985
+ return string(sources[0])
986
+
987
+ else:
988
+ def mapping(s: str, sources: Any=sources) -> YAMLElement:
989
+ return YAMLElement(3, singleton(YAMLElement(1, YAMLContent(s, None))))
990
+
991
+ return YAMLElement(2, of_seq(map_2(mapping, sources)))
992
+
993
+
994
+
995
+ def encode_link_merge_method(link_merge: LinkMergeMethod) -> YAMLElement:
996
+ return string(link_merge.AsCwlString)
997
+
998
+
999
+ def encode_pick_value_method(pick_value: PickValueMethod) -> YAMLElement:
1000
+ return string(pick_value.AsCwlString)
1001
+
1002
+
1003
+ def encode_scatter_method(scatter_method: ScatterMethod) -> YAMLElement:
1004
+ return string(scatter_method.AsCwlString)
1005
+
1006
+
1007
+ def encode_step_input(si: StepInput) -> tuple[str, YAMLElement]:
1008
+ pairs: FSharpList[tuple[str, YAMLElement]]
1009
+ value_21: str | None = si.Label
1010
+ acc_17: FSharpList[tuple[str, YAMLElement]]
1011
+ value_18: str | None = si.LoadListing
1012
+ acc_15: FSharpList[tuple[str, YAMLElement]]
1013
+ value_15: bool | None = si.LoadContents
1014
+ acc_13: FSharpList[tuple[str, YAMLElement]]
1015
+ value_13: str | None = si.Doc
1016
+ acc_11: FSharpList[tuple[str, YAMLElement]]
1017
+ value_10: PickValueMethod | None = si.PickValue
1018
+ acc_9: FSharpList[tuple[str, YAMLElement]]
1019
+ value_8: LinkMergeMethod | None = si.LinkMerge
1020
+ acc_7: FSharpList[tuple[str, YAMLElement]]
1021
+ value_6: str | None = si.ValueFrom
1022
+ acc_5: FSharpList[tuple[str, YAMLElement]]
1023
+ value_3: YAMLElement | None = si.DefaultValue
1024
+ acc_3: FSharpList[tuple[str, YAMLElement]]
1025
+ value_1: Array[str] | None = si.Source
1026
+ acc_1: FSharpList[tuple[str, YAMLElement]] = empty()
1027
+ acc_3 = acc_1 if (value_1 is None) else append(acc_1, singleton(("source", encode_source_array(value_1))))
1028
+ acc_5 = acc_3 if (value_3 is None) else append(acc_3, singleton(("default", value_3)))
1029
+ acc_7 = acc_5 if (value_6 is None) else append(acc_5, singleton(("valueFrom", string(value_6))))
1030
+ acc_9 = acc_7 if (value_8 is None) else append(acc_7, singleton(("linkMerge", encode_link_merge_method(value_8))))
1031
+ acc_11 = acc_9 if (value_10 is None) else append(acc_9, singleton(("pickValue", encode_pick_value_method(value_10))))
1032
+ acc_13 = acc_11 if (value_13 is None) else append(acc_11, singleton(("doc", string(value_13))))
1033
+ acc_15 = acc_13 if (value_15 is None) else append(acc_13, singleton(("loadContents", y_bool(value_15))))
1034
+ acc_17 = acc_15 if (value_18 is None) else append(acc_15, singleton(("loadListing", string(value_18))))
1035
+ pairs = acc_17 if (value_21 is None) else append(acc_17, singleton(("label", string(value_21))))
1036
+ (pattern_matching_result, s_1) = (None, None)
1037
+ if not is_empty(pairs):
1038
+ if head(pairs)[0] == "source":
1039
+ if is_empty(tail(pairs)):
1040
+ if (si.Label is None) if ((si.LoadListing is None) if ((si.LoadContents is None) if ((si.Doc is None) if ((si.PickValue is None) if ((si.LinkMerge is None) if ((si.ValueFrom is None) if (si.DefaultValue is None) else False) else False) else False) else False) else False) else False) else False:
1041
+ pattern_matching_result = 0
1042
+ s_1 = head(pairs)[1]
1043
+
1044
+ else:
1045
+ pattern_matching_result = 1
1046
+
1047
+
1048
+ else:
1049
+ pattern_matching_result = 1
1050
+
1051
+
1052
+ else:
1053
+ pattern_matching_result = 1
1054
+
1055
+
1056
+ else:
1057
+ pattern_matching_result = 1
1058
+
1059
+ if pattern_matching_result == 0:
1060
+ return (si.Id, s_1)
1061
+
1062
+ elif pattern_matching_result == 1:
1063
+ return (si.Id, y_map(pairs))
1064
+
1065
+
1066
+
1067
+ def encode_step_inputs(inputs: Array[StepInput]) -> YAMLElement:
1068
+ def _arrow1012(si: StepInput, inputs: Any=inputs) -> tuple[str, YAMLElement]:
1069
+ return encode_step_input(si)
1070
+
1071
+ return y_map(to_list(map_2(_arrow1012, inputs)))
1072
+
1073
+
1074
+ def encode_step_output_parameter(so: StepOutputParameter) -> YAMLElement:
1075
+ return y_map(singleton(("id", string(so.Id))))
1076
+
1077
+
1078
+ def encode_step_outputs(outputs: Array[StepOutput]) -> YAMLElement:
1079
+ def mapping(output: StepOutput, outputs: Any=outputs) -> YAMLElement:
1080
+ if output.tag == 1:
1081
+ return encode_step_output_parameter(output.fields[0])
1082
+
1083
+ else:
1084
+ return string(output.fields[0])
1085
+
1086
+
1087
+ return YAMLElement(2, of_seq(map_2(mapping, outputs)))
1088
+
1089
+
1090
+ def encode_scatter(scatter: Array[str]) -> YAMLElement:
1091
+ if len(scatter) == 1:
1092
+ return string(scatter[0])
1093
+
1094
+ else:
1095
+ def _arrow1013(value: str, scatter: Any=scatter) -> YAMLElement:
1096
+ return string(value)
1097
+
1098
+ return YAMLElement(2, of_seq(map_2(_arrow1013, scatter)))
1099
+
1100
+
1101
+
1102
+ def encode_workflow_step_run(run: WorkflowStepRun) -> YAMLElement:
1103
+ if run.tag == 1:
1104
+ match_value: CWLToolDescription | None = WorkflowStepRunOps_tryGetTool(run)
1105
+ if match_value is None:
1106
+ raise Exception(to_text(interpolate("RunCommandLineTool must contain CWLToolDescription but got %A%P()", [run.fields[0]])))
1107
+
1108
+ else:
1109
+ return encode_tool_description_element(match_value)
1110
+
1111
+
1112
+ elif run.tag == 2:
1113
+ match_value_1: CWLWorkflowDescription | None = WorkflowStepRunOps_tryGetWorkflow(run)
1114
+ if match_value_1 is None:
1115
+ raise Exception(to_text(interpolate("RunWorkflow must contain CWLWorkflowDescription but got %A%P()", [run.fields[0]])))
1116
+
1117
+ else:
1118
+ return encode_workflow_description_element(match_value_1)
1119
+
1120
+
1121
+ elif run.tag == 3:
1122
+ match_value_2: CWLExpressionToolDescription | None = WorkflowStepRunOps_tryGetExpressionTool(run)
1123
+ if match_value_2 is None:
1124
+ raise Exception(to_text(interpolate("RunExpressionTool must contain CWLExpressionToolDescription but got %A%P()", [run.fields[0]])))
1125
+
1126
+ else:
1127
+ return encode_expression_tool_description_element(match_value_2)
1128
+
1129
+
1130
+ elif run.tag == 4:
1131
+ match_value_3: CWLOperationDescription | None = WorkflowStepRunOps_tryGetOperation(run)
1132
+ if match_value_3 is None:
1133
+ raise Exception(to_text(interpolate("RunOperation must contain CWLOperationDescription but got %A%P()", [run.fields[0]])))
1134
+
1135
+ else:
1136
+ return encode_operation_description_element(match_value_3)
1137
+
1138
+
1139
+ else:
1140
+ return string(run.fields[0])
1141
+
1142
+
1143
+
1144
+ def encode_tool_description_element(td: CWLToolDescription) -> YAMLElement:
1145
+ base_pairs: FSharpList[tuple[str, YAMLElement]]
1146
+ acc_4: FSharpList[tuple[str, YAMLElement]]
1147
+ acc_2: FSharpList[tuple[str, YAMLElement]]
1148
+ acc: FSharpList[tuple[str, YAMLElement]] = of_array([("cwlVersion", string(td.CWLVersion)), ("class", string("CommandLineTool"))])
1149
+ def _arrow1014(label: str, td: Any=td) -> tuple[str, YAMLElement]:
1150
+ return encode_label(label)
1151
+
1152
+ pair_opt_1: tuple[str, YAMLElement] | None = map(_arrow1014, td.Label)
1153
+ acc_1: FSharpList[tuple[str, YAMLElement]] = acc
1154
+ acc_2 = acc_1 if (pair_opt_1 is None) else append(acc_1, singleton(pair_opt_1))
1155
+ def _arrow1015(doc: str, td: Any=td) -> tuple[str, YAMLElement]:
1156
+ return encode_doc(doc)
1157
+
1158
+ pair_opt_3: tuple[str, YAMLElement] | None = map(_arrow1015, td.Doc)
1159
+ acc_3: FSharpList[tuple[str, YAMLElement]] = acc_2
1160
+ acc_4 = acc_3 if (pair_opt_3 is None) else append(acc_3, singleton(pair_opt_3))
1161
+ def mapping(intent_1: Array[str], td: Any=td) -> tuple[str, YAMLElement]:
1162
+ return encode_intent(intent_1)
1163
+
1164
+ def predicate(intent: Array[str], td: Any=td) -> bool:
1165
+ return len(intent) > 0
1166
+
1167
+ pair_opt_5: tuple[str, YAMLElement] | None = map(mapping, filter(predicate, td.Intent))
1168
+ acc_5: FSharpList[tuple[str, YAMLElement]] = acc_4
1169
+ base_pairs = acc_5 if (pair_opt_5 is None) else append(acc_5, singleton(pair_opt_5))
1170
+ with_hints: FSharpList[tuple[str, YAMLElement]]
1171
+ match_value: Array[HintEntry] | None = td.Hints
1172
+ (pattern_matching_result, h_1) = (None, None)
1173
+ if match_value is not None:
1174
+ if len(match_value) > 0:
1175
+ pattern_matching_result = 0
1176
+ h_1 = match_value
1177
+
1178
+ else:
1179
+ pattern_matching_result = 1
1180
+
1181
+
1182
+ else:
1183
+ pattern_matching_result = 1
1184
+
1185
+ if pattern_matching_result == 0:
1186
+ def _arrow1016(hint: HintEntry, td: Any=td) -> YAMLElement:
1187
+ return encode_hint_entry(hint)
1188
+
1189
+ with_hints = append(base_pairs, singleton(("hints", YAMLElement(2, of_seq(map_2(_arrow1016, h_1))))))
1190
+
1191
+ elif pattern_matching_result == 1:
1192
+ with_hints = base_pairs
1193
+
1194
+ with_requirements: FSharpList[tuple[str, YAMLElement]]
1195
+ match_value_1: Array[Requirement] | None = td.Requirements
1196
+ (pattern_matching_result_1, r_1) = (None, None)
1197
+ if match_value_1 is not None:
1198
+ if len(match_value_1) > 0:
1199
+ pattern_matching_result_1 = 0
1200
+ r_1 = match_value_1
1201
+
1202
+ else:
1203
+ pattern_matching_result_1 = 1
1204
+
1205
+
1206
+ else:
1207
+ pattern_matching_result_1 = 1
1208
+
1209
+ if pattern_matching_result_1 == 0:
1210
+ def _arrow1017(r_2: Requirement, td: Any=td) -> YAMLElement:
1211
+ return encode_requirement(r_2)
1212
+
1213
+ with_requirements = append(with_hints, singleton(("requirements", YAMLElement(2, of_seq(map_2(_arrow1017, r_1))))))
1214
+
1215
+ elif pattern_matching_result_1 == 1:
1216
+ with_requirements = with_hints
1217
+
1218
+ with_base_command: FSharpList[tuple[str, YAMLElement]]
1219
+ match_value_2: Array[str] | None = td.BaseCommand
1220
+ (pattern_matching_result_2, bc_1) = (None, None)
1221
+ if match_value_2 is not None:
1222
+ if len(match_value_2) > 0:
1223
+ pattern_matching_result_2 = 0
1224
+ bc_1 = match_value_2
1225
+
1226
+ else:
1227
+ pattern_matching_result_2 = 1
1228
+
1229
+
1230
+ else:
1231
+ pattern_matching_result_2 = 1
1232
+
1233
+ if pattern_matching_result_2 == 0:
1234
+ def _arrow1018(value: str, td: Any=td) -> YAMLElement:
1235
+ return string(value)
1236
+
1237
+ with_base_command = append(with_requirements, singleton(("baseCommand", YAMLElement(2, of_seq(map_2(_arrow1018, bc_1))))))
1238
+
1239
+ elif pattern_matching_result_2 == 1:
1240
+ with_base_command = with_requirements
1241
+
1242
+ def _arrow1019(__unit: None=None, td: Any=td) -> FSharpList[tuple[str, YAMLElement]]:
1243
+ match_value_3: Array[CWLInput] | None = td.Inputs
1244
+ (pattern_matching_result_3, i_1) = (None, None)
1245
+ if match_value_3 is not None:
1246
+ if len(match_value_3) > 0:
1247
+ pattern_matching_result_3 = 0
1248
+ i_1 = match_value_3
1249
+
1250
+ else:
1251
+ pattern_matching_result_3 = 1
1252
+
1253
+
1254
+ else:
1255
+ pattern_matching_result_3 = 1
1256
+
1257
+ if pattern_matching_result_3 == 0:
1258
+ return append(with_base_command, singleton(("inputs", y_map(to_list(map_2(encode_cwlinput, i_1))))))
1259
+
1260
+ elif pattern_matching_result_3 == 1:
1261
+ return with_base_command
1262
+
1263
+
1264
+ def mapping_2(o: CWLOutput, td: Any=td) -> tuple[str, YAMLElement]:
1265
+ return encode_cwloutput(o)
1266
+
1267
+ with_outputs: FSharpList[tuple[str, YAMLElement]] = append(_arrow1019(), singleton(("outputs", y_map(to_list(map_2(mapping_2, td.Outputs))))))
1268
+ def _arrow1021(__unit: None=None, td: Any=td) -> FSharpList[tuple[str, YAMLElement]]:
1269
+ match_value_4: DynamicObj | None = td.Metadata
1270
+ if match_value_4 is None:
1271
+ return with_outputs
1272
+
1273
+ else:
1274
+ md: DynamicObj = match_value_4
1275
+ def folder(acc_6: FSharpList[tuple[str, YAMLElement]], kvp: Any) -> FSharpList[tuple[str, YAMLElement]]:
1276
+ def _arrow1020(__unit: None=None, acc_6: Any=acc_6, kvp: Any=kvp) -> YAMLElement:
1277
+ match_value_5: Any = kvp[1]
1278
+ return string(match_value_5) if (str(type(match_value_5)) == "<class \'str\'>") else (y_bool(match_value_5) if (str(type(match_value_5)) == "<class \'bool\'>") else (int_1(match_value_5) if (str(type(match_value_5)) == "<class \'int\'>") else (float_1(match_value_5) if (str(type(match_value_5)) == "<class \'float\'>") else (match_value_5 if isinstance(match_value_5, YAMLElement) else string(to_string(kvp[1]))))))
1279
+
1280
+ return append(acc_6, singleton((kvp[0], _arrow1020())))
1281
+
1282
+ return fold(folder, with_outputs, md.GetProperties(False))
1283
+
1284
+
1285
+ return y_map(_arrow1021())
1286
+
1287
+
1288
+ def encode_expression_tool_description_element(et: CWLExpressionToolDescription) -> YAMLElement:
1289
+ base_pairs: FSharpList[tuple[str, YAMLElement]]
1290
+ acc_4: FSharpList[tuple[str, YAMLElement]]
1291
+ acc_2: FSharpList[tuple[str, YAMLElement]]
1292
+ acc: FSharpList[tuple[str, YAMLElement]] = of_array([("cwlVersion", string(et.CWLVersion)), ("class", string("ExpressionTool"))])
1293
+ def _arrow1022(label: str, et: Any=et) -> tuple[str, YAMLElement]:
1294
+ return encode_label(label)
1295
+
1296
+ pair_opt_1: tuple[str, YAMLElement] | None = map(_arrow1022, et.Label)
1297
+ acc_1: FSharpList[tuple[str, YAMLElement]] = acc
1298
+ acc_2 = acc_1 if (pair_opt_1 is None) else append(acc_1, singleton(pair_opt_1))
1299
+ def _arrow1023(doc: str, et: Any=et) -> tuple[str, YAMLElement]:
1300
+ return encode_doc(doc)
1301
+
1302
+ pair_opt_3: tuple[str, YAMLElement] | None = map(_arrow1023, et.Doc)
1303
+ acc_3: FSharpList[tuple[str, YAMLElement]] = acc_2
1304
+ acc_4 = acc_3 if (pair_opt_3 is None) else append(acc_3, singleton(pair_opt_3))
1305
+ def mapping(intent_1: Array[str], et: Any=et) -> tuple[str, YAMLElement]:
1306
+ return encode_intent(intent_1)
1307
+
1308
+ def predicate(intent: Array[str], et: Any=et) -> bool:
1309
+ return len(intent) > 0
1310
+
1311
+ pair_opt_5: tuple[str, YAMLElement] | None = map(mapping, filter(predicate, et.Intent))
1312
+ acc_5: FSharpList[tuple[str, YAMLElement]] = acc_4
1313
+ base_pairs = acc_5 if (pair_opt_5 is None) else append(acc_5, singleton(pair_opt_5))
1314
+ with_hints: FSharpList[tuple[str, YAMLElement]]
1315
+ match_value: Array[HintEntry] | None = et.Hints
1316
+ (pattern_matching_result, h_1) = (None, None)
1317
+ if match_value is not None:
1318
+ if len(match_value) > 0:
1319
+ pattern_matching_result = 0
1320
+ h_1 = match_value
1321
+
1322
+ else:
1323
+ pattern_matching_result = 1
1324
+
1325
+
1326
+ else:
1327
+ pattern_matching_result = 1
1328
+
1329
+ if pattern_matching_result == 0:
1330
+ def _arrow1024(hint: HintEntry, et: Any=et) -> YAMLElement:
1331
+ return encode_hint_entry(hint)
1332
+
1333
+ with_hints = append(base_pairs, singleton(("hints", YAMLElement(2, of_seq(map_2(_arrow1024, h_1))))))
1334
+
1335
+ elif pattern_matching_result == 1:
1336
+ with_hints = base_pairs
1337
+
1338
+ with_requirements: FSharpList[tuple[str, YAMLElement]]
1339
+ match_value_1: Array[Requirement] | None = et.Requirements
1340
+ (pattern_matching_result_1, r_1) = (None, None)
1341
+ if match_value_1 is not None:
1342
+ if len(match_value_1) > 0:
1343
+ pattern_matching_result_1 = 0
1344
+ r_1 = match_value_1
1345
+
1346
+ else:
1347
+ pattern_matching_result_1 = 1
1348
+
1349
+
1350
+ else:
1351
+ pattern_matching_result_1 = 1
1352
+
1353
+ if pattern_matching_result_1 == 0:
1354
+ def _arrow1025(r_2: Requirement, et: Any=et) -> YAMLElement:
1355
+ return encode_requirement(r_2)
1356
+
1357
+ with_requirements = append(with_hints, singleton(("requirements", YAMLElement(2, of_seq(map_2(_arrow1025, r_1))))))
1358
+
1359
+ elif pattern_matching_result_1 == 1:
1360
+ with_requirements = with_hints
1361
+
1362
+ def _arrow1026(__unit: None=None, et: Any=et) -> FSharpList[tuple[str, YAMLElement]]:
1363
+ match_value_2: Array[CWLInput] | None = et.Inputs
1364
+ (pattern_matching_result_2, i_1) = (None, None)
1365
+ if match_value_2 is not None:
1366
+ if len(match_value_2) > 0:
1367
+ pattern_matching_result_2 = 0
1368
+ i_1 = match_value_2
1369
+
1370
+ else:
1371
+ pattern_matching_result_2 = 1
1372
+
1373
+
1374
+ else:
1375
+ pattern_matching_result_2 = 1
1376
+
1377
+ if pattern_matching_result_2 == 0:
1378
+ return append(with_requirements, singleton(("inputs", y_map(to_list(map_2(encode_cwlinput, i_1))))))
1379
+
1380
+ elif pattern_matching_result_2 == 1:
1381
+ return with_requirements
1382
+
1383
+
1384
+ def mapping_2(o: CWLOutput, et: Any=et) -> tuple[str, YAMLElement]:
1385
+ return encode_cwloutput(o)
1386
+
1387
+ with_expression: FSharpList[tuple[str, YAMLElement]] = append(append(_arrow1026(), singleton(("outputs", y_map(to_list(map_2(mapping_2, et.Outputs)))))), singleton(("expression", string(et.Expression))))
1388
+ def _arrow1028(__unit: None=None, et: Any=et) -> FSharpList[tuple[str, YAMLElement]]:
1389
+ match_value_3: DynamicObj | None = et.Metadata
1390
+ if match_value_3 is None:
1391
+ return with_expression
1392
+
1393
+ else:
1394
+ md: DynamicObj = match_value_3
1395
+ def folder(acc_6: FSharpList[tuple[str, YAMLElement]], kvp: Any) -> FSharpList[tuple[str, YAMLElement]]:
1396
+ def _arrow1027(__unit: None=None, acc_6: Any=acc_6, kvp: Any=kvp) -> YAMLElement:
1397
+ match_value_4: Any = kvp[1]
1398
+ return string(match_value_4) if (str(type(match_value_4)) == "<class \'str\'>") else (y_bool(match_value_4) if (str(type(match_value_4)) == "<class \'bool\'>") else (int_1(match_value_4) if (str(type(match_value_4)) == "<class \'int\'>") else (float_1(match_value_4) if (str(type(match_value_4)) == "<class \'float\'>") else (match_value_4 if isinstance(match_value_4, YAMLElement) else string(to_string(kvp[1]))))))
1399
+
1400
+ return append(acc_6, singleton((kvp[0], _arrow1027())))
1401
+
1402
+ return fold(folder, with_expression, md.GetProperties(False))
1403
+
1404
+
1405
+ return y_map(_arrow1028())
1406
+
1407
+
1408
+ def encode_operation_description_element(op: CWLOperationDescription) -> YAMLElement:
1409
+ base_pairs: FSharpList[tuple[str, YAMLElement]]
1410
+ acc_4: FSharpList[tuple[str, YAMLElement]]
1411
+ acc_2: FSharpList[tuple[str, YAMLElement]]
1412
+ acc: FSharpList[tuple[str, YAMLElement]] = of_array([("cwlVersion", string(op.CWLVersion)), ("class", string("Operation"))])
1413
+ def _arrow1029(label: str, op: Any=op) -> tuple[str, YAMLElement]:
1414
+ return encode_label(label)
1415
+
1416
+ pair_opt_1: tuple[str, YAMLElement] | None = map(_arrow1029, op.Label)
1417
+ acc_1: FSharpList[tuple[str, YAMLElement]] = acc
1418
+ acc_2 = acc_1 if (pair_opt_1 is None) else append(acc_1, singleton(pair_opt_1))
1419
+ def _arrow1030(doc: str, op: Any=op) -> tuple[str, YAMLElement]:
1420
+ return encode_doc(doc)
1421
+
1422
+ pair_opt_3: tuple[str, YAMLElement] | None = map(_arrow1030, op.Doc)
1423
+ acc_3: FSharpList[tuple[str, YAMLElement]] = acc_2
1424
+ acc_4 = acc_3 if (pair_opt_3 is None) else append(acc_3, singleton(pair_opt_3))
1425
+ def mapping(intent_1: Array[str], op: Any=op) -> tuple[str, YAMLElement]:
1426
+ return encode_intent(intent_1)
1427
+
1428
+ def predicate(intent: Array[str], op: Any=op) -> bool:
1429
+ return len(intent) > 0
1430
+
1431
+ pair_opt_5: tuple[str, YAMLElement] | None = map(mapping, filter(predicate, op.Intent))
1432
+ acc_5: FSharpList[tuple[str, YAMLElement]] = acc_4
1433
+ base_pairs = acc_5 if (pair_opt_5 is None) else append(acc_5, singleton(pair_opt_5))
1434
+ with_hints: FSharpList[tuple[str, YAMLElement]]
1435
+ match_value: Array[HintEntry] | None = op.Hints
1436
+ (pattern_matching_result, h_1) = (None, None)
1437
+ if match_value is not None:
1438
+ if len(match_value) > 0:
1439
+ pattern_matching_result = 0
1440
+ h_1 = match_value
1441
+
1442
+ else:
1443
+ pattern_matching_result = 1
1444
+
1445
+
1446
+ else:
1447
+ pattern_matching_result = 1
1448
+
1449
+ if pattern_matching_result == 0:
1450
+ def _arrow1031(hint: HintEntry, op: Any=op) -> YAMLElement:
1451
+ return encode_hint_entry(hint)
1452
+
1453
+ with_hints = append(base_pairs, singleton(("hints", YAMLElement(2, of_seq(map_2(_arrow1031, h_1))))))
1454
+
1455
+ elif pattern_matching_result == 1:
1456
+ with_hints = base_pairs
1457
+
1458
+ def _arrow1032(__unit: None=None, op: Any=op) -> FSharpList[tuple[str, YAMLElement]]:
1459
+ match_value_1: Array[Requirement] | None = op.Requirements
1460
+ (pattern_matching_result_1, r_1) = (None, None)
1461
+ if match_value_1 is not None:
1462
+ if len(match_value_1) > 0:
1463
+ pattern_matching_result_1 = 0
1464
+ r_1 = match_value_1
1465
+
1466
+ else:
1467
+ pattern_matching_result_1 = 1
1468
+
1469
+
1470
+ else:
1471
+ pattern_matching_result_1 = 1
1472
+
1473
+ if pattern_matching_result_1 == 0:
1474
+ return append(with_hints, singleton(("requirements", YAMLElement(2, of_seq(map_2(encode_requirement, r_1))))))
1475
+
1476
+ elif pattern_matching_result_1 == 1:
1477
+ return with_hints
1478
+
1479
+
1480
+ def mapping_1(i: CWLInput, op: Any=op) -> tuple[str, YAMLElement]:
1481
+ return encode_cwlinput(i)
1482
+
1483
+ def mapping_2(o: CWLOutput, op: Any=op) -> tuple[str, YAMLElement]:
1484
+ return encode_cwloutput(o)
1485
+
1486
+ with_outputs: FSharpList[tuple[str, YAMLElement]] = append(append(_arrow1032(), singleton(("inputs", y_map(to_list(map_2(mapping_1, op.Inputs)))))), singleton(("outputs", y_map(to_list(map_2(mapping_2, op.Outputs))))))
1487
+ def _arrow1034(__unit: None=None, op: Any=op) -> FSharpList[tuple[str, YAMLElement]]:
1488
+ match_value_2: DynamicObj | None = op.Metadata
1489
+ if match_value_2 is None:
1490
+ return with_outputs
1491
+
1492
+ else:
1493
+ md: DynamicObj = match_value_2
1494
+ def folder(acc_6: FSharpList[tuple[str, YAMLElement]], kvp: Any) -> FSharpList[tuple[str, YAMLElement]]:
1495
+ def _arrow1033(__unit: None=None, acc_6: Any=acc_6, kvp: Any=kvp) -> YAMLElement:
1496
+ match_value_3: Any = kvp[1]
1497
+ return string(match_value_3) if (str(type(match_value_3)) == "<class \'str\'>") else (y_bool(match_value_3) if (str(type(match_value_3)) == "<class \'bool\'>") else (int_1(match_value_3) if (str(type(match_value_3)) == "<class \'int\'>") else (float_1(match_value_3) if (str(type(match_value_3)) == "<class \'float\'>") else (match_value_3 if isinstance(match_value_3, YAMLElement) else string(to_string(kvp[1]))))))
1498
+
1499
+ return append(acc_6, singleton((kvp[0], _arrow1033())))
1500
+
1501
+ return fold(folder, with_outputs, md.GetProperties(False))
1502
+
1503
+
1504
+ return y_map(_arrow1034())
1505
+
1506
+
1507
+ def encode_workflow_description_element(wd: CWLWorkflowDescription) -> YAMLElement:
1508
+ base_pairs: FSharpList[tuple[str, YAMLElement]]
1509
+ acc_4: FSharpList[tuple[str, YAMLElement]]
1510
+ acc_2: FSharpList[tuple[str, YAMLElement]]
1511
+ acc: FSharpList[tuple[str, YAMLElement]] = of_array([("cwlVersion", string(wd.CWLVersion)), ("class", string("Workflow"))])
1512
+ def _arrow1035(label: str, wd: Any=wd) -> tuple[str, YAMLElement]:
1513
+ return encode_label(label)
1514
+
1515
+ pair_opt_1: tuple[str, YAMLElement] | None = map(_arrow1035, wd.Label)
1516
+ acc_1: FSharpList[tuple[str, YAMLElement]] = acc
1517
+ acc_2 = acc_1 if (pair_opt_1 is None) else append(acc_1, singleton(pair_opt_1))
1518
+ def _arrow1036(doc: str, wd: Any=wd) -> tuple[str, YAMLElement]:
1519
+ return encode_doc(doc)
1520
+
1521
+ pair_opt_3: tuple[str, YAMLElement] | None = map(_arrow1036, wd.Doc)
1522
+ acc_3: FSharpList[tuple[str, YAMLElement]] = acc_2
1523
+ acc_4 = acc_3 if (pair_opt_3 is None) else append(acc_3, singleton(pair_opt_3))
1524
+ def mapping(intent_1: Array[str], wd: Any=wd) -> tuple[str, YAMLElement]:
1525
+ return encode_intent(intent_1)
1526
+
1527
+ def predicate(intent: Array[str], wd: Any=wd) -> bool:
1528
+ return len(intent) > 0
1529
+
1530
+ pair_opt_5: tuple[str, YAMLElement] | None = map(mapping, filter(predicate, wd.Intent))
1531
+ acc_5: FSharpList[tuple[str, YAMLElement]] = acc_4
1532
+ base_pairs = acc_5 if (pair_opt_5 is None) else append(acc_5, singleton(pair_opt_5))
1533
+ with_hints: FSharpList[tuple[str, YAMLElement]]
1534
+ match_value: Array[HintEntry] | None = wd.Hints
1535
+ (pattern_matching_result, h_1) = (None, None)
1536
+ if match_value is not None:
1537
+ if len(match_value) > 0:
1538
+ pattern_matching_result = 0
1539
+ h_1 = match_value
1540
+
1541
+ else:
1542
+ pattern_matching_result = 1
1543
+
1544
+
1545
+ else:
1546
+ pattern_matching_result = 1
1547
+
1548
+ if pattern_matching_result == 0:
1549
+ def _arrow1037(hint: HintEntry, wd: Any=wd) -> YAMLElement:
1550
+ return encode_hint_entry(hint)
1551
+
1552
+ with_hints = append(base_pairs, singleton(("hints", YAMLElement(2, of_seq(map_2(_arrow1037, h_1))))))
1553
+
1554
+ elif pattern_matching_result == 1:
1555
+ with_hints = base_pairs
1556
+
1557
+ def _arrow1038(__unit: None=None, wd: Any=wd) -> FSharpList[tuple[str, YAMLElement]]:
1558
+ match_value_1: Array[Requirement] | None = wd.Requirements
1559
+ (pattern_matching_result_1, r_1) = (None, None)
1560
+ if match_value_1 is not None:
1561
+ if len(match_value_1) > 0:
1562
+ pattern_matching_result_1 = 0
1563
+ r_1 = match_value_1
1564
+
1565
+ else:
1566
+ pattern_matching_result_1 = 1
1567
+
1568
+
1569
+ else:
1570
+ pattern_matching_result_1 = 1
1571
+
1572
+ if pattern_matching_result_1 == 0:
1573
+ return append(with_hints, singleton(("requirements", YAMLElement(2, of_seq(map_2(encode_requirement, r_1))))))
1574
+
1575
+ elif pattern_matching_result_1 == 1:
1576
+ return with_hints
1577
+
1578
+
1579
+ def mapping_1(i: CWLInput, wd: Any=wd) -> tuple[str, YAMLElement]:
1580
+ return encode_cwlinput(i)
1581
+
1582
+ def mapping_2(ws: WorkflowStep, wd: Any=wd) -> tuple[str, YAMLElement]:
1583
+ return encode_workflow_step(ws)
1584
+
1585
+ def mapping_3(o: CWLOutput, wd: Any=wd) -> tuple[str, YAMLElement]:
1586
+ return encode_cwloutput(o)
1587
+
1588
+ with_outputs: FSharpList[tuple[str, YAMLElement]] = append(append(append(_arrow1038(), singleton(("inputs", y_map(to_list(map_2(mapping_1, wd.Inputs)))))), singleton(("steps", y_map(to_list(map_2(mapping_2, wd.Steps)))))), singleton(("outputs", y_map(to_list(map_2(mapping_3, wd.Outputs))))))
1589
+ def _arrow1040(__unit: None=None, wd: Any=wd) -> FSharpList[tuple[str, YAMLElement]]:
1590
+ match_value_2: DynamicObj | None = wd.Metadata
1591
+ if match_value_2 is None:
1592
+ return with_outputs
1593
+
1594
+ else:
1595
+ md: DynamicObj = match_value_2
1596
+ def folder(acc_6: FSharpList[tuple[str, YAMLElement]], kvp: Any) -> FSharpList[tuple[str, YAMLElement]]:
1597
+ def _arrow1039(__unit: None=None, acc_6: Any=acc_6, kvp: Any=kvp) -> YAMLElement:
1598
+ match_value_3: Any = kvp[1]
1599
+ return string(match_value_3) if (str(type(match_value_3)) == "<class \'str\'>") else (y_bool(match_value_3) if (str(type(match_value_3)) == "<class \'bool\'>") else (int_1(match_value_3) if (str(type(match_value_3)) == "<class \'int\'>") else (float_1(match_value_3) if (str(type(match_value_3)) == "<class \'float\'>") else (match_value_3 if isinstance(match_value_3, YAMLElement) else string(to_string(kvp[1]))))))
1600
+
1601
+ return append(acc_6, singleton((kvp[0], _arrow1039())))
1602
+
1603
+ return fold(folder, with_outputs, md.GetProperties(False))
1604
+
1605
+
1606
+ return y_map(_arrow1040())
1607
+
1608
+
1609
+ def encode_workflow_step(ws: WorkflowStep) -> tuple[str, YAMLElement]:
1610
+ base_pairs: FSharpList[tuple[str, YAMLElement]]
1611
+ acc_8: FSharpList[tuple[str, YAMLElement]]
1612
+ acc_6: FSharpList[tuple[str, YAMLElement]]
1613
+ acc_4: FSharpList[tuple[str, YAMLElement]]
1614
+ acc_2: FSharpList[tuple[str, YAMLElement]]
1615
+ acc: FSharpList[tuple[str, YAMLElement]] = of_array([("run", encode_workflow_step_run(ws.Run)), ("in", encode_step_inputs(ws.In)), ("out", encode_step_outputs(ws.Out))])
1616
+ value_2: str | None = ws.Label
1617
+ acc_1: FSharpList[tuple[str, YAMLElement]] = acc
1618
+ acc_2 = acc_1 if (value_2 is None) else append(acc_1, singleton(("label", string(value_2))))
1619
+ value_5: str | None = ws.Doc
1620
+ acc_3: FSharpList[tuple[str, YAMLElement]] = acc_2
1621
+ acc_4 = acc_3 if (value_5 is None) else append(acc_3, singleton(("doc", string(value_5))))
1622
+ value_7: Array[str] | None = ws.Scatter
1623
+ acc_5: FSharpList[tuple[str, YAMLElement]] = acc_4
1624
+ acc_6 = acc_5 if (value_7 is None) else append(acc_5, singleton(("scatter", encode_scatter(value_7))))
1625
+ value_9: ScatterMethod | None = ws.ScatterMethod
1626
+ acc_7: FSharpList[tuple[str, YAMLElement]] = acc_6
1627
+ acc_8 = acc_7 if (value_9 is None) else append(acc_7, singleton(("scatterMethod", encode_scatter_method(value_9))))
1628
+ value_12: str | None = ws.When_
1629
+ acc_9: FSharpList[tuple[str, YAMLElement]] = acc_8
1630
+ base_pairs = acc_9 if (value_12 is None) else append(acc_9, singleton(("when", string(value_12))))
1631
+ with_hints: FSharpList[tuple[str, YAMLElement]]
1632
+ match_value: Array[HintEntry] | None = ws.Hints
1633
+ (pattern_matching_result, h_1) = (None, None)
1634
+ if match_value is not None:
1635
+ if len(match_value) > 0:
1636
+ pattern_matching_result = 0
1637
+ h_1 = match_value
1638
+
1639
+ else:
1640
+ pattern_matching_result = 1
1641
+
1642
+
1643
+ else:
1644
+ pattern_matching_result = 1
1645
+
1646
+ if pattern_matching_result == 0:
1647
+ def _arrow1041(hint: HintEntry, ws: Any=ws) -> YAMLElement:
1648
+ return encode_hint_entry(hint)
1649
+
1650
+ with_hints = append(base_pairs, singleton(("hints", YAMLElement(2, of_seq(map_2(_arrow1041, h_1))))))
1651
+
1652
+ elif pattern_matching_result == 1:
1653
+ with_hints = base_pairs
1654
+
1655
+ with_req: FSharpList[tuple[str, YAMLElement]]
1656
+ match_value_1: Array[Requirement] | None = ws.Requirements
1657
+ (pattern_matching_result_1, r_1) = (None, None)
1658
+ if match_value_1 is not None:
1659
+ if len(match_value_1) > 0:
1660
+ pattern_matching_result_1 = 0
1661
+ r_1 = match_value_1
1662
+
1663
+ else:
1664
+ pattern_matching_result_1 = 1
1665
+
1666
+
1667
+ else:
1668
+ pattern_matching_result_1 = 1
1669
+
1670
+ if pattern_matching_result_1 == 0:
1671
+ def _arrow1042(r_2: Requirement, ws: Any=ws) -> YAMLElement:
1672
+ return encode_requirement(r_2)
1673
+
1674
+ with_req = append(with_hints, singleton(("requirements", YAMLElement(2, of_seq(map_2(_arrow1042, r_1))))))
1675
+
1676
+ elif pattern_matching_result_1 == 1:
1677
+ with_req = with_hints
1678
+
1679
+ return (ws.Id, y_map(with_req))
1680
+
1681
+
1682
+ def write_yaml(element: YAMLElement) -> str:
1683
+ def _arrow1043(c: Config, element: Any=element) -> Config:
1684
+ return Config(2, c.Level)
1685
+
1686
+ return write(element, _arrow1043)
1687
+
1688
+
1689
+ def get_object_pairs(element: YAMLElement) -> FSharpList[tuple[str, YAMLElement]]:
1690
+ if element.tag == 3:
1691
+ def chooser(_arg: YAMLElement, element: Any=element) -> tuple[str, YAMLElement] | None:
1692
+ if _arg.tag == 0:
1693
+ return (_arg.fields[0].Value, _arg.fields[1])
1694
+
1695
+ else:
1696
+ return None
1697
+
1698
+
1699
+ return choose(chooser, element.fields[0])
1700
+
1701
+ else:
1702
+ return empty()
1703
+
1704
+
1705
+
1706
+ def render_top_level_element(base_keys: FSharpList[str], ordered_section_keys: FSharpList[str], element: YAMLElement) -> str:
1707
+ def section(pairs: FSharpList[tuple[str, YAMLElement]], base_keys: Any=base_keys, ordered_section_keys: Any=ordered_section_keys, element: Any=element) -> str:
1708
+ return trim_end(replace(write_yaml(y_map(pairs)), "\r\n", "\n"), "\n")
1709
+
1710
+ pairs_2: FSharpList[tuple[str, YAMLElement]] = get_object_pairs(element)
1711
+ def predicate(tupled_arg: tuple[str, YAMLElement], base_keys: Any=base_keys, ordered_section_keys: Any=ordered_section_keys, element: Any=element) -> bool:
1712
+ class ObjectExpr1045:
1713
+ @property
1714
+ def Equals(self) -> Callable[[str, str], bool]:
1715
+ def _arrow1044(x: str, y: str) -> bool:
1716
+ return x == y
1717
+
1718
+ return _arrow1044
1719
+
1720
+ @property
1721
+ def GetHashCode(self) -> Callable[[str], int]:
1722
+ return string_hash
1723
+
1724
+ return contains(tupled_arg[0], base_keys, ObjectExpr1045())
1725
+
1726
+ base_pairs: FSharpList[tuple[str, YAMLElement]] = filter_1(predicate, pairs_2)
1727
+ def chooser(section_key: str, base_keys: Any=base_keys, ordered_section_keys: Any=ordered_section_keys, element: Any=element) -> FSharpList[tuple[str, YAMLElement]] | None:
1728
+ def mapping(value: tuple[str, YAMLElement], section_key: Any=section_key) -> FSharpList[tuple[str, YAMLElement]]:
1729
+ return singleton(value)
1730
+
1731
+ def predicate_1(tupled_arg_1: tuple[str, YAMLElement], section_key: Any=section_key) -> bool:
1732
+ return tupled_arg_1[0] == section_key
1733
+
1734
+ return map(mapping, try_find(predicate_1, pairs_2))
1735
+
1736
+ known_sections: FSharpList[FSharpList[tuple[str, YAMLElement]]] = choose(chooser, ordered_section_keys)
1737
+ class ObjectExpr1046:
1738
+ @property
1739
+ def Compare(self) -> Callable[[str, str], int]:
1740
+ return compare_primitives
1741
+
1742
+ reserved_keys: Any = of_list(append(base_keys, ordered_section_keys), ObjectExpr1046())
1743
+ def predicate_2(tupled_arg_2: tuple[str, YAMLElement], base_keys: Any=base_keys, ordered_section_keys: Any=ordered_section_keys, element: Any=element) -> bool:
1744
+ return not FSharpSet__Contains(reserved_keys, tupled_arg_2[0])
1745
+
1746
+ metadata_pairs: FSharpList[tuple[str, YAMLElement]] = filter_1(predicate_2, pairs_2)
1747
+ def merge(acc_mut: FSharpList[str], remaining_mut: FSharpList[str], base_keys: Any=base_keys, ordered_section_keys: Any=ordered_section_keys, element: Any=element) -> FSharpList[str]:
1748
+ while True:
1749
+ (acc, remaining) = (acc_mut, remaining_mut)
1750
+ (pattern_matching_result, a_1, b_1, rest_1, l, rest_2) = (None, None, None, None, None, None)
1751
+ if is_empty(remaining):
1752
+ pattern_matching_result = 2
1753
+
1754
+ elif not is_empty(tail(remaining)):
1755
+ if (trim_start(head(tail(remaining))).find(":") >= 0) if (head(remaining).strip() == "-") else False:
1756
+ pattern_matching_result = 0
1757
+ a_1 = head(remaining)
1758
+ b_1 = head(tail(remaining))
1759
+ rest_1 = tail(tail(remaining))
1760
+
1761
+ else:
1762
+ pattern_matching_result = 1
1763
+ l = head(remaining)
1764
+ rest_2 = tail(remaining)
1765
+
1766
+
1767
+ else:
1768
+ pattern_matching_result = 1
1769
+ l = head(remaining)
1770
+ rest_2 = tail(remaining)
1771
+
1772
+ if pattern_matching_result == 0:
1773
+ acc_mut = cons((a_1 + " ") + b_1.strip(), acc)
1774
+ remaining_mut = rest_1
1775
+ continue
1776
+
1777
+ elif pattern_matching_result == 1:
1778
+ acc_mut = cons(l, acc)
1779
+ remaining_mut = rest_2
1780
+ continue
1781
+
1782
+ elif pattern_matching_result == 2:
1783
+ return reverse(acc)
1784
+
1785
+ break
1786
+
1787
+ def _arrow1049(__unit: None=None, base_keys: Any=base_keys, ordered_section_keys: Any=ordered_section_keys, element: Any=element) -> IEnumerable_1[str]:
1788
+ def _arrow1048(__unit: None=None) -> IEnumerable_1[str]:
1789
+ def _arrow1047(__unit: None=None) -> IEnumerable_1[str]:
1790
+ return singleton_1(section(metadata_pairs)) if (length(metadata_pairs) > 0) else empty_1()
1791
+
1792
+ return append_1(map_1(section, known_sections), delay(_arrow1047))
1793
+
1794
+ return append_1(singleton_1(section(base_pairs)) if (length(base_pairs) > 0) else empty_1(), delay(_arrow1048))
1795
+
1796
+ return join("\r\n", merge(empty(), of_array(split(join("\r\n\r\n", to_list(delay(_arrow1049))), ["\r\n"], None, 0))))
1797
+
1798
+
1799
+ def encode_tool_description(td: CWLToolDescription) -> str:
1800
+ return render_top_level_element(of_array(["cwlVersion", "class", "label", "doc", "intent"]), of_array(["hints", "requirements", "baseCommand", "inputs", "outputs"]), encode_tool_description_element(td))
1801
+
1802
+
1803
+ def encode_workflow_description(wd: CWLWorkflowDescription) -> str:
1804
+ return render_top_level_element(of_array(["cwlVersion", "class", "label", "doc", "intent"]), of_array(["hints", "requirements", "inputs", "steps", "outputs"]), encode_workflow_description_element(wd))
1805
+
1806
+
1807
+ def encode_expression_tool_description(et: CWLExpressionToolDescription) -> str:
1808
+ return render_top_level_element(of_array(["cwlVersion", "class", "label", "doc", "intent"]), of_array(["hints", "requirements", "inputs", "outputs", "expression"]), encode_expression_tool_description_element(et))
1809
+
1810
+
1811
+ def encode_operation_description(op: CWLOperationDescription) -> str:
1812
+ return render_top_level_element(of_array(["cwlVersion", "class", "label", "doc", "intent"]), of_array(["hints", "requirements", "inputs", "outputs"]), encode_operation_description_element(op))
1813
+
1814
+
1815
+ def encode_processing_unit(pu: CWLProcessingUnit) -> str:
1816
+ if pu.tag == 1:
1817
+ return encode_workflow_description(pu.fields[0])
1818
+
1819
+ elif pu.tag == 2:
1820
+ return encode_expression_tool_description(pu.fields[0])
1821
+
1822
+ elif pu.tag == 3:
1823
+ return encode_operation_description(pu.fields[0])
1824
+
1825
+ else:
1826
+ return encode_tool_description(pu.fields[0])
1827
+
1828
+
1829
+
1830
+ def encode_cwltype_yaml(t: CWLType) -> str:
1831
+ if t.tag == 14:
1832
+ def mapping(t_1: CWLType, t: Any=t) -> str:
1833
+ return encode_cwltype_yaml(t_1)
1834
+
1835
+ return ("[" + join(", ", map_2(mapping, t.fields[0]))) + "]"
1836
+
1837
+ elif t.tag == 11:
1838
+ return encode_input_array_schema_yaml(t.fields[0])
1839
+
1840
+ elif t.tag == 12:
1841
+ return encode_input_record_schema_yaml(t.fields[0])
1842
+
1843
+ elif t.tag == 13:
1844
+ return encode_input_enum_schema_yaml(t.fields[0])
1845
+
1846
+ elif t.tag == 10:
1847
+ return "\"null\""
1848
+
1849
+ else:
1850
+ yaml_form: str = write_yaml(encode_cwltype(t))
1851
+ return yaml_form.strip()
1852
+
1853
+
1854
+
1855
+ def encode_input_record_field_yaml(field: InputRecordField) -> str:
1856
+ return ((("{name: " + field.Name) + ", type: ") + encode_cwltype_yaml(field.Type)) + "}"
1857
+
1858
+
1859
+ def encode_input_record_schema_yaml(schema: InputRecordSchema) -> str:
1860
+ fields_yaml: str
1861
+ match_value: Array[InputRecordField] | None = schema.Fields
1862
+ (pattern_matching_result, fs_1) = (None, None)
1863
+ if match_value is not None:
1864
+ if len(match_value) > 0:
1865
+ pattern_matching_result = 0
1866
+ fs_1 = match_value
1867
+
1868
+ else:
1869
+ pattern_matching_result = 1
1870
+
1871
+
1872
+ else:
1873
+ pattern_matching_result = 1
1874
+
1875
+ if pattern_matching_result == 0:
1876
+ def mapping(field: InputRecordField, schema: Any=schema) -> str:
1877
+ return encode_input_record_field_yaml(field)
1878
+
1879
+ fields_yaml = join(", ", map_2(mapping, fs_1))
1880
+
1881
+ elif pattern_matching_result == 1:
1882
+ fields_yaml = ""
1883
+
1884
+ if fields_yaml == "":
1885
+ return "{type: record, fields: []}"
1886
+
1887
+ else:
1888
+ return ("{type: record, fields: [" + fields_yaml) + "]}"
1889
+
1890
+
1891
+
1892
+ def encode_input_enum_schema_yaml(schema: InputEnumSchema) -> str:
1893
+ return ("{type: enum, symbols: [" + join(", ", schema.Symbols)) + "]}"
1894
+
1895
+
1896
+ def encode_input_array_schema_yaml(schema: InputArraySchema) -> str:
1897
+ return ("{type: array, items: " + encode_cwltype_yaml(schema.Items)) + "}"
1898
+
1899
+
1900
+ def cwl_type_to_yaml_string(t: CWLType) -> str:
1901
+ return encode_cwltype_yaml(t)
1902
+
1903
+
1904
+ __all__ = ["_007CPrimitiveType_007CComplexType_007C", "try_get_array_shorthand", "is_complex_type", "y_bool", "y_map", "normalize_doc_string", "encode_schema_salad_string", "normalize_env_value_for_encode", "encode_env_var_requirement_compact_map", "encode_software_requirement_compact_map", "encode_label", "encode_doc", "encode_intent", "encode_cwltype", "encode_input_record_field", "encode_input_record_schema", "encode_input_enum_schema", "encode_input_array_schema", "encode_output_binding", "encode_string_array_or_scalar", "encode_cwloutput", "encode_input_binding", "encode_cwlinput", "encode_schema_def_requirement_type", "encode_requirement", "encode_hint_entry", "encode_source_array", "encode_link_merge_method", "encode_pick_value_method", "encode_scatter_method", "encode_step_input", "encode_step_inputs", "encode_step_output_parameter", "encode_step_outputs", "encode_scatter", "encode_workflow_step_run", "encode_tool_description_element", "encode_expression_tool_description_element", "encode_operation_description_element", "encode_workflow_description_element", "encode_workflow_step", "write_yaml", "get_object_pairs", "render_top_level_element", "encode_tool_description", "encode_workflow_description", "encode_expression_tool_description", "encode_operation_description", "encode_processing_unit", "encode_cwltype_yaml", "encode_input_record_field_yaml", "encode_input_record_schema_yaml", "encode_input_enum_schema_yaml", "encode_input_array_schema_yaml", "cwl_type_to_yaml_string"]
1905
+