buildz 0.6.5__tar.gz → 0.6.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.6.5/buildz.egg-info → buildz-0.6.7}/PKG-INFO +1 -1
- {buildz-0.6.5 → buildz-0.6.7}/buildz/__init__.py +2 -1
- buildz-0.6.7/buildz/base.py +21 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/fz/__init__.py +1 -1
- buildz-0.6.7/buildz/fz/fhs.py +55 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc/base.py +2 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc/conf.py +2 -2
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc/confs.py +11 -3
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc/single.py +6 -1
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/base.py +26 -19
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/call.py +1 -1
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/calls.py +0 -2
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/conf/ref_lists.js +4 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/deal.py +1 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/iocf.py +1 -1
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/mcall.py +2 -2
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/obj.py +4 -1
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/ovar.py +1 -1
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/ref.py +13 -3
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/var.py +1 -1
- {buildz-0.6.5 → buildz-0.6.7}/buildz/pyz.py +26 -1
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/mapz.py +17 -0
- {buildz-0.6.5 → buildz-0.6.7/buildz.egg-info}/PKG-INFO +1 -1
- {buildz-0.6.5 → buildz-0.6.7}/buildz.egg-info/SOURCES.txt +1 -0
- {buildz-0.6.5 → buildz-0.6.7}/setup.py +1 -1
- buildz-0.6.5/buildz/fz/fhs.py +0 -17
- {buildz-0.6.5 → buildz-0.6.7}/LICENSE +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/MANIFEST.in +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/README.md +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/__main__.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/argx.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/cmd.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/db/__main__.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/db/dv/basez.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/db/dv/clickhousez.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/db/dv/lib/readme +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/db/dv/mysqlz.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/db/dv/oraclez.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/db/dv/structz.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/db/install.txt +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/db/run.conf +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/db/runz.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/demo/ioc/deal.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/demo/ioc/help.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/demo/myers/deal.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/demo/myers/help.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/demo/res/conf/ioc.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/demo/res/conf/main.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/demo/res/conf/myers.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/demo/res/conf/search.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/demo/res/conf/xf.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/demo/res/help/default.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/demo/res/help/ioc.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/demo/res/help/myers.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/demo/res/help/search.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/demo/res/help/xf.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/demo/res/test.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/demo/search/deal.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/demo/search/help.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/demo/test.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/demo/xf/deal.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/demo/xf/help.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/fz/dirz.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/fz/fio.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/fz/lsf.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/__init__.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/base.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/init.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/conf/call_defaults.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/conf/call_lists.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/conf/calls_defaults.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/conf/calls_lists.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/conf/deal_lists.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/conf/deals.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/conf/env_lists.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/conf/ioc_lists.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/conf/iocf_lists.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/conf/join_lists.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/conf/list_lists.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/conf/map_lists.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/conf/mcall_defaults.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/conf/mcall_lists.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/conf/obj_cst_lists.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/conf/obj_defaults.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/conf/obj_lists.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/conf/obj_set_lists.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/conf/ovar_lists.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/conf/var_lists.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/conf/xfile_defaults.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/conf/xfile_lists.js +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/demo.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/env.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/ioc.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/join.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/list.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/map.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/val.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/ioc/ioc_deal/xfile.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/tz/__init__.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/tz/myers_diff.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/__init__.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/__main__.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/code.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/code_modify.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/copy_old.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/file.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loader/base.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loader/buffer.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loader/deal/listz.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loader/deal/lr.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loader/deal/lrval.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loader/deal/mapz.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loader/deal/nextz.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loader/deal/reval.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loader/deal/setz.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loader/deal/spc.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loader/deal/spt.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loader/deal/strz.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loader/exp.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loader/item.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loader/mg.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loader/pos.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loaderz/base.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loaderz/buffer.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loaderz/deal/listz.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loaderz/deal/lr.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loaderz/deal/lrval.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loaderz/deal/mapz.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loaderz/deal/nextz.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loaderz/deal/reval.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loaderz/deal/setz.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loaderz/deal/spc.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loaderz/deal/spt.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loaderz/deal/strz.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loaderz/deal/strz_new.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loaderz/deal/strz_old.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loaderz/exp.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loaderz/item.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loaderz/mg.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loaderz/pos.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loaderz/test.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/loaderz/test1.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/read.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/readz.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/stack.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/write.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/writer/base.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/writer/conf.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/writer/deal/jsonval.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/writer/deal/listz.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/writer/deal/mapz.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/writer/deal/reval.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/writer/deal/strz.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/writer/itemz.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/writer/mg.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz/xf/xargs.py +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz.egg-info/dependency_links.txt +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/buildz.egg-info/top_level.txt +0 -0
- {buildz-0.6.5 → buildz-0.6.7}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: buildz
|
3
|
-
Version: 0.6.
|
3
|
+
Version: 0.6.7
|
4
4
|
Summary: 配置读写(基于json格式进行简化)、ioc、以及其他工具代码。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(ioc), and other tool codes
|
5
5
|
Home-page: https://github.com/buildCodeZ/buildz
|
6
6
|
Author: Zzz
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#coding=utf-8
|
2
|
+
|
3
|
+
class Base:
|
4
|
+
def str(self):
|
5
|
+
return str(self.__class__)
|
6
|
+
def __str__(self):
|
7
|
+
return self.str()
|
8
|
+
def __repr__(self):
|
9
|
+
return self.__str__()
|
10
|
+
def __init__(self, *args, **maps):
|
11
|
+
self.init(*args, **maps)
|
12
|
+
def __call__(self, *args, **maps):
|
13
|
+
return self.call(*args, **maps)
|
14
|
+
def init(self, *args, **maps):
|
15
|
+
pass
|
16
|
+
def call(self, *args, **maps):
|
17
|
+
return self.deal(*args, **maps)
|
18
|
+
def deal(self, *args, **maps):
|
19
|
+
return None
|
20
|
+
|
21
|
+
pass
|
@@ -3,6 +3,6 @@
|
|
3
3
|
from .dirz import dirs, FileDeal
|
4
4
|
from .lsf import lists, search, searchd,searchs,_search
|
5
5
|
from .fio import fread, freads, fwrite, fwrites, read,reads,write,writes, makefdir, dirpath,makedir,removes, cover, fcover, sread, swrite
|
6
|
-
from .fhs import fhash
|
6
|
+
from .fhs import fhash, fhashs
|
7
7
|
|
8
8
|
__author__ = "Zzz, emails: 1174534295@qq.com, 1309458652@qq.com"
|
@@ -0,0 +1,55 @@
|
|
1
|
+
#coding=utf-8
|
2
|
+
|
3
|
+
import hashlib
|
4
|
+
import os
|
5
|
+
#计算文件hash值
|
6
|
+
def fhash(fp, hm="sha256", blk_sz = 10240):
|
7
|
+
if type(hm) == str:
|
8
|
+
hm = getattr(hashlib, hm)()
|
9
|
+
with open(fp, 'rb') as f:
|
10
|
+
while True:
|
11
|
+
bs = f.read(blk_sz)
|
12
|
+
if len(bs)==0:
|
13
|
+
break
|
14
|
+
hm.update(bs)
|
15
|
+
return hm.hexdigest()
|
16
|
+
|
17
|
+
pass
|
18
|
+
def bs_hash(bs, fhm):
|
19
|
+
obj = fhm()
|
20
|
+
obj.update(bs)
|
21
|
+
return obj.hexdigest()
|
22
|
+
|
23
|
+
pass
|
24
|
+
def fhashs(fp, blk_size = 10240, max_read = -1, hm = "sha256"):
|
25
|
+
if type(hm) == str:
|
26
|
+
fhm = getattr(hashlib, hm)
|
27
|
+
else:
|
28
|
+
fhm = hm
|
29
|
+
hashs = []
|
30
|
+
if not os.path.isfile(fp) or max_read==0:
|
31
|
+
return hashs
|
32
|
+
size = 0
|
33
|
+
bs = b""
|
34
|
+
reads = 0
|
35
|
+
mark_read = True
|
36
|
+
with open(fp, 'rb') as f:
|
37
|
+
while len(bs)>0 or mark_read:
|
38
|
+
if max_read>0 and size>=max_read:
|
39
|
+
break
|
40
|
+
read_size = blk_size
|
41
|
+
if max_read>0:
|
42
|
+
read_size = min(max_read-size, blk_size)
|
43
|
+
if mark_read:
|
44
|
+
curr = f.read(read_size)
|
45
|
+
if len(curr)==0:
|
46
|
+
mark_read = False
|
47
|
+
else:
|
48
|
+
bs += curr
|
49
|
+
if len(bs)>=read_size or not mark_read:
|
50
|
+
tmp = bs[:read_size]
|
51
|
+
bs = bs[read_size:]
|
52
|
+
size+=read_size
|
53
|
+
hashs.append(bs_hash(tmp, fhm))
|
54
|
+
return hashs
|
55
|
+
|
@@ -2,7 +2,7 @@
|
|
2
2
|
from buildz import xf, pyz
|
3
3
|
from buildz.xf import g as xg
|
4
4
|
import json
|
5
|
-
from .base import Base, EncapeData,IOCError
|
5
|
+
from .base import Base, EncapeData,IOCError, IdNotFoundError
|
6
6
|
from builtins import id as _id
|
7
7
|
class Conf(Base):
|
8
8
|
"""
|
@@ -198,7 +198,7 @@ class Conf(Base):
|
|
198
198
|
else:
|
199
199
|
conf = self.get_data(id, src = src, info = info)
|
200
200
|
if conf is None:
|
201
|
-
raise
|
201
|
+
raise IdNotFoundError(f"can't find conf of {id}")
|
202
202
|
return None
|
203
203
|
deal = self.get_deal(conf.type)
|
204
204
|
if deal is None:
|
@@ -3,7 +3,7 @@ from buildz import xf, pyz
|
|
3
3
|
from buildz.xf import g as xg
|
4
4
|
from buildz import argx
|
5
5
|
import json
|
6
|
-
from .base import Base, EncapeData,IOCError
|
6
|
+
from .base import Base, EncapeData,IOCError, IdNotFoundError
|
7
7
|
from .conf import Conf
|
8
8
|
import os
|
9
9
|
class ConfsNode(Base):
|
@@ -237,6 +237,13 @@ class Confs(Base):
|
|
237
237
|
if not self.has_var(key):
|
238
238
|
return None, False
|
239
239
|
return self.vars[key][i], True
|
240
|
+
def push_vars(self, vars):
|
241
|
+
if vars is not None:
|
242
|
+
[self.push_var(key,val) for key,val in vars.items()]
|
243
|
+
return pyz.with_out(lambda :self.pop_vars(vars))
|
244
|
+
def pop_vars(self, vars):
|
245
|
+
if vars is not None:
|
246
|
+
[self.pop_var(key) for key in vars]
|
240
247
|
def push_var(self, key, val):
|
241
248
|
if key not in self.vars:
|
242
249
|
self.vars[key] = []
|
@@ -331,7 +338,8 @@ class Confs(Base):
|
|
331
338
|
if type(conf) in [bytes, str]:
|
332
339
|
conf = self.loads(conf)
|
333
340
|
obj = Conf(conf, self)
|
334
|
-
id =
|
341
|
+
id = obj.namespace
|
342
|
+
#id = xf.g1(conf, id=None, namespace=None)
|
335
343
|
ids = self.ids(id)
|
336
344
|
node = self.node
|
337
345
|
for id in ids:
|
@@ -358,7 +366,7 @@ class Confs(Base):
|
|
358
366
|
else:
|
359
367
|
conf = self.get_data(id, sid, src=src, info = info)
|
360
368
|
if conf is None:
|
361
|
-
raise
|
369
|
+
raise IdNotFoundError(f"confs: can't find conf of {id}")
|
362
370
|
return None
|
363
371
|
deal = self.get_deal(conf.type, sid)
|
364
372
|
if deal is None:
|
@@ -25,7 +25,7 @@ class Single(Base):
|
|
25
25
|
data = edata.data
|
26
26
|
info = edata.info
|
27
27
|
if type(info) == dict:
|
28
|
-
cid = xf.get(info, self.
|
28
|
+
cid = xf.get(info, self.k_cid, None)
|
29
29
|
else:
|
30
30
|
cid = None
|
31
31
|
id = xf.g(data, id = None)
|
@@ -52,5 +52,10 @@ class Single(Base):
|
|
52
52
|
if ids is None:
|
53
53
|
return
|
54
54
|
xf.sets(self.singles, ids, obj)
|
55
|
+
def remove(self,edata:EncapeData):
|
56
|
+
ids = self.get_ids(edata)
|
57
|
+
if ids is None:
|
58
|
+
return
|
59
|
+
xf.removes(self.singles, ids)
|
55
60
|
|
56
61
|
pass
|
@@ -96,8 +96,9 @@ class FormatData(Base):
|
|
96
96
|
null = xf.g(obj, nullable=1)
|
97
97
|
if not null:
|
98
98
|
raise Exception(f"error format in {self.name}, not default value for index {i}, key {key}")
|
99
|
-
default
|
100
|
-
|
99
|
+
if "default" in obj:
|
100
|
+
default = xf.g(obj, default=None)
|
101
|
+
maps[key] = default
|
101
102
|
cnt +=1
|
102
103
|
continue
|
103
104
|
next_conf = xf.g(obj, conf = None)
|
@@ -138,6 +139,12 @@ class BaseDeal(Base):
|
|
138
139
|
_type = conf.confs.get_data_type(data, 1, conf.default_type())
|
139
140
|
edata = EncapeData(data, conf, local=True, type=_type, src = src, info = info)
|
140
141
|
return edata
|
142
|
+
def fill_objs(self, data, conf, src = None, info = None):
|
143
|
+
if type(data)==list:
|
144
|
+
data = [get_obj(k, conf, src, info) for k in data]
|
145
|
+
else:
|
146
|
+
data = {k:get_obj(v, conf, src, info) for k,v in data.items()}
|
147
|
+
return data
|
141
148
|
def get_obj(self, data, conf, src = None, info = None):
|
142
149
|
edata = self.get_data(data, conf, src, info)
|
143
150
|
return edata()
|
@@ -149,10 +156,10 @@ class BaseDeal(Base):
|
|
149
156
|
_type = conf.confs.get_data_type(data, 1, conf.default_type())
|
150
157
|
edata = EncapeData(data, conf, local=True, type=_type, src = src, info = info)
|
151
158
|
return edata()
|
152
|
-
deal = conf.get_deal(edata.type)
|
153
|
-
if deal is None:
|
154
|
-
|
155
|
-
return deal(edata)
|
159
|
+
# deal = conf.get_deal(edata.type)
|
160
|
+
# if deal is None:
|
161
|
+
# return None
|
162
|
+
# return deal(edata)
|
156
163
|
def deal(self, edata:EncapeData):
|
157
164
|
"""
|
158
165
|
"""
|
@@ -190,18 +197,18 @@ class FormatDeal(BaseDeal):
|
|
190
197
|
data = self.format.l2m(data)
|
191
198
|
self.format.fill(data)
|
192
199
|
return data
|
193
|
-
def get_obj(self, data, conf, src = None, info = None):
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
200
|
+
# def get_obj(self, data, conf, src = None, info = None):
|
201
|
+
# if type(data) not in [list, dict, tuple]:
|
202
|
+
# i = conf.confs.data_index_type[0]
|
203
|
+
# data = [conf.default_type(), data]
|
204
|
+
# if i != 0:
|
205
|
+
# data.reverse()
|
206
|
+
# _type = conf.confs.get_data_type(data, 1, conf.default_type())
|
207
|
+
# edata = EncapeData(data, conf, local=True, type=_type, src = src, info = info)
|
208
|
+
# return edata()
|
209
|
+
# deal = conf.get_deal(edata.type)
|
210
|
+
# if deal is None:
|
211
|
+
# return None
|
212
|
+
# return deal(edata)
|
206
213
|
|
207
214
|
pass
|
@@ -60,9 +60,9 @@ class CallDeal(FormatDeal):
|
|
60
60
|
xf.fill(imaps, maps, 1)
|
61
61
|
# args = [self.get_obj(v, conf, src, info = edata.info) for v in args]
|
62
62
|
# maps = {k:self.get_obj(maps[k], conf, src, info = edata.info) for k in maps}
|
63
|
+
self.push_vars(conf, ivars)
|
63
64
|
args = [self.get_obj(v, conf, src) for v in args]
|
64
65
|
maps = {k:self.get_obj(maps[k], conf, src) for k in maps}
|
65
|
-
self.push_vars(conf, ivars)
|
66
66
|
rst = method(*args, **maps)
|
67
67
|
self.pop_vars(conf, ivars)
|
68
68
|
return rst
|
@@ -24,8 +24,6 @@ class CallsDeal(FormatDeal):
|
|
24
24
|
[[main_call, calls], [[call, buildz.pyz.pyexe], [call, buildz.pyz.pypkg]]]
|
25
25
|
"""
|
26
26
|
def init(self, fp_lists = None, fp_defaults = None):
|
27
|
-
self.singles = {}
|
28
|
-
self.sources = {}
|
29
27
|
super().init("CallsDeal", fp_lists, fp_defaults,
|
30
28
|
join(dp, "conf", "calls_lists.js"),
|
31
29
|
join(dp, "conf", "calls_defaults.js"))
|
@@ -67,6 +67,7 @@ class DealDeal(FormatDeal):
|
|
67
67
|
super().init("DealDeal", fp_lists, fp_defaults, join(dp, "conf", "deal_lists.js"), None)
|
68
68
|
def deal(self, edata:EncapeData):
|
69
69
|
data = edata.data
|
70
|
+
data = self.fill(data)
|
70
71
|
source = xf.g(data, source=None)
|
71
72
|
if source is None:
|
72
73
|
raise IOCError("not source in dealdeal")
|
@@ -62,7 +62,7 @@ class MethodCallDeal(FormatDeal):
|
|
62
62
|
iargs, imaps = None, None
|
63
63
|
ivars = None
|
64
64
|
if type(info) == dict:
|
65
|
-
iargs, imaps = xf.g(info, m_args = None, m_maps = None, vars=None)
|
65
|
+
iargs, imaps, ivars = xf.g(info, m_args = None, m_maps = None, vars=None)
|
66
66
|
args = xf.g(data, args=[])
|
67
67
|
maps = xf.g(data, maps ={})
|
68
68
|
vars = xf.g(data, vars={})
|
@@ -76,9 +76,9 @@ class MethodCallDeal(FormatDeal):
|
|
76
76
|
xf.fill(imaps, maps, 1)
|
77
77
|
# args = [self.get_obj(v, conf, src, edata.info) for v in args]
|
78
78
|
# maps = {k:self.get_obj(maps[k], conf, src, edata.info) for k in maps}
|
79
|
+
self.push_vars(conf, ivars)
|
79
80
|
args = [self.get_obj(v, conf, src) for v in args]
|
80
81
|
maps = {k:self.get_obj(maps[k], conf, src) for k in maps}
|
81
|
-
self.push_vars(conf, ivars)
|
82
82
|
rst = method(*args, **maps)
|
83
83
|
self.pop_vars(conf, ivars)
|
84
84
|
return rst
|
@@ -96,6 +96,8 @@ class ObjectDeal(FormatDeal):
|
|
96
96
|
cid = xf.g(info, id=None)
|
97
97
|
iargs, imaps = xf.g(info, args = None, maps = None)
|
98
98
|
icst = {'args':iargs, 'maps':imaps}
|
99
|
+
if iargs is None and imaps is None:
|
100
|
+
icst = None
|
99
101
|
isets = xf.g(info, sets = None)
|
100
102
|
ivars = xf.g(info, vars=None)
|
101
103
|
else:
|
@@ -141,10 +143,11 @@ class ObjectDeal(FormatDeal):
|
|
141
143
|
if icst is not None:
|
142
144
|
xf.fill(icst, cst, 1)
|
143
145
|
args = xf.g(cst, args=[])
|
146
|
+
args = xf.im2l(args)
|
144
147
|
maps = xf.g(cst, maps={})
|
148
|
+
self.push_vars(conf, ivars)
|
145
149
|
args = [self.get_obj(v, conf) for v in args]
|
146
150
|
maps = {k:self.get_obj(maps[k], conf) for k in maps}
|
147
|
-
self.push_vars(conf, ivars)
|
148
151
|
obj = fc(*args, **maps)
|
149
152
|
if ids is not None:
|
150
153
|
xf.sets(self.singles, ids, obj)
|
@@ -34,7 +34,7 @@ class ObjectVarDeal(FormatDeal):
|
|
34
34
|
src = edata.src
|
35
35
|
source = xf.g1(data, source=None, src=None)
|
36
36
|
#key = xf.g(data, key=0)
|
37
|
-
key = xf.get_first(data, "ovar", "key")
|
37
|
+
key = xf.get_first(data, "ovar", "key", "data")
|
38
38
|
info = xf.g(data, info=None)
|
39
39
|
if info is not None:
|
40
40
|
info = self.get_obj(info, src = edata.src, info = edata.info)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#coding=utf-8
|
2
|
-
from ..ioc.base import Base, EncapeData
|
2
|
+
from ..ioc.base import Base, EncapeData, IdNotFoundError
|
3
3
|
from .base import FormatData,FormatDeal
|
4
4
|
from buildz import xf, pyz
|
5
5
|
import os
|
@@ -31,10 +31,20 @@ class RefDeal(FormatDeal):
|
|
31
31
|
if info is not None and type(info)==dict:
|
32
32
|
#info = {k:self.get_obj(info, edata.conf, src = edata.src) for k in info}
|
33
33
|
info = {'type':'map', 'data':info}
|
34
|
-
info = self.get_obj(info, edata.conf, src = edata.src)
|
34
|
+
info = self.get_obj(info, edata.conf, src = edata.src)
|
35
|
+
else:
|
36
|
+
info = {}
|
37
|
+
_info = edata.info
|
38
|
+
if type(_info)==dict:
|
39
|
+
xf.deep_update(info, _info, 1)
|
35
40
|
var, exist = edata.conf.get_var(key)
|
36
41
|
if exist:
|
37
42
|
return var
|
38
|
-
|
43
|
+
try:
|
44
|
+
return edata.conf.get_obj(key, info = info, src = edata.src)
|
45
|
+
except IdNotFoundError as exp:
|
46
|
+
if "default" in data:
|
47
|
+
return data['default']
|
48
|
+
raise exp
|
39
49
|
|
40
50
|
pass
|
@@ -2,6 +2,29 @@
|
|
2
2
|
import sys
|
3
3
|
import os
|
4
4
|
import hashlib
|
5
|
+
class With:
|
6
|
+
def __init__(self, fc_in, fc_out, args = False):
|
7
|
+
self.fc_in = fc_in
|
8
|
+
self.fc_out = fc_out
|
9
|
+
self.args = args
|
10
|
+
def __enter__(self):
|
11
|
+
if self.fc_in is not None:
|
12
|
+
self.fc_in()
|
13
|
+
return self
|
14
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
15
|
+
rst = False
|
16
|
+
if self.fc_out is not None:
|
17
|
+
if self.args:
|
18
|
+
rst = self.fc_out(exc_type, exc_val, exc_tb)
|
19
|
+
else:
|
20
|
+
rst = self.fc_out()
|
21
|
+
return rst
|
22
|
+
|
23
|
+
pass
|
24
|
+
def with_out(fc, args = False):
|
25
|
+
return With(None, fc, args)
|
26
|
+
|
27
|
+
pass
|
5
28
|
def hashcode(s):
|
6
29
|
if type(s)==str:
|
7
30
|
s = s.encode("utf-8")
|
@@ -10,7 +33,7 @@ def hashcode(s):
|
|
10
33
|
pass
|
11
34
|
def test_current(fp, up = 1, adds = []):
|
12
35
|
"""
|
13
|
-
将当前目录的上{up}层目录加入sys.path
|
36
|
+
将当前目录的上{up}层目录加入sys.path,这样可以在同层写测试代码,但是写import的时候还是要当作是在上{up}层做import
|
14
37
|
"""
|
15
38
|
if type(adds) not in [list, tuple]:
|
16
39
|
adds = [adds]
|
@@ -22,6 +45,8 @@ def test_current(fp, up = 1, adds = []):
|
|
22
45
|
|
23
46
|
pass
|
24
47
|
add_path = test_current
|
48
|
+
add_current = test_current
|
49
|
+
add = test_current
|
25
50
|
def load(md, fc = None):
|
26
51
|
"""
|
27
52
|
import object(whether module or others) from md(or md.fc)
|
@@ -105,6 +105,23 @@ def fill_fc(maps, fc):
|
|
105
105
|
return maps
|
106
106
|
|
107
107
|
pass
|
108
|
+
def im2l(maps):
|
109
|
+
if type(maps)!=dict:
|
110
|
+
return maps
|
111
|
+
mx = 0
|
112
|
+
for k in maps:
|
113
|
+
if type(k)==str:
|
114
|
+
k = int(k)
|
115
|
+
if type(k)!=int or k<0:
|
116
|
+
raise Exception(f"args key only can be int and bigger than 0, but {type(k)}:{k} found")
|
117
|
+
mx = max(k+1, mx)
|
118
|
+
arr = [None]*mx
|
119
|
+
for k, v in maps.items():
|
120
|
+
arr[k] = v
|
121
|
+
return arr
|
122
|
+
|
123
|
+
pass
|
124
|
+
|
108
125
|
def sets(maps, keys, val):
|
109
126
|
if type(keys) != list:
|
110
127
|
keys = [keys]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: buildz
|
3
|
-
Version: 0.6.
|
3
|
+
Version: 0.6.7
|
4
4
|
Summary: 配置读写(基于json格式进行简化)、ioc、以及其他工具代码。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(ioc), and other tool codes
|
5
5
|
Home-page: https://github.com/buildCodeZ/buildz
|
6
6
|
Author: Zzz
|
buildz-0.6.5/buildz/fz/fhs.py
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
#coding=utf-8
|
2
|
-
|
3
|
-
import hashlib
|
4
|
-
|
5
|
-
#计算文件hash值
|
6
|
-
def fhash(fp, hm="sha256", blk_sz = 10240):
|
7
|
-
if type(hm) == str:
|
8
|
-
hm = getattr(hashlib, hm)()
|
9
|
-
with open(fp, 'rb') as f:
|
10
|
-
while True:
|
11
|
-
bs = f.read(blk_sz)
|
12
|
-
if len(bs)==0:
|
13
|
-
break
|
14
|
-
hm.update(bs)
|
15
|
-
return hm.hexdigest()
|
16
|
-
|
17
|
-
pass
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|