seqbuild 0.0.32__tar.gz → 0.0.34__tar.gz
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.
- {seqbuild-0.0.32 → seqbuild-0.0.34}/PKG-INFO +1 -1
- {seqbuild-0.0.32 → seqbuild-0.0.34}/pyproject.toml +1 -1
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/cl_guide_parser.py +3 -4
- seqbuild-0.0.34/seqbuild/face/cl_guide_parser_.py +443 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/comm_lang.py +45 -7
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/make_cmd.py +40 -44
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_23.txt +2 -0
- seqbuild-0.0.34/seqbuild/face/sample_script/commond_34.txt +3 -0
- seqbuild-0.0.34/seqbuild/face/sample_script/commond_three.txt +14 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/intigers/lcg_v2.py +5 -0
- seqbuild-0.0.34/seqbuild/intigers/lcg_v3.py +138 -0
- seqbuild-0.0.34/seqbuild/intigers/modulo_ops.py +148 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/intigers/tvec.py +15 -6
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/seqgen/ssi_load.py +3 -3
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild.egg-info/PKG-INFO +1 -1
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild.egg-info/SOURCES.txt +3 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/setup.py +1 -1
- seqbuild-0.0.32/seqbuild/face/sample_script/commond_three.txt +0 -21
- seqbuild-0.0.32/seqbuild/intigers/lcg_v3.py +0 -452
- {seqbuild-0.0.32 → seqbuild-0.0.34}/LICENSE.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/README.md +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/__init__.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/desi/__init__.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/desi/approximators.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/desi/differentials.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/desi/fraction.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/desi/multi_metric.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/desi/not_equals.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/desi/nvec_gen.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/desi/prng_dec_delta.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/desi/seqcov_perm.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/__init__.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/cmd_proc.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commlang_guide.md +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_11.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_12error.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_13.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_14.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_15.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_16.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_17.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_18.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_19.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_20.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_21.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_22.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_24.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_25.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_26.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_27.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_28.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_29.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_30.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_31.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_32.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_33.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_eight.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_five.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_four.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_lcg_cmp.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_lcg_cmp2.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_nine.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_one.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_seven.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_six.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_ten.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commond_two.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/commondeth.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/dummy_obj.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/example_command.md +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/seqbuild_base_screen.png +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/seqbuild_help_cmd.png +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/seqbuild_help_make.png +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/seqbuild_help_screen.png +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/seqbuild_load_c9.png +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/seqbuild_realtime_command.png +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sample_script/seqbuild_show_numbers.png +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/face/sb_ui.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/intigers/__init__.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/intigers/extraneous.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/intigers/idectree.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/intigers/idt_proc.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/intigers/intfactor.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/intigers/mdr_v2.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/intigers/mod_prng.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/intigers/n2mvf_autogen.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/intigers/pof_autogen.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/intigers/poly_output_fitter_.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/intigers/prng_pw_op.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/intigers/process_seq.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/intigers/seq_struct.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/mini_dm/__init__.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/mini_dm/ag_ext.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/mini_dm/csrch.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/mini_dm/iseq.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/mini_dm/matfactor_eval.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/mini_dm/minmax_freq.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/mini_dm/n2m.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/mini_dm/n2m_function.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/mini_dm/n2m_index.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/mini_dm/ngram.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/mini_dm/nsfr.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/mini_dm/puc.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/mini_dm/sp_op.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/mini_dm/vs_fit.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/mini_dm/vs_fit_mem.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/mini_dm/vs_fit_op.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/mini_dm/vs_srch.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/seqgen/__init__.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/seqgen/gg_gen.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/seqgen/idt_gen.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/seqgen/mdr_gen.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/seqgen/optri_gen.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/seqgen/rch_gen.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/seqgen/sb_crypt.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/seqgen/shadow_gen.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild/seqgen/ssi_netop.py +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild.egg-info/dependency_links.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild.egg-info/requires.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/seqbuild.egg-info/top_level.txt +0 -0
- {seqbuild-0.0.32 → seqbuild-0.0.34}/setup.cfg +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import os
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
4
3
|
base_dir = os.path.dirname(os.path.abspath(__file__))
|
|
5
4
|
BASE_COMM_LANG_FOLDER = os.path.join(base_dir, "sample_script")
|
|
6
5
|
COMM_LANG_GUIDE_FILE = os.path.join(BASE_COMM_LANG_FOLDER,"commlang_guide.md")
|
|
@@ -27,7 +26,7 @@ SAMPLE_USE_FILE_MAP = {"multimetric": os.path.join(BASE_COMM_LANG_FOLDER,"common
|
|
|
27
26
|
"shadow":os.path.join(BASE_COMM_LANG_FOLDER,"commond_23.txt"),\
|
|
28
27
|
"encrypt":os.path.join(BASE_COMM_LANG_FOLDER,"commond_25.txt"),\
|
|
29
28
|
"iomaps": os.path.join(BASE_COMM_LANG_FOLDER,"commond_29.txt"),\
|
|
30
|
-
"idforest": os.path.join(BASE_COMM_LANG_FOLDER,"commond_30.txt")}
|
|
29
|
+
"idforest": os.path.join(BASE_COMM_LANG_FOLDER,"commond_30.txt")}
|
|
31
30
|
|
|
32
31
|
def stringize_CLGuideParser_keywords(clgp):
|
|
33
32
|
term_map = {0:"Primary",1:"Secondary",2:"Tertiary"}
|
|
@@ -122,7 +121,7 @@ def stringize_CLGuideParser_command_forms(clgp):
|
|
|
122
121
|
class CLGuideParser:
|
|
123
122
|
|
|
124
123
|
def __init__(self):
|
|
125
|
-
|
|
124
|
+
assert os.path.exists(COMM_LANG_GUIDE_FILE)
|
|
126
125
|
|
|
127
126
|
self.file_obj = open(COMM_LANG_GUIDE_FILE,'r')
|
|
128
127
|
self.file_obj.seek(0,os.SEEK_END)
|
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
base_dir = os.path.dirname(os.path.abspath(__file__))
|
|
5
|
+
BASE_COMM_LANG_FOLDER = os.path.join(base_dir, "sample_script")
|
|
6
|
+
COMM_LANG_GUIDE_FILE = os.path.join(BASE_COMM_LANG_FOLDER,"commlang_guide.md")
|
|
7
|
+
|
|
8
|
+
SAMPLE_USE_FILE_MAP = {"multimetric": os.path.join(BASE_COMM_LANG_FOLDER,"commond_one.txt"),\
|
|
9
|
+
"lcg": os.path.join(BASE_COMM_LANG_FOLDER,"commond_one.txt"),\
|
|
10
|
+
"mdr":os.path.join(BASE_COMM_LANG_FOLDER,"commond_two.txt"),\
|
|
11
|
+
"lcgv3":os.path.join(BASE_COMM_LANG_FOLDER,"commond_three.txt"),\
|
|
12
|
+
"convert":os.path.join(BASE_COMM_LANG_FOLDER,"commond_four.txt"),\
|
|
13
|
+
"qval":os.path.join(BASE_COMM_LANG_FOLDER,"commond_five.txt"),\
|
|
14
|
+
"lcgv2":os.path.join(BASE_COMM_LANG_FOLDER,"commond_six.txt"),\
|
|
15
|
+
"mdrv2":os.path.join(BASE_COMM_LANG_FOLDER,"commond_six.txt"),\
|
|
16
|
+
"mdrgen":os.path.join(BASE_COMM_LANG_FOLDER,"commond_seven.txt"),\
|
|
17
|
+
"optri":os.path.join(BASE_COMM_LANG_FOLDER,"commond_eight.txt"),\
|
|
18
|
+
"pid":os.path.join(BASE_COMM_LANG_FOLDER,"commond_nine.txt"),\
|
|
19
|
+
"open":os.path.join(BASE_COMM_LANG_FOLDER,"commond_ten.txt"),\
|
|
20
|
+
"write":os.path.join(BASE_COMM_LANG_FOLDER,"commond_ten.txt"),\
|
|
21
|
+
"span":os.path.join(BASE_COMM_LANG_FOLDER,"commond_13.txt"),\
|
|
22
|
+
"make":os.path.join(BASE_COMM_LANG_FOLDER,"commond_14.txt"),\
|
|
23
|
+
"merge":os.path.join(BASE_COMM_LANG_FOLDER,"commond_15.txt"),\
|
|
24
|
+
"load":os.path.join(BASE_COMM_LANG_FOLDER,"commond_16.txt"),\
|
|
25
|
+
"rch":os.path.join(BASE_COMM_LANG_FOLDER,"commond_20.txt"),\
|
|
26
|
+
"echo":os.path.join(BASE_COMM_LANG_FOLDER,"commond_21.txt"),\
|
|
27
|
+
"shadow":os.path.join(BASE_COMM_LANG_FOLDER,"commond_23.txt"),\
|
|
28
|
+
"encrypt":os.path.join(BASE_COMM_LANG_FOLDER,"commond_25.txt"),\
|
|
29
|
+
"iomaps": os.path.join(BASE_COMM_LANG_FOLDER,"commond_29.txt"),\
|
|
30
|
+
"idforest": os.path.join(BASE_COMM_LANG_FOLDER,"commond_30.txt"),\
|
|
31
|
+
"ssino": os.path.join(BASE_COMM_LANG_FOLDER,"commond_33.txt"),\
|
|
32
|
+
"pddelta": os.path.join(BASE_COMM_LANG_FOLDER,"commond_34.txt")}
|
|
33
|
+
|
|
34
|
+
def stringize_CLGuideParser_keywords(clgp):
|
|
35
|
+
term_map = {0:"Primary",1:"Secondary",2:"Tertiary"}
|
|
36
|
+
s = "\t\t[+] Keywords\n\n"
|
|
37
|
+
|
|
38
|
+
for i in range(3):
|
|
39
|
+
kx = clgp.keywords[i]
|
|
40
|
+
s += "\t{}\n".format(term_map[i])
|
|
41
|
+
|
|
42
|
+
if i != 2:
|
|
43
|
+
kx_ = sorted(kx)
|
|
44
|
+
kx_ = ["* " + kx__ for kx__ in kx_]
|
|
45
|
+
s += "\n".join(kx_)
|
|
46
|
+
s += "\n"
|
|
47
|
+
else:
|
|
48
|
+
kx_ = sorted(kx.keys())
|
|
49
|
+
|
|
50
|
+
while len(kx_) > 0:
|
|
51
|
+
kx2 = kx_.pop(0)
|
|
52
|
+
s += "+ " + kx2 + "\n"
|
|
53
|
+
|
|
54
|
+
v2 = kx[kx2]
|
|
55
|
+
v2 = ["*\t" + v2_ for v2_ in v2]
|
|
56
|
+
s += "\n".join(v2)
|
|
57
|
+
s += "\n\n"
|
|
58
|
+
|
|
59
|
+
s += "\n"
|
|
60
|
+
return s
|
|
61
|
+
|
|
62
|
+
def stringize_one_CLGuideParser_structure(clgp,struct_name):
|
|
63
|
+
if struct_name not in clgp.structures:
|
|
64
|
+
return None
|
|
65
|
+
|
|
66
|
+
s_ = "* " + struct_name
|
|
67
|
+
s_ += "\n\t\tinit:\n"
|
|
68
|
+
|
|
69
|
+
v = clgp.structures[struct_name]
|
|
70
|
+
|
|
71
|
+
k2 = len(v['init'])
|
|
72
|
+
for i in range(k2):
|
|
73
|
+
s_ += "\n".join(v['init'][i])
|
|
74
|
+
s_ += "\n\n"
|
|
75
|
+
|
|
76
|
+
k2 = len(v['run'])
|
|
77
|
+
if k2 == 0:
|
|
78
|
+
s_ += "\n"
|
|
79
|
+
s_ += "\n-/-/-/-----------------/-/-/-\n"
|
|
80
|
+
return s_
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
s_ += "\n"
|
|
84
|
+
s_ += "\n\t\trun:\n"
|
|
85
|
+
for i in range(k2):
|
|
86
|
+
s_ += "\n".join(v['run'][i])
|
|
87
|
+
s_ += "\n"
|
|
88
|
+
|
|
89
|
+
s_ += "\n-/-/-/-----------------/-/-/-\n"
|
|
90
|
+
return s_
|
|
91
|
+
|
|
92
|
+
def stringize_CLGuideParser_structures(clgp):
|
|
93
|
+
assert type(clgp) == CLGuideParser
|
|
94
|
+
s = "\t\t[+] Structures\n\n"
|
|
95
|
+
for k in clgp.structures.keys():
|
|
96
|
+
s_ = stringize_one_CLGuideParser_structure(clgp,k)
|
|
97
|
+
s += s_
|
|
98
|
+
return s
|
|
99
|
+
|
|
100
|
+
def stringize_one_CLGuideParser_command_form(clgp,command_name):
|
|
101
|
+
if command_name not in clgp.command_forms:
|
|
102
|
+
return None
|
|
103
|
+
|
|
104
|
+
v = clgp.command_forms[command_name]
|
|
105
|
+
usage,description = v[0],v[1]
|
|
106
|
+
|
|
107
|
+
s = "* " + command_name + "\n"
|
|
108
|
+
s += "\t- usage\n" + usage + "\n"
|
|
109
|
+
s += "\t- description\n" + description + "\n"
|
|
110
|
+
s += "\n-/-/-/-----------------/-/-/-\n"
|
|
111
|
+
s += "\n"
|
|
112
|
+
return s
|
|
113
|
+
|
|
114
|
+
def stringize_CLGuideParser_command_forms(clgp):
|
|
115
|
+
|
|
116
|
+
assert type(clgp) == CLGuideParser
|
|
117
|
+
s = "\t\t[+] Command Forms\n\n"
|
|
118
|
+
|
|
119
|
+
for k in clgp.command_forms.keys():
|
|
120
|
+
s += stringize_one_CLGuideParser_command_form(clgp,k)
|
|
121
|
+
|
|
122
|
+
return s
|
|
123
|
+
|
|
124
|
+
class CLGuideParser:
|
|
125
|
+
|
|
126
|
+
def __init__(self):
|
|
127
|
+
#assert os.path.exists(COMM_LANG_GUIDE_FILE), "working directory is {}".format(os.getcwd())
|
|
128
|
+
|
|
129
|
+
self.file_obj = open(COMM_LANG_GUIDE_FILE,'r')
|
|
130
|
+
self.file_obj.seek(0,os.SEEK_END)
|
|
131
|
+
self.file_end = self.file_obj.tell()
|
|
132
|
+
self.file_obj.seek(0)
|
|
133
|
+
|
|
134
|
+
self.structures = dict() # str -> [parameter info]
|
|
135
|
+
self.keywords = dict() # level -> [keywords]
|
|
136
|
+
# command -> usage/description -> info.
|
|
137
|
+
self.command_forms = dict() # command -> usage
|
|
138
|
+
|
|
139
|
+
self.current_line = None
|
|
140
|
+
|
|
141
|
+
self.has_processed = False
|
|
142
|
+
return
|
|
143
|
+
|
|
144
|
+
def about(self,term):
|
|
145
|
+
ktype_dict = {0:"primary ", 1:"secondary ",2:"tertiary ",-1:"not a "}
|
|
146
|
+
ktype = self.keyword_type(term)
|
|
147
|
+
s0 = ktype_dict[ktype] + " keyword\n"
|
|
148
|
+
|
|
149
|
+
s = ""
|
|
150
|
+
if term in self.structures:
|
|
151
|
+
s0 += "\t* structure\n"
|
|
152
|
+
s = stringize_one_CLGuideParser_structure(self,term)
|
|
153
|
+
elif term in self.command_forms:
|
|
154
|
+
s0 += "\t* command\n"
|
|
155
|
+
s = stringize_one_CLGuideParser_command_form(self,term)
|
|
156
|
+
|
|
157
|
+
if type(s) == type(None):
|
|
158
|
+
s = ""
|
|
159
|
+
s = s0 + "\n-/-/-/-----------------/-/-/-\n" + s
|
|
160
|
+
|
|
161
|
+
if term in SAMPLE_USE_FILE_MAP:
|
|
162
|
+
fi_obj2 = open(SAMPLE_USE_FILE_MAP[term],"r")
|
|
163
|
+
lines = fi_obj2.readlines()
|
|
164
|
+
s = s + "\n\t\tsample use\n---------------\n"
|
|
165
|
+
s += ''.join(lines)
|
|
166
|
+
fi_obj2.close()
|
|
167
|
+
|
|
168
|
+
return s
|
|
169
|
+
|
|
170
|
+
def keyword_type(self,term):
|
|
171
|
+
if term in self.keywords[0]:
|
|
172
|
+
return 0
|
|
173
|
+
|
|
174
|
+
if term in self.keywords[1]:
|
|
175
|
+
return 1
|
|
176
|
+
|
|
177
|
+
q = self.keywords[2]
|
|
178
|
+
x = []
|
|
179
|
+
for v_ in q.values():
|
|
180
|
+
x.extend(list(v_))
|
|
181
|
+
if term in x: return 2
|
|
182
|
+
|
|
183
|
+
return -1
|
|
184
|
+
|
|
185
|
+
def __str__(self):
|
|
186
|
+
assert self.has_processed
|
|
187
|
+
|
|
188
|
+
s1 = stringize_CLGuideParser_keywords(self)
|
|
189
|
+
s2 = stringize_CLGuideParser_structures(self)
|
|
190
|
+
s3 = stringize_CLGuideParser_command_forms(self)
|
|
191
|
+
return s1 + "_" * 75 + "\n\n" \
|
|
192
|
+
+ s2 + "_" * 75 + "\n\n" + s3
|
|
193
|
+
|
|
194
|
+
"""
|
|
195
|
+
main method
|
|
196
|
+
"""
|
|
197
|
+
def process(self):
|
|
198
|
+
self.process_structures()
|
|
199
|
+
self.process_keywords()
|
|
200
|
+
self.process_command_forms()
|
|
201
|
+
self.has_processed = True
|
|
202
|
+
return
|
|
203
|
+
|
|
204
|
+
def process_structures(self):
|
|
205
|
+
self.go_to_section("structures")
|
|
206
|
+
|
|
207
|
+
while self.file_obj.tell() != self.file_end:
|
|
208
|
+
q = self.next_structure()
|
|
209
|
+
if type(q) == type(None):
|
|
210
|
+
break
|
|
211
|
+
|
|
212
|
+
n0,n1,n2 = q
|
|
213
|
+
self.structures[n0] = dict()
|
|
214
|
+
self.structures[n0]["init"] = n1
|
|
215
|
+
self.structures[n0]["run"] = n2
|
|
216
|
+
|
|
217
|
+
"""
|
|
218
|
+
"""
|
|
219
|
+
def next_structure(self):
|
|
220
|
+
|
|
221
|
+
def full_parse_line(d,qline_,index):
|
|
222
|
+
|
|
223
|
+
stat = True
|
|
224
|
+
if len(qline_) > 0:
|
|
225
|
+
stat = qline_[-1] != ")"
|
|
226
|
+
|
|
227
|
+
while stat:
|
|
228
|
+
line = self.file_obj.readline().strip()
|
|
229
|
+
qline_ = line
|
|
230
|
+
|
|
231
|
+
if len(qline_) == 0: continue
|
|
232
|
+
d[index][-1] += qline_
|
|
233
|
+
stat = qline_[-1] != ")"
|
|
234
|
+
|
|
235
|
+
def parse_section(d,s=0):
|
|
236
|
+
c = 0
|
|
237
|
+
while True:
|
|
238
|
+
position = self.file_obj.tell()
|
|
239
|
+
|
|
240
|
+
line = self.file_obj.readline().strip()
|
|
241
|
+
if len(line) == 0:
|
|
242
|
+
continue
|
|
243
|
+
|
|
244
|
+
# case: start of section `instantiation`
|
|
245
|
+
if line == "- instantiation:":
|
|
246
|
+
continue
|
|
247
|
+
|
|
248
|
+
# case: start of section `run`
|
|
249
|
+
if line == "- `run with` parameter:":
|
|
250
|
+
# end of `instantiation`
|
|
251
|
+
if s == 0:
|
|
252
|
+
self.file_obj.seek(position)
|
|
253
|
+
break
|
|
254
|
+
|
|
255
|
+
continue
|
|
256
|
+
|
|
257
|
+
# case: end of structure
|
|
258
|
+
if line[:3] == "[o]":
|
|
259
|
+
self.file_obj.seek(position)
|
|
260
|
+
break
|
|
261
|
+
|
|
262
|
+
# case: end of structure
|
|
263
|
+
if line[:2] == "##":
|
|
264
|
+
self.file_obj.seek(position)
|
|
265
|
+
break
|
|
266
|
+
|
|
267
|
+
# case: part of instantiation description
|
|
268
|
+
if line[0] == "*":
|
|
269
|
+
qline = line.strip("*")
|
|
270
|
+
qline = qline.strip()
|
|
271
|
+
d[c].append(qline)
|
|
272
|
+
full_parse_line(d,qline,c)
|
|
273
|
+
c += 1
|
|
274
|
+
|
|
275
|
+
position = self.file_obj.tell()
|
|
276
|
+
line = self.file_obj.readline().strip()
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
if len(line) == 0:
|
|
280
|
+
continue
|
|
281
|
+
|
|
282
|
+
if line[0] == "*":
|
|
283
|
+
c -= 1
|
|
284
|
+
self.file_obj.seek(position)
|
|
285
|
+
# case: start of instantiation description
|
|
286
|
+
else:
|
|
287
|
+
qline = line[2:].strip()
|
|
288
|
+
d[c] = [qline]
|
|
289
|
+
full_parse_line(d,qline,c)
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
# get the starting line of the next structure
|
|
293
|
+
line = ""
|
|
294
|
+
stat = False
|
|
295
|
+
while self.file_obj.tell() != self.file_end:
|
|
296
|
+
position = self.file_obj.tell()
|
|
297
|
+
line = self.file_obj.readline().strip()
|
|
298
|
+
|
|
299
|
+
if line[:3] == "[o]":
|
|
300
|
+
stat = True
|
|
301
|
+
break
|
|
302
|
+
|
|
303
|
+
if line[:2] == "##":
|
|
304
|
+
self.file_obj.seek(position)
|
|
305
|
+
break
|
|
306
|
+
|
|
307
|
+
if not stat:
|
|
308
|
+
return None
|
|
309
|
+
|
|
310
|
+
line = line[3:].strip()
|
|
311
|
+
struct_name = line
|
|
312
|
+
|
|
313
|
+
instant_dict = dict()
|
|
314
|
+
run_dict = dict()
|
|
315
|
+
parse_section(instant_dict,0)
|
|
316
|
+
parse_section(run_dict,1)
|
|
317
|
+
|
|
318
|
+
return struct_name,instant_dict,run_dict
|
|
319
|
+
|
|
320
|
+
def process_keywords(self):
|
|
321
|
+
self.go_to_section("keywords")
|
|
322
|
+
|
|
323
|
+
def process_s12(sx):
|
|
324
|
+
while self.file_obj.tell() != self.file_end:
|
|
325
|
+
line = self.file_obj.readline()
|
|
326
|
+
line = line.strip()
|
|
327
|
+
if len(line) == 0: break
|
|
328
|
+
keyword = line[3:].strip()
|
|
329
|
+
sx |= {keyword}
|
|
330
|
+
|
|
331
|
+
def process_s3(dx):
|
|
332
|
+
keyword = None
|
|
333
|
+
while self.file_obj.tell() != self.file_end:
|
|
334
|
+
line = self.file_obj.readline()
|
|
335
|
+
line = line.strip()
|
|
336
|
+
if len(line) == 0: break
|
|
337
|
+
|
|
338
|
+
if line[:3] == "[-]":
|
|
339
|
+
i1 = line.index("`")
|
|
340
|
+
sline = line[i1+1:]
|
|
341
|
+
i2 = sline.index("`")
|
|
342
|
+
keyword = sline[:i2]
|
|
343
|
+
dx[keyword] = []
|
|
344
|
+
elif line[0] == "*":
|
|
345
|
+
kw2 = line[1:].strip()
|
|
346
|
+
dx[keyword].append(kw2)
|
|
347
|
+
else:
|
|
348
|
+
assert False
|
|
349
|
+
|
|
350
|
+
# process primary,secondary,tertiary in
|
|
351
|
+
# that order
|
|
352
|
+
headlines = ["- Primary","- Secondary","- Tertiary"]
|
|
353
|
+
|
|
354
|
+
primary,secondary = set(),set()
|
|
355
|
+
tertiary = dict()
|
|
356
|
+
|
|
357
|
+
self.search_for_line(headlines[0])
|
|
358
|
+
process_s12(primary)
|
|
359
|
+
|
|
360
|
+
self.search_for_line(headlines[1])
|
|
361
|
+
process_s12(secondary)
|
|
362
|
+
|
|
363
|
+
self.search_for_line(headlines[2])
|
|
364
|
+
process_s3(tertiary)
|
|
365
|
+
|
|
366
|
+
self.keywords[0] = primary
|
|
367
|
+
self.keywords[1] = secondary
|
|
368
|
+
self.keywords[2] = tertiary
|
|
369
|
+
return primary,secondary,tertiary
|
|
370
|
+
|
|
371
|
+
def process_command_forms(self):
|
|
372
|
+
self.go_to_section("command forms")
|
|
373
|
+
|
|
374
|
+
stat = True
|
|
375
|
+
|
|
376
|
+
while stat:
|
|
377
|
+
c = self.next_command_form()
|
|
378
|
+
stat = not type(c) == type(None)
|
|
379
|
+
if not stat: continue
|
|
380
|
+
|
|
381
|
+
kw,u,d = c
|
|
382
|
+
self.command_forms[kw] = (u,d)
|
|
383
|
+
|
|
384
|
+
def next_command_form(self):
|
|
385
|
+
halt_line = "## Interface Layout"
|
|
386
|
+
line = self.search_for_line("[+]",halt_line=halt_line,is_prefix_search=True)
|
|
387
|
+
|
|
388
|
+
if type(line) == type(None):
|
|
389
|
+
return None
|
|
390
|
+
|
|
391
|
+
keyword = line[3:].strip()
|
|
392
|
+
|
|
393
|
+
# get usage
|
|
394
|
+
usage_ = self.search_for_line("[-] usage",halt_line=halt_line,is_prefix_search=True)
|
|
395
|
+
usage = ""
|
|
396
|
+
c = 0
|
|
397
|
+
while True:
|
|
398
|
+
if c == 2:
|
|
399
|
+
break
|
|
400
|
+
|
|
401
|
+
line = self.file_obj.readline().strip()
|
|
402
|
+
if line == "```":
|
|
403
|
+
c += 1
|
|
404
|
+
continue
|
|
405
|
+
usage += line + "\n"
|
|
406
|
+
|
|
407
|
+
# get description
|
|
408
|
+
self.search_for_line("[-] description",halt_line=halt_line,is_prefix_search=True)
|
|
409
|
+
description = ""
|
|
410
|
+
while True:
|
|
411
|
+
line = self.file_obj.readline().strip()
|
|
412
|
+
if len(line) == 0: continue
|
|
413
|
+
if line[0] == "-": break
|
|
414
|
+
description += line + "\n"
|
|
415
|
+
return keyword,usage,description
|
|
416
|
+
|
|
417
|
+
def go_to_section(self,section):
|
|
418
|
+
assert section in {"structures","keywords","command forms"}
|
|
419
|
+
if section == "command forms": section = "command Forms"
|
|
420
|
+
|
|
421
|
+
section_str = "## " + section[0].upper() + section[1:]
|
|
422
|
+
self.search_for_line(section_str,None,True)
|
|
423
|
+
|
|
424
|
+
def search_for_line(self,line_,halt_line=None,is_prefix_search:bool=False):
|
|
425
|
+
while self.file_obj.tell() != self.file_end:
|
|
426
|
+
line = self.file_obj.readline()
|
|
427
|
+
line = line.strip()
|
|
428
|
+
|
|
429
|
+
if is_prefix_search:
|
|
430
|
+
if line[:len(line_)] == line_:
|
|
431
|
+
return line
|
|
432
|
+
|
|
433
|
+
if line == line_:
|
|
434
|
+
return line
|
|
435
|
+
|
|
436
|
+
if line == halt_line:
|
|
437
|
+
return None
|
|
438
|
+
|
|
439
|
+
return None
|
|
440
|
+
|
|
441
|
+
def close(self):
|
|
442
|
+
self.file_obj.close()
|
|
443
|
+
del self
|
|
@@ -38,17 +38,45 @@ class CommLangParser:
|
|
|
38
38
|
dx += s + "\n"
|
|
39
39
|
return dx
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
"""
|
|
42
|
+
return:
|
|
43
|
+
- list::object
|
|
44
|
+
"""
|
|
45
|
+
def object_list(self,object_type,full_list:bool):
|
|
46
|
+
|
|
47
|
+
assert object_type in {"generator","sequence"}
|
|
48
|
+
|
|
49
|
+
X = None
|
|
50
|
+
if object_type == "generator":
|
|
51
|
+
def F(x):
|
|
52
|
+
return MAIN_method_for_object(x) != -1
|
|
53
|
+
|
|
54
|
+
else:
|
|
55
|
+
def F(x):
|
|
56
|
+
return type(x) == list
|
|
57
|
+
|
|
42
58
|
q = []
|
|
43
59
|
for x in self.varseq:
|
|
44
|
-
if
|
|
45
|
-
|
|
60
|
+
if F(self.vartable[x]):
|
|
61
|
+
if full_list:
|
|
62
|
+
q.append((x,self.vartable[x]))
|
|
63
|
+
else:
|
|
64
|
+
q.append(self.vartable[x])
|
|
46
65
|
return q
|
|
47
66
|
|
|
67
|
+
"""
|
|
68
|
+
fetches the name of the object in Comm Lang program
|
|
69
|
+
"""
|
|
70
|
+
def object_to_name(self,O):
|
|
71
|
+
for k,v in self.vartable.items():
|
|
72
|
+
if v == O:
|
|
73
|
+
return k
|
|
74
|
+
return None
|
|
75
|
+
|
|
48
76
|
def fetch_g(self,is_last:bool):
|
|
49
77
|
assert type(is_last) == bool
|
|
50
78
|
|
|
51
|
-
q = self.
|
|
79
|
+
q = self.object_list("generator",False)
|
|
52
80
|
if len(q) == 0: return None
|
|
53
81
|
|
|
54
82
|
index = -1 if is_last else 0
|
|
@@ -78,6 +106,13 @@ class CommLangParser:
|
|
|
78
106
|
|
|
79
107
|
def close(self):
|
|
80
108
|
self.file_obj.close()
|
|
109
|
+
|
|
110
|
+
for k,v in self.vartable.items():
|
|
111
|
+
if type(v) == ShadowGen:
|
|
112
|
+
v.close()
|
|
113
|
+
elif type(v) == NSFileReader:
|
|
114
|
+
v.close()
|
|
115
|
+
|
|
81
116
|
del self
|
|
82
117
|
|
|
83
118
|
def process_file(self):
|
|
@@ -137,7 +172,7 @@ class CommLangParser:
|
|
|
137
172
|
return
|
|
138
173
|
|
|
139
174
|
c_ = self.cmdlines.pop(0)
|
|
140
|
-
c = c_.split(" ")
|
|
175
|
+
c = c_.strip().split(" ")
|
|
141
176
|
c[-1] = c[-1].rstrip(".")
|
|
142
177
|
|
|
143
178
|
# case: `show` command, do nothing
|
|
@@ -199,7 +234,9 @@ class CommLangParser:
|
|
|
199
234
|
# case: primary use case of SET
|
|
200
235
|
if splitstr_cmd[2] == "=":
|
|
201
236
|
self.vartable[n] = self.MRCOW_proc(splitstr_cmd[3:])
|
|
202
|
-
|
|
237
|
+
|
|
238
|
+
if n not in self.varseq:
|
|
239
|
+
self.varseq.append(n)
|
|
203
240
|
return n, self.vartable[n]
|
|
204
241
|
|
|
205
242
|
# case: secondary use case of SET
|
|
@@ -222,7 +259,8 @@ class CommLangParser:
|
|
|
222
259
|
try:
|
|
223
260
|
x = wrap_ranged_modulo_over_generator(gen,(f0,f1))
|
|
224
261
|
self.vartable[n] = x
|
|
225
|
-
|
|
262
|
+
|
|
263
|
+
if n not in self.varseq: self.varseq.append(n)
|
|
226
264
|
except:
|
|
227
265
|
print("cannot set span for non-generator.")
|
|
228
266
|
self.log_error(splitstr_cmd)
|