setta 0.0.1__tar.gz → 0.0.2.dev0__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (275) hide show
  1. setta-0.0.2.dev0/LICENSE +201 -0
  2. setta-0.0.2.dev0/MANIFEST.in +3 -0
  3. setta-0.0.2.dev0/PKG-INFO +24 -0
  4. setta-0.0.2.dev0/README.md +25 -0
  5. setta-0.0.2.dev0/backend/setta/__init__.py +1 -0
  6. setta-0.0.2.dev0/backend/setta/cli/__init__.py +1 -0
  7. setta-0.0.2.dev0/backend/setta/cli/connect.py +43 -0
  8. setta-0.0.2.dev0/backend/setta/cli/logger.py +225 -0
  9. setta-0.0.2.dev0/backend/setta/code_gen/create_runnable_scripts.py +466 -0
  10. setta-0.0.2.dev0/backend/setta/code_gen/export_selected.py +776 -0
  11. setta-0.0.2.dev0/backend/setta/code_gen/find_placeholders.py +13 -0
  12. setta-0.0.2.dev0/backend/setta/code_gen/python/__init__.py +0 -0
  13. setta-0.0.2.dev0/backend/setta/code_gen/python/ast_utils.py +183 -0
  14. setta-0.0.2.dev0/backend/setta/code_gen/python/check_scope.py +187 -0
  15. setta-0.0.2.dev0/backend/setta/code_gen/python/generate_code.py +280 -0
  16. setta-0.0.2.dev0/backend/setta/code_gen/python/make_parseable.py +97 -0
  17. setta-0.0.2.dev0/backend/setta/code_gen/python/position_line_col.py +33 -0
  18. setta-0.0.2.dev0/backend/setta/code_gen/python/validate_imports.py +87 -0
  19. setta-0.0.2.dev0/backend/setta/code_gen/utils.py +120 -0
  20. setta-0.0.2.dev0/backend/setta/code_gen/yaml/__init__.py +0 -0
  21. setta-0.0.2.dev0/backend/setta/code_gen/yaml/generate_yaml.py +23 -0
  22. setta-0.0.2.dev0/backend/setta/code_gen/yaml/section_dict.py +93 -0
  23. setta-0.0.2.dev0/backend/setta/database/__init__.py +0 -0
  24. setta-0.0.2.dev0/backend/setta/database/backup.py +80 -0
  25. setta-0.0.2.dev0/backend/setta/database/db/__init__.py +0 -0
  26. setta-0.0.2.dev0/backend/setta/database/db/artifacts/__init__.py +0 -0
  27. setta-0.0.2.dev0/backend/setta/database/db/artifacts/load.py +93 -0
  28. setta-0.0.2.dev0/backend/setta/database/db/artifacts/save.py +85 -0
  29. setta-0.0.2.dev0/backend/setta/database/db/artifacts/save_or_create.py +68 -0
  30. setta-0.0.2.dev0/backend/setta/database/db/artifacts/utils.py +13 -0
  31. setta-0.0.2.dev0/backend/setta/database/db/codeInfo/__init__.py +0 -0
  32. setta-0.0.2.dev0/backend/setta/database/db/codeInfo/copy.py +26 -0
  33. setta-0.0.2.dev0/backend/setta/database/db/codeInfo/load.py +65 -0
  34. setta-0.0.2.dev0/backend/setta/database/db/codeInfo/save.py +75 -0
  35. setta-0.0.2.dev0/backend/setta/database/db/codeInfo/utils.py +33 -0
  36. setta-0.0.2.dev0/backend/setta/database/db/evRefs/__init__.py +0 -0
  37. setta-0.0.2.dev0/backend/setta/database/db/evRefs/load.py +45 -0
  38. setta-0.0.2.dev0/backend/setta/database/db/evRefs/save.py +95 -0
  39. setta-0.0.2.dev0/backend/setta/database/db/projects/__init__.py +0 -0
  40. setta-0.0.2.dev0/backend/setta/database/db/projects/copy.py +36 -0
  41. setta-0.0.2.dev0/backend/setta/database/db/projects/delete.py +7 -0
  42. setta-0.0.2.dev0/backend/setta/database/db/projects/load.py +184 -0
  43. setta-0.0.2.dev0/backend/setta/database/db/projects/save.py +267 -0
  44. setta-0.0.2.dev0/backend/setta/database/db/projects/saveAs.py +40 -0
  45. setta-0.0.2.dev0/backend/setta/database/db/projects/utils.py +135 -0
  46. setta-0.0.2.dev0/backend/setta/database/db/sectionVariants/__init__.py +0 -0
  47. setta-0.0.2.dev0/backend/setta/database/db/sectionVariants/copy.py +28 -0
  48. setta-0.0.2.dev0/backend/setta/database/db/sectionVariants/load.py +139 -0
  49. setta-0.0.2.dev0/backend/setta/database/db/sectionVariants/save.py +140 -0
  50. setta-0.0.2.dev0/backend/setta/database/db/sectionVariants/utils.py +44 -0
  51. setta-0.0.2.dev0/backend/setta/database/db/sections/__init__.py +0 -0
  52. setta-0.0.2.dev0/backend/setta/database/db/sections/copy.py +70 -0
  53. setta-0.0.2.dev0/backend/setta/database/db/sections/jsonSource.py +119 -0
  54. setta-0.0.2.dev0/backend/setta/database/db/sections/load.py +350 -0
  55. setta-0.0.2.dev0/backend/setta/database/db/sections/save.py +204 -0
  56. setta-0.0.2.dev0/backend/setta/database/db/sections/utils.py +13 -0
  57. setta-0.0.2.dev0/backend/setta/database/db/uiTypes/__init__.py +0 -0
  58. setta-0.0.2.dev0/backend/setta/database/db/uiTypes/copy.py +33 -0
  59. setta-0.0.2.dev0/backend/setta/database/db/uiTypes/load.py +51 -0
  60. setta-0.0.2.dev0/backend/setta/database/db/uiTypes/save.py +99 -0
  61. setta-0.0.2.dev0/backend/setta/database/db/uiTypes/utils.py +27 -0
  62. setta-0.0.2.dev0/backend/setta/database/db_init.py +36 -0
  63. setta-0.0.2.dev0/backend/setta/database/db_objs.py +102 -0
  64. setta-0.0.2.dev0/backend/setta/database/db_path.py +8 -0
  65. setta-0.0.2.dev0/backend/setta/database/export_db/__init__.py +0 -0
  66. setta-0.0.2.dev0/backend/setta/database/export_db/export_db.py +43 -0
  67. setta-0.0.2.dev0/backend/setta/database/export_db/export_raw.py +53 -0
  68. setta-0.0.2.dev0/backend/setta/database/export_db/export_readable.py +242 -0
  69. setta-0.0.2.dev0/backend/setta/database/export_db/utils.py +16 -0
  70. setta-0.0.2.dev0/backend/setta/database/import_db.py +28 -0
  71. setta-0.0.2.dev0/backend/setta/database/seed.py +41 -0
  72. setta-0.0.2.dev0/backend/setta/database/settings_file.py +118 -0
  73. setta-0.0.2.dev0/backend/setta/database/utils.py +32 -0
  74. setta-0.0.2.dev0/backend/setta/lsp/__init__.py +0 -0
  75. setta-0.0.2.dev0/backend/setta/lsp/file_watcher.py +113 -0
  76. setta-0.0.2.dev0/backend/setta/lsp/reader.py +184 -0
  77. setta-0.0.2.dev0/backend/setta/lsp/reader_fns/__init__.py +0 -0
  78. setta-0.0.2.dev0/backend/setta/lsp/reader_fns/completion.py +84 -0
  79. setta-0.0.2.dev0/backend/setta/lsp/reader_fns/definition.py +2 -0
  80. setta-0.0.2.dev0/backend/setta/lsp/reader_fns/diagnostics.py +99 -0
  81. setta-0.0.2.dev0/backend/setta/lsp/reader_fns/documentHighlight.py +25 -0
  82. setta-0.0.2.dev0/backend/setta/lsp/reader_fns/references.py +34 -0
  83. setta-0.0.2.dev0/backend/setta/lsp/reader_fns/signatureHelp.py +99 -0
  84. setta-0.0.2.dev0/backend/setta/lsp/server.py +150 -0
  85. setta-0.0.2.dev0/backend/setta/lsp/utils.py +60 -0
  86. setta-0.0.2.dev0/backend/setta/lsp/writer.py +306 -0
  87. setta-0.0.2.dev0/backend/setta/routers/__init__.py +11 -0
  88. setta-0.0.2.dev0/backend/setta/routers/artifact.py +105 -0
  89. setta-0.0.2.dev0/backend/setta/routers/code_info.py +32 -0
  90. setta-0.0.2.dev0/backend/setta/routers/dependencies.py +49 -0
  91. setta-0.0.2.dev0/backend/setta/routers/in_memory_fn_stdout_websocket.py +21 -0
  92. setta-0.0.2.dev0/backend/setta/routers/interactive.py +119 -0
  93. setta-0.0.2.dev0/backend/setta/routers/lsp.py +14 -0
  94. setta-0.0.2.dev0/backend/setta/routers/projects.py +188 -0
  95. setta-0.0.2.dev0/backend/setta/routers/reference_renaming.py +111 -0
  96. setta-0.0.2.dev0/backend/setta/routers/sections.py +174 -0
  97. setta-0.0.2.dev0/backend/setta/routers/settings.py +40 -0
  98. setta-0.0.2.dev0/backend/setta/routers/terminals.py +83 -0
  99. setta-0.0.2.dev0/backend/setta/routers/websocket.py +36 -0
  100. setta-0.0.2.dev0/backend/setta/server.py +141 -0
  101. setta-0.0.2.dev0/backend/setta/start.py +112 -0
  102. setta-0.0.2.dev0/backend/setta/static/constants/BaseUITypes.json +153 -0
  103. setta-0.0.2.dev0/backend/setta/static/constants/Settings.json +113 -0
  104. setta-0.0.2.dev0/backend/setta/static/constants/constants.json +117 -0
  105. setta-0.0.2.dev0/backend/setta/static/constants/db_init.sql +249 -0
  106. setta-0.0.2.dev0/backend/setta/static/constants/defaultValues.json +125 -0
  107. setta-0.0.2.dev0/backend/setta/static/constants/settingsProject.json +276 -0
  108. setta-0.0.2.dev0/backend/setta/static/frontend/android-chrome-192x192.png +0 -0
  109. setta-0.0.2.dev0/backend/setta/static/frontend/android-chrome-512x512.png +0 -0
  110. setta-0.0.2.dev0/backend/setta/static/frontend/apple-touch-icon.png +0 -0
  111. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_AMS-Regular-0cdd387c.woff2 +0 -0
  112. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_AMS-Regular-30da91e8.woff +0 -0
  113. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_AMS-Regular-68534840.ttf +0 -0
  114. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Caligraphic-Bold-07d8e303.ttf +0 -0
  115. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Caligraphic-Bold-1ae6bd74.woff +0 -0
  116. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Caligraphic-Bold-de7701e4.woff2 +0 -0
  117. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Caligraphic-Regular-3398dd02.woff +0 -0
  118. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Caligraphic-Regular-5d53e70a.woff2 +0 -0
  119. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Caligraphic-Regular-ed0b7437.ttf +0 -0
  120. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Fraktur-Bold-74444efd.woff2 +0 -0
  121. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Fraktur-Bold-9163df9c.ttf +0 -0
  122. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Fraktur-Bold-9be7ceb8.woff +0 -0
  123. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Fraktur-Regular-1e6f9579.ttf +0 -0
  124. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Fraktur-Regular-51814d27.woff2 +0 -0
  125. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Fraktur-Regular-5e28753b.woff +0 -0
  126. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Main-Bold-0f60d1b8.woff2 +0 -0
  127. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Main-Bold-138ac28d.ttf +0 -0
  128. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Main-Bold-c76c5d69.woff +0 -0
  129. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Main-BoldItalic-70ee1f64.ttf +0 -0
  130. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Main-BoldItalic-99cd42a3.woff2 +0 -0
  131. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Main-BoldItalic-a6f7ec0d.woff +0 -0
  132. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Main-Italic-0d85ae7c.ttf +0 -0
  133. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Main-Italic-97479ca6.woff2 +0 -0
  134. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Main-Italic-f1d6ef86.woff +0 -0
  135. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Main-Regular-c2342cd8.woff2 +0 -0
  136. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Main-Regular-c6368d87.woff +0 -0
  137. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Main-Regular-d0332f52.ttf +0 -0
  138. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Math-BoldItalic-850c0af5.woff +0 -0
  139. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Math-BoldItalic-dc47344d.woff2 +0 -0
  140. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Math-BoldItalic-f9377ab0.ttf +0 -0
  141. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Math-Italic-08ce98e5.ttf +0 -0
  142. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Math-Italic-7af58c5e.woff2 +0 -0
  143. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Math-Italic-8a8d2445.woff +0 -0
  144. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_SansSerif-Bold-1ece03f7.ttf +0 -0
  145. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_SansSerif-Bold-e99ae511.woff2 +0 -0
  146. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_SansSerif-Bold-ece03cfd.woff +0 -0
  147. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_SansSerif-Italic-00b26ac8.woff2 +0 -0
  148. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_SansSerif-Italic-3931dd81.ttf +0 -0
  149. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_SansSerif-Italic-91ee6750.woff +0 -0
  150. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_SansSerif-Regular-11e4dc8a.woff +0 -0
  151. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_SansSerif-Regular-68e8c73e.woff2 +0 -0
  152. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_SansSerif-Regular-f36ea897.ttf +0 -0
  153. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Script-Regular-036d4e95.woff2 +0 -0
  154. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Script-Regular-1c67f068.ttf +0 -0
  155. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Script-Regular-d96cdf2b.woff +0 -0
  156. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Size1-Regular-6b47c401.woff2 +0 -0
  157. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Size1-Regular-95b6d2f1.ttf +0 -0
  158. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Size1-Regular-c943cc98.woff +0 -0
  159. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Size2-Regular-2014c523.woff +0 -0
  160. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Size2-Regular-a6b2099f.ttf +0 -0
  161. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Size2-Regular-d04c5421.woff2 +0 -0
  162. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Size3-Regular-500e04d5.ttf +0 -0
  163. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Size3-Regular-6ab6b62e.woff +0 -0
  164. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Size4-Regular-99f9c675.woff +0 -0
  165. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Size4-Regular-a4af7d41.woff2 +0 -0
  166. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Size4-Regular-c647367d.ttf +0 -0
  167. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Typewriter-Regular-71d517d6.woff2 +0 -0
  168. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Typewriter-Regular-e14fed02.woff +0 -0
  169. setta-0.0.2.dev0/backend/setta/static/frontend/assets/KaTeX_Typewriter-Regular-f01f3e87.ttf +0 -0
  170. setta-0.0.2.dev0/backend/setta/static/frontend/assets/cormorant-garamond-all-700-italic-c9b58582.woff +0 -0
  171. setta-0.0.2.dev0/backend/setta/static/frontend/assets/cormorant-garamond-cyrillic-700-italic-9101ad5f.woff2 +0 -0
  172. setta-0.0.2.dev0/backend/setta/static/frontend/assets/cormorant-garamond-cyrillic-ext-700-italic-950de0d6.woff2 +0 -0
  173. setta-0.0.2.dev0/backend/setta/static/frontend/assets/cormorant-garamond-latin-700-italic-0bc53e12.woff2 +0 -0
  174. setta-0.0.2.dev0/backend/setta/static/frontend/assets/cormorant-garamond-latin-ext-700-italic-525738e0.woff2 +0 -0
  175. setta-0.0.2.dev0/backend/setta/static/frontend/assets/cormorant-garamond-vietnamese-700-italic-99563037.woff2 +0 -0
  176. setta-0.0.2.dev0/backend/setta/static/frontend/assets/erase-5e0448ea.svg +15 -0
  177. setta-0.0.2.dev0/backend/setta/static/frontend/assets/index-1d4b4ecf.css +32 -0
  178. setta-0.0.2.dev0/backend/setta/static/frontend/assets/index-ee99dc72.js +678 -0
  179. setta-0.0.2.dev0/backend/setta/static/frontend/assets/inter-all-400-normal-054f12d0.woff +0 -0
  180. setta-0.0.2.dev0/backend/setta/static/frontend/assets/inter-all-600-normal-c03769e5.woff +0 -0
  181. setta-0.0.2.dev0/backend/setta/static/frontend/assets/inter-all-800-normal-15dc6e4b.woff +0 -0
  182. setta-0.0.2.dev0/backend/setta/static/frontend/assets/inter-cyrillic-400-normal-a4eee61a.woff2 +0 -0
  183. setta-0.0.2.dev0/backend/setta/static/frontend/assets/inter-cyrillic-600-normal-8b14f703.woff2 +0 -0
  184. setta-0.0.2.dev0/backend/setta/static/frontend/assets/inter-cyrillic-800-normal-e706eaaa.woff2 +0 -0
  185. setta-0.0.2.dev0/backend/setta/static/frontend/assets/inter-cyrillic-ext-400-normal-70047a3b.woff2 +0 -0
  186. setta-0.0.2.dev0/backend/setta/static/frontend/assets/inter-cyrillic-ext-600-normal-d4ab9bc4.woff2 +0 -0
  187. setta-0.0.2.dev0/backend/setta/static/frontend/assets/inter-cyrillic-ext-800-normal-eae7515a.woff2 +0 -0
  188. setta-0.0.2.dev0/backend/setta/static/frontend/assets/inter-greek-400-normal-381ea30d.woff2 +0 -0
  189. setta-0.0.2.dev0/backend/setta/static/frontend/assets/inter-greek-600-normal-601f93a2.woff2 +0 -0
  190. setta-0.0.2.dev0/backend/setta/static/frontend/assets/inter-greek-800-normal-7af4fb64.woff2 +0 -0
  191. setta-0.0.2.dev0/backend/setta/static/frontend/assets/inter-greek-ext-400-normal-27027b17.woff2 +0 -0
  192. setta-0.0.2.dev0/backend/setta/static/frontend/assets/inter-greek-ext-600-normal-f2ddf9de.woff2 +0 -0
  193. setta-0.0.2.dev0/backend/setta/static/frontend/assets/inter-greek-ext-800-normal-4cb6189e.woff2 +0 -0
  194. setta-0.0.2.dev0/backend/setta/static/frontend/assets/inter-latin-400-normal-d56fec21.woff2 +0 -0
  195. setta-0.0.2.dev0/backend/setta/static/frontend/assets/inter-latin-600-normal-ff769fa6.woff2 +0 -0
  196. setta-0.0.2.dev0/backend/setta/static/frontend/assets/inter-latin-800-normal-5eea1309.woff2 +0 -0
  197. setta-0.0.2.dev0/backend/setta/static/frontend/assets/inter-latin-ext-400-normal-bb698d85.woff2 +0 -0
  198. setta-0.0.2.dev0/backend/setta/static/frontend/assets/inter-latin-ext-600-normal-ca4808f9.woff2 +0 -0
  199. setta-0.0.2.dev0/backend/setta/static/frontend/assets/inter-latin-ext-800-normal-ebdacc0f.woff2 +0 -0
  200. setta-0.0.2.dev0/backend/setta/static/frontend/assets/logo/logo.svg +8 -0
  201. setta-0.0.2.dev0/backend/setta/static/frontend/assets/pen-455d7d8a.svg +19 -0
  202. setta-0.0.2.dev0/backend/setta/static/frontend/assets/source-code-pro-all-500-normal-6bdaa03b.woff +0 -0
  203. setta-0.0.2.dev0/backend/setta/static/frontend/assets/source-code-pro-cyrillic-500-normal-288a0d68.woff2 +0 -0
  204. setta-0.0.2.dev0/backend/setta/static/frontend/assets/source-code-pro-cyrillic-ext-500-normal-b110a13b.woff2 +0 -0
  205. setta-0.0.2.dev0/backend/setta/static/frontend/assets/source-code-pro-greek-500-normal-04328acb.woff2 +0 -0
  206. setta-0.0.2.dev0/backend/setta/static/frontend/assets/source-code-pro-latin-500-normal-06edef1e.woff2 +0 -0
  207. setta-0.0.2.dev0/backend/setta/static/frontend/assets/source-code-pro-latin-ext-500-normal-6dc60d5e.woff2 +0 -0
  208. setta-0.0.2.dev0/backend/setta/static/frontend/assets/web-vitals-44a8e082.js +1 -0
  209. setta-0.0.2.dev0/backend/setta/static/frontend/assets/work-sans-all-400-normal-38034a3c.woff +0 -0
  210. setta-0.0.2.dev0/backend/setta/static/frontend/assets/work-sans-all-500-normal-550d64e5.woff +0 -0
  211. setta-0.0.2.dev0/backend/setta/static/frontend/assets/work-sans-all-600-normal-ccf14060.woff +0 -0
  212. setta-0.0.2.dev0/backend/setta/static/frontend/assets/work-sans-all-700-normal-494c2971.woff +0 -0
  213. setta-0.0.2.dev0/backend/setta/static/frontend/assets/work-sans-latin-400-normal-36735bc1.woff2 +0 -0
  214. setta-0.0.2.dev0/backend/setta/static/frontend/assets/work-sans-latin-500-normal-3790bfda.woff2 +0 -0
  215. setta-0.0.2.dev0/backend/setta/static/frontend/assets/work-sans-latin-600-normal-5fba494e.woff2 +0 -0
  216. setta-0.0.2.dev0/backend/setta/static/frontend/assets/work-sans-latin-700-normal-a5033d0a.woff2 +0 -0
  217. setta-0.0.2.dev0/backend/setta/static/frontend/assets/work-sans-latin-ext-400-normal-c20f571a.woff2 +0 -0
  218. setta-0.0.2.dev0/backend/setta/static/frontend/assets/work-sans-latin-ext-500-normal-0f5ac96c.woff2 +0 -0
  219. setta-0.0.2.dev0/backend/setta/static/frontend/assets/work-sans-latin-ext-600-normal-97a237d1.woff2 +0 -0
  220. setta-0.0.2.dev0/backend/setta/static/frontend/assets/work-sans-latin-ext-700-normal-103e112c.woff2 +0 -0
  221. setta-0.0.2.dev0/backend/setta/static/frontend/browserconfig.xml +9 -0
  222. setta-0.0.2.dev0/backend/setta/static/frontend/favicon-16x16.png +0 -0
  223. setta-0.0.2.dev0/backend/setta/static/frontend/favicon-32x32.png +0 -0
  224. setta-0.0.2.dev0/backend/setta/static/frontend/favicon.ico +0 -0
  225. setta-0.0.2.dev0/backend/setta/static/frontend/index.html +30 -0
  226. setta-0.0.2.dev0/backend/setta/static/frontend/manifest.json +25 -0
  227. setta-0.0.2.dev0/backend/setta/static/frontend/mstile-144x144.png +0 -0
  228. setta-0.0.2.dev0/backend/setta/static/frontend/mstile-150x150.png +0 -0
  229. setta-0.0.2.dev0/backend/setta/static/frontend/mstile-310x150.png +0 -0
  230. setta-0.0.2.dev0/backend/setta/static/frontend/mstile-310x310.png +0 -0
  231. setta-0.0.2.dev0/backend/setta/static/frontend/mstile-70x70.png +0 -0
  232. setta-0.0.2.dev0/backend/setta/static/frontend/robots.txt +3 -0
  233. setta-0.0.2.dev0/backend/setta/static/frontend/safari-pinned-tab.svg +18 -0
  234. setta-0.0.2.dev0/backend/setta/static/frontend/site.webmanifest +19 -0
  235. setta-0.0.2.dev0/backend/setta/static/seed/.DS_Store +0 -0
  236. setta-0.0.2.dev0/backend/setta/static/seed/examples/.DS_Store +0 -0
  237. setta-0.0.2.dev0/backend/setta/tasks/__init__.py +0 -0
  238. setta-0.0.2.dev0/backend/setta/tasks/fns/__init__.py +9 -0
  239. setta-0.0.2.dev0/backend/setta/tasks/fns/codeAreaAutocomplete.py +209 -0
  240. setta-0.0.2.dev0/backend/setta/tasks/fns/codeAreaFindTemplateVars.py +128 -0
  241. setta-0.0.2.dev0/backend/setta/tasks/fns/codeAreaInitializeCode.py +98 -0
  242. setta-0.0.2.dev0/backend/setta/tasks/fns/findEVRefs.py +236 -0
  243. setta-0.0.2.dev0/backend/setta/tasks/fns/parametersRequest.py +71 -0
  244. setta-0.0.2.dev0/backend/setta/tasks/fns/textFieldAutocomplete.py +210 -0
  245. setta-0.0.2.dev0/backend/setta/tasks/fns/textFieldInitializeCode.py +99 -0
  246. setta-0.0.2.dev0/backend/setta/tasks/fns/typeCheck.py +40 -0
  247. setta-0.0.2.dev0/backend/setta/tasks/fns/utils.py +134 -0
  248. setta-0.0.2.dev0/backend/setta/tasks/task_runner.py +29 -0
  249. setta-0.0.2.dev0/backend/setta/tasks/tasks.py +152 -0
  250. setta-0.0.2.dev0/backend/setta/tasks/utils.py +178 -0
  251. setta-0.0.2.dev0/backend/setta/terminals/__init__.py +0 -0
  252. setta-0.0.2.dev0/backend/setta/terminals/terminals.py +242 -0
  253. setta-0.0.2.dev0/backend/setta/terminals/utils.py +37 -0
  254. setta-0.0.2.dev0/backend/setta/utils/__init__.py +0 -0
  255. setta-0.0.2.dev0/backend/setta/utils/constants.py +148 -0
  256. setta-0.0.2.dev0/backend/setta/utils/generate_memorable_string.py +431 -0
  257. setta-0.0.2.dev0/backend/setta/utils/generate_new_filename.py +80 -0
  258. setta-0.0.2.dev0/backend/setta/utils/section_contents.py +133 -0
  259. setta-0.0.2.dev0/backend/setta/utils/utils.py +271 -0
  260. setta-0.0.2.dev0/backend/setta/utils/websocket_manager.py +91 -0
  261. setta-0.0.2.dev0/backend/setta.egg-info/PKG-INFO +24 -0
  262. setta-0.0.2.dev0/backend/setta.egg-info/SOURCES.txt +268 -0
  263. setta-0.0.2.dev0/backend/setta.egg-info/entry_points.txt +2 -0
  264. {setta-0.0.1/src → setta-0.0.2.dev0/backend}/setta.egg-info/requires.txt +11 -0
  265. setta-0.0.2.dev0/pyproject.toml +3 -0
  266. setta-0.0.2.dev0/setup.cfg +45 -0
  267. setta-0.0.1/PKG-INFO +0 -17
  268. setta-0.0.1/setup.cfg +0 -4
  269. setta-0.0.1/setup.py +0 -35
  270. setta-0.0.1/src/setta/__init__.py +0 -1
  271. setta-0.0.1/src/setta.egg-info/PKG-INFO +0 -17
  272. setta-0.0.1/src/setta.egg-info/SOURCES.txt +0 -8
  273. /setta-0.0.1/README.md → /setta-0.0.2.dev0/backend/setta/code_gen/__init__.py +0 -0
  274. {setta-0.0.1/src → setta-0.0.2.dev0/backend}/setta.egg-info/dependency_links.txt +0 -0
  275. {setta-0.0.1/src → setta-0.0.2.dev0/backend}/setta.egg-info/top_level.txt +0 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2025 Kevin Musgrave and Jeff Musgrave
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,3 @@
1
+ recursive-include backend/setta/static/frontend *
2
+ recursive-include backend/setta/static/seed *
3
+ recursive-include backend/setta/static/constants *
@@ -0,0 +1,24 @@
1
+ Metadata-Version: 2.2
2
+ Name: setta
3
+ Version: 0.0.2.dev0
4
+ Home-page: https://setta.dev
5
+ Project-URL: GitHub, https://github.com/settadev/setta
6
+ License-File: LICENSE
7
+ Requires-Dist: click==8.1.3
8
+ Requires-Dist: requests==2.28.1
9
+ Requires-Dist: PyYAML==6.0
10
+ Requires-Dist: websockets==11.0.3
11
+ Requires-Dist: fastapi==0.115.4
12
+ Requires-Dist: uvicorn==0.32.0
13
+ Requires-Dist: docstring_parser==0.15
14
+ Requires-Dist: pywinpty==2.0.12; platform_system == "Windows"
15
+ Requires-Dist: ptyprocess==0.7.0; platform_system != "Windows"
16
+ Requires-Dist: psutil==5.9.7
17
+ Requires-Dist: basedpyright==1.25.0
18
+ Requires-Dist: docstring-to-markdown==0.15
19
+ Requires-Dist: black==23.7.0
20
+ Requires-Dist: watchdog==6.0.0
21
+ Provides-Extra: dev
22
+ Requires-Dist: build==1.0.3; extra == "dev"
23
+ Requires-Dist: isort==5.12.0; extra == "dev"
24
+ Requires-Dist: flake8==6.1.0; extra == "dev"
@@ -0,0 +1,25 @@
1
+ # setta
2
+
3
+ ## Python Without The Drudgery
4
+
5
+ ### Streamline your code
6
+
7
+ ### Skip the boilerplate parsers and frontend
8
+
9
+ ### Effortlessly expose your Python functions as a flexible UI
10
+
11
+ ### Configure, interact, and share with ease
12
+
13
+
14
+ ## Installation
15
+
16
+ ```
17
+ pip install setta
18
+ ```
19
+
20
+
21
+
22
+ ## Contributors
23
+
24
+ - Kevin Musgrave: co-creator & full-stack developer.
25
+ - Jeff Musgrave: co-creator, UI/UX developer, frontend developer, and designer.
@@ -0,0 +1 @@
1
+ __version__ = "0.0.2.dev0"
@@ -0,0 +1 @@
1
+ from .logger import Setta
@@ -0,0 +1,43 @@
1
+ import json
2
+ import logging
3
+ import subprocess
4
+
5
+ import websockets
6
+
7
+ from setta.code_gen.create_runnable_scripts import runCode
8
+
9
+ from ..utils.constants import C
10
+
11
+ logger = logging.getLogger(__name__)
12
+
13
+
14
+ async def connect(websocket_id):
15
+ try:
16
+ extra_headers = {"isCLI": True}
17
+ if websocket_id:
18
+ extra_headers["websocketId"] = websocket_id
19
+ async with websockets.connect(
20
+ C.WEBSOCKET,
21
+ extra_headers=extra_headers,
22
+ ) as websocket:
23
+ await consumer_handler(websocket)
24
+ except websockets.ConnectionClosedError:
25
+ logger.debug("Connection closed unexpectedly")
26
+ except ConnectionRefusedError:
27
+ logger.debug("Connection refused")
28
+
29
+
30
+ async def consumer_handler(websocket):
31
+ async for message in websocket:
32
+ message = json.loads(message)
33
+ if message["messageType"] == C.WS_RUN_CODE:
34
+ # TODO: now that runCode requires lsp_writers
35
+ # this will have to be changed, probably needs to communicate
36
+ # with host setta process via websocket instead of calling
37
+ # runCode
38
+ command = await runCode(message)
39
+ run_code_as_subprocess(command)
40
+
41
+
42
+ def run_code_as_subprocess(command):
43
+ subprocess.run(command, shell=True)
@@ -0,0 +1,225 @@
1
+ import base64
2
+ import os
3
+ from abc import ABC, abstractmethod
4
+ from io import BytesIO
5
+ from pathlib import Path
6
+
7
+ import requests
8
+
9
+ from setta.utils.constants import (
10
+ CODE_FOLDER_ENV_VARIABLE,
11
+ HOST_ENV_VARIABLE,
12
+ PORT_ENV_VARIABLE,
13
+ C,
14
+ load_constants,
15
+ set_constants,
16
+ )
17
+
18
+
19
+ class Setta:
20
+ def __init__(self, root_path=None, host=None, port=None):
21
+ load_constants()
22
+ set_constants(
23
+ host=host or os.environ.get(HOST_ENV_VARIABLE, C.DEFAULT_HOST),
24
+ port=port or os.environ.get(PORT_ENV_VARIABLE, C.DEFAULT_PORT),
25
+ )
26
+ if root_path:
27
+ self.root_path = Path(root_path)
28
+ else:
29
+ self.root_path = Path(
30
+ os.environ.get(CODE_FOLDER_ENV_VARIABLE, os.path.relpath(os.getcwd()))
31
+ )
32
+
33
+ self.name_path_type_to_id = {}
34
+
35
+ def log(self, obj, save_to="db"):
36
+ data_to_send = []
37
+ for name, data in obj.items():
38
+ artifact_path = ""
39
+
40
+ if save_to == "disk":
41
+ full_path = self.root_path / name
42
+ full_path = data.path_with_extension(full_path)
43
+ directory = full_path.parent
44
+ directory.mkdir(parents=True, exist_ok=True)
45
+ data.save(full_path)
46
+ artifact_path = str(full_path)
47
+
48
+ serialized = data.serialize()
49
+ curr_data = {
50
+ "name": name,
51
+ "path": artifact_path,
52
+ "value": serialized["value"],
53
+ "type": serialized["type"],
54
+ }
55
+ curr_data["id"] = self.maybe_get_artifact_id(curr_data)
56
+ data_to_send.append(curr_data)
57
+
58
+ res = requests.post(
59
+ f"{C.BACKEND}{C.ROUTE_PREFIX}{C.ROUTE_SEND_ARTIFACT}",
60
+ json={
61
+ "data": data_to_send,
62
+ "saveTo": save_to,
63
+ "messageType": C.WS_ARTIFACT,
64
+ },
65
+ headers={"Content-Type": "application/json"},
66
+ )
67
+
68
+ if res.status_code == 200:
69
+ artifact_ids = res.json()
70
+ for idx, id in enumerate(artifact_ids):
71
+ sent_data = data_to_send[idx]
72
+ self.name_path_type_to_id[self.get_name_path_type_key(sent_data)] = id
73
+
74
+ def maybe_get_artifact_id(self, data_to_send):
75
+ return self.name_path_type_to_id.get(self.get_name_path_type_key(data_to_send))
76
+
77
+ def get_name_path_type_key(self, data_to_send):
78
+ return data_to_send["name"], data_to_send["path"], data_to_send["type"]
79
+
80
+
81
+ class SettaDataWrapper(ABC):
82
+ @abstractmethod
83
+ def path_with_extension(self, path):
84
+ pass
85
+
86
+ @abstractmethod
87
+ def save(self, path):
88
+ pass
89
+
90
+ @abstractmethod
91
+ def serialize(self):
92
+ pass
93
+
94
+ @abstractmethod
95
+ def load(self, path_with_extension):
96
+ pass
97
+
98
+
99
+ class SettaList(SettaDataWrapper):
100
+ def __init__(self, data=None):
101
+ self.data = data
102
+
103
+ def path_with_extension(self, path):
104
+ return path.with_suffix(".csv")
105
+
106
+ def save(self, path):
107
+ if not self.data:
108
+ return
109
+
110
+ headers = list(self.data.keys())
111
+ num_rows = len(next(iter(self.data.values()))) # Get length from first column
112
+
113
+ with open(path, "w") as f:
114
+ # Write headers
115
+ f.write(",".join(headers) + "\n")
116
+
117
+ # Write rows
118
+ for i in range(num_rows):
119
+ row_vals = []
120
+ for header in headers:
121
+ val = self.data[header][i] if i < len(self.data[header]) else None
122
+ row_vals.append("" if val is None else str(val))
123
+ f.write(",".join(row_vals) + "\n")
124
+
125
+ def serialize(self):
126
+ return {"value": self.data, "type": "list"}
127
+
128
+ def load(self, path):
129
+ self.data = load_from_csv_file(path)
130
+
131
+
132
+ class SettaImg(SettaDataWrapper):
133
+ def __init__(self, img=None, format="png"):
134
+ self.img = img
135
+ self.format = format
136
+
137
+ def path_with_extension(self, path):
138
+ return path.with_suffix(f".{self.format}")
139
+
140
+ def save(self, path):
141
+ with open(path, "wb") as f:
142
+ f.write(self.img)
143
+
144
+ def serialize(self):
145
+ if self.img is None:
146
+ raise ValueError("No image data to serialize")
147
+ b64_str = base64.b64encode(self.img).decode("utf-8")
148
+ return {"value": b64_str, "type": "img"}
149
+
150
+ def load(self, path_with_extension):
151
+ with open(path_with_extension, "rb") as f:
152
+ self.img = f.read()
153
+
154
+
155
+ def get_wrapper_for_loading(data_type):
156
+ if data_type == "list":
157
+ return SettaList()
158
+ if data_type == "img":
159
+ return SettaImg()
160
+
161
+
162
+ def default_section_type(data_type):
163
+ if data_type == "list":
164
+ return C.CHART
165
+ if data_type == "img":
166
+ return C.IMAGE
167
+
168
+
169
+ def save_base64_to_png(base64_string, output_file):
170
+ image_data = base64.b64decode(base64_string)
171
+
172
+ # Write the binary data to a file
173
+ with open(output_file, "wb") as f:
174
+ f.write(image_data)
175
+
176
+
177
+ def pil_to_setta_img(pil_image, format="png"):
178
+ buffer = BytesIO()
179
+ pil_image.save(buffer, format=format.upper())
180
+ raw_data = buffer.getvalue()
181
+ return SettaImg(img=raw_data, format=format)
182
+
183
+
184
+ def parse_csv_row(values):
185
+ row = []
186
+ for x in values:
187
+ if x.strip() == "":
188
+ row.append(None)
189
+ else:
190
+ try:
191
+ row.append(float(x))
192
+ except ValueError:
193
+ row.append(x)
194
+ return row
195
+
196
+
197
+ def parse_csv_content(content):
198
+ lines = content.strip().split("\n")
199
+ if not lines:
200
+ return {}
201
+
202
+ headers = [h.strip() for h in lines[0].split(",")]
203
+ result = {header: [] for header in headers}
204
+
205
+ if not lines[1:]:
206
+ return result
207
+
208
+ # Parse rows and populate lists
209
+ for line in lines[1:]:
210
+ values = parse_csv_row(line.strip().split(","))
211
+ for header, value in zip(headers, values):
212
+ result[header].append(value)
213
+
214
+ return result
215
+
216
+
217
+ def load_from_csv_file(path):
218
+ with open(path, "r") as f:
219
+ content = f.read()
220
+ return parse_csv_content(content)
221
+
222
+
223
+ def load_from_csv_base64(base64_string):
224
+ content = base64.b64decode(base64_string).decode("utf-8")
225
+ return parse_csv_content(content)