osbot-utils 1.7.7__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 (260) hide show
  1. osbot_utils/__init__.py +1 -0
  2. osbot_utils/base_classes/Cache_Pickle.py +129 -0
  3. osbot_utils/base_classes/Kwargs_To_Disk.py +27 -0
  4. osbot_utils/base_classes/Kwargs_To_Self.py +308 -0
  5. osbot_utils/base_classes/Type_Safe__List.py +14 -0
  6. osbot_utils/base_classes/__init__.py +0 -0
  7. osbot_utils/context_managers/__init__.py +0 -0
  8. osbot_utils/context_managers/capture_duration.py +33 -0
  9. osbot_utils/decorators/__init__.py +0 -0
  10. osbot_utils/decorators/classes/__init__.py +0 -0
  11. osbot_utils/decorators/classes/singleton.py +9 -0
  12. osbot_utils/decorators/lists/__init__.py +0 -0
  13. osbot_utils/decorators/lists/filter_list.py +12 -0
  14. osbot_utils/decorators/lists/group_by.py +21 -0
  15. osbot_utils/decorators/lists/index_by.py +27 -0
  16. osbot_utils/decorators/methods/__init__.py +0 -0
  17. osbot_utils/decorators/methods/cache.py +19 -0
  18. osbot_utils/decorators/methods/cache_on_function.py +56 -0
  19. osbot_utils/decorators/methods/cache_on_self.py +78 -0
  20. osbot_utils/decorators/methods/cache_on_tmp.py +71 -0
  21. osbot_utils/decorators/methods/capture_exception.py +37 -0
  22. osbot_utils/decorators/methods/capture_status.py +20 -0
  23. osbot_utils/decorators/methods/catch.py +13 -0
  24. osbot_utils/decorators/methods/context.py +11 -0
  25. osbot_utils/decorators/methods/depreciated.py +79 -0
  26. osbot_utils/decorators/methods/function_type_check.py +62 -0
  27. osbot_utils/decorators/methods/obj_as_context.py +6 -0
  28. osbot_utils/decorators/methods/remove_return_value.py +22 -0
  29. osbot_utils/decorators/methods/required_fields.py +19 -0
  30. osbot_utils/fluent/Fluent_Dict.py +19 -0
  31. osbot_utils/fluent/Fluent_List.py +44 -0
  32. osbot_utils/fluent/__init__.py +1 -0
  33. osbot_utils/graphs/__init__.py +0 -0
  34. osbot_utils/graphs/mermaid/Mermaid.py +75 -0
  35. osbot_utils/graphs/mermaid/Mermaid__Edge.py +49 -0
  36. osbot_utils/graphs/mermaid/Mermaid__Graph.py +93 -0
  37. osbot_utils/graphs/mermaid/Mermaid__Node.py +69 -0
  38. osbot_utils/graphs/mermaid/Mermaid__Renderer.py +54 -0
  39. osbot_utils/graphs/mermaid/configs/Mermaid__Edge__Config.py +7 -0
  40. osbot_utils/graphs/mermaid/configs/Mermaid__Node__Config.py +9 -0
  41. osbot_utils/graphs/mermaid/configs/Mermaid__Render__Config.py +7 -0
  42. osbot_utils/graphs/mermaid/examples/Mermaid_Examples__FlowChart.py +98 -0
  43. osbot_utils/graphs/mermaid/models/Mermaid__Diagram_Direction.py +9 -0
  44. osbot_utils/graphs/mermaid/models/Mermaid__Diagram__Type.py +17 -0
  45. osbot_utils/graphs/mermaid/models/Mermaid__Node__Shape.py +30 -0
  46. osbot_utils/graphs/mgraph/MGraph.py +53 -0
  47. osbot_utils/graphs/mgraph/MGraph__Config.py +7 -0
  48. osbot_utils/graphs/mgraph/MGraph__Data.py +139 -0
  49. osbot_utils/graphs/mgraph/MGraph__Edge.py +27 -0
  50. osbot_utils/graphs/mgraph/MGraph__Node.py +33 -0
  51. osbot_utils/graphs/mgraph/MGraph__Random_Graphs.py +27 -0
  52. osbot_utils/graphs/mgraph/MGraph__Serializer.py +43 -0
  53. osbot_utils/graphs/mgraph/MGraphs.py +17 -0
  54. osbot_utils/graphs/mgraph/__init__.py +0 -0
  55. osbot_utils/helpers/CPrint.py +98 -0
  56. osbot_utils/helpers/Dict_To_Attr.py +7 -0
  57. osbot_utils/helpers/Local_Cache.py +111 -0
  58. osbot_utils/helpers/Local_Caches.py +54 -0
  59. osbot_utils/helpers/Print_Table.py +369 -0
  60. osbot_utils/helpers/Python_Audit.py +45 -0
  61. osbot_utils/helpers/Random_Seed.py +27 -0
  62. osbot_utils/helpers/SCP.py +58 -0
  63. osbot_utils/helpers/SSH.py +151 -0
  64. osbot_utils/helpers/Type_Registry.py +16 -0
  65. osbot_utils/helpers/__init__.py +0 -0
  66. osbot_utils/helpers/ast/Ast.py +35 -0
  67. osbot_utils/helpers/ast/Ast_Base.py +124 -0
  68. osbot_utils/helpers/ast/Ast_Data.py +28 -0
  69. osbot_utils/helpers/ast/Ast_Load.py +62 -0
  70. osbot_utils/helpers/ast/Ast_Merge.py +26 -0
  71. osbot_utils/helpers/ast/Ast_Node.py +117 -0
  72. osbot_utils/helpers/ast/Ast_Visit.py +85 -0
  73. osbot_utils/helpers/ast/Call_Tree.py +38 -0
  74. osbot_utils/helpers/ast/__init__.py +145 -0
  75. osbot_utils/helpers/ast/nodes/Ast_Add.py +6 -0
  76. osbot_utils/helpers/ast/nodes/Ast_Alias.py +6 -0
  77. osbot_utils/helpers/ast/nodes/Ast_And.py +6 -0
  78. osbot_utils/helpers/ast/nodes/Ast_Argument.py +7 -0
  79. osbot_utils/helpers/ast/nodes/Ast_Arguments.py +10 -0
  80. osbot_utils/helpers/ast/nodes/Ast_Assert.py +7 -0
  81. osbot_utils/helpers/ast/nodes/Ast_Assign.py +8 -0
  82. osbot_utils/helpers/ast/nodes/Ast_Attribute.py +9 -0
  83. osbot_utils/helpers/ast/nodes/Ast_Aug_Assign.py +9 -0
  84. osbot_utils/helpers/ast/nodes/Ast_Bin_Op.py +8 -0
  85. osbot_utils/helpers/ast/nodes/Ast_Bool_Op.py +7 -0
  86. osbot_utils/helpers/ast/nodes/Ast_Break.py +7 -0
  87. osbot_utils/helpers/ast/nodes/Ast_Call.py +17 -0
  88. osbot_utils/helpers/ast/nodes/Ast_Class_Def.py +9 -0
  89. osbot_utils/helpers/ast/nodes/Ast_Compare.py +9 -0
  90. osbot_utils/helpers/ast/nodes/Ast_Comprehension.py +10 -0
  91. osbot_utils/helpers/ast/nodes/Ast_Constant.py +6 -0
  92. osbot_utils/helpers/ast/nodes/Ast_Continue.py +7 -0
  93. osbot_utils/helpers/ast/nodes/Ast_Dict.py +8 -0
  94. osbot_utils/helpers/ast/nodes/Ast_Eq.py +6 -0
  95. osbot_utils/helpers/ast/nodes/Ast_Except_Handler.py +9 -0
  96. osbot_utils/helpers/ast/nodes/Ast_Expr.py +7 -0
  97. osbot_utils/helpers/ast/nodes/Ast_For.py +10 -0
  98. osbot_utils/helpers/ast/nodes/Ast_Function_Def.py +17 -0
  99. osbot_utils/helpers/ast/nodes/Ast_Generator_Exp.py +8 -0
  100. osbot_utils/helpers/ast/nodes/Ast_Gt.py +7 -0
  101. osbot_utils/helpers/ast/nodes/Ast_GtE.py +7 -0
  102. osbot_utils/helpers/ast/nodes/Ast_If.py +9 -0
  103. osbot_utils/helpers/ast/nodes/Ast_If_Exp.py +9 -0
  104. osbot_utils/helpers/ast/nodes/Ast_Import.py +7 -0
  105. osbot_utils/helpers/ast/nodes/Ast_Import_From.py +7 -0
  106. osbot_utils/helpers/ast/nodes/Ast_In.py +6 -0
  107. osbot_utils/helpers/ast/nodes/Ast_Is.py +6 -0
  108. osbot_utils/helpers/ast/nodes/Ast_Is_Not.py +7 -0
  109. osbot_utils/helpers/ast/nodes/Ast_Keyword.py +8 -0
  110. osbot_utils/helpers/ast/nodes/Ast_Lambda.py +8 -0
  111. osbot_utils/helpers/ast/nodes/Ast_List.py +8 -0
  112. osbot_utils/helpers/ast/nodes/Ast_List_Comp.py +8 -0
  113. osbot_utils/helpers/ast/nodes/Ast_Load.py +6 -0
  114. osbot_utils/helpers/ast/nodes/Ast_Lt.py +7 -0
  115. osbot_utils/helpers/ast/nodes/Ast_LtE.py +7 -0
  116. osbot_utils/helpers/ast/nodes/Ast_Mod.py +6 -0
  117. osbot_utils/helpers/ast/nodes/Ast_Module.py +20 -0
  118. osbot_utils/helpers/ast/nodes/Ast_Mult.py +6 -0
  119. osbot_utils/helpers/ast/nodes/Ast_Name.py +6 -0
  120. osbot_utils/helpers/ast/nodes/Ast_Not.py +7 -0
  121. osbot_utils/helpers/ast/nodes/Ast_Not_Eq.py +7 -0
  122. osbot_utils/helpers/ast/nodes/Ast_Not_In.py +6 -0
  123. osbot_utils/helpers/ast/nodes/Ast_Or.py +7 -0
  124. osbot_utils/helpers/ast/nodes/Ast_Pass.py +7 -0
  125. osbot_utils/helpers/ast/nodes/Ast_Pow.py +7 -0
  126. osbot_utils/helpers/ast/nodes/Ast_Raise.py +8 -0
  127. osbot_utils/helpers/ast/nodes/Ast_Return.py +7 -0
  128. osbot_utils/helpers/ast/nodes/Ast_Set.py +7 -0
  129. osbot_utils/helpers/ast/nodes/Ast_Slice.py +8 -0
  130. osbot_utils/helpers/ast/nodes/Ast_Starred.py +8 -0
  131. osbot_utils/helpers/ast/nodes/Ast_Store.py +7 -0
  132. osbot_utils/helpers/ast/nodes/Ast_Sub.py +7 -0
  133. osbot_utils/helpers/ast/nodes/Ast_Subscript.py +8 -0
  134. osbot_utils/helpers/ast/nodes/Ast_Try.py +9 -0
  135. osbot_utils/helpers/ast/nodes/Ast_Tuple.py +9 -0
  136. osbot_utils/helpers/ast/nodes/Ast_Unary_Op.py +7 -0
  137. osbot_utils/helpers/ast/nodes/Ast_While.py +8 -0
  138. osbot_utils/helpers/ast/nodes/Ast_With.py +7 -0
  139. osbot_utils/helpers/ast/nodes/Ast_With_Item.py +7 -0
  140. osbot_utils/helpers/ast/nodes/Ast_Yield.py +7 -0
  141. osbot_utils/helpers/ast/nodes/__init__.py +0 -0
  142. osbot_utils/helpers/html/Dict_To_Css.py +20 -0
  143. osbot_utils/helpers/html/Dict_To_Html.py +59 -0
  144. osbot_utils/helpers/html/Dict_To_Tags.py +88 -0
  145. osbot_utils/helpers/html/Html_To_Dict.py +75 -0
  146. osbot_utils/helpers/html/Html_To_Tag.py +20 -0
  147. osbot_utils/helpers/html/Tag__Base.py +91 -0
  148. osbot_utils/helpers/html/Tag__Body.py +5 -0
  149. osbot_utils/helpers/html/Tag__Div.py +5 -0
  150. osbot_utils/helpers/html/Tag__H.py +9 -0
  151. osbot_utils/helpers/html/Tag__HR.py +5 -0
  152. osbot_utils/helpers/html/Tag__Head.py +32 -0
  153. osbot_utils/helpers/html/Tag__Html.py +42 -0
  154. osbot_utils/helpers/html/Tag__Link.py +17 -0
  155. osbot_utils/helpers/html/Tag__Style.py +25 -0
  156. osbot_utils/helpers/html/__init__.py +0 -0
  157. osbot_utils/helpers/pubsub/Event__Queue.py +95 -0
  158. osbot_utils/helpers/pubsub/PubSub__Client.py +53 -0
  159. osbot_utils/helpers/pubsub/PubSub__Room.py +13 -0
  160. osbot_utils/helpers/pubsub/PubSub__Server.py +94 -0
  161. osbot_utils/helpers/pubsub/PubSub__Sqlite.py +24 -0
  162. osbot_utils/helpers/pubsub/__init__.py +0 -0
  163. osbot_utils/helpers/pubsub/schemas/Schema__Event.py +15 -0
  164. osbot_utils/helpers/pubsub/schemas/Schema__Event__Connect.py +7 -0
  165. osbot_utils/helpers/pubsub/schemas/Schema__Event__Disconnect.py +7 -0
  166. osbot_utils/helpers/pubsub/schemas/Schema__Event__Join_Room.py +8 -0
  167. osbot_utils/helpers/pubsub/schemas/Schema__Event__Leave_Room.py +8 -0
  168. osbot_utils/helpers/pubsub/schemas/Schema__Event__Message.py +7 -0
  169. osbot_utils/helpers/pubsub/schemas/Schema__PubSub__Client.py +8 -0
  170. osbot_utils/helpers/pubsub/schemas/__init__.py +0 -0
  171. osbot_utils/helpers/sqlite/Capture_Sqlite_Error.py +51 -0
  172. osbot_utils/helpers/sqlite/Sqlite__Cursor.py +87 -0
  173. osbot_utils/helpers/sqlite/Sqlite__Database.py +137 -0
  174. osbot_utils/helpers/sqlite/Sqlite__Field.py +70 -0
  175. osbot_utils/helpers/sqlite/Sqlite__Globals.py +5 -0
  176. osbot_utils/helpers/sqlite/Sqlite__Table.py +293 -0
  177. osbot_utils/helpers/sqlite/Sqlite__Table__Create.py +96 -0
  178. osbot_utils/helpers/sqlite/Temp_Sqlite__Database__Disk.py +17 -0
  179. osbot_utils/helpers/sqlite/Temp_Sqlite__Table.py +23 -0
  180. osbot_utils/helpers/sqlite/__init__.py +0 -0
  181. osbot_utils/helpers/sqlite/domains/Sqlite__Cache__Requests.py +214 -0
  182. osbot_utils/helpers/sqlite/domains/Sqlite__Cache__Requests__Patch.py +63 -0
  183. osbot_utils/helpers/sqlite/domains/Sqlite__DB__Files.py +23 -0
  184. osbot_utils/helpers/sqlite/domains/Sqlite__DB__Graph.py +47 -0
  185. osbot_utils/helpers/sqlite/domains/Sqlite__DB__Json.py +83 -0
  186. osbot_utils/helpers/sqlite/domains/Sqlite__DB__Local.py +20 -0
  187. osbot_utils/helpers/sqlite/domains/Sqlite__DB__Requests.py +39 -0
  188. osbot_utils/helpers/sqlite/domains/__init__.py +0 -0
  189. osbot_utils/helpers/sqlite/domains/schemas/Schema__Table__Requests.py +12 -0
  190. osbot_utils/helpers/sqlite/domains/schemas/__init__.py +0 -0
  191. osbot_utils/helpers/sqlite/models/Sqlite__Field__Type.py +37 -0
  192. osbot_utils/helpers/sqlite/models/__init__.py +0 -0
  193. osbot_utils/helpers/sqlite/sample_data/Sqlite__Sample_Data__Chinook.py +116 -0
  194. osbot_utils/helpers/sqlite/sample_data/__init__.py +0 -0
  195. osbot_utils/helpers/sqlite/sql_builder/SQL_Builder.py +159 -0
  196. osbot_utils/helpers/sqlite/sql_builder/SQL_Builder__Select.py +12 -0
  197. osbot_utils/helpers/sqlite/sql_builder/__init__.py +0 -0
  198. osbot_utils/helpers/sqlite/tables/Sqlite__Table__Config.py +63 -0
  199. osbot_utils/helpers/sqlite/tables/Sqlite__Table__Edges.py +46 -0
  200. osbot_utils/helpers/sqlite/tables/Sqlite__Table__Files.py +45 -0
  201. osbot_utils/helpers/sqlite/tables/Sqlite__Table__Nodes.py +52 -0
  202. osbot_utils/helpers/sqlite/tables/__init__.py +0 -0
  203. osbot_utils/helpers/trace/Trace_Call.py +120 -0
  204. osbot_utils/helpers/trace/Trace_Call__Config.py +94 -0
  205. osbot_utils/helpers/trace/Trace_Call__Graph.py +26 -0
  206. osbot_utils/helpers/trace/Trace_Call__Handler.py +215 -0
  207. osbot_utils/helpers/trace/Trace_Call__Print_Lines.py +85 -0
  208. osbot_utils/helpers/trace/Trace_Call__Print_Traces.py +170 -0
  209. osbot_utils/helpers/trace/Trace_Call__Stack.py +166 -0
  210. osbot_utils/helpers/trace/Trace_Call__Stack_Node.py +59 -0
  211. osbot_utils/helpers/trace/Trace_Call__Stats.py +71 -0
  212. osbot_utils/helpers/trace/Trace_Call__View_Model.py +75 -0
  213. osbot_utils/helpers/trace/Trace_Files.py +33 -0
  214. osbot_utils/helpers/trace/__init__.py +0 -0
  215. osbot_utils/testing/Catch.py +54 -0
  216. osbot_utils/testing/Duration.py +69 -0
  217. osbot_utils/testing/Hook_Method.py +118 -0
  218. osbot_utils/testing/Log_To_Queue.py +46 -0
  219. osbot_utils/testing/Log_To_String.py +37 -0
  220. osbot_utils/testing/Logging.py +81 -0
  221. osbot_utils/testing/Patch_Print.py +52 -0
  222. osbot_utils/testing/Profiler.py +89 -0
  223. osbot_utils/testing/Stderr.py +19 -0
  224. osbot_utils/testing/Stdout.py +19 -0
  225. osbot_utils/testing/Temp_File.py +46 -0
  226. osbot_utils/testing/Temp_Folder.py +114 -0
  227. osbot_utils/testing/Temp_Sys_Path.py +13 -0
  228. osbot_utils/testing/Temp_Web_Server.py +83 -0
  229. osbot_utils/testing/Temp_Zip.py +45 -0
  230. osbot_utils/testing/Temp_Zip_In_Memory.py +90 -0
  231. osbot_utils/testing/Unit_Test.py +34 -0
  232. osbot_utils/testing/Unzip_File.py +30 -0
  233. osbot_utils/testing/__init__.py +0 -0
  234. osbot_utils/utils/Assert.py +52 -0
  235. osbot_utils/utils/Call_Stack.py +187 -0
  236. osbot_utils/utils/Csv.py +32 -0
  237. osbot_utils/utils/Dev.py +47 -0
  238. osbot_utils/utils/Exceptions.py +7 -0
  239. osbot_utils/utils/Files.py +528 -0
  240. osbot_utils/utils/Functions.py +113 -0
  241. osbot_utils/utils/Http.py +136 -0
  242. osbot_utils/utils/Int.py +6 -0
  243. osbot_utils/utils/Json.py +171 -0
  244. osbot_utils/utils/Json_Cache.py +59 -0
  245. osbot_utils/utils/Lists.py +198 -0
  246. osbot_utils/utils/Misc.py +496 -0
  247. osbot_utils/utils/Objects.py +341 -0
  248. osbot_utils/utils/Png.py +29 -0
  249. osbot_utils/utils/Process.py +73 -0
  250. osbot_utils/utils/Python_Logger.py +301 -0
  251. osbot_utils/utils/Status.py +79 -0
  252. osbot_utils/utils/Str.py +63 -0
  253. osbot_utils/utils/Version.py +16 -0
  254. osbot_utils/utils/Zip.py +97 -0
  255. osbot_utils/utils/__init__.py +16 -0
  256. osbot_utils/version +1 -0
  257. osbot_utils-1.7.7.dist-info/LICENSE +201 -0
  258. osbot_utils-1.7.7.dist-info/METADATA +46 -0
  259. osbot_utils-1.7.7.dist-info/RECORD +260 -0
  260. osbot_utils-1.7.7.dist-info/WHEEL +4 -0
@@ -0,0 +1,6 @@
1
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
2
+
3
+ class Ast_And(Ast_Node):
4
+
5
+ def info(self):
6
+ return {'Ast_And': {}}
@@ -0,0 +1,7 @@
1
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
2
+
3
+
4
+ class Ast_Argument(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Argument': {'arg': self.node.arg}}
@@ -0,0 +1,10 @@
1
+ import ast
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Arguments(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Arguments': {'args': self.args()}}
8
+
9
+ # def names(self):
10
+ # return [arg.arg for arg in self.args.args]
@@ -0,0 +1,7 @@
1
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
2
+
3
+ class Ast_Assert(Ast_Node):
4
+
5
+ def info(self):
6
+ return {'Ast_Assert': { 'msg' : self.msg() ,
7
+ 'test' : self.test() }}
@@ -0,0 +1,8 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Assign(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Assign': {'targets': self.targets(),
8
+ 'value' : self.value() }}
@@ -0,0 +1,9 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Attribute(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Attribute': { 'attr' : self.node.attr,
8
+ 'ctx' : self.ctx () ,
9
+ 'value' : self.value() }}
@@ -0,0 +1,9 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Aug_Assign(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Aug_Assign': { 'op' : self.op (),
8
+ 'target': self.target(),
9
+ 'value' : self.value ()}}
@@ -0,0 +1,8 @@
1
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
2
+
3
+ class Ast_Bin_Op(Ast_Node):
4
+
5
+ def info(self):
6
+ return {'Ast_Bin_Op': {'left' : self.left (),
7
+ 'op' : self.op (),
8
+ 'right': self.right()}}
@@ -0,0 +1,7 @@
1
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
2
+
3
+ class Ast_Bool_Op(Ast_Node):
4
+
5
+ def info(self):
6
+ return {'Ast_Bool_Op': {'op' : self.op (),
7
+ 'values' : self.values()}}
@@ -0,0 +1,7 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Break(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Break': { }}
@@ -0,0 +1,17 @@
1
+ from osbot_utils.utils.Objects import obj_info
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Call(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Call': { 'args' : self.args() ,
8
+ 'func' : self.func() ,
9
+ 'keywords': self.keywords()}}
10
+
11
+ def name(self):
12
+ func = self.func()
13
+ if type(func).__name__ == 'Ast_Name':
14
+ return func.id()
15
+ if type(func).__name__ == 'Ast_Attribute':
16
+ return func.node.attr
17
+ return None
@@ -0,0 +1,9 @@
1
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
2
+
3
+ class Ast_Class_Def(Ast_Node):
4
+
5
+ def info(self):
6
+ #self.print()
7
+ return {'Ast_Class_Def': {'bases': self.bases() ,
8
+ 'body' : self.body() ,
9
+ 'name' : self.node.name }} # we need to use the actual node.name value here
@@ -0,0 +1,9 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Compare(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Compare': { 'comparators' : self.comparators(),
8
+ 'left' : self.left (),
9
+ 'ops' : self.ops ()}}
@@ -0,0 +1,10 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Comprehension(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Comprehension': {'ifs' : self.ifs(),
8
+ 'is_async': self.node.is_async,
9
+ 'iter' : self.iter(),
10
+ 'target' : self.target()}}
@@ -0,0 +1,6 @@
1
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
2
+
3
+ class Ast_Constant(Ast_Node):
4
+
5
+ def info(self):
6
+ return {'Ast_Constant': {'value': self.value()}} # we need to use the actual value here
@@ -0,0 +1,7 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Continue(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Continue': {}}
@@ -0,0 +1,8 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Dict(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Dict': { 'keys' : self.keys() ,
8
+ 'values': self.values()}}
@@ -0,0 +1,6 @@
1
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
2
+
3
+ class Ast_Eq(Ast_Node):
4
+
5
+ def info(self):
6
+ return {'Ast_Eq': {}}
@@ -0,0 +1,9 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Except_Handler(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Except_Handler': { 'body': self.body() ,
8
+ 'name': self.node.name ,
9
+ 'type': self.type() }}
@@ -0,0 +1,7 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Expr(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Expr': { 'value' : self.value() }}
@@ -0,0 +1,10 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_For(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_For': { 'body' : self.body(),
8
+ 'iter' : self.iter(),
9
+ 'orelse': self.orelse(),
10
+ 'target': self.target()}}
@@ -0,0 +1,17 @@
1
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
2
+ from osbot_utils.helpers.ast.nodes.Ast_Arguments import Ast_Arguments
3
+
4
+
5
+
6
+ class Ast_Function_Def(Ast_Node):
7
+
8
+ def args(self):
9
+ return Ast_Arguments(self.node.args) # def convert to Ast_Arguments
10
+
11
+ def info(self):
12
+ return {'Ast_Function_Def': {'args' : self.args() ,
13
+ 'body' : self.body() ,
14
+ 'name' : self.name()}}
15
+ #'returns': self.returns() # this is for type hints
16
+
17
+
@@ -0,0 +1,8 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Generator_Exp(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Generator_Exp': {'elt' : self.elt() ,
8
+ 'generators': self.generators()}}
@@ -0,0 +1,7 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Gt(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Gt': {}}
@@ -0,0 +1,7 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_GtE(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_GtE': {}}
@@ -0,0 +1,9 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_If(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_If': { 'body' : self.body() ,
8
+ 'test' : self.test() ,
9
+ 'orelse': self.orelse()}}
@@ -0,0 +1,9 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_If_Exp(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_If_Exp': { 'body' : self.body (), # note: body is not an array here
8
+ 'orelse': self.orelse(),
9
+ 'test' : self.test ()}}
@@ -0,0 +1,7 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Import(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Import': { 'names' : self.names() }}
@@ -0,0 +1,7 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Import_From(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Import_From': { 'level': self.level(), 'module': self.module(), 'names' : self.names() }}
@@ -0,0 +1,6 @@
1
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
2
+
3
+ class Ast_In(Ast_Node):
4
+
5
+ def info(self):
6
+ return {'Ast_In': {}}
@@ -0,0 +1,6 @@
1
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
2
+
3
+ class Ast_Is(Ast_Node):
4
+
5
+ def info(self):
6
+ return {'Ast_Is': {}}
@@ -0,0 +1,7 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Is_Not(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Is_Not': {}}
@@ -0,0 +1,8 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Keyword(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Keyword': { 'arg' : self.node.arg ,
8
+ 'value': self.value()}}
@@ -0,0 +1,8 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Lambda(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Lambda': { 'args' : self.args() ,
8
+ 'body' : self.body() }}
@@ -0,0 +1,8 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_List(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_List': { 'ctx' : self.ctx() ,
8
+ 'elts' : self.elts()}}
@@ -0,0 +1,8 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_List_Comp(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_List_Comp': { 'elt' : self.elt() ,
8
+ 'generators' : self.generators() }}
@@ -0,0 +1,6 @@
1
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
2
+
3
+ class Ast_Load(Ast_Node):
4
+
5
+ def info(self):
6
+ return {'Ast_Load': {}}
@@ -0,0 +1,7 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Lt(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Lt': { }}
@@ -0,0 +1,7 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_LtE(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_LtE': {}}
@@ -0,0 +1,6 @@
1
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
2
+
3
+ class Ast_Mod(Ast_Node):
4
+
5
+ def info(self):
6
+ return {'Ast_Mod': {}}
@@ -0,0 +1,20 @@
1
+ import ast
2
+
3
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
4
+
5
+
6
+ class Ast_Module(Ast_Node):
7
+
8
+ def __init__(self, target):
9
+ if self.is_not_ast(target):
10
+ target = self.parse(target)
11
+ super().__init__(target)
12
+
13
+ # def body(self):
14
+ # return self.node.body
15
+
16
+ # todo: see if .info() is the best name for this
17
+ # I think .data() might be a better name
18
+ # with the name 'Ast_Module' moved into a variable (or retrieved from the class name)
19
+ def info(self):
20
+ return {'Ast_Module': {'body':self.body() } }
@@ -0,0 +1,6 @@
1
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
2
+
3
+ class Ast_Mult(Ast_Node):
4
+
5
+ def info(self):
6
+ return {'Ast_Mult': {}}
@@ -0,0 +1,6 @@
1
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
2
+
3
+ class Ast_Name(Ast_Node):
4
+
5
+ def info(self):
6
+ return {'Ast_Name': {'ctx': self.ctx()}, 'id': self.id() }
@@ -0,0 +1,7 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Not(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Not': {}}
@@ -0,0 +1,7 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Not_Eq(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Not_Eq': {}}
@@ -0,0 +1,6 @@
1
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
2
+
3
+ class Ast_Not_In(Ast_Node):
4
+
5
+ def info(self):
6
+ return {'Ast_Not_In': {}}
@@ -0,0 +1,7 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Or(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Or': { }}
@@ -0,0 +1,7 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Pass(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Pass': {}}
@@ -0,0 +1,7 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Pow(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Pow': {}}
@@ -0,0 +1,8 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Raise(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Raise': { 'cause': self.cause() ,
8
+ 'exc' : self.exc()}}
@@ -0,0 +1,7 @@
1
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
2
+
3
+ class Ast_Return(Ast_Node):
4
+
5
+ def info(self):
6
+ return {'Ast_Return': { 'value': self.value()}}
7
+
@@ -0,0 +1,7 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Set(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Set': { 'elts' : self.elts() }}
@@ -0,0 +1,8 @@
1
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
2
+
3
+ class Ast_Slice(Ast_Node):
4
+
5
+ def info(self):
6
+ return {'Ast_Slice': {'lower': self.lower (),
7
+ 'step' : self.node.step,
8
+ 'upper': self.upper()}}
@@ -0,0 +1,8 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Starred(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Starred': {'ctx': self.ctx(),
8
+ 'value': self.value()}}
@@ -0,0 +1,7 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Store(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Store': {}}
@@ -0,0 +1,7 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Sub(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Sub': {}}
@@ -0,0 +1,8 @@
1
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
2
+
3
+ class Ast_Subscript(Ast_Node):
4
+
5
+ def info(self):
6
+ return {'Ast_Subscript': {'ctx' : self.ctx (),
7
+ 'slice': self.slice(),
8
+ 'value': self.value()}}
@@ -0,0 +1,9 @@
1
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
2
+
3
+ class Ast_Try(Ast_Node):
4
+
5
+ def info(self):
6
+ return {'Ast_Try': {'body' : self.body (),
7
+ 'finalbody': self.finalbody(),
8
+ 'handlers' : self.handlers (),
9
+ 'orelse' : self.orelse ()}}
@@ -0,0 +1,9 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Tuple(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Tuple': { 'ctx' : self.ctx(),
8
+ 'dims' : self.dims(),
9
+ 'elts' : self.elts()}}
@@ -0,0 +1,7 @@
1
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
2
+
3
+ class Ast_Unary_Op(Ast_Node):
4
+
5
+ def info(self):
6
+ return {'Ast_Unary_Op': {'op' : self.op() ,
7
+ 'operand': self.operand()}}
@@ -0,0 +1,8 @@
1
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
2
+
3
+ class Ast_While(Ast_Node):
4
+
5
+ def info(self):
6
+ return {'Ast_While': {'body' : self.body (),
7
+ 'orelse': self.orelse(),
8
+ 'test' : self.test ()}}
@@ -0,0 +1,7 @@
1
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
2
+
3
+ class Ast_With(Ast_Node):
4
+
5
+ def info(self):
6
+ return {'Ast_With': {'body' : self.body() ,
7
+ 'items': self.items()}}
@@ -0,0 +1,7 @@
1
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
2
+
3
+ class Ast_With_Item(Ast_Node):
4
+
5
+ def info(self):
6
+ return {'Ast_With_Item': {'context_expr' : self.context_expr() ,
7
+ 'optional_vars': self.node.optional_vars}}
@@ -0,0 +1,7 @@
1
+ from osbot_utils.utils.Dev import pprint
2
+ from osbot_utils.helpers.ast.Ast_Node import Ast_Node
3
+
4
+ class Ast_Yield(Ast_Node):
5
+
6
+ def info(self):
7
+ return {'Ast_Yield': {'value': self.value()}}
File without changes