buildz 0.4.5__tar.gz → 0.4.7__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.
- buildz-0.4.7/PKG-INFO +45 -0
- buildz-0.4.7/README.md +32 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/argx.py +20 -4
- buildz-0.4.7/buildz/demo/ioc/deal.py +20 -0
- buildz-0.4.7/buildz/demo/ioc/help.py +42 -0
- buildz-0.4.7/buildz/demo/myers/deal.py +54 -0
- buildz-0.4.7/buildz/demo/myers/help.py +16 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/demo/res/conf/main.js +10 -2
- buildz-0.4.7/buildz/demo/res/conf/myers.js +21 -0
- buildz-0.4.7/buildz/demo/res/conf/search.js +21 -0
- buildz-0.4.7/buildz/demo/res/help/default.js +24 -0
- buildz-0.4.7/buildz/demo/res/help/ioc.js +39 -0
- buildz-0.4.7/buildz/demo/res/help/myers.js +36 -0
- buildz-0.4.7/buildz/demo/res/help/search.js +38 -0
- buildz-0.4.7/buildz/demo/res/help/xf.js +34 -0
- buildz-0.4.7/buildz/demo/res/test.js +23 -0
- buildz-0.4.7/buildz/demo/search/deal.py +29 -0
- buildz-0.4.7/buildz/demo/search/help.py +16 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/demo/test.py +16 -2
- {buildz-0.4.5 → buildz-0.4.7}/buildz/demo/xf/deal.py +1 -1
- buildz-0.4.7/buildz/demo/xf/help.py +16 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/fz/__init__.py +1 -0
- buildz-0.4.7/buildz/fz/fio.py +35 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/fz/lsf.py +6 -3
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/__init__.py +1 -1
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc/base.py +2 -1
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc/conf.py +52 -7
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc/confs.py +11 -5
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/base.py +10 -3
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/call.py +18 -10
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/calls.py +15 -8
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/conf/deals.js +13 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/conf/mcall_defaults.js +1 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/conf/mcall_lists.js +2 -1
- buildz-0.4.7/buildz/ioc/ioc_deal/conf/obj_defaults.js +12 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/conf/obj_lists.js +2 -2
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/conf/ovar_lists.js +1 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/conf/ref_lists.js +4 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/env.py +13 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/ioc.py +14 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/join.py +14 -1
- buildz-0.4.7/buildz/ioc/ioc_deal/list.py +35 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/map.py +17 -1
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/mcall.py +24 -12
- buildz-0.4.7/buildz/ioc/ioc_deal/obj.py +165 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/ovar.py +19 -8
- buildz-0.4.7/buildz/ioc/ioc_deal/ref.py +35 -0
- buildz-0.4.7/buildz/ioc/ioc_deal/val.py +29 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/var.py +11 -7
- {buildz-0.4.5 → buildz-0.4.7}/buildz/pyz.py +35 -1
- buildz-0.4.7/buildz/tz/__init__.py +11 -0
- buildz-0.4.7/buildz/tz/myers_diff.py +219 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/mapz.py +38 -1
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/write.py +1 -1
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/writer/deal/strz.py +3 -1
- buildz-0.4.7/buildz.egg-info/PKG-INFO +45 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz.egg-info/SOURCES.txt +11 -46
- {buildz-0.4.5 → buildz-0.4.7}/setup.py +2 -2
- buildz-0.4.5/PKG-INFO +0 -155
- buildz-0.4.5/README.md +0 -142
- buildz-0.4.5/buildz/demo/ioc/deal.py +0 -19
- buildz-0.4.5/buildz/demo/ioc/help.py +0 -7
- buildz-0.4.5/buildz/demo/res/help/default.js +0 -9
- buildz-0.4.5/buildz/demo/res/help/ioc.js +0 -165
- buildz-0.4.5/buildz/demo/res/help/xf.js +0 -35
- buildz-0.4.5/buildz/demo/res/test.js +0 -13
- buildz-0.4.5/buildz/demo/xf/help.py +0 -8
- buildz-0.4.5/buildz/demos/ioc/test.py +0 -43
- buildz-0.4.5/buildz/demos/ioc/test_conf/base.js +0 -9
- buildz-0.4.5/buildz/demos/ioc/test_conf/data1.js +0 -59
- buildz-0.4.5/buildz/demos/ioc/test_conf/data2.js +0 -21
- buildz-0.4.5/buildz/demos/ioc/test_conf/data3.js +0 -21
- buildz-0.4.5/buildz/demos/xf/test.js +0 -12
- buildz-0.4.5/buildz/demos/xf/test.py +0 -13
- buildz-0.4.5/buildz/ioc/ioc_deal/conf/obj_defaults.js +0 -8
- buildz-0.4.5/buildz/ioc/ioc_deal/list.py +0 -19
- buildz-0.4.5/buildz/ioc/ioc_deal/obj.py +0 -92
- buildz-0.4.5/buildz/ioc/ioc_deal/ref.py +0 -17
- buildz-0.4.5/buildz/ioc/ioc_deal/val.py +0 -16
- buildz-0.4.5/buildz/keys.py +0 -232
- buildz-0.4.5/buildz/old_version/__init__.py +0 -29
- buildz-0.4.5/buildz/old_version/__main__.py +0 -19
- buildz-0.4.5/buildz/old_version/base.py +0 -88
- buildz-0.4.5/buildz/old_version/build.py +0 -274
- buildz-0.4.5/buildz/old_version/confz.py +0 -501
- buildz-0.4.5/buildz/old_version/demo/x/demo.confz +0 -33
- buildz-0.4.5/buildz/old_version/demo/x/demo.py +0 -20
- buildz-0.4.5/buildz/old_version/demo/x/run.confz +0 -26
- buildz-0.4.5/buildz/old_version/demo/x/test.confz +0 -24
- buildz-0.4.5/buildz/old_version/demo/x/test.py +0 -15
- buildz-0.4.5/buildz/old_version/demo/x/testc.py +0 -18
- buildz-0.4.5/buildz/old_version/demo/x/testf.py +0 -46
- buildz-0.4.5/buildz/old_version/demo/x/testz.py +0 -90
- buildz-0.4.5/buildz/old_version/demo/x/value.confz +0 -19
- buildz-0.4.5/buildz/old_version/demo/x/x.py +0 -14
- buildz-0.4.5/buildz/old_version/dj.txt +0 -0
- buildz-0.4.5/buildz/old_version/keys.py +0 -232
- buildz-0.4.5/buildz/old_version/test_loader copy.py +0 -69
- buildz-0.4.5/buildz/old_version/test_loader.py +0 -26
- buildz-0.4.5/buildz/old_version/test_writer.py +0 -50
- buildz-0.4.5/buildz/old_version/tools.py +0 -39
- buildz-0.4.5/buildz/old_version/xconfz/__init__.py +0 -21
- buildz-0.4.5/buildz/old_version/xconfz/base.py +0 -222
- buildz-0.4.5/buildz/old_version/xconfz/buff.py +0 -57
- buildz-0.4.5/buildz/old_version/xconfz/fc.py +0 -8
- buildz-0.4.5/buildz/old_version/xconfz/fc_item.py +0 -88
- buildz-0.4.5/buildz/old_version/xconfz/fc_list.py +0 -85
- buildz-0.4.5/buildz/old_version/xconfz/fc_map.py +0 -91
- buildz-0.4.5/buildz/old_version/xconfz/fc_set.py +0 -60
- buildz-0.4.5/buildz/old_version/xconfz/fc_str.py +0 -80
- buildz-0.4.5/buildz/old_version/xconfz/fc_type.py +0 -100
- buildz-0.4.5/buildz/old_version/xconfz/fmt_base.py +0 -155
- buildz-0.4.5/buildz/old_version/xconfz/fmt_str.py +0 -50
- buildz-0.4.5/buildz/old_version/xconfz/fmt_type.py +0 -86
- buildz-0.4.5/buildz/old_version/xconfz/mg.py +0 -163
- buildz-0.4.5/buildz/old_version/xconfz/mg_fmt.py +0 -145
- buildz-0.4.5/buildz/xf/file.py +0 -41
- buildz-0.4.5/buildz/xf/test_write.py +0 -73
- buildz-0.4.5/buildz.egg-info/PKG-INFO +0 -155
- {buildz-0.4.5 → buildz-0.4.7}/LICENSE +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/MANIFEST.in +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/__init__.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/__main__.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/demo/res/conf/ioc.js +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/demo/res/conf/xf.js +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/fz/dirz.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/init.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/conf/call_defaults.js +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/conf/call_lists.js +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/conf/calls_defaults.js +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/conf/calls_lists.js +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/conf/env_lists.js +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/conf/ioc_lists.js +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/conf/join_lists.js +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/conf/list_lists.js +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/conf/map_lists.js +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/conf/obj_cst_lists.js +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/conf/obj_set_lists.js +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/conf/var_lists.js +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/ioc/ioc_deal/demo.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/__init__.py +0 -0
- {buildz-0.4.5/buildz/old_version/xconfz → buildz-0.4.7/buildz/xf}/file.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/loader/base.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/loader/buffer.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/loader/deal/listz.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/loader/deal/lr.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/loader/deal/lrval.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/loader/deal/mapz.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/loader/deal/nextz.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/loader/deal/reval.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/loader/deal/setz.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/loader/deal/spc.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/loader/deal/spt.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/loader/deal/strz.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/loader/exp.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/loader/item.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/loader/mg.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/loader/pos.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/read.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/writer/base.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/writer/conf.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/writer/deal/jsonval.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/writer/deal/listz.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/writer/deal/mapz.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/writer/deal/reval.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/writer/itemz.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/writer/mg.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz/xf/xargs.py +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz.egg-info/dependency_links.txt +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/buildz.egg-info/top_level.txt +0 -0
- {buildz-0.4.5 → buildz-0.4.7}/setup.cfg +0 -0
buildz-0.4.7/PKG-INFO
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: buildz
|
3
|
+
Version: 0.4.7
|
4
|
+
Summary: a json-base file format's read and write code by python, and codes to read and product object from configure file in such format
|
5
|
+
Home-page: https://github.com/buildCodeZ/buildz
|
6
|
+
Author: Zzz
|
7
|
+
Author-email: 1309458652@qq.com
|
8
|
+
License: Apache License 2.0
|
9
|
+
Keywords: buildz
|
10
|
+
Platform: any
|
11
|
+
Description-Content-Type: text/markdown
|
12
|
+
License-File: LICENSE
|
13
|
+
|
14
|
+
# buildz
|
15
|
+
```
|
16
|
+
1,在json格式基础上加了点东西,让配置文件写起来更简单,模块在buildz.xf下
|
17
|
+
2,基于xf格式写了个ioc控制反转配置文件读取的程序,模块在buildz.ioc下
|
18
|
+
3,其他工具模块:
|
19
|
+
buildz.fz: 文件夹查找
|
20
|
+
buildz.pyz: 简化python __import__调用
|
21
|
+
buildz.argx: 按格式读命令行参数
|
22
|
+
buildz.tz: 加些工具,目前只有myerse diff字符串比较算法
|
23
|
+
buildz.demo: 使用参考,运行"python -m buildz"会用这个模块
|
24
|
+
代码关系:
|
25
|
+
buildz.xf, buildz.pyz, buildz.argx, buildz.fz, buildz.tz都是独立的模块
|
26
|
+
buildz.ioc需要buildz.xf和buildz.pyz
|
27
|
+
buildz.demo需要其他全部模块
|
28
|
+
|
29
|
+
运行python -m buildz查看帮助
|
30
|
+
|
31
|
+
1, a profile file format base on json, make it easy to write profile file, module is in buildz.xf
|
32
|
+
2, a ioc profile file read function base on xf format, module is in buildz.ioc
|
33
|
+
3, other tools module:
|
34
|
+
buildz.fz: file search
|
35
|
+
buildz.pyz: make it easier to use python's __import__ function
|
36
|
+
buildz.argx: read command argument in special format
|
37
|
+
buildz.demo: example codes to use buildz, run "python -m buildz" will use this module
|
38
|
+
code relationship:
|
39
|
+
buildz.xf, buildz.pyz, buildz.argx, buildz.fz, buildz.tz is independent
|
40
|
+
buildz.ioc use buildz.xf and buildz.pyz
|
41
|
+
buildz.tz: some tools, only contains "myerse diff algorithm" now
|
42
|
+
buildz.demo use all other modules
|
43
|
+
|
44
|
+
run python -m buildz to see help
|
45
|
+
```
|
buildz-0.4.7/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# buildz
|
2
|
+
```
|
3
|
+
1,在json格式基础上加了点东西,让配置文件写起来更简单,模块在buildz.xf下
|
4
|
+
2,基于xf格式写了个ioc控制反转配置文件读取的程序,模块在buildz.ioc下
|
5
|
+
3,其他工具模块:
|
6
|
+
buildz.fz: 文件夹查找
|
7
|
+
buildz.pyz: 简化python __import__调用
|
8
|
+
buildz.argx: 按格式读命令行参数
|
9
|
+
buildz.tz: 加些工具,目前只有myerse diff字符串比较算法
|
10
|
+
buildz.demo: 使用参考,运行"python -m buildz"会用这个模块
|
11
|
+
代码关系:
|
12
|
+
buildz.xf, buildz.pyz, buildz.argx, buildz.fz, buildz.tz都是独立的模块
|
13
|
+
buildz.ioc需要buildz.xf和buildz.pyz
|
14
|
+
buildz.demo需要其他全部模块
|
15
|
+
|
16
|
+
运行python -m buildz查看帮助
|
17
|
+
|
18
|
+
1, a profile file format base on json, make it easy to write profile file, module is in buildz.xf
|
19
|
+
2, a ioc profile file read function base on xf format, module is in buildz.ioc
|
20
|
+
3, other tools module:
|
21
|
+
buildz.fz: file search
|
22
|
+
buildz.pyz: make it easier to use python's __import__ function
|
23
|
+
buildz.argx: read command argument in special format
|
24
|
+
buildz.demo: example codes to use buildz, run "python -m buildz" will use this module
|
25
|
+
code relationship:
|
26
|
+
buildz.xf, buildz.pyz, buildz.argx, buildz.fz, buildz.tz is independent
|
27
|
+
buildz.ioc use buildz.xf and buildz.pyz
|
28
|
+
buildz.tz: some tools, only contains "myerse diff algorithm" now
|
29
|
+
buildz.demo use all other modules
|
30
|
+
|
31
|
+
run python -m buildz to see help
|
32
|
+
```
|
@@ -13,12 +13,14 @@ def fetch(argv = None):
|
|
13
13
|
i = 0
|
14
14
|
while i<len(argv):
|
15
15
|
v = argv[i]
|
16
|
+
make_plus = 0
|
16
17
|
if v in ["-", "--", "+"]or v[0] not in "+-":
|
17
18
|
lists.append(v)
|
18
19
|
i+=1
|
19
20
|
continue
|
20
21
|
if v[0] == "+":
|
21
22
|
key = v[1:]
|
23
|
+
make_plus = 1
|
22
24
|
val = 1
|
23
25
|
else:
|
24
26
|
if v[1]=="-":
|
@@ -31,16 +33,21 @@ def fetch(argv = None):
|
|
31
33
|
else:
|
32
34
|
key = v[1]
|
33
35
|
if len(v)>2:
|
34
|
-
val =
|
36
|
+
val = v[2:]
|
35
37
|
else:
|
36
38
|
if i+1>=len(argv):
|
37
39
|
val = 1
|
38
40
|
else:
|
39
41
|
val = argv[i+1]
|
40
42
|
i+=1
|
41
|
-
if
|
42
|
-
|
43
|
-
|
43
|
+
if make_plus:
|
44
|
+
keys = key.split(",")
|
45
|
+
else:
|
46
|
+
keys = [key]
|
47
|
+
for key in keys:
|
48
|
+
if key not in maps:
|
49
|
+
maps[key] = []
|
50
|
+
maps[key].append(val)
|
44
51
|
i+=1
|
45
52
|
for k in maps:
|
46
53
|
v = maps[k]
|
@@ -50,5 +57,14 @@ def fetch(argv = None):
|
|
50
57
|
|
51
58
|
pass
|
52
59
|
|
60
|
+
def get(maps, keys, default=None):
|
61
|
+
if type(keys) not in [list, tuple]:
|
62
|
+
keys = [keys]
|
63
|
+
for key in keys:
|
64
|
+
if key in maps:
|
65
|
+
return maps[key]
|
66
|
+
return default
|
67
|
+
|
68
|
+
pass
|
53
69
|
|
54
70
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#coding=utf-8
|
2
|
+
from buildz import xf, argx, pyz, ioc, fz
|
3
|
+
|
4
|
+
from ..test import text_sfx, args, maps
|
5
|
+
class Deal:
|
6
|
+
def deal(self):
|
7
|
+
if len(args)<2:
|
8
|
+
print("need params 1 to be dirpath")
|
9
|
+
return
|
10
|
+
dp = args[1]
|
11
|
+
sfx = argx.get(maps, ("s", "suffix"), "js")
|
12
|
+
fps = fz.search(dp, f".*\.{sfx}$")
|
13
|
+
confs = ioc.build()
|
14
|
+
confs.add_fps(fps)
|
15
|
+
id = argx.get(maps, ("i", "id"), "main")
|
16
|
+
rst = confs.get(id)
|
17
|
+
print(f"get {id}: {rst}")
|
18
|
+
return rst
|
19
|
+
|
20
|
+
pass
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#coding=utf-8
|
2
|
+
from buildz import xf, argx, pyz, ioc
|
3
|
+
from buildz.ioc.ioc.conf import Conf
|
4
|
+
from ..test import Help as BaseHelp
|
5
|
+
from os.path import dirname, join
|
6
|
+
from ..test import text_sfx, args, maps, en
|
7
|
+
class Help(BaseHelp):
|
8
|
+
def __init__(self, dp, fp):
|
9
|
+
fp = join(dp, fp)
|
10
|
+
self.helps = xf.loads(xf.fread(fp))
|
11
|
+
self.text = self.helps['text'+text_sfx]
|
12
|
+
def deal(self):
|
13
|
+
self._deal()
|
14
|
+
if en:
|
15
|
+
print("remarks isn't fully translated into English yet.")
|
16
|
+
def _deal(self):
|
17
|
+
if xf.g(maps, doc=0):
|
18
|
+
print(Conf.__doc__)
|
19
|
+
return
|
20
|
+
fp = argx.get(maps, ('f', 'file'))
|
21
|
+
if fp is None:
|
22
|
+
fp = ioc.default_deals
|
23
|
+
deals = xf.g(xf.loads(xf.fread(fp)), deals=[])
|
24
|
+
types = [f"{k['type']}({xf.g(k, note='???')})" for k in deals]
|
25
|
+
deals = {k['type']:k for k in deals}
|
26
|
+
notes = []
|
27
|
+
stypes = ", ".join(types)
|
28
|
+
self.text = self.text.replace("{items}",stypes)
|
29
|
+
var = argx.get(maps, ('h', 'help'))
|
30
|
+
if var == True:
|
31
|
+
print(self.text)
|
32
|
+
return
|
33
|
+
if var not in deals:
|
34
|
+
print(f"unknown type: {var}")
|
35
|
+
return
|
36
|
+
build = deals[var]['build']
|
37
|
+
c = pyz.load(build)
|
38
|
+
doc = c.__doc__
|
39
|
+
if doc is None:
|
40
|
+
doc = "没有注释"
|
41
|
+
print(doc)
|
42
|
+
pass
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#coding=utf-8
|
2
|
+
from buildz import xf, argx, pyz, ioc, fz,tz
|
3
|
+
|
4
|
+
from ..test import text_sfx, args, maps
|
5
|
+
class Deal:
|
6
|
+
def deal(self):
|
7
|
+
if len(args)<5:
|
8
|
+
print("need opt, file1, file2, step_file")
|
9
|
+
return
|
10
|
+
opt = args[1]
|
11
|
+
fp1 = args[2]
|
12
|
+
fp2 = args[3]
|
13
|
+
fp_step = args[4]
|
14
|
+
mark_encode = argx.get(maps, 'e', 1)
|
15
|
+
mark_txt = argx.get(maps, 't', None)
|
16
|
+
if mark_txt:
|
17
|
+
mark_encode = 0
|
18
|
+
spt = argx.get(maps, 's', 1)
|
19
|
+
nspt = argx.get(maps, 'ns', 0)
|
20
|
+
if nspt:
|
21
|
+
spt = 0
|
22
|
+
print(f"SPT:{spt}")
|
23
|
+
if opt == 'diff':
|
24
|
+
bs1 = fz.read(fp1).decode("utf-8")
|
25
|
+
bs2 = fz.read(fp2).decode("utf-8")
|
26
|
+
#bs1 = b"text z xxxyzijsa"
|
27
|
+
#bs2 = b"test xxxx afzjcovijsax"
|
28
|
+
stps = tz.m_steps(bs1, bs2,split=spt)
|
29
|
+
if mark_encode:
|
30
|
+
stps = b"e"+tz.m_encode(stps)
|
31
|
+
else:
|
32
|
+
for stp in stps:
|
33
|
+
c = stp[-1]
|
34
|
+
if type(c)==bytes:
|
35
|
+
stp[-1] = c.decode()
|
36
|
+
stps = "t"+xf.dumps(stps)
|
37
|
+
stps = stps.encode()
|
38
|
+
fz.write(fp_step, stps)
|
39
|
+
elif opt == 'update':
|
40
|
+
bs1 = fz.read(fp1).decode("utf-8")
|
41
|
+
bs_step = fz.read(fp_step)
|
42
|
+
mark_encode = bs_step[:1] == b'e'
|
43
|
+
bs_step= bs_step[1:]
|
44
|
+
if mark_encode:
|
45
|
+
stps = tz.m_decode(bs_step)
|
46
|
+
else:
|
47
|
+
stps = xf.loads(bs_step.decode())
|
48
|
+
bs2 = tz.m_update(bs1, stps,split=spt).encode("utf-8")
|
49
|
+
fz.write(fp2, bs2)
|
50
|
+
else:
|
51
|
+
print(f"unexpect opt: {opt}")
|
52
|
+
pass
|
53
|
+
|
54
|
+
pass
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#coding=utf-8
|
2
|
+
from buildz import xf, argx, pyz, ioc
|
3
|
+
from ..test import Help as BaseHelp
|
4
|
+
from os.path import dirname, join
|
5
|
+
from ..test import text_sfx, args, maps
|
6
|
+
dp = dirname(dirname(__file__))
|
7
|
+
default_fp = join(dp, "res")
|
8
|
+
class Help(BaseHelp):
|
9
|
+
def __init__(self, dp, fp):
|
10
|
+
fp = join(dp, fp)
|
11
|
+
self.text = xf.loads(xf.fread(fp))['text'+text_sfx]
|
12
|
+
self.text = self.text.replace("{default}", default_fp)
|
13
|
+
def deal(self):
|
14
|
+
print(self.text)
|
15
|
+
|
16
|
+
pass
|
@@ -5,13 +5,13 @@
|
|
5
5
|
type: join
|
6
6
|
data: [
|
7
7
|
[var, buildz.demo.test.dp]
|
8
|
-
|
8
|
+
res/help
|
9
9
|
]
|
10
10
|
}
|
11
11
|
{
|
12
12
|
id: help.default, type: object, source: buildz.demo.test.Help
|
13
13
|
construct: {
|
14
|
-
args: [(ref, help.dir),
|
14
|
+
args: [(ref, help.dir), default.js]
|
15
15
|
}
|
16
16
|
}
|
17
17
|
{
|
@@ -34,6 +34,14 @@
|
|
34
34
|
xf: {
|
35
35
|
deal: deal.xf
|
36
36
|
help: help.xf
|
37
|
+
},
|
38
|
+
search: {
|
39
|
+
deal: deal.search
|
40
|
+
help: help.search
|
41
|
+
},
|
42
|
+
myers: {
|
43
|
+
deal: deal.myers
|
44
|
+
help: help.myers
|
37
45
|
}
|
38
46
|
}
|
39
47
|
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
{
|
2
|
+
datas: [
|
3
|
+
{
|
4
|
+
id: help.myers
|
5
|
+
type: object
|
6
|
+
source: buildz.demo.myers.help.Help
|
7
|
+
construct: {
|
8
|
+
args: [
|
9
|
+
[ref, help.dir]
|
10
|
+
[val, myers.js]
|
11
|
+
]
|
12
|
+
}
|
13
|
+
}
|
14
|
+
{
|
15
|
+
id: deal.myers
|
16
|
+
type: object
|
17
|
+
source: buildz.demo.myers.deal.Deal
|
18
|
+
construct: {}
|
19
|
+
}
|
20
|
+
]
|
21
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
{
|
2
|
+
datas: [
|
3
|
+
{
|
4
|
+
id: help.search
|
5
|
+
type: object
|
6
|
+
source: buildz.demo.search.help.Help
|
7
|
+
construct: {
|
8
|
+
args: [
|
9
|
+
[ref, help.dir]
|
10
|
+
[val, search.js]
|
11
|
+
]
|
12
|
+
}
|
13
|
+
}
|
14
|
+
{
|
15
|
+
id: deal.search
|
16
|
+
type: object
|
17
|
+
source: buildz.demo.search.deal.Deal
|
18
|
+
construct: {}
|
19
|
+
}
|
20
|
+
]
|
21
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
{
|
2
|
+
text=
|
3
|
+
r"""run
|
4
|
+
python -m buildz xf +h [+en]
|
5
|
+
or
|
6
|
+
python -m buildz ioc +h [+en]
|
7
|
+
or
|
8
|
+
python -m buildz search +h [+en]
|
9
|
+
or
|
10
|
+
python -m buildz myers opt f1 f2 f_stp [+e/+t]
|
11
|
+
to see help
|
12
|
+
"""
|
13
|
+
text.en=
|
14
|
+
r"""run
|
15
|
+
python -m buildz xf +h [+en]
|
16
|
+
or
|
17
|
+
python -m buildz ioc +h [+en]
|
18
|
+
or
|
19
|
+
python -m buildz search +h [+en]
|
20
|
+
or
|
21
|
+
python -m buildz myers opt f1 f2 f_stp [+e/+t]
|
22
|
+
to see help
|
23
|
+
"""
|
24
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
{
|
2
|
+
text=
|
3
|
+
r"""
|
4
|
+
xf格式的ioc控制反转配置文件的文件读取和生成对象
|
5
|
+
预设的数据项(item_conf)格式:
|
6
|
+
{items}
|
7
|
+
查看预设数据类型格式:
|
8
|
+
python -m buildz ioc -h 类型 [--file=预设数据处理配置文件] [-f 预设数据处理配置文件]
|
9
|
+
查看配置文件书写格式:
|
10
|
+
python -m buildz ioc +h,doc
|
11
|
+
比如:
|
12
|
+
python -m buildz ioc -h val
|
13
|
+
|
14
|
+
测试执行ioc:
|
15
|
+
python -m buildz ioc 文件夹路径 [-s 配置文件后缀,默认js] [-i 数据id,默认main]
|
16
|
+
例:
|
17
|
+
python -m buildz ioc /root/test -i obj.test
|
18
|
+
""";
|
19
|
+
text.en=
|
20
|
+
r"""
|
21
|
+
xf format ioc profile file's reading and object build
|
22
|
+
preset data item(item_conf)format:
|
23
|
+
|
24
|
+
{items}
|
25
|
+
|
26
|
+
to see preset data item format:
|
27
|
+
python -m buildz ioc -h type [--file="filepath contain deal func to deal item_conf"] [-f "same to --file"]
|
28
|
+
|
29
|
+
to see profile file write format:
|
30
|
+
python -m buildz ioc +h,doc
|
31
|
+
exp:
|
32
|
+
python -m buildz ioc -h val
|
33
|
+
|
34
|
+
test run ioc:
|
35
|
+
python -m buildz ioc dirpath [-s profile file suffix, default js] [-i "data id,default 'main'"]
|
36
|
+
exp:
|
37
|
+
python -m buildz ioc /root/test -i obj.test
|
38
|
+
""";
|
39
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
{
|
2
|
+
text=
|
3
|
+
r"""
|
4
|
+
文件比较(模仿git diff):
|
5
|
+
python -m buildz myers 操作 文件路径1 文件路径2 step文件 [+e/t/s/ns]
|
6
|
+
操作:
|
7
|
+
diff: 计算文件1到文件2需要的步骤,保存到step文件
|
8
|
+
update: 文件1根据step文件修改,保存到文件2
|
9
|
+
可选:
|
10
|
+
+e: step文件字节保存(默认)
|
11
|
+
+t: step文件字符串保存
|
12
|
+
+s: 字符串做切分(默认)
|
13
|
+
+ns: 字符串不做切分(更精准,但可能耗时很高)
|
14
|
+
|
15
|
+
比如:
|
16
|
+
python -m buildz myers diff test.py curr_test.py step.dt
|
17
|
+
|
18
|
+
"""
|
19
|
+
text.en=
|
20
|
+
r"""
|
21
|
+
file compare:
|
22
|
+
python -m buildz myers opt file1 file2 step_file
|
23
|
+
opt:
|
24
|
+
diff: calucate steps from file1 to fiel2, save into step_file
|
25
|
+
update: update file1 by step_file, save into file2
|
26
|
+
options:
|
27
|
+
+e: step_file save in bytes(default)
|
28
|
+
+t: step_file save by string
|
29
|
+
+s: cut string into pices(default)
|
30
|
+
+ns: not cut string(more precise but maybe more step_file size)
|
31
|
+
|
32
|
+
exp:
|
33
|
+
python -m buildz myers diff test.py curr_test.py step.dt
|
34
|
+
|
35
|
+
"""
|
36
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
{
|
2
|
+
text=
|
3
|
+
r"""
|
4
|
+
文件查找,运行:
|
5
|
+
python -m buildz search 文件夹路径
|
6
|
+
可选参数:
|
7
|
+
-f 文件路径正则
|
8
|
+
--file=文件路径正则
|
9
|
+
-c 文件内容正则
|
10
|
+
--content=文件内容正则
|
11
|
+
-o 输出文件
|
12
|
+
--output=输出文件
|
13
|
+
-d 最深路径
|
14
|
+
--depth=最深路径
|
15
|
+
|
16
|
+
比如:
|
17
|
+
python -m buildz search {default} -f ".*\.js" -c "ioc" -d 3
|
18
|
+
|
19
|
+
"""
|
20
|
+
text.en=
|
21
|
+
r"""
|
22
|
+
file search, run by:
|
23
|
+
python -m buildz search dirpath
|
24
|
+
options:
|
25
|
+
-f "regex on filepath"
|
26
|
+
--file="regex on filepath"
|
27
|
+
-c "regex on file content"
|
28
|
+
--content="regex on file content"
|
29
|
+
-o "output filepath"
|
30
|
+
--output="output filepath"
|
31
|
+
-d "max-depth"
|
32
|
+
--depth="max-depth"
|
33
|
+
|
34
|
+
exp:
|
35
|
+
python -m buildz search {default} -f ".*\.js" -c "ioc" -d 3
|
36
|
+
|
37
|
+
"""
|
38
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
{
|
2
|
+
text=
|
3
|
+
r"""在json格式基础上加了些其他东西,让配置写起来更简单:
|
4
|
+
1,字符串可以不用引号括起来,程序判断字段不是整数,小数,布尔型等类型后,当字段是字符串
|
5
|
+
2,可以写注释,//,#,/**/, ###...###,其中/*note*/和###note###是多行注释
|
6
|
+
3,分号;和逗号,和换行\n等价,等于号=和冒号:等价,括号()和中括号[]等价
|
7
|
+
4,加了python的字符串书写方式:"...", '...', r"...",r'...', r'''...'''
|
8
|
+
5,输出格式化
|
9
|
+
6,可配置化(但没太多注释)
|
10
|
+
|
11
|
+
运行以下命令会打印文件格式化后的样式:
|
12
|
+
python -m buildz xf 文件名
|
13
|
+
|
14
|
+
比如:
|
15
|
+
python -m buildz xf {default}
|
16
|
+
|
17
|
+
"""
|
18
|
+
text.en=
|
19
|
+
r"""add something base on json format, make it eaisier to write profile file:
|
20
|
+
1, string can write without ' or ", codes will regard item as string if not in int, float, boolean, list, map, ... format
|
21
|
+
2, can write note on file, support note type: //note1 #note2 /*note3*/ ###note4###, /*note*/ and ###note### support multi-line notes
|
22
|
+
3, ';' and '\n' used equal to ',' in json, '=' used equal to ':', '()' used equals to '[]'
|
23
|
+
4, string can write like python format: "string1", 'string2', r"string3", r'string4', '''multi-line string1''', r'''multi-line string2'''
|
24
|
+
5, codes to make format output string on data
|
25
|
+
6, configurable(but has few notes on code)
|
26
|
+
|
27
|
+
output format string on input file:
|
28
|
+
python -m buildz xf filepath
|
29
|
+
|
30
|
+
exp:
|
31
|
+
python -m buildz xf {default}
|
32
|
+
|
33
|
+
"""
|
34
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
/*
|
3
|
+
这里有三行注释
|
4
|
+
这里有三行注释
|
5
|
+
这里有三行注释
|
6
|
+
*/
|
7
|
+
name: 测试配置
|
8
|
+
###
|
9
|
+
还是注释
|
10
|
+
steal is note
|
11
|
+
###
|
12
|
+
data: [
|
13
|
+
(1,.2,.03,4e-4,500)
|
14
|
+
{
|
15
|
+
// 中文当key
|
16
|
+
代号=嘿嘿
|
17
|
+
age = ???
|
18
|
+
# 字符串里有特殊符合,还是要用引号括起来
|
19
|
+
# if special charater is contained in string, use '' or "" to wrap string
|
20
|
+
'a:b':"{c,d,e,f}"
|
21
|
+
}
|
22
|
+
]
|
23
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#coding=utf-8
|
2
|
+
from buildz import xf, argx, pyz, ioc, fz
|
3
|
+
|
4
|
+
from ..test import text_sfx, args, maps
|
5
|
+
class Deal:
|
6
|
+
def deal(self):
|
7
|
+
if len(args)<2:
|
8
|
+
print("need params 1 to be dirpath")
|
9
|
+
return
|
10
|
+
dp = args[1]
|
11
|
+
ct_fp = argx.get(maps, "f,file".split(","), None)
|
12
|
+
ct = argx.get(maps, "c,content".split(","), None)
|
13
|
+
depth = argx.get(maps, "d,depth".split(","), None)
|
14
|
+
out_fp = argx.get(maps, "o,output".split(","), None)
|
15
|
+
if depth is not None:
|
16
|
+
depth = int(depth)
|
17
|
+
rst = fz.search(dp, ct_fp, ct, depth)
|
18
|
+
l = len(rst)
|
19
|
+
rs = "\n".join(rst)
|
20
|
+
if out_fp is not None:
|
21
|
+
with open(out_fp, 'w') as f:
|
22
|
+
f.write(rs)
|
23
|
+
print(f"result save in {out_fp}")
|
24
|
+
else:
|
25
|
+
print(rs)
|
26
|
+
print(f"done search, find files: {l}")
|
27
|
+
pass
|
28
|
+
|
29
|
+
pass
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#coding=utf-8
|
2
|
+
from buildz import xf, argx, pyz, ioc
|
3
|
+
from ..test import Help as BaseHelp
|
4
|
+
from os.path import dirname, join
|
5
|
+
from ..test import text_sfx, args, maps
|
6
|
+
dp = dirname(dirname(__file__))
|
7
|
+
default_fp = join(dp, "res")
|
8
|
+
class Help(BaseHelp):
|
9
|
+
def __init__(self, dp, fp):
|
10
|
+
fp = join(dp, fp)
|
11
|
+
self.text = xf.loads(xf.fread(fp))['text'+text_sfx]
|
12
|
+
self.text = self.text.replace("{default}", default_fp)
|
13
|
+
def deal(self):
|
14
|
+
print(self.text)
|
15
|
+
|
16
|
+
pass
|
@@ -1,10 +1,14 @@
|
|
1
1
|
#coding=utf-8
|
2
2
|
from buildz import xf, argx, pyz, ioc, fz
|
3
3
|
from os.path import dirname, join
|
4
|
+
args, maps = argx.fetch()
|
5
|
+
en = argx.get(maps, 'en', 0)
|
6
|
+
text_sfx = "" if not en else ".en"
|
4
7
|
class Help:
|
5
8
|
def __init__(self, dp, fp):
|
6
9
|
fp = join(dp, fp)
|
7
|
-
self.
|
10
|
+
self.obj = xf.loads(xf.fread(fp))
|
11
|
+
self.text = self.obj['text'+text_sfx]
|
8
12
|
def deal(self):
|
9
13
|
print(self.text)
|
10
14
|
|
@@ -21,22 +25,32 @@ class Deal:
|
|
21
25
|
obj = conf.get(ref)
|
22
26
|
self.deals[md][key] = obj
|
23
27
|
def run(self):
|
24
|
-
args, maps = argx.fetch()
|
25
28
|
if len(args)==0:
|
26
29
|
return self.default.deal()
|
27
30
|
md = args[0]
|
28
31
|
help = "h" in maps or "help" in maps
|
29
32
|
key = "deal" if not help else "help"
|
33
|
+
if md not in self.deals:
|
34
|
+
return self.default.deal()
|
30
35
|
obj = self.deals[md][key]
|
31
36
|
obj.deal()
|
32
37
|
|
33
38
|
pass
|
34
39
|
dp = dirname(__file__)
|
40
|
+
import time
|
35
41
|
def test():
|
42
|
+
print(f"start\n{'='*30}")
|
43
|
+
args, maps = argx.fetch()
|
44
|
+
curr = time.time()
|
36
45
|
fps = fz.search(join(dp, 'res', 'conf'), ".*\.js")
|
37
46
|
confs = ioc.build()
|
38
47
|
confs.add_fps(fps)
|
39
48
|
confs.get("run")
|
49
|
+
sec = time.time()-curr
|
50
|
+
ps = f"{'='*30}\nPS: 这只是个使用展示demo,代码在buildz.demo里,可供参考,运行耗时: {sec}"
|
51
|
+
if en:
|
52
|
+
ps = f"{'='*30}\nPS: just an demo show used of buildz module, demo codes is in buildz.demo, run time cost: {sec}"
|
53
|
+
print(ps)
|
40
54
|
|
41
55
|
pass
|
42
56
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#coding=utf-8
|
2
|
+
from buildz import xf, argx, pyz, ioc
|
3
|
+
from ..test import Help as BaseHelp
|
4
|
+
from ..test import text_sfx, args, maps
|
5
|
+
from os.path import dirname, join
|
6
|
+
dp = dirname(dirname(__file__))
|
7
|
+
default_fp = join(dp, "res", "test.js")
|
8
|
+
class Help(BaseHelp):
|
9
|
+
def __init__(self, dp, fp):
|
10
|
+
fp = join(dp, fp)
|
11
|
+
self.text = xf.loads(xf.fread(fp))['text'+text_sfx]
|
12
|
+
self.text = self.text.replace("{default}", default_fp)
|
13
|
+
def deal(self):
|
14
|
+
print(self.text)
|
15
|
+
|
16
|
+
pass
|