-
@@ -27,7 +26,7 @@
- python >=3.6
项目地址: https://gitee.com/cacode_cctvadmin/CACodeFramework-python-ORM
-项目文档:https://frame.cacode.ren
+项目文档:http://doc.cacode.ren
> 统一市面上所有的数据库创建者,并分配连接池和缓存
@@ -35,8 +34,6 @@
如果这个框架对你有帮助的话,请给个星点个star
-# CACode开发团队
+# CACode

-文档编辑于:2021/03/17 07:41
-作者:CACode
diff --git a/CACodeFramework/MainWork/CACodeAdapter.py b/cacode_framework/MainWork/CACodeAdapter.py
similarity index 79%
rename from CACodeFramework/MainWork/CACodeAdapter.py
rename to cacode_framework/MainWork/CACodeAdapter.py
index 0474b35..46b7cd4 100644
--- a/CACodeFramework/MainWork/CACodeAdapter.py
+++ b/cacode_framework/MainWork/CACodeAdapter.py
@@ -9,8 +9,10 @@ class LanguageAdapter:
funcs = {}
def __init__(self):
- self.funcs['like'] = self._like_opera
- self.funcs['in'] = self._in_opera
+ if not hasattr(self, 'funcs'):
+ self.funcs = {}
+ self.sp('like', self._like_opera)
+ self.sp('in', self._in_opera)
def _like_opera(self, instance, key, value):
instance.args.append('`' + key + '`')
@@ -27,3 +29,7 @@ class LanguageAdapter:
instance.args.append(f'( {vals} )')
else:
raise AttributeError('value type is not list or QuerySet object')
+
+ def sp(self, key, val):
+ if key not in self.funcs.keys():
+ self.funcs[key] = val
diff --git a/CACodeFramework/MainWork/CACodeAopContainer.py b/cacode_framework/MainWork/CACodeAopContainer.py
similarity index 100%
rename from CACodeFramework/MainWork/CACodeAopContainer.py
rename to cacode_framework/MainWork/CACodeAopContainer.py
diff --git a/CACodeFramework/MainWork/CACodeConfig.py b/cacode_framework/MainWork/CACodeConfig.py
similarity index 94%
rename from CACodeFramework/MainWork/CACodeConfig.py
rename to cacode_framework/MainWork/CACodeConfig.py
index 039a2d7..aeec07f 100644
--- a/CACodeFramework/MainWork/CACodeConfig.py
+++ b/cacode_framework/MainWork/CACodeConfig.py
@@ -1,3 +1,4 @@
+from .CACodeAdapter import LanguageAdapter
from ..cacode.Serialize import JsonUtil
from ..exception.e_fields import FieldNotExist
from ..util.Log import CACodeLog
@@ -40,6 +41,8 @@ class Conf(ParseUtil):
self.password = password
self.charset = charset
ParseUtil.insert_to_obj(self, kwargs)
+ if 'adapter' not in kwargs.keys():
+ self.adapter = LanguageAdapter()
super(Conf, self).__init__()
def get(self):
diff --git a/CACodeFramework/MainWork/CACodePureORM.py b/cacode_framework/MainWork/CACodePureORM.py
similarity index 93%
rename from CACodeFramework/MainWork/CACodePureORM.py
rename to cacode_framework/MainWork/CACodePureORM.py
index 12d9b83..8b8daf4 100644
--- a/CACodeFramework/MainWork/CACodePureORM.py
+++ b/cacode_framework/MainWork/CACodePureORM.py
@@ -63,7 +63,8 @@ s """
# self.args.append(insert_str)
# self.args.append('{}{}'.format(self.__table_name__, left_par))
sql = self.ParseUtil.parse_insert_pojo(
- pojo, self.__table_name__.replace('`', ''))
+ pojo, self.__table_name__.replace('`', ''), insert_str=self.sqlFields.insert_str,
+ values_str=self.sqlFields.values_str)
self.args.append(sql['sql'])
self.params = sql['params']
@@ -169,7 +170,10 @@ s """
# 去掉末尾的逗号
self.rep_sym()
# 加上from关键字
- self.con_from()
+ if 'poly' not in kwargs.keys():
+ self.con_from()
+ else:
+ self.args += kwargs['poly']
return self
def order_by(self, *args):
@@ -320,7 +324,7 @@ s """
self.args.append(self.sqlFields.ander_str)
return self
- def run(self):
+ def run(self, need_sql=False):
"""
最终执行任务
"""
@@ -328,7 +332,9 @@ s """
conf = self.ParseUtil.get_dict()
print_sql = 'print_sql' in conf.keys() and conf['print_sql'] is True
last_id = 'last_id' in conf.keys() and conf['last_id'] is True
- sql += ' '.join(self.args)
+ sql += ''.join(self.args)
+ if need_sql:
+ return sql
if self.sqlFields.find_str in sql:
_result = self.repository.db_util.select(
sql=sql,
@@ -386,3 +392,23 @@ s """
def end(self):
return self.run()
+
+ def __rshift__(self, other):
+ """
+ 将左边orm迁移至右边
+ """
+ new_args = self.args.copy()
+ new_args.append(' ) ')
+ other.args.append(' ( ')
+ other.args += new_args
+ return other
+
+ def __lshift__(self, other):
+ """
+ 将右边迁移至左边
+ """
+ new_args = other.args.copy()
+ new_args.append(' ) ')
+ self.args.append(' ( ')
+ self.args = self.args + new_args
+ return self
diff --git a/CACodeFramework/MainWork/CACodeRepository.py b/cacode_framework/MainWork/CACodeRepository.py
similarity index 99%
rename from CACodeFramework/MainWork/CACodeRepository.py
rename to cacode_framework/MainWork/CACodeRepository.py
index a4829cd..33628cc 100644
--- a/CACodeFramework/MainWork/CACodeRepository.py
+++ b/cacode_framework/MainWork/CACodeRepository.py
@@ -319,7 +319,7 @@ class Repository:
:return:
"""
kwargs['config_obj'] = self.config_obj
- kwargs = self.ParseUtil.print_sql(**kwargs)
+ kwargs = self.ParseUtil.find_print_sql(**kwargs)
kwargs = self.ParseUtil.last_id(**kwargs)
return self.db_util.update(**kwargs)
@@ -333,7 +333,7 @@ class Repository:
params:需要填充的字段
:return rowcount,last_id if last_id=True
"""
- kwargs = self.ParseUtil.print_sql(**kwargs)
+ kwargs = self.ParseUtil.find_print_sql(**kwargs)
kwargs = self.ParseUtil.last_id(**kwargs)
return self.db_util.insert(**kwargs)
diff --git a/CACodeFramework/MainWork/__init__.py b/cacode_framework/MainWork/__init__.py
similarity index 100%
rename from CACodeFramework/MainWork/__init__.py
rename to cacode_framework/MainWork/__init__.py
diff --git a/CACodeFramework/__init__.py b/cacode_framework/__init__.py
similarity index 100%
rename from CACodeFramework/__init__.py
rename to cacode_framework/__init__.py
diff --git a/CACodeFramework/anno/__init__.py b/cacode_framework/anno/__init__.py
similarity index 100%
rename from CACodeFramework/anno/__init__.py
rename to cacode_framework/anno/__init__.py
diff --git a/CACodeFramework/anno/annos.py b/cacode_framework/anno/annos.py
similarity index 97%
rename from CACodeFramework/anno/annos.py
rename to cacode_framework/anno/annos.py
index 2107742..cf547dc 100644
--- a/CACodeFramework/anno/annos.py
+++ b/cacode_framework/anno/annos.py
@@ -67,7 +67,7 @@ def Select(sql, params=None):
new_args = parse_kwargs(params, kwargs)
result = obj.find_sql(sql=sql, params=new_args)
- from CACodeFramework.cacode.Serialize import QuerySet
+ from cacode_framework.cacode.Serialize import QuerySet
return QuerySet(obj, result)
return _wrapper_
@@ -170,7 +170,7 @@ def AopModel(before=None, after=None,
"""
# 得到对象组
- from CACodeFramework.MainWork.CACodeAopContainer import AopModelObject
+ from cacode_framework.MainWork.CACodeAopContainer import AopModelObject
aop_obj = AopModelObject(before, after,
before_args, before_kwargs,
after_args, after_kwargs)
diff --git a/CACodeFramework/cacode/Factory.py b/cacode_framework/cacode/Factory.py
similarity index 86%
rename from CACodeFramework/cacode/Factory.py
rename to cacode_framework/cacode/Factory.py
index 58a1515..31c3b5e 100644
--- a/CACodeFramework/cacode/Factory.py
+++ b/cacode_framework/cacode/Factory.py
@@ -1,10 +1,10 @@
import threading
-from CACodeFramework.cacode import Modes
-from CACodeFramework.exception import e_fields
-from CACodeFramework.exception.e_fields import ModuleCreateError
-from CACodeFramework.opera.CompulsoryRun import Compulsory
-from CACodeFramework.util.Log import CACodeLog
+from cacode_framework.cacode import Modes
+from cacode_framework.exception import e_fields
+from cacode_framework.exception.e_fields import ModuleCreateError
+from cacode_framework.opera.CompulsoryRun import Compulsory
+from cacode_framework.util.Log import CACodeLog
import importlib
@@ -36,8 +36,8 @@ class Factory(object):
CACodeLog.err(SyntaxError, e_fields.CACode_Factory_Error(
'Please import the Pojo module first,请先设置导入modules模块'))
- self.module_names = {}
- self.__base_init__()
+ self.module_names = self.modules
+ # self.__base_init__()
def __base_init__(self):
for package_name in self.modules:
@@ -61,9 +61,7 @@ class Factory(object):
创建一个实例对象,并提供ORM操作
- name使用包名最后一位置作为起始值,如:
-
- Test.models.Demo
+ name 使用自定义的键
那么,当你调用Demo下的model时,你必须使用`Demo.DemoTable`这种
diff --git a/CACodeFramework/cacode/Modes.py b/cacode_framework/cacode/Modes.py
similarity index 99%
rename from CACodeFramework/cacode/Modes.py
rename to cacode_framework/cacode/Modes.py
index ce07bb8..699e2d9 100644
--- a/CACodeFramework/cacode/Modes.py
+++ b/cacode_framework/cacode/Modes.py
@@ -295,7 +295,7 @@ if __name__ == '__main__':
"e": rep
}
result = Recursion.find_key_for_dict(data, "a")
- from CACodeFramework.cacode.Serialize import JsonUtil
+ from cacode_framework.cacode.Serialize import JsonUtil
print(JsonUtil.parse(result))
diff --git a/CACodeFramework/cacode/ReviewJson/JSON.py b/cacode_framework/cacode/ReviewJson/JSON.py
similarity index 100%
rename from CACodeFramework/cacode/ReviewJson/JSON.py
rename to cacode_framework/cacode/ReviewJson/JSON.py
diff --git a/CACodeFramework/cacode/ReviewJson/__init__.py b/cacode_framework/cacode/ReviewJson/__init__.py
similarity index 100%
rename from CACodeFramework/cacode/ReviewJson/__init__.py
rename to cacode_framework/cacode/ReviewJson/__init__.py
diff --git a/CACodeFramework/cacode/ReviewJson/_speedups.c b/cacode_framework/cacode/ReviewJson/_speedups.c
similarity index 100%
rename from CACodeFramework/cacode/ReviewJson/_speedups.c
rename to cacode_framework/cacode/ReviewJson/_speedups.c
diff --git a/CACodeFramework/cacode/ReviewJson/compat.py b/cacode_framework/cacode/ReviewJson/compat.py
similarity index 100%
rename from CACodeFramework/cacode/ReviewJson/compat.py
rename to cacode_framework/cacode/ReviewJson/compat.py
diff --git a/CACodeFramework/cacode/ReviewJson/decoder.py b/cacode_framework/cacode/ReviewJson/decoder.py
similarity index 100%
rename from CACodeFramework/cacode/ReviewJson/decoder.py
rename to cacode_framework/cacode/ReviewJson/decoder.py
diff --git a/CACodeFramework/cacode/ReviewJson/encoder.py b/cacode_framework/cacode/ReviewJson/encoder.py
similarity index 100%
rename from CACodeFramework/cacode/ReviewJson/encoder.py
rename to cacode_framework/cacode/ReviewJson/encoder.py
diff --git a/CACodeFramework/cacode/ReviewJson/errors.py b/cacode_framework/cacode/ReviewJson/errors.py
similarity index 100%
rename from CACodeFramework/cacode/ReviewJson/errors.py
rename to cacode_framework/cacode/ReviewJson/errors.py
diff --git a/CACodeFramework/cacode/ReviewJson/ordered_dict.py b/cacode_framework/cacode/ReviewJson/ordered_dict.py
similarity index 100%
rename from CACodeFramework/cacode/ReviewJson/ordered_dict.py
rename to cacode_framework/cacode/ReviewJson/ordered_dict.py
diff --git a/CACodeFramework/cacode/ReviewJson/raw_json.py b/cacode_framework/cacode/ReviewJson/raw_json.py
similarity index 100%
rename from CACodeFramework/cacode/ReviewJson/raw_json.py
rename to cacode_framework/cacode/ReviewJson/raw_json.py
diff --git a/CACodeFramework/cacode/ReviewJson/scanner.py b/cacode_framework/cacode/ReviewJson/scanner.py
similarity index 100%
rename from CACodeFramework/cacode/ReviewJson/scanner.py
rename to cacode_framework/cacode/ReviewJson/scanner.py
diff --git a/CACodeFramework/cacode/ReviewJson/tool.py b/cacode_framework/cacode/ReviewJson/tool.py
similarity index 100%
rename from CACodeFramework/cacode/ReviewJson/tool.py
rename to cacode_framework/cacode/ReviewJson/tool.py
diff --git a/CACodeFramework/cacode/Serialize.py b/cacode_framework/cacode/Serialize.py
similarity index 98%
rename from CACodeFramework/cacode/Serialize.py
rename to cacode_framework/cacode/Serialize.py
index f676361..cb2ee3e 100644
--- a/CACodeFramework/cacode/Serialize.py
+++ b/cacode_framework/cacode/Serialize.py
@@ -15,9 +15,9 @@
# CACode 1.2 2021/4/27 统一序列化器位置
# ------------------------------------------------------------------
-from CACodeFramework.cacode.ReviewJson.JSON import Json
-from CACodeFramework.util.Log import CACodeLog
-from CACodeFramework.cacode import ReviewJson
+from cacode_framework.cacode.ReviewJson.JSON import Json
+from cacode_framework.util.Log import CACodeLog
+from cacode_framework.cacode import ReviewJson
from datetime import date, datetime
import functools
@@ -265,7 +265,7 @@ class QuerySet(list):
初始化数据源
"""
list.__init__([])
- if not query_items:
+ if query_items is None:
self.__instance__ = instance
self.__using_fields__ = self.__instance__.getFields()
@@ -342,6 +342,11 @@ class QuerySet(list):
"""
return self[index]
+ def __str__(self):
+ return str(self.to_dict())
+
+ __repr__ = __str__
+
#
# class QueryItem(JsonUtil):
diff --git a/CACodeFramework/cacode/__init__.py b/cacode_framework/cacode/__init__.py
similarity index 100%
rename from CACodeFramework/cacode/__init__.py
rename to cacode_framework/cacode/__init__.py
diff --git a/CACodeFramework/exception/__init__.py b/cacode_framework/exception/__init__.py
similarity index 100%
rename from CACodeFramework/exception/__init__.py
rename to cacode_framework/exception/__init__.py
diff --git a/CACodeFramework/exception/e_fields.py b/cacode_framework/exception/e_fields.py
similarity index 100%
rename from CACodeFramework/exception/e_fields.py
rename to cacode_framework/exception/e_fields.py
diff --git a/CACodeFramework/field/FManage.py b/cacode_framework/field/FManage.py
similarity index 100%
rename from CACodeFramework/field/FManage.py
rename to cacode_framework/field/FManage.py
diff --git a/CACodeFramework/field/MySqlDefault.py b/cacode_framework/field/MySqlDefault.py
similarity index 96%
rename from CACodeFramework/field/MySqlDefault.py
rename to cacode_framework/field/MySqlDefault.py
index 79b0674..e1b8a1b 100644
--- a/CACodeFramework/field/MySqlDefault.py
+++ b/cacode_framework/field/MySqlDefault.py
@@ -23,6 +23,13 @@ class MySqlFields_Default:
"""
return '`'
+ @property
+ def space(self):
+ """
+ 空格
+ """
+ return ' '
+
@property
def right_subscript(self):
"""
diff --git a/CACodeFramework/field/__init__.py b/cacode_framework/field/__init__.py
similarity index 100%
rename from CACodeFramework/field/__init__.py
rename to cacode_framework/field/__init__.py
diff --git a/CACodeFramework/opera/CompulsoryRun.py b/cacode_framework/opera/CompulsoryRun.py
similarity index 91%
rename from CACodeFramework/opera/CompulsoryRun.py
rename to cacode_framework/opera/CompulsoryRun.py
index 5e34abd..49c4317 100644
--- a/CACodeFramework/opera/CompulsoryRun.py
+++ b/cacode_framework/opera/CompulsoryRun.py
@@ -33,8 +33,8 @@ class Compulsory(object):
深度搜素树
"""
- from CACodeFramework.exception import e_fields
- from CACodeFramework.util.Log import CACodeLog
+ from cacode_framework.exception import e_fields
+ from cacode_framework.util.Log import CACodeLog
if len(target_names) == 0:
return module
diff --git a/CACodeFramework/opera/__init__.py b/cacode_framework/opera/__init__.py
similarity index 100%
rename from CACodeFramework/opera/__init__.py
rename to cacode_framework/opera/__init__.py
diff --git a/CACodeFramework/opera/op_db.py b/cacode_framework/opera/op_db.py
similarity index 89%
rename from CACodeFramework/opera/op_db.py
rename to cacode_framework/opera/op_db.py
index cb4e419..71602d7 100644
--- a/CACodeFramework/opera/op_db.py
+++ b/cacode_framework/opera/op_db.py
@@ -1,11 +1,11 @@
import threading
-from CACodeFramework.cacode.Modes import Recursion
-from CACodeFramework.cacode.Serialize import JsonUtil
-from CACodeFramework.util.Log import CACodeLog
+from cacode_framework.cacode.Modes import Recursion
+from cacode_framework.cacode.Serialize import JsonUtil
+from cacode_framework.util.Log import CACodeLog
-from CACodeFramework.field.MySqlDefault import *
-from CACodeFramework.util.ParseUtil import ParseUtil
+from cacode_framework.field.MySqlDefault import *
+from cacode_framework.util.ParseUtil import ParseUtil
class DbOperation(object):
@@ -57,7 +57,7 @@ class DbOperation(object):
任务方法
"""
- fields = ParseUtil(*args, is_field=True).parse_key()
+ fields = ParseUtil().parse_key(*args, is_field=True)
sql_str = kwargs['sqlFields'].find_str + fields + kwargs['sqlFields'].from_str + kwargs['__table_name__']
kwargs['sql'] = sql_str
self.result = self.__find_many__(**kwargs)
@@ -69,7 +69,7 @@ class DbOperation(object):
任务方法
"""
# kwargs['conf_obj'] = config_obj
- kwargs = ParseUtil.print_sql(**kwargs)
+ kwargs = ParseUtil.find_print_sql(**kwargs)
self.result = self.__find_sql__(**kwargs)
return self.result
@@ -78,7 +78,7 @@ class DbOperation(object):
任务方法
"""
- kwargs = ParseUtil.print_sql(**kwargs)
+ kwargs = ParseUtil.find_print_sql(**kwargs)
_rs = kwargs['db_util'].select(**kwargs)
self.result = []
@@ -93,7 +93,7 @@ class DbOperation(object):
:param pojo: pojo对象
任务方法
"""
- kwargs = ParseUtil.print_sql(**kwargs)
+ kwargs = ParseUtil.find_print_sql(**kwargs)
kwargs = ParseUtil.last_id(**kwargs)
ParseUtil.fieldExist(kwargs, 'pojo', raise_exception=True)
diff --git a/CACodeFramework/pojoManager/Manage.py b/cacode_framework/pojoManager/Manage.py
similarity index 80%
rename from CACodeFramework/pojoManager/Manage.py
rename to cacode_framework/pojoManager/Manage.py
index 852faac..37e1b2a 100644
--- a/CACodeFramework/pojoManager/Manage.py
+++ b/cacode_framework/pojoManager/Manage.py
@@ -1,9 +1,9 @@
-from CACodeFramework.MainWork.CACodePureORM import CACodePureORM
-from CACodeFramework.cacode.Serialize import QuerySet
-from CACodeFramework.pojoManager import tag
-from CACodeFramework.cacode.Serialize import JsonUtil
-from CACodeFramework.MainWork import CACodeRepository
-from CACodeFramework.util.Log import CACodeLog
+from cacode_framework.MainWork.CACodePureORM import CACodePureORM
+from cacode_framework.cacode.Serialize import QuerySet
+from cacode_framework.pojoManager import tag
+from cacode_framework.cacode.Serialize import JsonUtil
+from cacode_framework.MainWork import CACodeRepository
+from cacode_framework.util.Log import CACodeLog
class Pojo(CACodeRepository.Repository):
@@ -25,15 +25,15 @@ class Pojo(CACodeRepository.Repository):
self.__table_name__ = self.__table_name__
self.__table_msg__ = self.__table_msg__
self.__fields__ = {}
- self.init_fields()
- for key, value in kwargs.items():
- self.__setattr__(key, value)
# 在这里将config_obj实例化
self.serializer = serializer
# 忽略的字段
self.__ignore_field__ = {}
# 添加的字段
self.__append_field__ = {}
+ self.init_fields()
+ for key, value in kwargs.items():
+ self.__setattr__(key, value)
super(Pojo, self).__init__(config_obj=config_obj,
instance=self,
log_conf=log_conf,
@@ -51,8 +51,10 @@ class Pojo(CACodeRepository.Repository):
# 取出这个值引用对象的父类
try:
t_v = value.__class__.__base__
- if t_v == tag.Template or t_v == tag.baseTag:
- fds[key] = value
+ if t_v in [tag.Template, tag.baseTag]:
+ if not hasattr(self, key) or getattr(self, key) is None or t_v in [tag.Template, tag.baseTag]:
+ setattr(self, key, value.default)
+ fds[key] = value if value.default is None else value.default
except SyntaxError as a:
continue
@@ -129,24 +131,6 @@ class Pojo(CACodeRepository.Repository):
self.__fields__['ig'] = []
self.format(key, name)
- @staticmethod
- def add_field(self, key, default_value=None):
- """
- 添加一个不会被解析忽略的字段
- """
- if key not in self.append_field.keys() and \
- key not in self.using_fields.keys():
-
- self.append_field[key] = default_value
- else:
- CACodeLog.log(obj=self, msg='`{}` already exists'.format(key))
-
- def remove_field(self, key):
- """
- 添加一个会被解析忽略的字段
- """
- self.ignore_field[key] = None
-
def __str__(self):
"""
默认显示表名称
diff --git a/CACodeFramework/pojoManager/__init__.py b/cacode_framework/pojoManager/__init__.py
similarity index 100%
rename from CACodeFramework/pojoManager/__init__.py
rename to cacode_framework/pojoManager/__init__.py
diff --git a/CACodeFramework/pojoManager/tag.py b/cacode_framework/pojoManager/tag.py
similarity index 95%
rename from CACodeFramework/pojoManager/tag.py
rename to cacode_framework/pojoManager/tag.py
index 34dfcc1..2daca82 100644
--- a/CACodeFramework/pojoManager/tag.py
+++ b/cacode_framework/pojoManager/tag.py
@@ -1,6 +1,6 @@
import datetime
-from CACodeFramework.cacode.Serialize import JsonUtil
+from cacode_framework.cacode.Serialize import JsonUtil
"""
这个文件用来为pojo对象做标记,当对象为空或为以下任意类型时
@@ -36,8 +36,12 @@ class baseTag(object):
"""
# 是否为随着时间而更新
self.update_auto_time = update_auto_time
+ if update_auto_time:
+ self.default = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
# 是否自动设置为当前时间
self.auto_time = auto_time
+ if auto_time:
+ self.default = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
# 是否为自增
self.autoField = auto_field
# 注释
diff --git a/CACodeFramework/util/DBPool/__init__.py b/cacode_framework/util/DBPool/__init__.py
similarity index 100%
rename from CACodeFramework/util/DBPool/__init__.py
rename to cacode_framework/util/DBPool/__init__.py
diff --git a/CACodeFramework/util/DBPool/persistent_db.py b/cacode_framework/util/DBPool/persistent_db.py
similarity index 100%
rename from CACodeFramework/util/DBPool/persistent_db.py
rename to cacode_framework/util/DBPool/persistent_db.py
diff --git a/CACodeFramework/util/DBPool/persistent_pg.py b/cacode_framework/util/DBPool/persistent_pg.py
similarity index 100%
rename from CACodeFramework/util/DBPool/persistent_pg.py
rename to cacode_framework/util/DBPool/persistent_pg.py
diff --git a/CACodeFramework/util/DBPool/pooled_db.py b/cacode_framework/util/DBPool/pooled_db.py
similarity index 100%
rename from CACodeFramework/util/DBPool/pooled_db.py
rename to cacode_framework/util/DBPool/pooled_db.py
diff --git a/CACodeFramework/util/DBPool/pooled_pg.py b/cacode_framework/util/DBPool/pooled_pg.py
similarity index 100%
rename from CACodeFramework/util/DBPool/pooled_pg.py
rename to cacode_framework/util/DBPool/pooled_pg.py
diff --git a/CACodeFramework/util/DBPool/simple_pooled_db.py b/cacode_framework/util/DBPool/simple_pooled_db.py
similarity index 100%
rename from CACodeFramework/util/DBPool/simple_pooled_db.py
rename to cacode_framework/util/DBPool/simple_pooled_db.py
diff --git a/CACodeFramework/util/DBPool/simple_pooled_pg.py b/cacode_framework/util/DBPool/simple_pooled_pg.py
similarity index 100%
rename from CACodeFramework/util/DBPool/simple_pooled_pg.py
rename to cacode_framework/util/DBPool/simple_pooled_pg.py
diff --git a/CACodeFramework/util/DBPool/steady_db.py b/cacode_framework/util/DBPool/steady_db.py
similarity index 100%
rename from CACodeFramework/util/DBPool/steady_db.py
rename to cacode_framework/util/DBPool/steady_db.py
diff --git a/CACodeFramework/util/DBPool/steady_pg.py b/cacode_framework/util/DBPool/steady_pg.py
similarity index 100%
rename from CACodeFramework/util/DBPool/steady_pg.py
rename to cacode_framework/util/DBPool/steady_pg.py
diff --git a/CACodeFramework/util/DbUtil.py b/cacode_framework/util/DbUtil.py
similarity index 93%
rename from CACodeFramework/util/DbUtil.py
rename to cacode_framework/util/DbUtil.py
index 5d2481f..ac12ecf 100644
--- a/CACodeFramework/util/DbUtil.py
+++ b/cacode_framework/util/DbUtil.py
@@ -1,9 +1,9 @@
import sys
import threading
-from CACodeFramework.cacode.Modes import Singleton
-from CACodeFramework.util.DBPool.pooled_db import PooledDB
-from CACodeFramework.util.Log import CACodeLog
+from cacode_framework.cacode.Modes import Singleton
+from cacode_framework.util.DBPool.pooled_db import PooledDB
+from cacode_framework.util.Log import CACodeLog
def parse_kwa(db, **kwargs):
@@ -183,6 +183,9 @@ class Db_opera(object):
return _result
except Exception as e:
db.rollback()
+ CACodeLog.log_error(obj=e.__class__, msg=e.__str__(),
+ LogObject=kwargs['logObject'] if 'logObject' in kwargs.keys() else None,
+ raise_exception=True)
raise e
finally:
db.close()
@@ -212,7 +215,9 @@ class Db_opera(object):
return rowcount
except Exception as e:
db.rollback()
- raise e
+ CACodeLog.log_error(obj=e.__class__, msg=e.__str__(),
+ LogObject=kwargs['logObject'] if 'logObject' in kwargs.keys() else None,
+ raise_exception=True)
finally:
db.close()
diff --git a/CACodeFramework/util/Log.py b/cacode_framework/util/Log.py
similarity index 98%
rename from CACodeFramework/util/Log.py
rename to cacode_framework/util/Log.py
index 000a68e..eaa748c 100644
--- a/CACodeFramework/util/Log.py
+++ b/cacode_framework/util/Log.py
@@ -4,8 +4,8 @@ import re
import sys
import time
import threading
-from CACodeFramework.cacode.Modes import Singleton
-from CACodeFramework.exception import e_fields
+from cacode_framework.cacode.Modes import Singleton
+from cacode_framework.exception import e_fields
class FieldsLength:
diff --git a/CACodeFramework/util/ParseUtil.py b/cacode_framework/util/ParseUtil.py
similarity index 98%
rename from CACodeFramework/util/ParseUtil.py
rename to cacode_framework/util/ParseUtil.py
index 0b7248e..169f8db 100644
--- a/CACodeFramework/util/ParseUtil.py
+++ b/cacode_framework/util/ParseUtil.py
@@ -181,7 +181,7 @@ class ParseUtil(object):
return kwargs
@staticmethod
- def print_sql(**kwargs):
+ def find_print_sql(**kwargs):
"""
遵循规则:
内部>配置文件
@@ -231,7 +231,8 @@ class ParseUtil(object):
"""
try:
t_v = __val.__class__.__base__
- return t_v == tag.Template or t_v == tag.baseTag
+ if t_v in [tag.Template, tag.baseTag]:
+ return __val.default is None
except SyntaxError:
return False
diff --git a/CACodeFramework/util/__init__.py b/cacode_framework/util/__init__.py
similarity index 100%
rename from CACodeFramework/util/__init__.py
rename to cacode_framework/util/__init__.py
diff --git a/setup.py b/setup.py
index 88d7fb5..1361e63 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
setuptools.setup(
name="cacode_framework",
- version="1.3.1.2",
+ version="1.0.0",
author="CACode",
author_email="cacode@163.com",
description="CACode Framework For Python Flask,This framework corresponds to the ORM problem,You can see:https://gitee.com/cacode_cctvadmin/CACodeFramework-python-ORM",
diff --git a/test/README.md b/test/README.md
deleted file mode 100644
index 3db0777..0000000
--- a/test/README.md
+++ /dev/null
@@ -1,42 +0,0 @@
-
-# 快速开始
-```
-pip install cacode_framework
-```
-## 版本要求
-```
-python>=3.6
-```
-
-# 入门
-此框架适用于大部分数据库和web架构,入门门槛需要熟悉python语法即可
-## 定义一张表
-
-创建一个名为`demo`数据库
-使用mysql命令行工具或者navicat执行以下sql语句,推荐使用navicat
-
-```
-CREATE DATABASE demo
-```
-
-然后创建一张名为`demo_table`的表
-```
-SET NAMES utf8mb4;
-SET FOREIGN_KEY_CHECKS = 0;
-DROP TABLE IF EXISTS `demo_table`;
-CREATE TABLE `demo_table` (
- `t_id` int NOT NULL AUTO_INCREMENT,
- `t_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
- `t_pwd` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
- `t_msg` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
- `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP,
- `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- PRIMARY KEY (`t_id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 1000000 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-
-SET FOREIGN_KEY_CHECKS = 1;
-
-```
\ No newline at end of file
diff --git a/test/b.html b/test/b.html
deleted file mode 100644
index ab68fa5..0000000
--- a/test/b.html
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Please wait...
-
-
-
-
-
\ No newline at end of file
diff --git a/test/modules/DatabaseConf.py b/test/modules/DatabaseConf.py
index 036de55..d437864 100644
--- a/test/modules/DatabaseConf.py
+++ b/test/modules/DatabaseConf.py
@@ -1,8 +1,8 @@
import pymssql
import pymysql
-from CACodeFramework.MainWork import CACodeConfig
-from CACodeFramework.MainWork.CACodeAdapter import LanguageAdapter
+from cacode_framework.MainWork import CACodeConfig
+from cacode_framework.MainWork.CACodeAdapter import LanguageAdapter
class Adapter(LanguageAdapter):
diff --git a/test/modules/MySqlTest.py b/test/modules/MySqlTest.py
index 5f281e3..a511ca7 100644
--- a/test/modules/MySqlTest.py
+++ b/test/modules/MySqlTest.py
@@ -1,8 +1,8 @@
import datetime
-from CACodeFramework.anno.annos import Table, Select
-from CACodeFramework.pojoManager import Manage
-from CACodeFramework.pojoManager.Manage import Pojo
+from cacode_framework.anno.annos import Table, Select
+from cacode_framework.pojoManager import Manage
+from cacode_framework.pojoManager.Manage import Pojo
from test.modules.DatabaseConf import MySqlConfig
diff --git a/test/modules/SqlServerTest.py b/test/modules/SqlServerTest.py
index 3e0542c..d66ef14 100644
--- a/test/modules/SqlServerTest.py
+++ b/test/modules/SqlServerTest.py
@@ -3,9 +3,9 @@
# @Author: CACode
# @File: SqlServerTest.py
# @Software: PyCharm
-from CACodeFramework.anno.annos import Table
-from CACodeFramework.pojoManager import Manage
-from CACodeFramework.pojoManager.Manage import Pojo
+from cacode_framework.anno.annos import Table
+from cacode_framework.pojoManager import Manage
+from cacode_framework.pojoManager.Manage import Pojo
from test.modules.DatabaseConf import SqlServerConfig
diff --git a/test/testFunc.py b/test/testFunc.py
index 1ec8a7e..259b4f3 100644
--- a/test/testFunc.py
+++ b/test/testFunc.py
@@ -7,30 +7,31 @@ Description: Update Test
'''
import time
-from CACodeFramework.cacode.Factory import Factory
-from CACodeFramework.util.Log import CACodeLog
+from cacode_framework.cacode.Factory import Factory
+from cacode_framework.util.Log import CACodeLog
class MyFactory(Factory):
- modules = [
- 'test.modules.Demo',
- 'test.modules.MySqlTest',
- 'test.modules.SqlServerTest',
- ]
+ modules = {
+ "demo": 'test.modules.Demo',
+ "mysql_test": 'test.modules.MySqlTest',
+ "sqlserver_test": 'test.modules.SqlServerTest',
+ }
def set_many():
a = []
for i in range(0, 100 * 10000):
a.append(
- MyFactory.createInstance('SqlServerTest.DemoTable', t_msg=f'测试msg{i}', t_name=f'测试name{i}',
+ MyFactory.createInstance('sqlserver_test.DemoTable', t_msg=f'测试msg{i}', t_name=f'测试name{i}',
t_pwd=f'测试pwd{i}',
abs=True))
return a
def TestMySql():
- demoTable = MyFactory.createInstance('MySqlTest.DemoTable')
+ demoTable = MyFactory.createInstance('mysql_test.DemoTable')
+ d_2 = MyFactory.createInstance('mysql_test.DemoTable')
# result = demoTable.find_all()
# test_data = set_many()
t = time.time()
@@ -38,8 +39,11 @@ def TestMySql():
# result = demoTable.find_by_id(t_id=10)
# page = result.page(7)
# result = page.to_dict()
- result = demoTable.orm.find().where(t_id__in=[1, 2, 3, 4, 5, 6, 7, 8, 9]).end()
- info(result.to_json(True))
+ result = demoTable.orm.find().where(t_id__in=[1, 2, 3, 4, 5, 6, 7, 8, 9])
+ r_2 = d_2.orm.find(poly=[' FROM '])
+ var = r_2 << result
+ info(var.append(' a').end())
+ # info(result.to_json(True))
# info(f'count:{len(result)}')
info(f'application run time:{time.time() - t}')
# warn(result)
@@ -55,6 +59,6 @@ if __name__ == '__main__':
info = CACodeLog.log
warn = CACodeLog.warning
t1 = time.time()
- TestSqlServer()
- # TestMySql()
+ # TestSqlServer()
+ TestMySql()
info(f'time:{time.time() - t1}')
--
Gitee
From fc8d1755acf15a5ed823f1412cb9ad8d10ee3acb Mon Sep 17 00:00:00 2001
From: CACode <54068986+cctvadmin@users.noreply.github.com>
Date: Mon, 17 May 2021 08:36:14 +0800
Subject: [PATCH 11/26] On branch cacode
---
{CACodeFramework => cacode_framework}/MainWork/CACodeAdapter.py | 0
.../MainWork/CACodeAopContainer.py | 0
{CACodeFramework => cacode_framework}/MainWork/CACodeConfig.py | 0
{CACodeFramework => cacode_framework}/MainWork/CACodePureORM.py | 0
.../MainWork/CACodeRepository.py | 0
{CACodeFramework => cacode_framework}/MainWork/__init__.py | 0
{CACodeFramework => cacode_framework}/__init__.py | 0
{CACodeFramework => cacode_framework}/anno/__init__.py | 0
{CACodeFramework => cacode_framework}/anno/annos.py | 0
{CACodeFramework => cacode_framework}/cacode/Factory.py | 0
{CACodeFramework => cacode_framework}/cacode/Modes.py | 0
{CACodeFramework => cacode_framework}/cacode/ReviewJson/JSON.py | 0
.../cacode/ReviewJson/__init__.py | 0
.../cacode/ReviewJson/_speedups.c | 0
{CACodeFramework => cacode_framework}/cacode/ReviewJson/compat.py | 0
.../cacode/ReviewJson/decoder.py | 0
.../cacode/ReviewJson/encoder.py | 0
{CACodeFramework => cacode_framework}/cacode/ReviewJson/errors.py | 0
.../cacode/ReviewJson/ordered_dict.py | 0
.../cacode/ReviewJson/raw_json.py | 0
.../cacode/ReviewJson/scanner.py | 0
{CACodeFramework => cacode_framework}/cacode/ReviewJson/tool.py | 0
{CACodeFramework => cacode_framework}/cacode/Serialize.py | 0
{CACodeFramework => cacode_framework}/cacode/__init__.py | 0
{CACodeFramework => cacode_framework}/exception/__init__.py | 0
{CACodeFramework => cacode_framework}/exception/e_fields.py | 0
{CACodeFramework => cacode_framework}/field/FManage.py | 0
{CACodeFramework => cacode_framework}/field/MySqlDefault.py | 0
{CACodeFramework => cacode_framework}/field/__init__.py | 0
{CACodeFramework => cacode_framework}/opera/CompulsoryRun.py | 0
{CACodeFramework => cacode_framework}/opera/__init__.py | 0
{CACodeFramework => cacode_framework}/opera/op_db.py | 0
{CACodeFramework => cacode_framework}/pojoManager/Manage.py | 0
{CACodeFramework => cacode_framework}/pojoManager/__init__.py | 0
{CACodeFramework => cacode_framework}/pojoManager/tag.py | 0
{CACodeFramework => cacode_framework}/util/DBPool/__init__.py | 0
.../util/DBPool/persistent_db.py | 0
.../util/DBPool/persistent_pg.py | 0
{CACodeFramework => cacode_framework}/util/DBPool/pooled_db.py | 0
{CACodeFramework => cacode_framework}/util/DBPool/pooled_pg.py | 0
.../util/DBPool/simple_pooled_db.py | 0
.../util/DBPool/simple_pooled_pg.py | 0
{CACodeFramework => cacode_framework}/util/DBPool/steady_db.py | 0
{CACodeFramework => cacode_framework}/util/DBPool/steady_pg.py | 0
{CACodeFramework => cacode_framework}/util/DbUtil.py | 0
{CACodeFramework => cacode_framework}/util/Log.py | 0
{CACodeFramework => cacode_framework}/util/ParseUtil.py | 0
{CACodeFramework => cacode_framework}/util/__init__.py | 0
48 files changed, 0 insertions(+), 0 deletions(-)
rename {CACodeFramework => cacode_framework}/MainWork/CACodeAdapter.py (100%)
rename {CACodeFramework => cacode_framework}/MainWork/CACodeAopContainer.py (100%)
rename {CACodeFramework => cacode_framework}/MainWork/CACodeConfig.py (100%)
rename {CACodeFramework => cacode_framework}/MainWork/CACodePureORM.py (100%)
rename {CACodeFramework => cacode_framework}/MainWork/CACodeRepository.py (100%)
rename {CACodeFramework => cacode_framework}/MainWork/__init__.py (100%)
rename {CACodeFramework => cacode_framework}/__init__.py (100%)
rename {CACodeFramework => cacode_framework}/anno/__init__.py (100%)
rename {CACodeFramework => cacode_framework}/anno/annos.py (100%)
rename {CACodeFramework => cacode_framework}/cacode/Factory.py (100%)
rename {CACodeFramework => cacode_framework}/cacode/Modes.py (100%)
rename {CACodeFramework => cacode_framework}/cacode/ReviewJson/JSON.py (100%)
rename {CACodeFramework => cacode_framework}/cacode/ReviewJson/__init__.py (100%)
rename {CACodeFramework => cacode_framework}/cacode/ReviewJson/_speedups.c (100%)
rename {CACodeFramework => cacode_framework}/cacode/ReviewJson/compat.py (100%)
rename {CACodeFramework => cacode_framework}/cacode/ReviewJson/decoder.py (100%)
rename {CACodeFramework => cacode_framework}/cacode/ReviewJson/encoder.py (100%)
rename {CACodeFramework => cacode_framework}/cacode/ReviewJson/errors.py (100%)
rename {CACodeFramework => cacode_framework}/cacode/ReviewJson/ordered_dict.py (100%)
rename {CACodeFramework => cacode_framework}/cacode/ReviewJson/raw_json.py (100%)
rename {CACodeFramework => cacode_framework}/cacode/ReviewJson/scanner.py (100%)
rename {CACodeFramework => cacode_framework}/cacode/ReviewJson/tool.py (100%)
rename {CACodeFramework => cacode_framework}/cacode/Serialize.py (100%)
rename {CACodeFramework => cacode_framework}/cacode/__init__.py (100%)
rename {CACodeFramework => cacode_framework}/exception/__init__.py (100%)
rename {CACodeFramework => cacode_framework}/exception/e_fields.py (100%)
rename {CACodeFramework => cacode_framework}/field/FManage.py (100%)
rename {CACodeFramework => cacode_framework}/field/MySqlDefault.py (100%)
rename {CACodeFramework => cacode_framework}/field/__init__.py (100%)
rename {CACodeFramework => cacode_framework}/opera/CompulsoryRun.py (100%)
rename {CACodeFramework => cacode_framework}/opera/__init__.py (100%)
rename {CACodeFramework => cacode_framework}/opera/op_db.py (100%)
rename {CACodeFramework => cacode_framework}/pojoManager/Manage.py (100%)
rename {CACodeFramework => cacode_framework}/pojoManager/__init__.py (100%)
rename {CACodeFramework => cacode_framework}/pojoManager/tag.py (100%)
rename {CACodeFramework => cacode_framework}/util/DBPool/__init__.py (100%)
rename {CACodeFramework => cacode_framework}/util/DBPool/persistent_db.py (100%)
rename {CACodeFramework => cacode_framework}/util/DBPool/persistent_pg.py (100%)
rename {CACodeFramework => cacode_framework}/util/DBPool/pooled_db.py (100%)
rename {CACodeFramework => cacode_framework}/util/DBPool/pooled_pg.py (100%)
rename {CACodeFramework => cacode_framework}/util/DBPool/simple_pooled_db.py (100%)
rename {CACodeFramework => cacode_framework}/util/DBPool/simple_pooled_pg.py (100%)
rename {CACodeFramework => cacode_framework}/util/DBPool/steady_db.py (100%)
rename {CACodeFramework => cacode_framework}/util/DBPool/steady_pg.py (100%)
rename {CACodeFramework => cacode_framework}/util/DbUtil.py (100%)
rename {CACodeFramework => cacode_framework}/util/Log.py (100%)
rename {CACodeFramework => cacode_framework}/util/ParseUtil.py (100%)
rename {CACodeFramework => cacode_framework}/util/__init__.py (100%)
diff --git a/CACodeFramework/MainWork/CACodeAdapter.py b/cacode_framework/MainWork/CACodeAdapter.py
similarity index 100%
rename from CACodeFramework/MainWork/CACodeAdapter.py
rename to cacode_framework/MainWork/CACodeAdapter.py
diff --git a/CACodeFramework/MainWork/CACodeAopContainer.py b/cacode_framework/MainWork/CACodeAopContainer.py
similarity index 100%
rename from CACodeFramework/MainWork/CACodeAopContainer.py
rename to cacode_framework/MainWork/CACodeAopContainer.py
diff --git a/CACodeFramework/MainWork/CACodeConfig.py b/cacode_framework/MainWork/CACodeConfig.py
similarity index 100%
rename from CACodeFramework/MainWork/CACodeConfig.py
rename to cacode_framework/MainWork/CACodeConfig.py
diff --git a/CACodeFramework/MainWork/CACodePureORM.py b/cacode_framework/MainWork/CACodePureORM.py
similarity index 100%
rename from CACodeFramework/MainWork/CACodePureORM.py
rename to cacode_framework/MainWork/CACodePureORM.py
diff --git a/CACodeFramework/MainWork/CACodeRepository.py b/cacode_framework/MainWork/CACodeRepository.py
similarity index 100%
rename from CACodeFramework/MainWork/CACodeRepository.py
rename to cacode_framework/MainWork/CACodeRepository.py
diff --git a/CACodeFramework/MainWork/__init__.py b/cacode_framework/MainWork/__init__.py
similarity index 100%
rename from CACodeFramework/MainWork/__init__.py
rename to cacode_framework/MainWork/__init__.py
diff --git a/CACodeFramework/__init__.py b/cacode_framework/__init__.py
similarity index 100%
rename from CACodeFramework/__init__.py
rename to cacode_framework/__init__.py
diff --git a/CACodeFramework/anno/__init__.py b/cacode_framework/anno/__init__.py
similarity index 100%
rename from CACodeFramework/anno/__init__.py
rename to cacode_framework/anno/__init__.py
diff --git a/CACodeFramework/anno/annos.py b/cacode_framework/anno/annos.py
similarity index 100%
rename from CACodeFramework/anno/annos.py
rename to cacode_framework/anno/annos.py
diff --git a/CACodeFramework/cacode/Factory.py b/cacode_framework/cacode/Factory.py
similarity index 100%
rename from CACodeFramework/cacode/Factory.py
rename to cacode_framework/cacode/Factory.py
diff --git a/CACodeFramework/cacode/Modes.py b/cacode_framework/cacode/Modes.py
similarity index 100%
rename from CACodeFramework/cacode/Modes.py
rename to cacode_framework/cacode/Modes.py
diff --git a/CACodeFramework/cacode/ReviewJson/JSON.py b/cacode_framework/cacode/ReviewJson/JSON.py
similarity index 100%
rename from CACodeFramework/cacode/ReviewJson/JSON.py
rename to cacode_framework/cacode/ReviewJson/JSON.py
diff --git a/CACodeFramework/cacode/ReviewJson/__init__.py b/cacode_framework/cacode/ReviewJson/__init__.py
similarity index 100%
rename from CACodeFramework/cacode/ReviewJson/__init__.py
rename to cacode_framework/cacode/ReviewJson/__init__.py
diff --git a/CACodeFramework/cacode/ReviewJson/_speedups.c b/cacode_framework/cacode/ReviewJson/_speedups.c
similarity index 100%
rename from CACodeFramework/cacode/ReviewJson/_speedups.c
rename to cacode_framework/cacode/ReviewJson/_speedups.c
diff --git a/CACodeFramework/cacode/ReviewJson/compat.py b/cacode_framework/cacode/ReviewJson/compat.py
similarity index 100%
rename from CACodeFramework/cacode/ReviewJson/compat.py
rename to cacode_framework/cacode/ReviewJson/compat.py
diff --git a/CACodeFramework/cacode/ReviewJson/decoder.py b/cacode_framework/cacode/ReviewJson/decoder.py
similarity index 100%
rename from CACodeFramework/cacode/ReviewJson/decoder.py
rename to cacode_framework/cacode/ReviewJson/decoder.py
diff --git a/CACodeFramework/cacode/ReviewJson/encoder.py b/cacode_framework/cacode/ReviewJson/encoder.py
similarity index 100%
rename from CACodeFramework/cacode/ReviewJson/encoder.py
rename to cacode_framework/cacode/ReviewJson/encoder.py
diff --git a/CACodeFramework/cacode/ReviewJson/errors.py b/cacode_framework/cacode/ReviewJson/errors.py
similarity index 100%
rename from CACodeFramework/cacode/ReviewJson/errors.py
rename to cacode_framework/cacode/ReviewJson/errors.py
diff --git a/CACodeFramework/cacode/ReviewJson/ordered_dict.py b/cacode_framework/cacode/ReviewJson/ordered_dict.py
similarity index 100%
rename from CACodeFramework/cacode/ReviewJson/ordered_dict.py
rename to cacode_framework/cacode/ReviewJson/ordered_dict.py
diff --git a/CACodeFramework/cacode/ReviewJson/raw_json.py b/cacode_framework/cacode/ReviewJson/raw_json.py
similarity index 100%
rename from CACodeFramework/cacode/ReviewJson/raw_json.py
rename to cacode_framework/cacode/ReviewJson/raw_json.py
diff --git a/CACodeFramework/cacode/ReviewJson/scanner.py b/cacode_framework/cacode/ReviewJson/scanner.py
similarity index 100%
rename from CACodeFramework/cacode/ReviewJson/scanner.py
rename to cacode_framework/cacode/ReviewJson/scanner.py
diff --git a/CACodeFramework/cacode/ReviewJson/tool.py b/cacode_framework/cacode/ReviewJson/tool.py
similarity index 100%
rename from CACodeFramework/cacode/ReviewJson/tool.py
rename to cacode_framework/cacode/ReviewJson/tool.py
diff --git a/CACodeFramework/cacode/Serialize.py b/cacode_framework/cacode/Serialize.py
similarity index 100%
rename from CACodeFramework/cacode/Serialize.py
rename to cacode_framework/cacode/Serialize.py
diff --git a/CACodeFramework/cacode/__init__.py b/cacode_framework/cacode/__init__.py
similarity index 100%
rename from CACodeFramework/cacode/__init__.py
rename to cacode_framework/cacode/__init__.py
diff --git a/CACodeFramework/exception/__init__.py b/cacode_framework/exception/__init__.py
similarity index 100%
rename from CACodeFramework/exception/__init__.py
rename to cacode_framework/exception/__init__.py
diff --git a/CACodeFramework/exception/e_fields.py b/cacode_framework/exception/e_fields.py
similarity index 100%
rename from CACodeFramework/exception/e_fields.py
rename to cacode_framework/exception/e_fields.py
diff --git a/CACodeFramework/field/FManage.py b/cacode_framework/field/FManage.py
similarity index 100%
rename from CACodeFramework/field/FManage.py
rename to cacode_framework/field/FManage.py
diff --git a/CACodeFramework/field/MySqlDefault.py b/cacode_framework/field/MySqlDefault.py
similarity index 100%
rename from CACodeFramework/field/MySqlDefault.py
rename to cacode_framework/field/MySqlDefault.py
diff --git a/CACodeFramework/field/__init__.py b/cacode_framework/field/__init__.py
similarity index 100%
rename from CACodeFramework/field/__init__.py
rename to cacode_framework/field/__init__.py
diff --git a/CACodeFramework/opera/CompulsoryRun.py b/cacode_framework/opera/CompulsoryRun.py
similarity index 100%
rename from CACodeFramework/opera/CompulsoryRun.py
rename to cacode_framework/opera/CompulsoryRun.py
diff --git a/CACodeFramework/opera/__init__.py b/cacode_framework/opera/__init__.py
similarity index 100%
rename from CACodeFramework/opera/__init__.py
rename to cacode_framework/opera/__init__.py
diff --git a/CACodeFramework/opera/op_db.py b/cacode_framework/opera/op_db.py
similarity index 100%
rename from CACodeFramework/opera/op_db.py
rename to cacode_framework/opera/op_db.py
diff --git a/CACodeFramework/pojoManager/Manage.py b/cacode_framework/pojoManager/Manage.py
similarity index 100%
rename from CACodeFramework/pojoManager/Manage.py
rename to cacode_framework/pojoManager/Manage.py
diff --git a/CACodeFramework/pojoManager/__init__.py b/cacode_framework/pojoManager/__init__.py
similarity index 100%
rename from CACodeFramework/pojoManager/__init__.py
rename to cacode_framework/pojoManager/__init__.py
diff --git a/CACodeFramework/pojoManager/tag.py b/cacode_framework/pojoManager/tag.py
similarity index 100%
rename from CACodeFramework/pojoManager/tag.py
rename to cacode_framework/pojoManager/tag.py
diff --git a/CACodeFramework/util/DBPool/__init__.py b/cacode_framework/util/DBPool/__init__.py
similarity index 100%
rename from CACodeFramework/util/DBPool/__init__.py
rename to cacode_framework/util/DBPool/__init__.py
diff --git a/CACodeFramework/util/DBPool/persistent_db.py b/cacode_framework/util/DBPool/persistent_db.py
similarity index 100%
rename from CACodeFramework/util/DBPool/persistent_db.py
rename to cacode_framework/util/DBPool/persistent_db.py
diff --git a/CACodeFramework/util/DBPool/persistent_pg.py b/cacode_framework/util/DBPool/persistent_pg.py
similarity index 100%
rename from CACodeFramework/util/DBPool/persistent_pg.py
rename to cacode_framework/util/DBPool/persistent_pg.py
diff --git a/CACodeFramework/util/DBPool/pooled_db.py b/cacode_framework/util/DBPool/pooled_db.py
similarity index 100%
rename from CACodeFramework/util/DBPool/pooled_db.py
rename to cacode_framework/util/DBPool/pooled_db.py
diff --git a/CACodeFramework/util/DBPool/pooled_pg.py b/cacode_framework/util/DBPool/pooled_pg.py
similarity index 100%
rename from CACodeFramework/util/DBPool/pooled_pg.py
rename to cacode_framework/util/DBPool/pooled_pg.py
diff --git a/CACodeFramework/util/DBPool/simple_pooled_db.py b/cacode_framework/util/DBPool/simple_pooled_db.py
similarity index 100%
rename from CACodeFramework/util/DBPool/simple_pooled_db.py
rename to cacode_framework/util/DBPool/simple_pooled_db.py
diff --git a/CACodeFramework/util/DBPool/simple_pooled_pg.py b/cacode_framework/util/DBPool/simple_pooled_pg.py
similarity index 100%
rename from CACodeFramework/util/DBPool/simple_pooled_pg.py
rename to cacode_framework/util/DBPool/simple_pooled_pg.py
diff --git a/CACodeFramework/util/DBPool/steady_db.py b/cacode_framework/util/DBPool/steady_db.py
similarity index 100%
rename from CACodeFramework/util/DBPool/steady_db.py
rename to cacode_framework/util/DBPool/steady_db.py
diff --git a/CACodeFramework/util/DBPool/steady_pg.py b/cacode_framework/util/DBPool/steady_pg.py
similarity index 100%
rename from CACodeFramework/util/DBPool/steady_pg.py
rename to cacode_framework/util/DBPool/steady_pg.py
diff --git a/CACodeFramework/util/DbUtil.py b/cacode_framework/util/DbUtil.py
similarity index 100%
rename from CACodeFramework/util/DbUtil.py
rename to cacode_framework/util/DbUtil.py
diff --git a/CACodeFramework/util/Log.py b/cacode_framework/util/Log.py
similarity index 100%
rename from CACodeFramework/util/Log.py
rename to cacode_framework/util/Log.py
diff --git a/CACodeFramework/util/ParseUtil.py b/cacode_framework/util/ParseUtil.py
similarity index 100%
rename from CACodeFramework/util/ParseUtil.py
rename to cacode_framework/util/ParseUtil.py
diff --git a/CACodeFramework/util/__init__.py b/cacode_framework/util/__init__.py
similarity index 100%
rename from CACodeFramework/util/__init__.py
rename to cacode_framework/util/__init__.py
--
Gitee
From a71ff12d98f6cf59ffe062b539864def1b284453 Mon Sep 17 00:00:00 2001
From: CACode <54068986+cctvadmin@users.noreply.github.com>
Date: Mon, 17 May 2021 18:12:27 +0800
Subject: [PATCH 12/26] 1
---
cacode_framework/MainWork/CACodePureORM.py | 31 +++++-----------------
cacode_framework/exception/e_fields.py | 10 +++++++
cacode_framework/pojoManager/Manage.py | 4 +--
3 files changed, 17 insertions(+), 28 deletions(-)
diff --git a/cacode_framework/MainWork/CACodePureORM.py b/cacode_framework/MainWork/CACodePureORM.py
index 8b8daf4..38d0876 100644
--- a/cacode_framework/MainWork/CACodePureORM.py
+++ b/cacode_framework/MainWork/CACodePureORM.py
@@ -67,28 +67,6 @@ s """
values_str=self.sqlFields.values_str)
self.args.append(sql['sql'])
self.params = sql['params']
-
- # _dict = pojo.__dict__
- # keys = []
- # # 解析item
- # for key, value in _dict.items():
- # # 去除为空的键
- # if value is None:
- # continue
- # keys.append('`{}`{}'.format(key, comma))
- # self.params.append(value)
- # for i in keys:
- # self.args.append(i)
- # # 将最后一个字段的逗号改成空格
- # self.rep_sym(comma, space)
- # # 加上右边括号
- # self.args.append(right_par)
- # self.args.append('{}{}'.format(values_str, left_par))
- # for i in keys:
- # self.args.append('%s{}'.format(comma))
- # # 将最后一个字段的逗号改成空格
- # self.rep_sym(comma, space)
- # self.args.append(right_par)
return self
def delete(self):
@@ -154,8 +132,9 @@ s """
fs = fields.split(',')
if len(fs) != len(asses):
# 匿名参数长度与字段长度不符合
- raise TypeError(
- 'The length of the anonymous parameter does not match the length of the field')
+ CACodeLog.log_error(obj=TypeError,
+ msg='The length of the anonymous parameter does not match the length of the field',
+ raise_exception=True)
for i, v in enumerate(fs):
if asses[i] is not None:
self.args.append('{}{}{}'.format(
@@ -359,8 +338,10 @@ s """
self.args.clear()
self.params.clear()
if self.first_data:
- if type(_result) is list or type(_result) is tuple:
+ if (isinstance(_result, list) or isinstance(_result, tuple)) and _result and len(_result) > 0:
return self.serializer(instance=self.repository.instance, base_data=_result).first()
+ else:
+ return None
else:
q = self.serializer(
instance=self.repository.instance, base_data=_result)
diff --git a/cacode_framework/exception/e_fields.py b/cacode_framework/exception/e_fields.py
index b1f33b1..e7cf7bc 100644
--- a/cacode_framework/exception/e_fields.py
+++ b/cacode_framework/exception/e_fields.py
@@ -1,3 +1,13 @@
+__all__ = [
+ 'mat', 'CACode_SqlError', 'CACode_Factory_Error',
+ 'Json_Error', 'Syntax_Error', 'Attribute_Error',
+ 'Attribute_Error', 'Log_Opera_Name', 'Miss_Attr',
+ 'Error', 'Warn', 'Info',
+ 'Database_Operation', 'Parse_Error', 'FieldNotExist',
+ 'ModuleCreateError'
+]
+
+
def mat(prefix, suffix):
return '%s:%s' % (prefix, suffix)
diff --git a/cacode_framework/pojoManager/Manage.py b/cacode_framework/pojoManager/Manage.py
index 37e1b2a..ab3ee20 100644
--- a/cacode_framework/pojoManager/Manage.py
+++ b/cacode_framework/pojoManager/Manage.py
@@ -22,8 +22,6 @@ class Pojo(CACodeRepository.Repository):
if not hasattr(self, '__table_msg__'):
self.__table_msg__ = 'The current object has no description'
- self.__table_name__ = self.__table_name__
- self.__table_msg__ = self.__table_msg__
self.__fields__ = {}
# 在这里将config_obj实例化
self.serializer = serializer
@@ -55,7 +53,7 @@ class Pojo(CACodeRepository.Repository):
if not hasattr(self, key) or getattr(self, key) is None or t_v in [tag.Template, tag.baseTag]:
setattr(self, key, value.default)
fds[key] = value if value.default is None else value.default
- except SyntaxError as a:
+ except SyntaxError:
continue
self.__fields__ = fds
--
Gitee
From fff4cf0bd10dca36e97cbe296322f401f818d415 Mon Sep 17 00:00:00 2001
From: CACode
Date: Wed, 19 May 2021 23:21:16 +0800
Subject: [PATCH 13/26] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=B8=E5=8F=AF?=
=?UTF-8?q?=E8=AF=81=E7=B1=BB=E5=9E=8B=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=A1=86?=
=?UTF-8?q?=E6=9E=B6=E5=90=8D=E7=A7=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
LICENSE | 875 ++++--------------
README.md | 20 +-
cacode_framework/util/__init__.py | 0
setup.py | 8 +-
{cacode_framework => summer}/__init__.py | 0
{cacode_framework => summer}/anno/__init__.py | 0
{cacode_framework => summer}/anno/annos.py | 6 +-
.../cacode/Factory.py | 10 +-
{cacode_framework => summer}/cacode/Modes.py | 2 +-
.../cacode/ReviewJson/JSON.py | 15 +-
.../cacode/ReviewJson/__init__.py | 0
.../cacode/ReviewJson/_speedups.c | 0
.../cacode/ReviewJson/compat.py | 0
.../cacode/ReviewJson/decoder.py | 0
.../cacode/ReviewJson/encoder.py | 0
.../cacode/ReviewJson/errors.py | 0
.../cacode/ReviewJson/ordered_dict.py | 9 +-
.../cacode/ReviewJson/raw_json.py | 0
.../cacode/ReviewJson/scanner.py | 0
.../cacode/ReviewJson/tool.py | 0
.../cacode/Serialize.py | 6 +-
.../cacode/__init__.py | 0
summer/exception/__init__.py | 16 +
.../exception/e_fields.py | 8 -
{cacode_framework => summer}/field/FManage.py | 0
.../field/MySqlDefault.py | 2 +-
.../exception => summer/field}/__init__.py | 0
.../field => summer/opera}/__init__.py | 0
.../DbUtil.py => summer/opera/global_db.py | 18 +-
{cacode_framework => summer}/opera/op_db.py | 10 +-
.../pojoManager/Manage.py | 14 +-
.../opera => summer/pojoManager}/__init__.py | 0
.../pojoManager/tag.py | 2 +-
.../opera => summer/util}/CompulsoryRun.py | 4 +-
.../util/DBPool/__init__.py | 0
.../util/DBPool/persistent_db.py | 0
.../util/DBPool/persistent_pg.py | 0
.../util/DBPool/pooled_db.py | 0
.../util/DBPool/pooled_pg.py | 0
.../util/DBPool/simple_pooled_db.py | 0
.../util/DBPool/simple_pooled_pg.py | 0
.../util/DBPool/steady_db.py | 0
.../util/DBPool/steady_pg.py | 0
{cacode_framework => summer}/util/Log.py | 4 +-
.../util/ParseUtil.py | 6 +-
.../pojoManager => summer/util}/__init__.py | 0
.../work/AopContainer.py | 2 +-
.../CACodeConfig.py => summer/work/Config.py | 10 +-
.../work/SummerAdapter.py | 0
.../MainWork => summer/work}/__init__.py | 0
.../CACodePureORM.py => summer/work/orm.py | 4 +-
.../work/repository.py | 31 +-
test/modules/DatabaseConf.py | 8 +-
test/modules/MySqlTest.py | 6 +-
test/modules/SqlServerTest.py | 6 +-
test/testFunc.py | 10 +-
56 files changed, 310 insertions(+), 802 deletions(-)
delete mode 100644 cacode_framework/util/__init__.py
rename {cacode_framework => summer}/__init__.py (100%)
rename {cacode_framework => summer}/anno/__init__.py (100%)
rename {cacode_framework => summer}/anno/annos.py (97%)
rename {cacode_framework => summer}/cacode/Factory.py (91%)
rename {cacode_framework => summer}/cacode/Modes.py (99%)
rename {cacode_framework => summer}/cacode/ReviewJson/JSON.py (88%)
rename {cacode_framework => summer}/cacode/ReviewJson/__init__.py (100%)
rename {cacode_framework => summer}/cacode/ReviewJson/_speedups.c (100%)
rename {cacode_framework => summer}/cacode/ReviewJson/compat.py (100%)
rename {cacode_framework => summer}/cacode/ReviewJson/decoder.py (100%)
rename {cacode_framework => summer}/cacode/ReviewJson/encoder.py (100%)
rename {cacode_framework => summer}/cacode/ReviewJson/errors.py (100%)
rename {cacode_framework => summer}/cacode/ReviewJson/ordered_dict.py (90%)
rename {cacode_framework => summer}/cacode/ReviewJson/raw_json.py (100%)
rename {cacode_framework => summer}/cacode/ReviewJson/scanner.py (100%)
rename {cacode_framework => summer}/cacode/ReviewJson/tool.py (100%)
rename {cacode_framework => summer}/cacode/Serialize.py (98%)
rename {cacode_framework => summer}/cacode/__init__.py (100%)
create mode 100644 summer/exception/__init__.py
rename {cacode_framework => summer}/exception/e_fields.py (87%)
rename {cacode_framework => summer}/field/FManage.py (100%)
rename {cacode_framework => summer}/field/MySqlDefault.py (98%)
rename {cacode_framework/exception => summer/field}/__init__.py (100%)
rename {cacode_framework/field => summer/opera}/__init__.py (100%)
rename cacode_framework/util/DbUtil.py => summer/opera/global_db.py (92%)
rename {cacode_framework => summer}/opera/op_db.py (93%)
rename {cacode_framework => summer}/pojoManager/Manage.py (91%)
rename {cacode_framework/opera => summer/pojoManager}/__init__.py (100%)
rename {cacode_framework => summer}/pojoManager/tag.py (98%)
rename {cacode_framework/opera => summer/util}/CompulsoryRun.py (91%)
rename {cacode_framework => summer}/util/DBPool/__init__.py (100%)
rename {cacode_framework => summer}/util/DBPool/persistent_db.py (100%)
rename {cacode_framework => summer}/util/DBPool/persistent_pg.py (100%)
rename {cacode_framework => summer}/util/DBPool/pooled_db.py (100%)
rename {cacode_framework => summer}/util/DBPool/pooled_pg.py (100%)
rename {cacode_framework => summer}/util/DBPool/simple_pooled_db.py (100%)
rename {cacode_framework => summer}/util/DBPool/simple_pooled_pg.py (100%)
rename {cacode_framework => summer}/util/DBPool/steady_db.py (100%)
rename {cacode_framework => summer}/util/DBPool/steady_pg.py (100%)
rename {cacode_framework => summer}/util/Log.py (98%)
rename {cacode_framework => summer}/util/ParseUtil.py (98%)
rename {cacode_framework/pojoManager => summer/util}/__init__.py (100%)
rename cacode_framework/MainWork/CACodeAopContainer.py => summer/work/AopContainer.py (99%)
rename cacode_framework/MainWork/CACodeConfig.py => summer/work/Config.py (90%)
rename cacode_framework/MainWork/CACodeAdapter.py => summer/work/SummerAdapter.py (100%)
rename {cacode_framework/MainWork => summer/work}/__init__.py (100%)
rename cacode_framework/MainWork/CACodePureORM.py => summer/work/orm.py (99%)
rename cacode_framework/MainWork/CACodeRepository.py => summer/work/repository.py (91%)
diff --git a/LICENSE b/LICENSE
index e72bfdd..f49a4e1 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,674 +1,201 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
\ No newline at end of file
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
\ No newline at end of file
diff --git a/README.md b/README.md
index ec3f93d..944c20a 100644
--- a/README.md
+++ b/README.md
@@ -10,29 +10,15 @@
-> pip命令:pip install CACodeFramework
-
-## Author
+# 安装
-👤 **CACode**
-
-* Github: [@cctvadmin](https://github.com/cctvadmin)
-* QQ: 2075383131
-* wechat: cacode
-* email: cacode@163.com
+> pip命令:pip install CACodeFramework
## 先决条件
- python >=3.6
-项目地址: https://gitee.com/cacode_cctvadmin/CACodeFramework-python-ORM
-项目文档:http://doc.cacode.ren
-
-> 统一市面上所有的数据库创建者,并分配连接池和缓存
-
-## 结语
-
-如果这个框架对你有帮助的话,请给个星点个star
+> 教程文档地址:http://doc.cacode.ren
# CACode
diff --git a/cacode_framework/util/__init__.py b/cacode_framework/util/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/setup.py b/setup.py
index 1361e63..5ef218c 100644
--- a/setup.py
+++ b/setup.py
@@ -4,16 +4,16 @@ with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
- name="cacode_framework",
+ name="summer_framework",
version="1.0.0",
author="CACode",
author_email="cacode@163.com",
- description="CACode Framework For Python Flask,This framework corresponds to the ORM problem,You can see:https://gitee.com/cacode_cctvadmin/CACodeFramework-python-ORM",
+ description="Summer framework for Python,You can see:https://gitee.com/cacode_cctvadmin/summer-python",
long_description=long_description,
long_description_content_type="text/markdown",
- url="https://gitee.com/cacode_cctvadmin/CACodeFramework-python-ORM",
+ url="https://gitee.com/cacode_cctvadmin/summer-python",
project_urls={
- "Bug Tracker": "https://gitee.com/cacode_cctvadmin/CACodeFramework-python-ORM/issues",
+ "Bug Tracker": "https://gitee.com/cacode_cctvadmin/summer-python/issues",
},
license=' GPL-3.0',
classifiers=[
diff --git a/cacode_framework/__init__.py b/summer/__init__.py
similarity index 100%
rename from cacode_framework/__init__.py
rename to summer/__init__.py
diff --git a/cacode_framework/anno/__init__.py b/summer/anno/__init__.py
similarity index 100%
rename from cacode_framework/anno/__init__.py
rename to summer/anno/__init__.py
diff --git a/cacode_framework/anno/annos.py b/summer/anno/annos.py
similarity index 97%
rename from cacode_framework/anno/annos.py
rename to summer/anno/annos.py
index cf547dc..459c52b 100644
--- a/cacode_framework/anno/annos.py
+++ b/summer/anno/annos.py
@@ -1,3 +1,6 @@
+from summer.work.AopContainer import AopModelObject
+
+
def Table(name, msg, **kwargs):
"""
标注该类为一个表
@@ -67,7 +70,7 @@ def Select(sql, params=None):
new_args = parse_kwargs(params, kwargs)
result = obj.find_sql(sql=sql, params=new_args)
- from cacode_framework.cacode.Serialize import QuerySet
+ from summer.cacode.Serialize import QuerySet
return QuerySet(obj, result)
return _wrapper_
@@ -170,7 +173,6 @@ def AopModel(before=None, after=None,
"""
# 得到对象组
- from cacode_framework.MainWork.CACodeAopContainer import AopModelObject
aop_obj = AopModelObject(before, after,
before_args, before_kwargs,
after_args, after_kwargs)
diff --git a/cacode_framework/cacode/Factory.py b/summer/cacode/Factory.py
similarity index 91%
rename from cacode_framework/cacode/Factory.py
rename to summer/cacode/Factory.py
index 31c3b5e..b2af1c3 100644
--- a/cacode_framework/cacode/Factory.py
+++ b/summer/cacode/Factory.py
@@ -1,10 +1,10 @@
import threading
-from cacode_framework.cacode import Modes
-from cacode_framework.exception import e_fields
-from cacode_framework.exception.e_fields import ModuleCreateError
-from cacode_framework.opera.CompulsoryRun import Compulsory
-from cacode_framework.util.Log import CACodeLog
+from summer.cacode import Modes
+from summer.exception import e_fields
+from summer.exception import ModuleCreateError
+from summer.util.CompulsoryRun import Compulsory
+from summer.util.Log import CACodeLog
import importlib
diff --git a/cacode_framework/cacode/Modes.py b/summer/cacode/Modes.py
similarity index 99%
rename from cacode_framework/cacode/Modes.py
rename to summer/cacode/Modes.py
index 699e2d9..99907f0 100644
--- a/cacode_framework/cacode/Modes.py
+++ b/summer/cacode/Modes.py
@@ -295,7 +295,7 @@ if __name__ == '__main__':
"e": rep
}
result = Recursion.find_key_for_dict(data, "a")
- from cacode_framework.cacode.Serialize import JsonUtil
+ from summer.cacode.Serialize import JsonUtil
print(JsonUtil.parse(result))
diff --git a/cacode_framework/cacode/ReviewJson/JSON.py b/summer/cacode/ReviewJson/JSON.py
similarity index 88%
rename from cacode_framework/cacode/ReviewJson/JSON.py
rename to summer/cacode/ReviewJson/JSON.py
index 159c447..f2319f0 100644
--- a/cacode_framework/cacode/ReviewJson/JSON.py
+++ b/summer/cacode/ReviewJson/JSON.py
@@ -5,6 +5,9 @@ __all__ = [
__author__ = 'CACode '
+from . import _default_encoder, JSONEncoder, _default_decoder, JSONDecoder
+from decimal import Decimal
+
class Json:
@@ -17,10 +20,8 @@ class Json:
for_json=False, ignore_nan=False, int_as_string_bitcount=None,
iterable_as_array=False, **kw):
"""
-
- serializer `obj` to a json formatted `str`
+ 转json字符串
"""
- # cached encoder
if (not skipkeys and ensure_ascii and
check_circular and allow_nan and
cls is None and indent is None and separators is None and
@@ -31,10 +32,8 @@ class Json:
and not ignore_nan and int_as_string_bitcount is None
and not kw
):
- from . import _default_encoder
return _default_encoder.encode(obj)
if cls is None:
- from . import JSONEncoder
cls = JSONEncoder
return cls(
skipkeys=skipkeys, ensure_ascii=ensure_ascii,
@@ -57,17 +56,14 @@ class Json:
parse_int=None, parse_constant=None, object_pairs_hook=None,
use_decimal=False, **kw):
"""
- Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON
- document) to a Python object.
+ json转字典
"""
if (cls is None and encoding is None and object_hook is None and
parse_int is None and parse_float is None and
parse_constant is None and object_pairs_hook is None
and not use_decimal and not kw):
- from . import _default_decoder
return _default_decoder.decode(s)
if cls is None:
- from . import JSONDecoder
cls = JSONDecoder
if object_hook is not None:
kw['object_hook'] = object_hook
@@ -82,6 +78,5 @@ class Json:
if use_decimal:
if parse_float is not None:
raise TypeError("use_decimal=True implies parse_float=Decimal")
- from decimal import Decimal
kw['parse_float'] = Decimal
return cls(encoding=encoding, **kw).decode(s)
diff --git a/cacode_framework/cacode/ReviewJson/__init__.py b/summer/cacode/ReviewJson/__init__.py
similarity index 100%
rename from cacode_framework/cacode/ReviewJson/__init__.py
rename to summer/cacode/ReviewJson/__init__.py
diff --git a/cacode_framework/cacode/ReviewJson/_speedups.c b/summer/cacode/ReviewJson/_speedups.c
similarity index 100%
rename from cacode_framework/cacode/ReviewJson/_speedups.c
rename to summer/cacode/ReviewJson/_speedups.c
diff --git a/cacode_framework/cacode/ReviewJson/compat.py b/summer/cacode/ReviewJson/compat.py
similarity index 100%
rename from cacode_framework/cacode/ReviewJson/compat.py
rename to summer/cacode/ReviewJson/compat.py
diff --git a/cacode_framework/cacode/ReviewJson/decoder.py b/summer/cacode/ReviewJson/decoder.py
similarity index 100%
rename from cacode_framework/cacode/ReviewJson/decoder.py
rename to summer/cacode/ReviewJson/decoder.py
diff --git a/cacode_framework/cacode/ReviewJson/encoder.py b/summer/cacode/ReviewJson/encoder.py
similarity index 100%
rename from cacode_framework/cacode/ReviewJson/encoder.py
rename to summer/cacode/ReviewJson/encoder.py
diff --git a/cacode_framework/cacode/ReviewJson/errors.py b/summer/cacode/ReviewJson/errors.py
similarity index 100%
rename from cacode_framework/cacode/ReviewJson/errors.py
rename to summer/cacode/ReviewJson/errors.py
diff --git a/cacode_framework/cacode/ReviewJson/ordered_dict.py b/summer/cacode/ReviewJson/ordered_dict.py
similarity index 90%
rename from cacode_framework/cacode/ReviewJson/ordered_dict.py
rename to summer/cacode/ReviewJson/ordered_dict.py
index d5a55eb..cafea6b 100644
--- a/cacode_framework/cacode/ReviewJson/ordered_dict.py
+++ b/summer/cacode/ReviewJson/ordered_dict.py
@@ -5,6 +5,7 @@ http://code.activestate.com/recipes/576693/
"""
from UserDict import DictMixin
+
class OrderedDict(dict, DictMixin):
def __init__(self, *args, **kwds):
@@ -18,8 +19,8 @@ class OrderedDict(dict, DictMixin):
def clear(self):
self.__end = end = []
- end += [None, end, end] # sentinel node for doubly linked list
- self.__map = {} # key --> [key, prev, next]
+ end += [None, end, end] # sentinel node for doubly linked list
+ self.__map = {} # key --> [key, prev, next]
dict.clear(self)
def __setitem__(self, key, value):
@@ -95,8 +96,8 @@ class OrderedDict(dict, DictMixin):
def __eq__(self, other):
if isinstance(other, OrderedDict):
- return len(self)==len(other) and \
- all(p==q for p, q in zip(self.items(), other.items()))
+ return len(self) == len(other) and \
+ all(p == q for p, q in zip(self.items(), other.items()))
return dict.__eq__(self, other)
def __ne__(self, other):
diff --git a/cacode_framework/cacode/ReviewJson/raw_json.py b/summer/cacode/ReviewJson/raw_json.py
similarity index 100%
rename from cacode_framework/cacode/ReviewJson/raw_json.py
rename to summer/cacode/ReviewJson/raw_json.py
diff --git a/cacode_framework/cacode/ReviewJson/scanner.py b/summer/cacode/ReviewJson/scanner.py
similarity index 100%
rename from cacode_framework/cacode/ReviewJson/scanner.py
rename to summer/cacode/ReviewJson/scanner.py
diff --git a/cacode_framework/cacode/ReviewJson/tool.py b/summer/cacode/ReviewJson/tool.py
similarity index 100%
rename from cacode_framework/cacode/ReviewJson/tool.py
rename to summer/cacode/ReviewJson/tool.py
diff --git a/cacode_framework/cacode/Serialize.py b/summer/cacode/Serialize.py
similarity index 98%
rename from cacode_framework/cacode/Serialize.py
rename to summer/cacode/Serialize.py
index cb2ee3e..49e188f 100644
--- a/cacode_framework/cacode/Serialize.py
+++ b/summer/cacode/Serialize.py
@@ -15,9 +15,9 @@
# CACode 1.2 2021/4/27 统一序列化器位置
# ------------------------------------------------------------------
-from cacode_framework.cacode.ReviewJson.JSON import Json
-from cacode_framework.util.Log import CACodeLog
-from cacode_framework.cacode import ReviewJson
+from summer.cacode.ReviewJson.JSON import Json
+from summer.util.Log import CACodeLog
+from summer.cacode import ReviewJson
from datetime import date, datetime
import functools
diff --git a/cacode_framework/cacode/__init__.py b/summer/cacode/__init__.py
similarity index 100%
rename from cacode_framework/cacode/__init__.py
rename to summer/cacode/__init__.py
diff --git a/summer/exception/__init__.py b/summer/exception/__init__.py
new file mode 100644
index 0000000..ea200f4
--- /dev/null
+++ b/summer/exception/__init__.py
@@ -0,0 +1,16 @@
+class DBException(Exception):
+ def __init__(self, baseException):
+ self.baseException = baseException
+ self.baseName = self.baseException.__class__.__name__
+ super(DBException, self).__init__()
+
+ def __str__(self):
+ return f"({self.baseName}):{str(self.baseException)}"
+
+
+class ModuleCreateError(ModuleNotFoundError):
+ pass
+
+
+class FieldNotExist(AttributeError):
+ pass
diff --git a/cacode_framework/exception/e_fields.py b/summer/exception/e_fields.py
similarity index 87%
rename from cacode_framework/exception/e_fields.py
rename to summer/exception/e_fields.py
index b1f33b1..d31400f 100644
--- a/cacode_framework/exception/e_fields.py
+++ b/summer/exception/e_fields.py
@@ -48,11 +48,3 @@ def Database_Operation():
def Parse_Error(msg):
return mat('CACode-Parse', msg)
-
-
-class FieldNotExist(AttributeError):
- pass
-
-
-class ModuleCreateError(ModuleNotFoundError):
- pass
diff --git a/cacode_framework/field/FManage.py b/summer/field/FManage.py
similarity index 100%
rename from cacode_framework/field/FManage.py
rename to summer/field/FManage.py
diff --git a/cacode_framework/field/MySqlDefault.py b/summer/field/MySqlDefault.py
similarity index 98%
rename from cacode_framework/field/MySqlDefault.py
rename to summer/field/MySqlDefault.py
index e1b8a1b..87ae5f3 100644
--- a/cacode_framework/field/MySqlDefault.py
+++ b/summer/field/MySqlDefault.py
@@ -2,7 +2,7 @@
# 空格符
import threading
-from ..cacode.Modes import Singleton
+from summer.cacode.Modes import Singleton
class MySqlFields_Default:
diff --git a/cacode_framework/exception/__init__.py b/summer/field/__init__.py
similarity index 100%
rename from cacode_framework/exception/__init__.py
rename to summer/field/__init__.py
diff --git a/cacode_framework/field/__init__.py b/summer/opera/__init__.py
similarity index 100%
rename from cacode_framework/field/__init__.py
rename to summer/opera/__init__.py
diff --git a/cacode_framework/util/DbUtil.py b/summer/opera/global_db.py
similarity index 92%
rename from cacode_framework/util/DbUtil.py
rename to summer/opera/global_db.py
index ac12ecf..d412ae2 100644
--- a/cacode_framework/util/DbUtil.py
+++ b/summer/opera/global_db.py
@@ -1,9 +1,10 @@
import sys
import threading
-from cacode_framework.cacode.Modes import Singleton
-from cacode_framework.util.DBPool.pooled_db import PooledDB
-from cacode_framework.util.Log import CACodeLog
+from summer.cacode.Modes import Singleton
+from summer.exception import DBException
+from summer.util.DBPool.pooled_db import PooledDB
+from summer.util.Log import CACodeLog
def parse_kwa(db, **kwargs):
@@ -161,7 +162,6 @@ class Db_opera(object):
:return:
"""
db = self.get_conn()
- cursor = None
try:
cursor = parse_kwa(db=db, **kwargs)
# 列名
@@ -183,10 +183,7 @@ class Db_opera(object):
return _result
except Exception as e:
db.rollback()
- CACodeLog.log_error(obj=e.__class__, msg=e.__str__(),
- LogObject=kwargs['logObject'] if 'logObject' in kwargs.keys() else None,
- raise_exception=True)
- raise e
+ raise DBException(e)
finally:
db.close()
@@ -200,7 +197,6 @@ class Db_opera(object):
:param many:是否为多行执行
"""
db = self.get_conn()
- cursor = None
try:
cursor = parse_kwa(db=db, many=many, **kwargs)
db.commit()
@@ -215,9 +211,7 @@ class Db_opera(object):
return rowcount
except Exception as e:
db.rollback()
- CACodeLog.log_error(obj=e.__class__, msg=e.__str__(),
- LogObject=kwargs['logObject'] if 'logObject' in kwargs.keys() else None,
- raise_exception=True)
+ raise DBException(e)
finally:
db.close()
diff --git a/cacode_framework/opera/op_db.py b/summer/opera/op_db.py
similarity index 93%
rename from cacode_framework/opera/op_db.py
rename to summer/opera/op_db.py
index 71602d7..d624e38 100644
--- a/cacode_framework/opera/op_db.py
+++ b/summer/opera/op_db.py
@@ -1,11 +1,7 @@
-import threading
+from summer.util.Log import CACodeLog
-from cacode_framework.cacode.Modes import Recursion
-from cacode_framework.cacode.Serialize import JsonUtil
-from cacode_framework.util.Log import CACodeLog
-
-from cacode_framework.field.MySqlDefault import *
-from cacode_framework.util.ParseUtil import ParseUtil
+from summer.field.MySqlDefault import *
+from summer.util.ParseUtil import ParseUtil
class DbOperation(object):
diff --git a/cacode_framework/pojoManager/Manage.py b/summer/pojoManager/Manage.py
similarity index 91%
rename from cacode_framework/pojoManager/Manage.py
rename to summer/pojoManager/Manage.py
index 37e1b2a..0d94b07 100644
--- a/cacode_framework/pojoManager/Manage.py
+++ b/summer/pojoManager/Manage.py
@@ -1,12 +1,12 @@
-from cacode_framework.MainWork.CACodePureORM import CACodePureORM
-from cacode_framework.cacode.Serialize import QuerySet
-from cacode_framework.pojoManager import tag
-from cacode_framework.cacode.Serialize import JsonUtil
-from cacode_framework.MainWork import CACodeRepository
-from cacode_framework.util.Log import CACodeLog
+from summer.work.orm import CACodePureORM
+from summer.cacode.Serialize import QuerySet
+from summer.pojoManager import tag
+from summer.cacode.Serialize import JsonUtil
+from summer.work import repository
+from summer.util.Log import CACodeLog
-class Pojo(CACodeRepository.Repository):
+class Pojo(repository.Repository):
def __init__(self, config_obj=None, log_conf=None, close_log=False, serializer=QuerySet, **kwargs):
"""
初始化ORM框架
diff --git a/cacode_framework/opera/__init__.py b/summer/pojoManager/__init__.py
similarity index 100%
rename from cacode_framework/opera/__init__.py
rename to summer/pojoManager/__init__.py
diff --git a/cacode_framework/pojoManager/tag.py b/summer/pojoManager/tag.py
similarity index 98%
rename from cacode_framework/pojoManager/tag.py
rename to summer/pojoManager/tag.py
index 2daca82..c6ec889 100644
--- a/cacode_framework/pojoManager/tag.py
+++ b/summer/pojoManager/tag.py
@@ -1,6 +1,6 @@
import datetime
-from cacode_framework.cacode.Serialize import JsonUtil
+from summer.cacode.Serialize import JsonUtil
"""
这个文件用来为pojo对象做标记,当对象为空或为以下任意类型时
diff --git a/cacode_framework/opera/CompulsoryRun.py b/summer/util/CompulsoryRun.py
similarity index 91%
rename from cacode_framework/opera/CompulsoryRun.py
rename to summer/util/CompulsoryRun.py
index 49c4317..0d67e56 100644
--- a/cacode_framework/opera/CompulsoryRun.py
+++ b/summer/util/CompulsoryRun.py
@@ -33,8 +33,8 @@ class Compulsory(object):
深度搜素树
"""
- from cacode_framework.exception import e_fields
- from cacode_framework.util.Log import CACodeLog
+ from summer.exception import e_fields
+ from summer.util.Log import CACodeLog
if len(target_names) == 0:
return module
diff --git a/cacode_framework/util/DBPool/__init__.py b/summer/util/DBPool/__init__.py
similarity index 100%
rename from cacode_framework/util/DBPool/__init__.py
rename to summer/util/DBPool/__init__.py
diff --git a/cacode_framework/util/DBPool/persistent_db.py b/summer/util/DBPool/persistent_db.py
similarity index 100%
rename from cacode_framework/util/DBPool/persistent_db.py
rename to summer/util/DBPool/persistent_db.py
diff --git a/cacode_framework/util/DBPool/persistent_pg.py b/summer/util/DBPool/persistent_pg.py
similarity index 100%
rename from cacode_framework/util/DBPool/persistent_pg.py
rename to summer/util/DBPool/persistent_pg.py
diff --git a/cacode_framework/util/DBPool/pooled_db.py b/summer/util/DBPool/pooled_db.py
similarity index 100%
rename from cacode_framework/util/DBPool/pooled_db.py
rename to summer/util/DBPool/pooled_db.py
diff --git a/cacode_framework/util/DBPool/pooled_pg.py b/summer/util/DBPool/pooled_pg.py
similarity index 100%
rename from cacode_framework/util/DBPool/pooled_pg.py
rename to summer/util/DBPool/pooled_pg.py
diff --git a/cacode_framework/util/DBPool/simple_pooled_db.py b/summer/util/DBPool/simple_pooled_db.py
similarity index 100%
rename from cacode_framework/util/DBPool/simple_pooled_db.py
rename to summer/util/DBPool/simple_pooled_db.py
diff --git a/cacode_framework/util/DBPool/simple_pooled_pg.py b/summer/util/DBPool/simple_pooled_pg.py
similarity index 100%
rename from cacode_framework/util/DBPool/simple_pooled_pg.py
rename to summer/util/DBPool/simple_pooled_pg.py
diff --git a/cacode_framework/util/DBPool/steady_db.py b/summer/util/DBPool/steady_db.py
similarity index 100%
rename from cacode_framework/util/DBPool/steady_db.py
rename to summer/util/DBPool/steady_db.py
diff --git a/cacode_framework/util/DBPool/steady_pg.py b/summer/util/DBPool/steady_pg.py
similarity index 100%
rename from cacode_framework/util/DBPool/steady_pg.py
rename to summer/util/DBPool/steady_pg.py
diff --git a/cacode_framework/util/Log.py b/summer/util/Log.py
similarity index 98%
rename from cacode_framework/util/Log.py
rename to summer/util/Log.py
index eaa748c..ee6ae41 100644
--- a/cacode_framework/util/Log.py
+++ b/summer/util/Log.py
@@ -4,8 +4,8 @@ import re
import sys
import time
import threading
-from cacode_framework.cacode.Modes import Singleton
-from cacode_framework.exception import e_fields
+from summer.cacode.Modes import Singleton
+from summer.exception import e_fields
class FieldsLength:
diff --git a/cacode_framework/util/ParseUtil.py b/summer/util/ParseUtil.py
similarity index 98%
rename from cacode_framework/util/ParseUtil.py
rename to summer/util/ParseUtil.py
index 169f8db..89442a1 100644
--- a/cacode_framework/util/ParseUtil.py
+++ b/summer/util/ParseUtil.py
@@ -2,9 +2,9 @@ import copy
from typing import List
-from ..exception.e_fields import FieldNotExist
-from ..pojoManager import tag
-from ..util.Log import CACodeLog
+from summer.exception import FieldNotExist
+from summer.pojoManager import tag
+from summer.util.Log import CACodeLog
class ParseUtil(object):
diff --git a/cacode_framework/pojoManager/__init__.py b/summer/util/__init__.py
similarity index 100%
rename from cacode_framework/pojoManager/__init__.py
rename to summer/util/__init__.py
diff --git a/cacode_framework/MainWork/CACodeAopContainer.py b/summer/work/AopContainer.py
similarity index 99%
rename from cacode_framework/MainWork/CACodeAopContainer.py
rename to summer/work/AopContainer.py
index d420051..c5d6dcb 100644
--- a/cacode_framework/MainWork/CACodeAopContainer.py
+++ b/summer/work/AopContainer.py
@@ -1,6 +1,6 @@
import types
-from ..opera.CompulsoryRun import Compulsory
+from summer.util.CompulsoryRun import Compulsory
class AopModelObject(object):
diff --git a/cacode_framework/MainWork/CACodeConfig.py b/summer/work/Config.py
similarity index 90%
rename from cacode_framework/MainWork/CACodeConfig.py
rename to summer/work/Config.py
index aeec07f..9d3f9b0 100644
--- a/cacode_framework/MainWork/CACodeConfig.py
+++ b/summer/work/Config.py
@@ -1,8 +1,8 @@
-from .CACodeAdapter import LanguageAdapter
-from ..cacode.Serialize import JsonUtil
-from ..exception.e_fields import FieldNotExist
-from ..util.Log import CACodeLog
-from ..util.ParseUtil import ParseUtil
+from SummerAdapter import LanguageAdapter
+from summer.cacode.Serialize import JsonUtil
+from summer.exception import FieldNotExist
+from summer.util.Log import CACodeLog
+from summer.util.ParseUtil import ParseUtil
class Conf(ParseUtil):
diff --git a/cacode_framework/MainWork/CACodeAdapter.py b/summer/work/SummerAdapter.py
similarity index 100%
rename from cacode_framework/MainWork/CACodeAdapter.py
rename to summer/work/SummerAdapter.py
diff --git a/cacode_framework/MainWork/__init__.py b/summer/work/__init__.py
similarity index 100%
rename from cacode_framework/MainWork/__init__.py
rename to summer/work/__init__.py
diff --git a/cacode_framework/MainWork/CACodePureORM.py b/summer/work/orm.py
similarity index 99%
rename from cacode_framework/MainWork/CACodePureORM.py
rename to summer/work/orm.py
index 8b8daf4..e5b5b77 100644
--- a/cacode_framework/MainWork/CACodePureORM.py
+++ b/summer/work/orm.py
@@ -1,5 +1,5 @@
-from ..exception import e_fields
-from ..util.Log import CACodeLog
+from summer.exception import e_fields
+from summer.util.Log import CACodeLog
class CACodePureORM(object):
diff --git a/cacode_framework/MainWork/CACodeRepository.py b/summer/work/repository.py
similarity index 91%
rename from cacode_framework/MainWork/CACodeRepository.py
rename to summer/work/repository.py
index 33628cc..12c8186 100644
--- a/cacode_framework/MainWork/CACodeRepository.py
+++ b/summer/work/repository.py
@@ -1,13 +1,12 @@
import copy
-from ..cacode.Serialize import QuerySet
-from ..exception import e_fields
-from ..field import MySqlDefault
-from ..opera import op_db
-from ..util.Log import CACodeLog
+from summer.cacode.Serialize import QuerySet
+from summer.exception import e_fields
+from summer.field import MySqlDefault
+from summer.opera import op_db, global_db
+from summer.util.Log import CACodeLog
-from ..MainWork.CACodePureORM import CACodePureORM
-from ..util import DbUtil
+from summer.work.orm import CACodePureORM
# 每个任务唯一ID
import uuid
@@ -103,15 +102,15 @@ class Repository:
ParseUtil.set_field_compulsory(self, key='sqlFields', data=kwargs, val=MySqlDefault.MySqlFields_Default())
# 连接池
if hasattr(self, 'config_obj') and self.config_obj:
- self.db_util = DbUtil.Db_opera(host=ParseUtil.fieldExist(self.config_obj, 'host'),
- port=ParseUtil.fieldExist(self.config_obj, 'port'),
- user=ParseUtil.fieldExist(self.config_obj, 'user'),
- password=ParseUtil.fieldExist(self.config_obj, 'password'),
- database=ParseUtil.fieldExist(self.config_obj, 'database'),
- charset=ParseUtil.fieldExist(self.config_obj, 'charset'),
- creator=ParseUtil.fieldExist(self.config_obj, 'creator',
- raise_exception=True),
- POOL=None if 'POOL' not in kwargs.keys() else kwargs['POOL'])
+ self.db_util = global_db.Db_opera(host=ParseUtil.fieldExist(self.config_obj, 'host'),
+ port=ParseUtil.fieldExist(self.config_obj, 'port'),
+ user=ParseUtil.fieldExist(self.config_obj, 'user'),
+ password=ParseUtil.fieldExist(self.config_obj, 'password'),
+ database=ParseUtil.fieldExist(self.config_obj, 'database'),
+ charset=ParseUtil.fieldExist(self.config_obj, 'charset'),
+ creator=ParseUtil.fieldExist(self.config_obj, 'creator',
+ raise_exception=True),
+ POOL=None if 'POOL' not in kwargs.keys() else kwargs['POOL'])
else:
CACodeLog.err(AttributeError, e_fields.Miss_Attr('`config_obj` is missing'))
diff --git a/test/modules/DatabaseConf.py b/test/modules/DatabaseConf.py
index 4806b6b..ee6c1bb 100644
--- a/test/modules/DatabaseConf.py
+++ b/test/modules/DatabaseConf.py
@@ -1,8 +1,8 @@
import pymssql
import pymysql
-from cacode_framework.MainWork import CACodeConfig
-from cacode_framework.MainWork.CACodeAdapter import LanguageAdapter
+from summer.work import Config
+from summer.work.SummerAdapter import LanguageAdapter
class Adapter(LanguageAdapter):
@@ -16,7 +16,7 @@ class Adapter(LanguageAdapter):
self._like_opera(instance, key, value)
-class MySqlConfig(CACodeConfig.Conf):
+class MySqlConfig(Config.Conf):
def __init__(self,
host='localhost',
port=3306,
@@ -31,7 +31,7 @@ class MySqlConfig(CACodeConfig.Conf):
adapter=Adapter())
-class SqlServerConfig(CACodeConfig.Conf):
+class SqlServerConfig(Config.Conf):
def __init__(self,
host='localhsot',
port=1433,
diff --git a/test/modules/MySqlTest.py b/test/modules/MySqlTest.py
index a511ca7..6d530c8 100644
--- a/test/modules/MySqlTest.py
+++ b/test/modules/MySqlTest.py
@@ -1,8 +1,8 @@
import datetime
-from cacode_framework.anno.annos import Table, Select
-from cacode_framework.pojoManager import Manage
-from cacode_framework.pojoManager.Manage import Pojo
+from summer.anno.annos import Table, Select
+from summer.pojoManager import Manage
+from summer.pojoManager.Manage import Pojo
from test.modules.DatabaseConf import MySqlConfig
diff --git a/test/modules/SqlServerTest.py b/test/modules/SqlServerTest.py
index d66ef14..245d1cb 100644
--- a/test/modules/SqlServerTest.py
+++ b/test/modules/SqlServerTest.py
@@ -3,9 +3,9 @@
# @Author: CACode
# @File: SqlServerTest.py
# @Software: PyCharm
-from cacode_framework.anno.annos import Table
-from cacode_framework.pojoManager import Manage
-from cacode_framework.pojoManager.Manage import Pojo
+from summer.anno.annos import Table
+from summer.pojoManager import Manage
+from summer.pojoManager.Manage import Pojo
from test.modules.DatabaseConf import SqlServerConfig
diff --git a/test/testFunc.py b/test/testFunc.py
index 259b4f3..844c433 100644
--- a/test/testFunc.py
+++ b/test/testFunc.py
@@ -7,8 +7,8 @@ Description: Update Test
'''
import time
-from cacode_framework.cacode.Factory import Factory
-from cacode_framework.util.Log import CACodeLog
+from summer.cacode.Factory import Factory
+from summer.util.Log import CACodeLog
class MyFactory(Factory):
@@ -40,9 +40,9 @@ def TestMySql():
# page = result.page(7)
# result = page.to_dict()
result = demoTable.orm.find().where(t_id__in=[1, 2, 3, 4, 5, 6, 7, 8, 9])
- r_2 = d_2.orm.find(poly=[' FROM '])
- var = r_2 << result
- info(var.append(' a').end())
+ # r_2 = d_2.orm.find(poly=[' FROM '])
+ # var = r_2 << result
+ info(result.append(' a').end())
# info(result.to_json(True))
# info(f'count:{len(result)}')
info(f'application run time:{time.time() - t}')
--
Gitee
From 22652aaf866ae664b30664cb8d34a90d853ebafe Mon Sep 17 00:00:00 2001
From: CACode
Date: Thu, 20 May 2021 00:13:52 +0800
Subject: [PATCH 14/26] updateRRADME.md
---
.gitignore | 7 +++----
README.md | 41 ++++++++++++++++++++++++++++++++++-------
imgs/lct.png | Bin 35815 -> 46275 bytes
imgs/summer_tr.png | Bin 0 -> 844101 bytes
4 files changed, 37 insertions(+), 11 deletions(-)
create mode 100644 imgs/summer_tr.png
diff --git a/.gitignore b/.gitignore
index a57e2e7..e7d7c34 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,12 +3,11 @@ __pycache__/
#upload.bat
#pyproject.toml
#delete.py
-#*.pyc
-#venv
+*.pyc
+venv
.pypirc
build
cacode_framework.egg-info
dist
upload.bat
-pyproject.toml
-.pypirc
\ No newline at end of file
+pyproject.toml
\ No newline at end of file
diff --git a/README.md b/README.md
index 944c20a..33d2f78 100644
--- a/README.md
+++ b/README.md
@@ -1,25 +1,52 @@
-