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.
- jaseci/__init__.py +3 -37
- jaseci-2.0.0.dist-info/METADATA +65 -0
- jaseci-2.0.0.dist-info/RECORD +4 -0
- {jaseci-1.4.2.6.dist-info → jaseci-2.0.0.dist-info}/WHEEL +1 -2
- jaseci/VERSION +0 -1
- jaseci/cli_tools/__init__.py +0 -0
- jaseci/cli_tools/book_tools.py +0 -457
- jaseci/cli_tools/jsctl.py +0 -500
- jaseci/cli_tools/tests/__init__.py +0 -0
- jaseci/cli_tools/tests/test_jsctl.py +0 -556
- jaseci/extens/__init__.py +0 -0
- jaseci/extens/act_lib/__init__.py +0 -0
- jaseci/extens/act_lib/date.py +0 -118
- jaseci/extens/act_lib/elastic.py +0 -87
- jaseci/extens/act_lib/file.py +0 -77
- jaseci/extens/act_lib/file_handler.py +0 -190
- jaseci/extens/act_lib/internal.py +0 -19
- jaseci/extens/act_lib/jaseci.py +0 -62
- jaseci/extens/act_lib/mail.py +0 -10
- jaseci/extens/act_lib/maths.py +0 -168
- jaseci/extens/act_lib/net.py +0 -192
- jaseci/extens/act_lib/rand.py +0 -83
- jaseci/extens/act_lib/regex.py +0 -85
- jaseci/extens/act_lib/request.py +0 -170
- jaseci/extens/act_lib/std.py +0 -236
- jaseci/extens/act_lib/storage.py +0 -53
- jaseci/extens/act_lib/stripe.py +0 -338
- jaseci/extens/act_lib/task.py +0 -14
- jaseci/extens/act_lib/tests/__init__.py +0 -0
- jaseci/extens/act_lib/tests/std_test_code.py +0 -37
- jaseci/extens/act_lib/tests/test_date.py +0 -26
- jaseci/extens/act_lib/tests/test_elastic.py +0 -159
- jaseci/extens/act_lib/tests/test_file.py +0 -116
- jaseci/extens/act_lib/tests/test_file_lib.py +0 -40
- jaseci/extens/act_lib/tests/test_mail_lib.py +0 -33
- jaseci/extens/act_lib/tests/test_maths.py +0 -147
- jaseci/extens/act_lib/tests/test_net_lib.py +0 -62
- jaseci/extens/act_lib/tests/test_regex.py +0 -61
- jaseci/extens/act_lib/tests/test_std.py +0 -51
- jaseci/extens/act_lib/tests/test_std_lib.py +0 -36
- jaseci/extens/act_lib/tests/test_url.py +0 -32
- jaseci/extens/act_lib/tests/test_vector.py +0 -36
- jaseci/extens/act_lib/tests/test_webtool.py +0 -44
- jaseci/extens/act_lib/tests/test_zlib.py +0 -24
- jaseci/extens/act_lib/url.py +0 -80
- jaseci/extens/act_lib/vector.py +0 -158
- jaseci/extens/act_lib/webtool.py +0 -29
- jaseci/extens/act_lib/zip.py +0 -34
- jaseci/extens/api/__init__.py +0 -0
- jaseci/extens/api/actions_api.py +0 -171
- jaseci/extens/api/alias_api.py +0 -140
- jaseci/extens/api/architype_api.py +0 -197
- jaseci/extens/api/config_api.py +0 -129
- jaseci/extens/api/global_api.py +0 -85
- jaseci/extens/api/graph_api.py +0 -168
- jaseci/extens/api/health_api.py +0 -21
- jaseci/extens/api/interface.py +0 -269
- jaseci/extens/api/jac_api.py +0 -172
- jaseci/extens/api/jsorc_api.py +0 -317
- jaseci/extens/api/logger_api.py +0 -90
- jaseci/extens/api/master_api.py +0 -134
- jaseci/extens/api/object_api.py +0 -102
- jaseci/extens/api/prometheus_api.py +0 -75
- jaseci/extens/api/queue_api.py +0 -141
- jaseci/extens/api/sentinel_api.py +0 -271
- jaseci/extens/api/share_api.py +0 -64
- jaseci/extens/api/super_api.py +0 -65
- jaseci/extens/api/tests/__init__.py +0 -0
- jaseci/extens/api/tests/test_architype_api.py +0 -66
- jaseci/extens/api/tests/test_global_api.py +0 -179
- jaseci/extens/api/tests/test_graph_api.py +0 -64
- jaseci/extens/api/tests/test_logger_api.py +0 -43
- jaseci/extens/api/tests/test_object_api.py +0 -20
- jaseci/extens/api/tests/test_sentinel_api.py +0 -66
- jaseci/extens/api/tests/test_uncommon.py +0 -107
- jaseci/extens/api/tests/test_user_api.py +0 -32
- jaseci/extens/api/tests/test_walker_api.py +0 -316
- jaseci/extens/api/user_api.py +0 -166
- jaseci/extens/api/walker_api.py +0 -299
- jaseci/extens/api/webhook_api.py +0 -77
- jaseci/extens/svc/__init__.py +0 -0
- jaseci/extens/svc/elastic_svc.py +0 -366
- jaseci/extens/svc/kube_svc.py +0 -432
- jaseci/extens/svc/mail_svc.py +0 -156
- jaseci/extens/svc/prome_svc.py +0 -378
- jaseci/extens/svc/redis_svc.py +0 -63
- jaseci/extens/svc/storage_svc.py +0 -193
- jaseci/extens/svc/stripe_svc.py +0 -51
- jaseci/extens/svc/task_svc.py +0 -155
- jaseci/extens/svc/tasks.py +0 -302
- jaseci/jac/__init__.py +0 -0
- jaseci/jac/interpreter/__init__.py +0 -0
- jaseci/jac/interpreter/architype_interp.py +0 -219
- jaseci/jac/interpreter/interp.py +0 -1784
- jaseci/jac/interpreter/sentinel_interp.py +0 -260
- jaseci/jac/interpreter/tests/__init__.py +0 -0
- jaseci/jac/interpreter/tests/test_interp.py +0 -42
- jaseci/jac/interpreter/walker_interp.py +0 -249
- jaseci/jac/ir/__init__.py +0 -0
- jaseci/jac/ir/ast.py +0 -73
- jaseci/jac/ir/ast_builder.py +0 -249
- jaseci/jac/ir/jac_code.py +0 -151
- jaseci/jac/ir/passes/__init__.py +0 -6
- jaseci/jac/ir/passes/ast_prune_pass.py +0 -9
- jaseci/jac/ir/passes/codegen_pass.py +0 -244
- jaseci/jac/ir/passes/ir_pass.py +0 -29
- jaseci/jac/ir/passes/printer_pass.py +0 -23
- jaseci/jac/ir/passes/pt_prune_pass.py +0 -29
- jaseci/jac/ir/passes/schedule.py +0 -23
- jaseci/jac/ir/passes/stats_pass.py +0 -16
- jaseci/jac/jac.g4 +0 -450
- jaseci/jac/jac_parse/__init__.py +0 -0
- jaseci/jac/jac_parse/jacLexer.py +0 -809
- jaseci/jac/jac_parse/jacListener.py +0 -853
- jaseci/jac/jac_parse/jacParser.py +0 -9192
- jaseci/jac/jac_set.py +0 -120
- jaseci/jac/jsci_vm/__init__.py +0 -0
- jaseci/jac/jsci_vm/disasm.py +0 -94
- jaseci/jac/jsci_vm/inst_ptr.py +0 -31
- jaseci/jac/jsci_vm/machine.py +0 -188
- jaseci/jac/jsci_vm/op_codes.py +0 -82
- jaseci/jac/jsci_vm/tests/__init__.py +0 -0
- jaseci/jac/jsci_vm/tests/test_codegen.py +0 -31
- jaseci/jac/machine/__init__.py +0 -0
- jaseci/jac/machine/jac_scope.py +0 -86
- jaseci/jac/machine/jac_value.py +0 -227
- jaseci/jac/machine/machine_state.py +0 -386
- jaseci/jac/tests/__init__.py +0 -0
- jaseci/jac/tests/book_code.py +0 -624
- jaseci/jac/tests/test_book.py +0 -380
- jaseci/jac/tests/test_lang_14.py +0 -49
- jaseci/jsorc/__init__.py +0 -7
- jaseci/jsorc/jsorc.py +0 -642
- jaseci/jsorc/jsorc_settings.py +0 -211
- jaseci/jsorc/jsorc_utils.py +0 -298
- jaseci/jsorc/live_actions.py +0 -365
- jaseci/jsorc/manifests/__init__.py +0 -0
- jaseci/jsorc/manifests/database.yaml +0 -109
- jaseci/jsorc/manifests/elastic.yaml +0 -6029
- jaseci/jsorc/manifests/prometheus.yaml +0 -1383
- jaseci/jsorc/manifests/redis.yaml +0 -64
- jaseci/jsorc/memory.py +0 -258
- jaseci/jsorc/redis.py +0 -140
- jaseci/jsorc/remote_actions.py +0 -158
- jaseci/jsorc/tests/__init__.py +0 -0
- jaseci/jsorc/tests/test_actions.py +0 -542
- jaseci/jsorc/tests/test_jsorc.py +0 -112
- jaseci/prim/__init__.py +0 -0
- jaseci/prim/ability.py +0 -94
- jaseci/prim/architype.py +0 -90
- jaseci/prim/edge.py +0 -173
- jaseci/prim/element.py +0 -233
- jaseci/prim/graph.py +0 -27
- jaseci/prim/master.py +0 -67
- jaseci/prim/node.py +0 -533
- jaseci/prim/obj_mixins.py +0 -238
- jaseci/prim/sentinel.py +0 -282
- jaseci/prim/super_master.py +0 -31
- jaseci/prim/walker.py +0 -261
- jaseci/svc/__init__.py +0 -0
- jaseci/tests/__init__.py +0 -0
- jaseci/tests/infer.py +0 -39
- jaseci/tests/jac_test_code.py +0 -1293
- jaseci/tests/jac_test_progs.py +0 -774
- jaseci/tests/test_core.py +0 -153
- jaseci/tests/test_jac.py +0 -824
- jaseci/tests/test_node.py +0 -89
- jaseci/tests/test_progs.py +0 -702
- jaseci/tests/test_stack.py +0 -220
- jaseci/tests/test_stripe.py +0 -225
- jaseci/utils/__init__.py +0 -0
- jaseci/utils/actions/__init__.py +0 -0
- jaseci/utils/actions/actions_manager.py +0 -254
- jaseci/utils/actions/actions_optimizer.py +0 -517
- jaseci/utils/actions/actions_state.py +0 -95
- jaseci/utils/file_handler.py +0 -171
- jaseci/utils/gprof2dot.py +0 -3786
- jaseci/utils/id_list.py +0 -169
- jaseci/utils/json_handler.py +0 -70
- jaseci/utils/log_utils.py +0 -57
- jaseci/utils/test_core.py +0 -62
- jaseci/utils/utils.py +0 -387
- jaseci-1.4.2.6.dist-info/LICENSE +0 -21
- jaseci-1.4.2.6.dist-info/METADATA +0 -39
- jaseci-1.4.2.6.dist-info/RECORD +0 -185
- jaseci-1.4.2.6.dist-info/entry_points.txt +0 -3
- jaseci-1.4.2.6.dist-info/top_level.txt +0 -1
jaseci/extens/act_lib/elastic.py
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
from jaseci.jsorc.live_actions import jaseci_action
|
|
2
|
-
from jaseci.jsorc.jsorc import JsOrc
|
|
3
|
-
from jaseci.extens.svc.elastic_svc import ElasticService, Elastic
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def elastic():
|
|
7
|
-
return JsOrc.svc("elastic", ElasticService).poke(Elastic)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
@jaseci_action()
|
|
11
|
-
def _post(url: str, json: dict = {}):
|
|
12
|
-
return elastic()._post(url, json)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
@jaseci_action()
|
|
16
|
-
def _get(url: str, json: dict = None):
|
|
17
|
-
return elastic()._get(url, json)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@jaseci_action()
|
|
21
|
-
def post(url: str, body: dict, index: str = "", suffix: str = ""):
|
|
22
|
-
return elastic().post(url, body, index, suffix)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
@jaseci_action()
|
|
26
|
-
def post_act(url: str, body: dict, suffix: str = ""):
|
|
27
|
-
return elastic().post_act(url, body, suffix)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
@jaseci_action()
|
|
31
|
-
def get(url: str, body: dict, index: str = "", suffix: str = ""):
|
|
32
|
-
return elastic().get(url, body, index)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
@jaseci_action()
|
|
36
|
-
def get_act(url: str, body: dict, suffix: str = ""):
|
|
37
|
-
return elastic().get_act(url, body, suffix)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
@jaseci_action()
|
|
41
|
-
def doc(log: dict, query: str = "", index: str = "", suffix: str = ""):
|
|
42
|
-
return elastic().doc(log, query, index, suffix)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
@jaseci_action()
|
|
46
|
-
def doc_activity(log: dict, query: str = "", suffix: str = ""):
|
|
47
|
-
return elastic().doc_activity(log, query, suffix)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
@jaseci_action()
|
|
51
|
-
def search(body: dict, query: str = "", index: str = "", suffix: str = ""):
|
|
52
|
-
return elastic().search(body, query, index, suffix)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
@jaseci_action()
|
|
56
|
-
def search_activity(body: dict, query: str = "", suffix: str = ""):
|
|
57
|
-
return elastic().search_activity(body, query, suffix)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
@jaseci_action()
|
|
61
|
-
def mapping(query: str = "", index: str = "", suffix: str = ""):
|
|
62
|
-
return elastic().mapping(query, index, suffix)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
@jaseci_action()
|
|
66
|
-
def mapping_activity(query: str = "", suffix: str = ""):
|
|
67
|
-
return elastic().mapping_activity(query, suffix)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
@jaseci_action()
|
|
71
|
-
def refresh(index: str = "", suffix: str = ""):
|
|
72
|
-
return elastic().refresh(index, suffix)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
@jaseci_action()
|
|
76
|
-
def refresh_activity(suffix: str = ""):
|
|
77
|
-
return elastic().refresh_activity(suffix)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
@jaseci_action()
|
|
81
|
-
def aliases(query: str = "pretty=true"):
|
|
82
|
-
return elastic().aliases(query)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
@jaseci_action()
|
|
86
|
-
def reindex(body: dict, query: str = "pretty"):
|
|
87
|
-
return elastic().reindex(body, query)
|
jaseci/extens/act_lib/file.py
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"""Built in actions for Jaseci"""
|
|
2
|
-
|
|
3
|
-
from jaseci.jsorc.live_actions import jaseci_action
|
|
4
|
-
import os
|
|
5
|
-
import json
|
|
6
|
-
import base64
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
@jaseci_action()
|
|
10
|
-
def load_str(fn: str, max_chars: int = None):
|
|
11
|
-
"""Standard built in for loading from file to string"""
|
|
12
|
-
with open(fn, "r") as file:
|
|
13
|
-
data = file.read(max_chars)
|
|
14
|
-
return data
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@jaseci_action()
|
|
18
|
-
def load_json(fn: str):
|
|
19
|
-
"""Standard built in for loading json from file to dictionary"""
|
|
20
|
-
with open(fn, "r") as file:
|
|
21
|
-
data = json.load(file)
|
|
22
|
-
return data
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
@jaseci_action()
|
|
26
|
-
def load_to_b64(fn: str):
|
|
27
|
-
"""Standard built in for loading binary from file to base64"""
|
|
28
|
-
with open(fn, "rb") as file:
|
|
29
|
-
data = base64.b64encode(file.read()).decode("ascii")
|
|
30
|
-
return data
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
@jaseci_action()
|
|
34
|
-
def dump_str(fn: str, s: str):
|
|
35
|
-
"""Standard built in for dumping to file from string"""
|
|
36
|
-
with open(fn, "w") as file:
|
|
37
|
-
num_chars = file.write(s)
|
|
38
|
-
return num_chars
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
@jaseci_action()
|
|
42
|
-
def dump_json(fn: str, obj, indent: int = None):
|
|
43
|
-
"""Standard built in for dumping json to file from dictionary"""
|
|
44
|
-
with open(fn, "w") as file:
|
|
45
|
-
json.dump(obj, file, indent=indent)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
@jaseci_action()
|
|
49
|
-
def dump_from_b64(fn: str, b64: str):
|
|
50
|
-
"""Standard built in for dumping binary to file from from base64"""
|
|
51
|
-
with open(fn, "wb") as file:
|
|
52
|
-
file.write(base64.b64decode(b64.encode("ascii")))
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
@jaseci_action()
|
|
56
|
-
def append_str(fn: str, s: str):
|
|
57
|
-
"""Standard built in for appending to file from string"""
|
|
58
|
-
with open(fn, "a") as file:
|
|
59
|
-
num_chars = file.write(s)
|
|
60
|
-
return num_chars
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
@jaseci_action()
|
|
64
|
-
def append_from_b64(fn: str, b64: str):
|
|
65
|
-
"""Standard built in for appending binary to file from from base64"""
|
|
66
|
-
with open(fn, "ab") as file:
|
|
67
|
-
file.write(base64.b64decode(b64.encode("ascii")))
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
@jaseci_action()
|
|
71
|
-
def delete(fn: str):
|
|
72
|
-
"""Standard built in for deleting a file"""
|
|
73
|
-
if os.path.exists(fn):
|
|
74
|
-
os.remove(fn)
|
|
75
|
-
return True
|
|
76
|
-
else:
|
|
77
|
-
return False
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
"""Built in actions for Jaseci"""
|
|
2
|
-
|
|
3
|
-
import mimetypes
|
|
4
|
-
import magic
|
|
5
|
-
from os import path
|
|
6
|
-
from urllib.parse import urlparse
|
|
7
|
-
from requests import get
|
|
8
|
-
from jaseci.jsorc.live_actions import jaseci_action
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
@jaseci_action(act_group=["fh"])
|
|
12
|
-
def load(path: str, meta: dict = {}):
|
|
13
|
-
"""temp"""
|
|
14
|
-
from jaseci.utils.file_handler import FileHandler
|
|
15
|
-
|
|
16
|
-
return meta["h"].add_file_handler(FileHandler.fromPath(path))
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
@jaseci_action(act_group=["fh"])
|
|
20
|
-
def new(
|
|
21
|
-
name: str,
|
|
22
|
-
content_type: str = None,
|
|
23
|
-
field: str = None,
|
|
24
|
-
persist: bool = False,
|
|
25
|
-
meta: dict = {},
|
|
26
|
-
):
|
|
27
|
-
"""temp"""
|
|
28
|
-
from jaseci.utils.file_handler import FileHandler
|
|
29
|
-
|
|
30
|
-
return meta["h"].add_file_handler(
|
|
31
|
-
FileHandler(name=name, content_type=content_type, field=field, persist=persist)
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
@jaseci_action
|
|
36
|
-
def guess_type(filename: str) -> tuple:
|
|
37
|
-
"""temp"""
|
|
38
|
-
return mimetypes.guess_type(filename)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
@jaseci_action(act_group=["fh"])
|
|
42
|
-
def update(
|
|
43
|
-
id: str,
|
|
44
|
-
name: str = None,
|
|
45
|
-
content_type: str = None,
|
|
46
|
-
field: str = None,
|
|
47
|
-
persist: bool = None,
|
|
48
|
-
meta: dict = {},
|
|
49
|
-
):
|
|
50
|
-
"""temp"""
|
|
51
|
-
from jaseci.utils.file_handler import FileHandler
|
|
52
|
-
|
|
53
|
-
file_handler: FileHandler = meta["h"].get_file_handler(id)
|
|
54
|
-
if name:
|
|
55
|
-
file_handler.name = name
|
|
56
|
-
if not content_type:
|
|
57
|
-
file_handler.content_type = mimetypes.guess_type(name)[0]
|
|
58
|
-
|
|
59
|
-
if content_type:
|
|
60
|
-
file_handler.content_type = content_type
|
|
61
|
-
|
|
62
|
-
if field:
|
|
63
|
-
file_handler.field = field
|
|
64
|
-
|
|
65
|
-
if persist != None:
|
|
66
|
-
file_handler.persist = persist
|
|
67
|
-
|
|
68
|
-
return file_handler.attr()
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
@jaseci_action(act_group=["fh"])
|
|
72
|
-
def read(
|
|
73
|
-
id: str, offset: int = None, mode: str = "r", encoding: str = None, meta: dict = {}
|
|
74
|
-
):
|
|
75
|
-
"""temp"""
|
|
76
|
-
return meta["h"].get_file_handler(id).read(offset, mode, encoding)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
@jaseci_action(act_group=["fh"])
|
|
80
|
-
def seek(id: str, offset: int, whence: int = 0, meta: dict = {}):
|
|
81
|
-
"""temp"""
|
|
82
|
-
return meta["h"].get_file_handler(id).seek(offset, whence)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
@jaseci_action(act_group=["fh"])
|
|
86
|
-
def open(id: str, mode: str = "r", encoding: str = None, meta: dict = {}, **kwargs):
|
|
87
|
-
"""temp"""
|
|
88
|
-
meta["h"].get_file_handler(id).open(mode, encoding, False, **kwargs)
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
@jaseci_action(act_group=["fh"])
|
|
92
|
-
def is_open(id: str, meta: dict = {}):
|
|
93
|
-
"""temp"""
|
|
94
|
-
return meta["h"].get_file_handler(id).is_open()
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
@jaseci_action(act_group=["fh"])
|
|
98
|
-
def exists(id: str, meta: dict = {}):
|
|
99
|
-
"""temp"""
|
|
100
|
-
return meta["h"].get_file_handler(id).exists()
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
@jaseci_action(act_group=["fh"])
|
|
104
|
-
def write(id: str, content: str, meta: dict = {}):
|
|
105
|
-
"""temp"""
|
|
106
|
-
meta["h"].get_file_handler(id).write(content)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
@jaseci_action(act_group=["fh"])
|
|
110
|
-
def flush(id: str, meta: dict = {}):
|
|
111
|
-
"""temp"""
|
|
112
|
-
meta["h"].get_file_handler(id).flush()
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
@jaseci_action(act_group=["fh"])
|
|
116
|
-
def close(id: str, meta: dict = {}):
|
|
117
|
-
"""temp"""
|
|
118
|
-
meta["h"].get_file_handler(id).close()
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
@jaseci_action(act_group=["fh"])
|
|
122
|
-
def detach(id: str, persist: bool = None, meta: dict = {}):
|
|
123
|
-
"""temp"""
|
|
124
|
-
from jaseci.utils.file_handler import FileHandler
|
|
125
|
-
|
|
126
|
-
file_handler: FileHandler = meta["h"].pop_file_handler(id)
|
|
127
|
-
file_info = file_handler.attr()
|
|
128
|
-
|
|
129
|
-
if (persist is None and not file_handler.persist) or persist is False:
|
|
130
|
-
file_handler.delete()
|
|
131
|
-
else:
|
|
132
|
-
file_handler.close()
|
|
133
|
-
|
|
134
|
-
return file_info
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
@jaseci_action(act_group=["fh"])
|
|
138
|
-
def delete(id: str, meta: dict = {}):
|
|
139
|
-
"""temp"""
|
|
140
|
-
meta["h"].pop_file_handler(id).delete()
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
@jaseci_action(act_group=["fh"])
|
|
144
|
-
def attr(id: str, meta: dict = {}):
|
|
145
|
-
"""temp"""
|
|
146
|
-
return meta["h"].get_file_handler(id).attr()
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
@jaseci_action(act_group=["fh"])
|
|
150
|
-
def to_bytes(id: str, meta: dict = {}):
|
|
151
|
-
"""temp"""
|
|
152
|
-
return meta["h"].get_file_handler(id).to_bytes()
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
@jaseci_action(act_group=["fh"])
|
|
156
|
-
def to_base64(id: str, meta: dict = {}):
|
|
157
|
-
"""temp"""
|
|
158
|
-
return meta["h"].get_file_handler(id).to_base64()
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
@jaseci_action(act_group=["fh"])
|
|
162
|
-
def to_json(id: str, meta: dict = {}):
|
|
163
|
-
"""temp"""
|
|
164
|
-
return meta["h"].get_file_handler(id).to_json()
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
@jaseci_action(act_group=["fh"])
|
|
168
|
-
def dump_json(id: str, json, indent: int = None, meta: dict = {}):
|
|
169
|
-
"""temp"""
|
|
170
|
-
meta["h"].get_file_handler(id).dump_json(json, indent)
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
@jaseci_action(act_group=["fh"])
|
|
174
|
-
def download(url: str, header: dict = {}, meta: dict = {}):
|
|
175
|
-
"""Standard built in for download file from url"""
|
|
176
|
-
from jaseci.utils.file_handler import FileHandler
|
|
177
|
-
|
|
178
|
-
tmp = FileHandler(path.basename(urlparse(url).path) or "file")
|
|
179
|
-
meta["h"].add_file_handler(tmp)
|
|
180
|
-
|
|
181
|
-
with get(url, stream=True, headers=header) as res:
|
|
182
|
-
res.raise_for_status()
|
|
183
|
-
tmp.open("wb+")
|
|
184
|
-
for chunk in res.iter_content(chunk_size=8192):
|
|
185
|
-
tmp.buffer.write(chunk)
|
|
186
|
-
|
|
187
|
-
tmp.content_type = magic.from_buffer(tmp.read(0), mime=True)
|
|
188
|
-
tmp.close()
|
|
189
|
-
|
|
190
|
-
return tmp.id
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"""Built in actions for Jaseci"""
|
|
2
|
-
|
|
3
|
-
from jaseci.jsorc.live_actions import jaseci_action
|
|
4
|
-
from jaseci.utils.utils import perf_test_start, perf_test_stop
|
|
5
|
-
|
|
6
|
-
perf_tests = {}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
@jaseci_action()
|
|
10
|
-
def start_perf_test(name: str = "default"):
|
|
11
|
-
perf_tests[name] = perf_test_start()
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@jaseci_action()
|
|
15
|
-
def stop_perf_test(name: str = "default"):
|
|
16
|
-
if name not in perf_tests.keys():
|
|
17
|
-
return
|
|
18
|
-
calls, graph = perf_test_stop(perf_tests[name])
|
|
19
|
-
return {"calls": calls, "graph": graph}
|
jaseci/extens/act_lib/jaseci.py
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"""Built in actions for Jaseci"""
|
|
2
|
-
|
|
3
|
-
from jaseci.jsorc.live_actions import jaseci_action
|
|
4
|
-
from jaseci.utils.utils import master_from_meta, copy_func
|
|
5
|
-
from jaseci.prim.super_master import SuperMaster
|
|
6
|
-
import functools
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def interface_api(api_name, is_public, p_spec, *args, meta):
|
|
10
|
-
"""
|
|
11
|
-
Interfaces Master apis after processing arguments/parameters
|
|
12
|
-
from cli
|
|
13
|
-
"""
|
|
14
|
-
mast = master_from_meta(meta)
|
|
15
|
-
params = construct_params(p_spec, args)
|
|
16
|
-
if is_public:
|
|
17
|
-
return mast.public_interface_to_api(params, api_name)
|
|
18
|
-
else:
|
|
19
|
-
return mast.general_interface_to_api(params, api_name)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def construct_params(p_spec, args):
|
|
23
|
-
arg_count = 0
|
|
24
|
-
params = {}
|
|
25
|
-
for i in p_spec.keys():
|
|
26
|
-
if i == "self":
|
|
27
|
-
continue
|
|
28
|
-
p_default = (
|
|
29
|
-
p_spec[i].default if p_spec[i].default is not p_spec[i].empty else None
|
|
30
|
-
)
|
|
31
|
-
if arg_count < len(args):
|
|
32
|
-
params[i] = args[arg_count]
|
|
33
|
-
else:
|
|
34
|
-
params[i] = p_default
|
|
35
|
-
arg_count += 1
|
|
36
|
-
return params
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
def build_cmds():
|
|
40
|
-
"""
|
|
41
|
-
Generates Click function with options for each command
|
|
42
|
-
group and leaf signatures
|
|
43
|
-
leaf is format: [api_name, func_sig, is_public, func_doc]
|
|
44
|
-
"""
|
|
45
|
-
|
|
46
|
-
for i in SuperMaster.all_apis(None):
|
|
47
|
-
func_name = "_".join(i["groups"])
|
|
48
|
-
f = functools.partial(
|
|
49
|
-
copy_func(interface_api, func_name),
|
|
50
|
-
func_name,
|
|
51
|
-
i in SuperMaster._public_api,
|
|
52
|
-
i["sig"].parameters,
|
|
53
|
-
)
|
|
54
|
-
f.__name__ = func_name
|
|
55
|
-
f.__doc__ = i["doc"]
|
|
56
|
-
f.__module__ = __name__
|
|
57
|
-
|
|
58
|
-
# original_args = inspect.getargspec(func).args
|
|
59
|
-
globals()[func_name] = jaseci_action()(f)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
build_cmds()
|
jaseci/extens/act_lib/mail.py
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
from jaseci.jsorc.live_actions import jaseci_action
|
|
2
|
-
from jaseci.jsorc.jsorc import JsOrc
|
|
3
|
-
from jaseci.extens.svc.mail_svc import Mailer
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
@jaseci_action()
|
|
7
|
-
def send(sender, recipients, subject, text, html):
|
|
8
|
-
JsOrc.svc("mail").poke(Mailer).send_custom_email(
|
|
9
|
-
sender, recipients, subject, (text, html)
|
|
10
|
-
)
|
jaseci/extens/act_lib/maths.py
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import math
|
|
2
|
-
|
|
3
|
-
from jaseci.jsorc.live_actions import jaseci_action
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
@jaseci_action()
|
|
7
|
-
def ceil(x):
|
|
8
|
-
# return int
|
|
9
|
-
return math.ceil(x)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@jaseci_action()
|
|
13
|
-
def comb(n, k):
|
|
14
|
-
# return int
|
|
15
|
-
return math.comb(n, k)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
@jaseci_action()
|
|
19
|
-
def copysign(x, y):
|
|
20
|
-
# return float
|
|
21
|
-
return math.copysign(x, y)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
@jaseci_action()
|
|
25
|
-
def fabs(x):
|
|
26
|
-
# return float
|
|
27
|
-
return math.fabs(x)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
@jaseci_action()
|
|
31
|
-
def factorial(n):
|
|
32
|
-
# return int
|
|
33
|
-
return math.factorial(n)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
@jaseci_action()
|
|
37
|
-
def floor(x):
|
|
38
|
-
# return int
|
|
39
|
-
return math.floor(x)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
@jaseci_action()
|
|
43
|
-
def fmod(x, y):
|
|
44
|
-
# return float
|
|
45
|
-
return math.fmod(x, y)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
@jaseci_action()
|
|
49
|
-
def frexp(x):
|
|
50
|
-
# return tuple
|
|
51
|
-
_tuple = math.frexp(x)
|
|
52
|
-
return list(_tuple)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
@jaseci_action()
|
|
56
|
-
def fsum(iterable: list):
|
|
57
|
-
# return float
|
|
58
|
-
return math.fsum(iterable)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
@jaseci_action()
|
|
62
|
-
def gcd(args: list):
|
|
63
|
-
args = tuple(args)
|
|
64
|
-
# return int
|
|
65
|
-
return math.gcd(*args)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
@jaseci_action()
|
|
69
|
-
def isclose(a, b, rel_tol=1e-09, abs_tol=0.0):
|
|
70
|
-
# return boolean
|
|
71
|
-
return math.isclose(a, b, rel_tol=rel_tol, abs_tol=abs_tol)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
@jaseci_action()
|
|
75
|
-
def isfinite(x):
|
|
76
|
-
# return boolean
|
|
77
|
-
return math.isfinite(x)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
@jaseci_action()
|
|
81
|
-
def isinf(x):
|
|
82
|
-
# return boolean
|
|
83
|
-
return math.isinf(x)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
@jaseci_action()
|
|
87
|
-
def isnan(x):
|
|
88
|
-
# return boolean
|
|
89
|
-
return math.isnan(x)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
@jaseci_action()
|
|
93
|
-
def isqrt(n):
|
|
94
|
-
# return int
|
|
95
|
-
return math.isqrt(n)
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
@jaseci_action()
|
|
99
|
-
def lcm(args: list):
|
|
100
|
-
args = tuple(args)
|
|
101
|
-
# return int
|
|
102
|
-
return math.lcm(*args)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
@jaseci_action()
|
|
106
|
-
def ldexp(x, i):
|
|
107
|
-
# return float
|
|
108
|
-
return math.ldexp(x, i)
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
@jaseci_action()
|
|
112
|
-
def modf(x):
|
|
113
|
-
_tupple = math.modf(x)
|
|
114
|
-
# return list
|
|
115
|
-
return list(_tupple)
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
@jaseci_action()
|
|
119
|
-
def nextafter(x, y):
|
|
120
|
-
# return float
|
|
121
|
-
return math.nextafter(x, y)
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
@jaseci_action()
|
|
125
|
-
def perm(n, k=None):
|
|
126
|
-
# return int
|
|
127
|
-
return math.perm(n, k)
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
@jaseci_action()
|
|
131
|
-
def prod(iterable, start=1):
|
|
132
|
-
return math.prod(iterable, start=start)
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
@jaseci_action()
|
|
136
|
-
def remainder(x, y):
|
|
137
|
-
# return float
|
|
138
|
-
return math.remainder(x, y)
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
@jaseci_action()
|
|
142
|
-
def trunc(x):
|
|
143
|
-
# return int
|
|
144
|
-
return math.trunc(x)
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
@jaseci_action()
|
|
148
|
-
def ulp(x):
|
|
149
|
-
# return float
|
|
150
|
-
return math.ulp(x)
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
@jaseci_action()
|
|
154
|
-
def cubert(x):
|
|
155
|
-
# return float
|
|
156
|
-
return x ** (1 / 3)
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
@jaseci_action()
|
|
160
|
-
def exp(x):
|
|
161
|
-
# return float
|
|
162
|
-
return math.exp(x)
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
@jaseci_action()
|
|
166
|
-
def log(x, base):
|
|
167
|
-
# return float
|
|
168
|
-
return math.log(x, base)
|