jaseci 1.4.2.6__py3-none-any.whl → 2.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.

Potentially problematic release.


This version of jaseci might be problematic. Click here for more details.

Files changed (187) hide show
  1. jaseci/__init__.py +3 -37
  2. jaseci-2.0.0.dist-info/METADATA +65 -0
  3. jaseci-2.0.0.dist-info/RECORD +4 -0
  4. {jaseci-1.4.2.6.dist-info → jaseci-2.0.0.dist-info}/WHEEL +1 -2
  5. jaseci/VERSION +0 -1
  6. jaseci/cli_tools/__init__.py +0 -0
  7. jaseci/cli_tools/book_tools.py +0 -457
  8. jaseci/cli_tools/jsctl.py +0 -500
  9. jaseci/cli_tools/tests/__init__.py +0 -0
  10. jaseci/cli_tools/tests/test_jsctl.py +0 -556
  11. jaseci/extens/__init__.py +0 -0
  12. jaseci/extens/act_lib/__init__.py +0 -0
  13. jaseci/extens/act_lib/date.py +0 -118
  14. jaseci/extens/act_lib/elastic.py +0 -87
  15. jaseci/extens/act_lib/file.py +0 -77
  16. jaseci/extens/act_lib/file_handler.py +0 -190
  17. jaseci/extens/act_lib/internal.py +0 -19
  18. jaseci/extens/act_lib/jaseci.py +0 -62
  19. jaseci/extens/act_lib/mail.py +0 -10
  20. jaseci/extens/act_lib/maths.py +0 -168
  21. jaseci/extens/act_lib/net.py +0 -192
  22. jaseci/extens/act_lib/rand.py +0 -83
  23. jaseci/extens/act_lib/regex.py +0 -85
  24. jaseci/extens/act_lib/request.py +0 -170
  25. jaseci/extens/act_lib/std.py +0 -236
  26. jaseci/extens/act_lib/storage.py +0 -53
  27. jaseci/extens/act_lib/stripe.py +0 -338
  28. jaseci/extens/act_lib/task.py +0 -14
  29. jaseci/extens/act_lib/tests/__init__.py +0 -0
  30. jaseci/extens/act_lib/tests/std_test_code.py +0 -37
  31. jaseci/extens/act_lib/tests/test_date.py +0 -26
  32. jaseci/extens/act_lib/tests/test_elastic.py +0 -159
  33. jaseci/extens/act_lib/tests/test_file.py +0 -116
  34. jaseci/extens/act_lib/tests/test_file_lib.py +0 -40
  35. jaseci/extens/act_lib/tests/test_mail_lib.py +0 -33
  36. jaseci/extens/act_lib/tests/test_maths.py +0 -147
  37. jaseci/extens/act_lib/tests/test_net_lib.py +0 -62
  38. jaseci/extens/act_lib/tests/test_regex.py +0 -61
  39. jaseci/extens/act_lib/tests/test_std.py +0 -51
  40. jaseci/extens/act_lib/tests/test_std_lib.py +0 -36
  41. jaseci/extens/act_lib/tests/test_url.py +0 -32
  42. jaseci/extens/act_lib/tests/test_vector.py +0 -36
  43. jaseci/extens/act_lib/tests/test_webtool.py +0 -44
  44. jaseci/extens/act_lib/tests/test_zlib.py +0 -24
  45. jaseci/extens/act_lib/url.py +0 -80
  46. jaseci/extens/act_lib/vector.py +0 -158
  47. jaseci/extens/act_lib/webtool.py +0 -29
  48. jaseci/extens/act_lib/zip.py +0 -34
  49. jaseci/extens/api/__init__.py +0 -0
  50. jaseci/extens/api/actions_api.py +0 -171
  51. jaseci/extens/api/alias_api.py +0 -140
  52. jaseci/extens/api/architype_api.py +0 -197
  53. jaseci/extens/api/config_api.py +0 -129
  54. jaseci/extens/api/global_api.py +0 -85
  55. jaseci/extens/api/graph_api.py +0 -168
  56. jaseci/extens/api/health_api.py +0 -21
  57. jaseci/extens/api/interface.py +0 -269
  58. jaseci/extens/api/jac_api.py +0 -172
  59. jaseci/extens/api/jsorc_api.py +0 -317
  60. jaseci/extens/api/logger_api.py +0 -90
  61. jaseci/extens/api/master_api.py +0 -134
  62. jaseci/extens/api/object_api.py +0 -102
  63. jaseci/extens/api/prometheus_api.py +0 -75
  64. jaseci/extens/api/queue_api.py +0 -141
  65. jaseci/extens/api/sentinel_api.py +0 -271
  66. jaseci/extens/api/share_api.py +0 -64
  67. jaseci/extens/api/super_api.py +0 -65
  68. jaseci/extens/api/tests/__init__.py +0 -0
  69. jaseci/extens/api/tests/test_architype_api.py +0 -66
  70. jaseci/extens/api/tests/test_global_api.py +0 -179
  71. jaseci/extens/api/tests/test_graph_api.py +0 -64
  72. jaseci/extens/api/tests/test_logger_api.py +0 -43
  73. jaseci/extens/api/tests/test_object_api.py +0 -20
  74. jaseci/extens/api/tests/test_sentinel_api.py +0 -66
  75. jaseci/extens/api/tests/test_uncommon.py +0 -107
  76. jaseci/extens/api/tests/test_user_api.py +0 -32
  77. jaseci/extens/api/tests/test_walker_api.py +0 -316
  78. jaseci/extens/api/user_api.py +0 -166
  79. jaseci/extens/api/walker_api.py +0 -299
  80. jaseci/extens/api/webhook_api.py +0 -77
  81. jaseci/extens/svc/__init__.py +0 -0
  82. jaseci/extens/svc/elastic_svc.py +0 -366
  83. jaseci/extens/svc/kube_svc.py +0 -432
  84. jaseci/extens/svc/mail_svc.py +0 -156
  85. jaseci/extens/svc/prome_svc.py +0 -378
  86. jaseci/extens/svc/redis_svc.py +0 -63
  87. jaseci/extens/svc/storage_svc.py +0 -193
  88. jaseci/extens/svc/stripe_svc.py +0 -51
  89. jaseci/extens/svc/task_svc.py +0 -155
  90. jaseci/extens/svc/tasks.py +0 -302
  91. jaseci/jac/__init__.py +0 -0
  92. jaseci/jac/interpreter/__init__.py +0 -0
  93. jaseci/jac/interpreter/architype_interp.py +0 -219
  94. jaseci/jac/interpreter/interp.py +0 -1784
  95. jaseci/jac/interpreter/sentinel_interp.py +0 -260
  96. jaseci/jac/interpreter/tests/__init__.py +0 -0
  97. jaseci/jac/interpreter/tests/test_interp.py +0 -42
  98. jaseci/jac/interpreter/walker_interp.py +0 -249
  99. jaseci/jac/ir/__init__.py +0 -0
  100. jaseci/jac/ir/ast.py +0 -73
  101. jaseci/jac/ir/ast_builder.py +0 -249
  102. jaseci/jac/ir/jac_code.py +0 -151
  103. jaseci/jac/ir/passes/__init__.py +0 -6
  104. jaseci/jac/ir/passes/ast_prune_pass.py +0 -9
  105. jaseci/jac/ir/passes/codegen_pass.py +0 -244
  106. jaseci/jac/ir/passes/ir_pass.py +0 -29
  107. jaseci/jac/ir/passes/printer_pass.py +0 -23
  108. jaseci/jac/ir/passes/pt_prune_pass.py +0 -29
  109. jaseci/jac/ir/passes/schedule.py +0 -23
  110. jaseci/jac/ir/passes/stats_pass.py +0 -16
  111. jaseci/jac/jac.g4 +0 -450
  112. jaseci/jac/jac_parse/__init__.py +0 -0
  113. jaseci/jac/jac_parse/jacLexer.py +0 -809
  114. jaseci/jac/jac_parse/jacListener.py +0 -853
  115. jaseci/jac/jac_parse/jacParser.py +0 -9192
  116. jaseci/jac/jac_set.py +0 -120
  117. jaseci/jac/jsci_vm/__init__.py +0 -0
  118. jaseci/jac/jsci_vm/disasm.py +0 -94
  119. jaseci/jac/jsci_vm/inst_ptr.py +0 -31
  120. jaseci/jac/jsci_vm/machine.py +0 -188
  121. jaseci/jac/jsci_vm/op_codes.py +0 -82
  122. jaseci/jac/jsci_vm/tests/__init__.py +0 -0
  123. jaseci/jac/jsci_vm/tests/test_codegen.py +0 -31
  124. jaseci/jac/machine/__init__.py +0 -0
  125. jaseci/jac/machine/jac_scope.py +0 -86
  126. jaseci/jac/machine/jac_value.py +0 -227
  127. jaseci/jac/machine/machine_state.py +0 -386
  128. jaseci/jac/tests/__init__.py +0 -0
  129. jaseci/jac/tests/book_code.py +0 -624
  130. jaseci/jac/tests/test_book.py +0 -380
  131. jaseci/jac/tests/test_lang_14.py +0 -49
  132. jaseci/jsorc/__init__.py +0 -7
  133. jaseci/jsorc/jsorc.py +0 -642
  134. jaseci/jsorc/jsorc_settings.py +0 -211
  135. jaseci/jsorc/jsorc_utils.py +0 -298
  136. jaseci/jsorc/live_actions.py +0 -365
  137. jaseci/jsorc/manifests/__init__.py +0 -0
  138. jaseci/jsorc/manifests/database.yaml +0 -109
  139. jaseci/jsorc/manifests/elastic.yaml +0 -6029
  140. jaseci/jsorc/manifests/prometheus.yaml +0 -1383
  141. jaseci/jsorc/manifests/redis.yaml +0 -64
  142. jaseci/jsorc/memory.py +0 -258
  143. jaseci/jsorc/redis.py +0 -140
  144. jaseci/jsorc/remote_actions.py +0 -158
  145. jaseci/jsorc/tests/__init__.py +0 -0
  146. jaseci/jsorc/tests/test_actions.py +0 -542
  147. jaseci/jsorc/tests/test_jsorc.py +0 -112
  148. jaseci/prim/__init__.py +0 -0
  149. jaseci/prim/ability.py +0 -94
  150. jaseci/prim/architype.py +0 -90
  151. jaseci/prim/edge.py +0 -173
  152. jaseci/prim/element.py +0 -233
  153. jaseci/prim/graph.py +0 -27
  154. jaseci/prim/master.py +0 -67
  155. jaseci/prim/node.py +0 -533
  156. jaseci/prim/obj_mixins.py +0 -238
  157. jaseci/prim/sentinel.py +0 -282
  158. jaseci/prim/super_master.py +0 -31
  159. jaseci/prim/walker.py +0 -261
  160. jaseci/svc/__init__.py +0 -0
  161. jaseci/tests/__init__.py +0 -0
  162. jaseci/tests/infer.py +0 -39
  163. jaseci/tests/jac_test_code.py +0 -1293
  164. jaseci/tests/jac_test_progs.py +0 -774
  165. jaseci/tests/test_core.py +0 -153
  166. jaseci/tests/test_jac.py +0 -824
  167. jaseci/tests/test_node.py +0 -89
  168. jaseci/tests/test_progs.py +0 -702
  169. jaseci/tests/test_stack.py +0 -220
  170. jaseci/tests/test_stripe.py +0 -225
  171. jaseci/utils/__init__.py +0 -0
  172. jaseci/utils/actions/__init__.py +0 -0
  173. jaseci/utils/actions/actions_manager.py +0 -254
  174. jaseci/utils/actions/actions_optimizer.py +0 -517
  175. jaseci/utils/actions/actions_state.py +0 -95
  176. jaseci/utils/file_handler.py +0 -171
  177. jaseci/utils/gprof2dot.py +0 -3786
  178. jaseci/utils/id_list.py +0 -169
  179. jaseci/utils/json_handler.py +0 -70
  180. jaseci/utils/log_utils.py +0 -57
  181. jaseci/utils/test_core.py +0 -62
  182. jaseci/utils/utils.py +0 -387
  183. jaseci-1.4.2.6.dist-info/LICENSE +0 -21
  184. jaseci-1.4.2.6.dist-info/METADATA +0 -39
  185. jaseci-1.4.2.6.dist-info/RECORD +0 -185
  186. jaseci-1.4.2.6.dist-info/entry_points.txt +0 -3
  187. jaseci-1.4.2.6.dist-info/top_level.txt +0 -1
jaseci/__init__.py CHANGED
@@ -1,37 +1,3 @@
1
- from os.path import dirname, join
2
-
3
-
4
- def get_ver():
5
- with open(join(dirname(__file__), "VERSION")) as version_file:
6
- return version_file.read().strip()
7
-
8
-
9
- __version__ = get_ver()
10
- __creator__ = "Jason Mars and friends"
11
- __url__ = "https://jaseci.org"
12
-
13
-
14
- def load_standard():
15
- import jaseci.extens.act_lib.net # noqa
16
- import jaseci.extens.act_lib.rand # noqa
17
- import jaseci.extens.act_lib.request # noqa
18
- import jaseci.extens.act_lib.std # noqa
19
- import jaseci.extens.act_lib.file # noqa
20
- import jaseci.extens.act_lib.file_handler # noqa
21
- import jaseci.extens.act_lib.storage # noqa
22
- import jaseci.extens.act_lib.vector # noqa
23
- import jaseci.extens.act_lib.date # noqa
24
- import jaseci.extens.act_lib.jaseci # noqa
25
- import jaseci.extens.act_lib.mail # noqa
26
- import jaseci.extens.act_lib.task # noqa
27
- import jaseci.extens.act_lib.internal # noqa
28
- import jaseci.extens.act_lib.zip # noqa
29
- import jaseci.extens.act_lib.webtool # noqa
30
- import jaseci.extens.act_lib.elastic # noqa
31
- import jaseci.extens.act_lib.url # noqa
32
- import jaseci.extens.act_lib.stripe # noqa
33
- import jaseci.extens.act_lib.regex # noqa
34
- import jaseci.extens.act_lib.maths # noqa
35
-
36
-
37
- load_standard()
1
+ # Jaseci v2.0 Meta-package
2
+ # This package installs the complete Jaseci ecosystem
3
+ __version__ = "2.0.0"
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.4
2
+ Name: jaseci
3
+ Version: 2.0.0
4
+ Summary: Jaseci - A complete AI-native programming ecosystem with Jac language, LLM integration, cloud deployment, and Streamlit visualization
5
+ License: MIT
6
+ Keywords: jac,jaclang,jaseci,ai,llm,cloud,streamlit,programming-language,machine-learning,artificial-intelligence
7
+ Author: Jason Mars
8
+ Author-email: jason@mars.ninja
9
+ Maintainer: Jason Mars
10
+ Maintainer-email: jason@mars.ninja
11
+ Requires-Python: >=3.11.0,<4.0.0
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Requires-Dist: byllm (>=0.4.5,<0.5.0)
19
+ Requires-Dist: jac-cloud (>=0.2.10,<0.3.0)
20
+ Requires-Dist: jac-streamlit (>=0.0.4,<0.0.5)
21
+ Requires-Dist: jaclang (>=0.8.10,<0.9.0)
22
+ Project-URL: Documentation, https://jac-lang.org
23
+ Project-URL: Homepage, https://jaseci.org
24
+ Project-URL: Repository, https://github.com/Jaseci-Labs/jaseci
25
+ Description-Content-Type: text/markdown
26
+
27
+ # Jaseci
28
+ ### Complete AI-Native Programming Ecosystem
29
+
30
+ Jaseci is a meta-package that provides a unified installation for the complete Jaseci ecosystem.
31
+
32
+ ## What's Included
33
+
34
+ When you install `jaseci`, you automatically get:
35
+
36
+ - **jaclang** - The Jac programming language
37
+ - **byllm** - LLM integration for AI-native programming
38
+ - **jac-cloud** - Cloud deployment and scaling capabilities
39
+ - **jac-streamlit** - Streamlit integration for visualization
40
+
41
+ ## Installation
42
+
43
+ ```bash
44
+ pip install jaseci
45
+ ```
46
+
47
+ ## Quick Start
48
+
49
+ After installation, you can start using Jac:
50
+
51
+ ```bash
52
+ jac --help
53
+ ```
54
+
55
+ ## Documentation
56
+
57
+ - **Jac Language**: [https://www.jac-lang.org](https://www.jac-lang.org)
58
+ - **byLLM (AI Integration)**: [https://www.byllm.ai](https://www.byllm.ai)
59
+ - **Jac Cloud**: [https://www.jac-lang.org/learn/jac-cloud/introduction/](https://www.jac-lang.org/learn/jac-cloud/introduction/)
60
+ - **Jaseci Homepage**: [https://jaseci.org](https://jaseci.org)
61
+ - **GitHub Repository**: [https://github.com/Jaseci-Labs/jaseci](https://github.com/Jaseci-Labs/jaseci)
62
+
63
+ ## Version 2.0.0
64
+
65
+ This major release marks the transition to a modular ecosystem where each component is independently maintained and versioned, while this meta-package provides convenient unified installation.
@@ -0,0 +1,4 @@
1
+ jaseci/__init__.py,sha256=7SA14mL87sr5bgu8mwjjAWAb-mCrSBb75Fw5gOi4NZA,102
2
+ jaseci-2.0.0.dist-info/METADATA,sha256=WuYnAqvahLSiYsa33wtG-u8xrLN1tV2Ixi4OMQiZFWQ,2389
3
+ jaseci-2.0.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
4
+ jaseci-2.0.0.dist-info/RECORD,,
@@ -1,5 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: poetry-core 2.2.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
-
jaseci/VERSION DELETED
@@ -1 +0,0 @@
1
- 1.4.2.6
File without changes
@@ -1,457 +0,0 @@
1
- from jaseci.utils.utils import obj_class_cache, build_class_dict
2
- from jaseci.prim.super_master import SuperMaster as Sm
3
- from docstring_parser import parse
4
- from os.path import exists
5
-
6
- # from pprint import pformat
7
- from inspect import getdoc, signature
8
- import jaseci
9
-
10
-
11
- class Book:
12
- def format_params(self, sig, ignore_args=[]):
13
- ret = ""
14
- for i in sig.parameters:
15
- if i == "self" or i in ignore_args:
16
- continue
17
- if len(ret):
18
- ret += ", "
19
- ret += i + ": " + sig.parameters[i].annotation.__name__
20
- default = sig.parameters[i].default
21
- if default == sig.parameters[i].empty:
22
- ret += " (*req)"
23
- else:
24
- # if isinstance(default, str):
25
- # default = default.encode("unicode_escape").lstrip("b")
26
- default = (
27
- str(default)
28
- .replace("_", "\\_")
29
- .replace("{", "\\{")
30
- .replace("}", "\\}")
31
- .replace("\n", "\\\\n")
32
- )
33
- ret += f" ({default})"
34
- return ret if len(ret) else "n/a"
35
-
36
- def bookgen_api_cheatsheet(self, root, out=None, str=""):
37
- if out is None:
38
- out = []
39
- if "leaf" in root.keys():
40
- line = "\\lstinline$" + str.strip()
41
- if root["leaf"][5]: # cli_only
42
- line += " (cli only)"
43
- line += (
44
- "$ "
45
- + "& \\lstinline$"
46
- + f'{self.format_params(root["leaf"][1])}'
47
- + "$ \\\\ \\hline\n"
48
- )
49
- out.append(line)
50
- return
51
- for i in root.keys():
52
- self.bookgen_api_cheatsheet(root[i], out, str + f"{i} ")
53
- return "".join(out)
54
-
55
- def get_stdlib_pre_table(self):
56
- clip = (
57
- "\\rowcolors{1}{light-cyan}{light-gray}\\begin{longtable}"
58
- "{|p{4cm} | p{6cm}|}\\toprule\\rowcolor{white}\\textbf"
59
- "{Action}&\\textbf{Args}\\\\\\midrule"
60
- )
61
- return clip
62
-
63
- def get_stdlib_post_table(self, act="default"):
64
- clip = (
65
- "\\bottomrule\\hiderowcolors\\caption{"
66
- + act
67
- + " Actions in Jac}\\label{tab:"
68
- + act
69
- + "std}\\end{longtable}"
70
- )
71
- return clip
72
-
73
- def get_global_actions(self):
74
- import jaseci.extens.act_lib as stdact
75
- import pkgutil
76
- from importlib.machinery import SourceFileLoader
77
- from jaseci.jsorc.live_actions import live_actions
78
-
79
- all_action_sets = []
80
- for importer, modname, ispkg in pkgutil.iter_modules(stdact.__path__):
81
- if not exists(stdact.__path__[0] + "/" + modname + ".py"):
82
- continue
83
- mod = SourceFileLoader(
84
- modname, stdact.__path__[0] + "/" + modname + ".py"
85
- ).load_module()
86
- all_action_sets.append(
87
- [modname]
88
- + [getdoc(mod)]
89
- + [
90
- [name, val]
91
- for name, val in mod.__dict__.items()
92
- if callable(val) and modname + "." + name in live_actions
93
- ]
94
- )
95
- return all_action_sets
96
-
97
- def func_to_sexy_box(self, fname, func, ignore_args=[]):
98
- doc = getdoc(func)
99
- line = (
100
- "\\apispec{"
101
- + fname
102
- + "}{"
103
- + f"{self.format_params(signature(func), ignore_args=ignore_args)}"
104
- + "}\n"
105
- )
106
- parsed_doc = parse(doc)
107
- doc = parsed_doc.long_description
108
- if doc is None:
109
- doc = "No documentation yet."
110
- doc = doc.replace("_", " ")
111
- if len(parsed_doc.params):
112
- # doc += "\\vspace{3mm}\\par\n\\textbf{Parameters}\n\\par"
113
- doc += "\\vspace{4mm}\\par\n"
114
- args_doc = "\\argspec{Parameters}{"
115
- for i in parsed_doc.params:
116
- args_doc += (
117
- f"\n\\texttt{{{i.arg_name}}} -"
118
- f"- {i.description}\\vspace{{1.5mm}}\\par\n"
119
- )
120
- args_doc += "}"
121
- args_doc = args_doc.replace("_", "\\_")
122
- doc += args_doc
123
- if parsed_doc.returns:
124
- # doc += "\\vspace{3mm}\\par\n\\textbf{Parameters}\n\\par"
125
- doc += "\\vspace{4mm}\\par\n"
126
- args_doc = "\\argspec{Returns}{" + parsed_doc.returns.description + "}"
127
- args_doc = args_doc.replace("_", "\\_")
128
- doc += args_doc
129
- line += "{" + doc + "}\n"
130
-
131
- return line
132
-
133
- def bookgen_std_library(self):
134
- out = []
135
- for i in self.get_global_actions():
136
- lib = i[0]
137
- moddoc = parse(i[1]).long_description
138
- if moddoc is None:
139
- moddoc = "No documentation yet."
140
- if lib == "jaseci":
141
- continue
142
- out += ["\\subsection{" + lib + "}\n\\par\n" + moddoc + "\n"]
143
- i = i[2:]
144
- for j in i:
145
- out.append(
146
- self.func_to_sexy_box(
147
- ".".join([lib, j[0].replace("_", "\\_")]),
148
- j[1],
149
- ignore_args=["meta"],
150
- )
151
- )
152
- return "".join(out)
153
-
154
- def std_library_table(self):
155
- out = []
156
- for i in self.get_global_actions():
157
- lib = i[0]
158
- if lib == "jaseci":
159
- continue
160
- out += ["\\subsection{" + lib + "}\n", self.get_stdlib_pre_table()]
161
-
162
- i = i[1:]
163
- for j in i:
164
- line = (
165
- "\\lstinline$"
166
- + lib
167
- + "."
168
- + j[0]
169
- + "$ & \\lstinline$"
170
- + f"{self.format_params(signature(j[1]))}"
171
- + "$ \\\\ \\hline\n"
172
- )
173
- out.append(line)
174
- doc = getdoc(j[1]) if getdoc(j[1]) is not None else ""
175
- line = "\\multicolumn{2}{|p|}{Description: " + doc + "} \\\\ \\hline\n"
176
- out.append(line)
177
- out.append(self.get_stdlib_post_table(lib))
178
- return "".join(out)
179
-
180
- def bookgen_api_spec(self):
181
- ret = ""
182
- build_class_dict(jaseci)
183
- for i in obj_class_cache.keys():
184
- if not i.endswith("_api"):
185
- continue
186
- ret += f"\\subsection{{APIs for {i[:-4]}}}\n\n"
187
- doc = getdoc(obj_class_cache[i]).replace("\n\n", "\n\\par\n")
188
- doc = parse(doc).long_description
189
- doc = (
190
- doc.replace("_", "\\_") if doc is not None else "No documentation yet."
191
- )
192
- ret += f"{doc}\n\n"
193
- ret += self.api_call_spec(obj_class_cache[i])
194
- # return ret
195
-
196
- def api_call_spec(self, cls):
197
- ret = ""
198
- for i, v in cls.__dict__.items():
199
- # access = 'master'
200
- found = False
201
- auth_level = ""
202
- for j in Sm.all_apis(None, True):
203
- if i == j["fname"]:
204
- found = True
205
- auth_level = (
206
- "public"
207
- if j in Sm._public_api
208
- else (
209
- "user"
210
- if j in Sm._private_api
211
- else "admin" if j in Sm._admin_api else "cli_only"
212
- )
213
- )
214
- break
215
- if not found:
216
- continue
217
- name = i.replace("_", " ")
218
- api = i.replace("_", "\\_")
219
- ret += (
220
- f"\\subsubsection{{\\lstinline"
221
- f"[basicstyle=\\Large\\ttfamily]${name}$}}\n\n"
222
- )
223
- authstr = "(cli only)"
224
- if auth_level != "cli_only":
225
- authstr = f"| api: {api} | auth: {auth_level}"
226
- ret += self.func_to_sexy_box(f"cli: {name} {authstr}", v)
227
- print(ret)
228
- return ret
229
-
230
-
231
- # modified book class
232
-
233
-
234
- class modifiedBook:
235
- def format_params(self, sig, ignore_args=[]):
236
- ret = ""
237
- for i in sig.parameters:
238
- if i == "self" or i in ignore_args:
239
- continue
240
- if len(ret):
241
- ret += ", "
242
- ret += i + ": " + sig.parameters[i].annotation.__name__
243
- default = sig.parameters[i].default
244
- if default == sig.parameters[i].empty:
245
- ret += " (*req)"
246
- else:
247
- # if isinstance(default, str):
248
- # default = default.encode("unicode_escape").lstrip("b")
249
- default = (
250
- str(default)
251
- .replace("_", "\\_")
252
- .replace("{", "\\{")
253
- .replace("}", "\\}")
254
- .replace("\n", "\\\\n")
255
- )
256
- ret += f" ({default})"
257
- return ret if len(ret) else "n/a"
258
-
259
- def bookgen_api_cheatsheet(self, root, out=None, str=""):
260
- if out is None:
261
- out = []
262
- line = "<tr> \n"
263
- if "leaf" in root.keys():
264
- line = "<tr> \n <td>" + str.strip()
265
- if root["leaf"][5]: # cli_only
266
- line += " (cli only)"
267
- line += "</td>"
268
- line += "<td> \n <ul>"
269
- arguments = self.format_params(root["leaf"][1])
270
- arguments = arguments.split(",")
271
- for argument in arguments:
272
- line += "<li>" + f"{argument}" + "</li>\n"
273
- line += "</ul> \n </td> \n </tr>"
274
- out.append(line)
275
- return
276
- for i in root.keys():
277
- self.bookgen_api_cheatsheet(root[i], out, str + f"{i} ")
278
- all_info = "".join(out)
279
- return (
280
- "<table id='cheatsheet'> <tr> <th>Interface</th> <th>Parameters</th> </tr>"
281
- + all_info
282
- + "</table>"
283
- )
284
-
285
- def get_stdlib_pre_table(self):
286
- clip = (
287
- "\\rowcolors{1}{light-cyan}{light-gray}\\begin{longtable}"
288
- "{|p{4cm} | p{6cm}|}\\toprule\\rowcolor{white}\\textbf"
289
- "{Action}&\\textbf{Args}\\\\\\midrule"
290
- )
291
- return clip
292
-
293
- def get_stdlib_post_table(self, act="default"):
294
- clip = (
295
- "\\bottomrule\\hiderowcolors\\caption{"
296
- + act
297
- + " Actions in Jac}\\label{tab:"
298
- + act
299
- + "std}\\end{longtable}"
300
- )
301
- return clip
302
-
303
- def get_global_actions(self):
304
- import jaseci.extens.act_lib as stdact
305
- import pkgutil
306
- from importlib.machinery import SourceFileLoader
307
- from jaseci.jsorc.live_actions import live_actions
308
-
309
- all_action_sets = []
310
- for importer, modname, ispkg in pkgutil.iter_modules(stdact.__path__):
311
- if not exists(stdact.__path__[0] + "/" + modname + ".py"):
312
- continue
313
- mod = SourceFileLoader(
314
- modname, stdact.__path__[0] + "/" + modname + ".py"
315
- ).load_module()
316
- all_action_sets.append(
317
- [modname]
318
- + [getdoc(mod)]
319
- + [
320
- [name, val]
321
- for name, val in mod.__dict__.items()
322
- if callable(val) and modname + "." + name in live_actions
323
- ]
324
- )
325
- return all_action_sets
326
-
327
- def func_to_sexy_box(self, fname, func, ignore_args=[]):
328
- doc = getdoc(func)
329
- line = (
330
- "\ <div class='actionName'> "
331
- + fname
332
- + " </div> \n <div class ='actionsArgs'> "
333
- + f"{self.format_params(signature(func), ignore_args=ignore_args)}"
334
- + "</div>\n"
335
- )
336
- line = line.replace("\\", "")
337
- parsed_doc = parse(doc)
338
- doc = parsed_doc.long_description
339
- if doc is None:
340
- doc = "No documentation yet."
341
- doc = doc.replace("_", " ")
342
- if len(parsed_doc.params):
343
- # doc += "\\vspace{3mm}\\par\n\\textbf{Parameters}\n\\par"
344
- doc += "<div class='heading'>Params</div> \n <div class='params'> Params"
345
- # args_doc = "\\argspec{Parameters}{"
346
- args_doc = " "
347
- for i in parsed_doc.params:
348
- args_doc += f"\n{i.arg_name} -" f"- {i.description} <br> \n"
349
- args_doc += "</div>"
350
-
351
- doc += args_doc
352
- if parsed_doc.returns:
353
- # doc += "\\vspace{3mm}\\par\n\\textbf{Parameters}\n\\par"
354
- doc += "<div class='heading'>Returns</div> \n<div class='return'>"
355
- args_doc = "Returns - " + parsed_doc.returns.description
356
- args_doc = args_doc.replace("_", "\\_")
357
- doc += args_doc
358
- line += (
359
- " <div class ='mainbody'> <div class ='actionsDescription'>"
360
- + doc
361
- + "</div> </div> \n \n"
362
- )
363
- return line
364
-
365
- def bookgen_std_library(self):
366
- out = []
367
- for i in self.get_global_actions():
368
- lib = i[0]
369
- moddoc = parse(i[1]).long_description
370
- if moddoc is None:
371
- moddoc = "No documentation yet."
372
- if lib == "jaseci":
373
- continue
374
- out += ["\n" + "# " + lib + "\n\n" + moddoc + "\n"]
375
- i = i[2:]
376
- for j in i:
377
- out.append(
378
- self.func_to_sexy_box(
379
- ".".join([lib, j[0]]),
380
- j[1],
381
- ignore_args=["meta"],
382
- )
383
- )
384
-
385
- return "".join(out)
386
-
387
- def std_library_table(self):
388
- out = []
389
- for i in self.get_global_actions():
390
- lib = i[0]
391
- if lib == "jaseci":
392
- continue
393
- out += ["\\subsection{" + lib + "}\n", self.get_stdlib_pre_table()]
394
-
395
- i = i[1:]
396
- for j in i:
397
- line = (
398
- "\\lstinline$"
399
- + lib
400
- + "."
401
- + j[0]
402
- + "$ & \\lstinline$"
403
- + f"{self.format_params(signature(j[1]))}"
404
- + "$ \\\\ \\hline\n"
405
- )
406
- out.append(line)
407
- doc = getdoc(j[1]) if getdoc(j[1]) is not None else ""
408
- line = "\\multicolumn{2}{|p|}{Description: " + doc + "} \\\\ \\hline\n"
409
- out.append(line)
410
- out.append(self.get_stdlib_post_table(lib))
411
- return "".join(out)
412
-
413
- def bookgen_api_spec(self):
414
- ret = ""
415
- build_class_dict(jaseci)
416
- for i in obj_class_cache.keys():
417
- if not i.endswith("_api"):
418
- continue
419
- ret += f" # APIs for {i[:-4]}\n\n"
420
- doc = getdoc(obj_class_cache[i]).replace("\n\n", "\n\n")
421
- doc = parse(doc).long_description
422
- doc = (
423
- doc.replace("_", "\\_") if doc is not None else "No documentation yet."
424
- )
425
- ret += f"{doc}\n\n"
426
- ret += self.api_call_spec(obj_class_cache[i])
427
- return ret
428
-
429
- def api_call_spec(self, cls):
430
- ret = ""
431
- for i, v in cls.__dict__.items():
432
- # access = 'master'
433
- found = False
434
- auth_level = ""
435
- for j in Sm.all_apis(None, True):
436
- if i == j["fname"]:
437
- found = True
438
- auth_level = (
439
- "public"
440
- if j in Sm._public_api
441
- else (
442
- "user"
443
- if j in Sm._private_api
444
- else "admin" if j in Sm._admin_api else "cli_only"
445
- )
446
- )
447
- break
448
- if not found:
449
- continue
450
- name = i.replace("_", " ")
451
- api = i.replace("_", "\\_")
452
- ret += f"<div class='actionHeading'>{name}</div>\n\n"
453
- authstr = "(cli only)"
454
- if auth_level != "cli_only":
455
- authstr = f"| api: {api} | auth: {auth_level}"
456
- ret += self.func_to_sexy_box(f"cli: {name} {authstr}", v)
457
- return ret