def __init__(self, **kwargs): """ 初始化 """ # 列名 self.columnName = "" # 数据类型 self.dataType = "" # 类型名 self.type_name = "" # Oracle类型 self.oracleJavaType = "" # 列大小 self.column_size = "" # 备注 self.remarks = "" # 是否可为空 self.nullable = "" self.copy_from(kwargs) # 属性名 self.propertyName = strcm.under_to_camel(self.columnName) # 属性名首字母大写 self.propertyNameFcu = strcm.upper_first(self.propertyName) # 模块创建时间 self.codeCreateTime = datecm.now_time_str("%Y年%m月%d日 00:00:00")
def __init__(self, **kwargs): """ 模块初始化 """ # 模块包名 self.packageName = "" # 模块名 self.moduleName = "" # 模块描述 self.moduleDesc = "" self.copy_from(kwargs) # 模块创建时间 self.codeCreateTime = datecm.now_time_str("%Y年%m月%d日 00:00:00") # 模块名首字母大写 self.moduleNameFcu = strcm.upper_first(self.moduleName) # 常量KEY名 self.keyName = strcm.camel_to_under(self.moduleName).upper() # 接口列表 self.services = [] # Bean列表 self.beans = [] # Code列表 self.codes = []
def get_header_tag(self, new_data, ref_id, no_data=False): """ 生成MessageHeader标签 :param new_data:是否新数据 :param sort_no:序号 :param no_data:是否无数据 :return: """ header = { "ReportingID": self.ReportingID, "FIID": self.FIID, "ReportingType": "CRS", "MessageRefId": ref_id, "ReportingPeriod": cncrs_cm.convert("date", self.ReportingPeriod), "MessageTypeIndic": cncrs_cm.get_message_type_indic(new_data, no_data), "Tmstp": datecm.now_time_str("%Y-%m-%dT%H:%M:%S+08:00") } return MessageHeaderTag(**header)
def run_task(sleep_seconds): # 声明使用全局锁 global lock, queue_list # 取得当前线程 thd_now = threading.current_thread() thd_name = thd_now.getName() # 循环直到任务队列为空 while not queue_list.empty(): # 取得任务编号 task = queue_list.get() # 锁请求 if lock.acquire(): # 当前时间 now_time = datecm.now_time_str('%Y-%m-%d %H:%M:%S') # 输出日志(同时只有一个线程可以写日志) logcm.print_info("%s is doing %s sleep %d seconds. %s " % (thd_name, task, sleep_seconds, now_time)) # 释放锁 lock.release() # 等待N秒后继续 time.sleep(sleep_seconds)
from common import logcm from common import webcm # 缺省配置及说明 default_config = """" { "site_list": [ { "url": "http://www.baidu.com/", "name": "baidu.txt" }, { "url": "http://www.163.com/", "name": "163.txt" } ] } """ # 定义并创建临时目录 tmp_path = './temp/net/curl/' + datecm.now_time_str() filecm.makedir(tmp_path) # 加载配置文件 config_map = loadcfgcm.load("net_curl.json", default_config) # 按照站点一览进行循环 for cfg in config_map["site_list"]: result = webcm.curl(cfg["url"], tmp_path, cfg["name"]) logcm.print_obj(result, "result-%s" % cfg["name"])
#!/usr/bin/env python # -*- coding: utf-8 -*- """ EXCEL数据加载 """ from common import datecm from common import filecm from common import xlscm from common import loadcfgcm from common import logcm # 根目录 root_dir = "/Users/xxxx/Downloads" out_file = "output" + datecm.now_time_str() + ".csv" # 配置 # Excel文件名,可以对应到多个Sheet,每个Sheet有一个标题行。 default_config = """ { "XXXXXX": [{ "sheet_name": "明细", "title_line": 0, "col_titles": ["基金名称", "投资者名称", "客户类型", "证件类型", "证件号码", "????"] }], "YYYYYY": [{ "sheet_name": "客户明细J", "title_line": 0, "col_titles": ["????", "客户名称", "客户类型", "证件类型", "证件号码", "持有份额"] }] }
#!/usr/bin/env python # -*- coding: utf-8 -*- """ 数字图片的训练和识别。 """ import cv2 from common import cvknncm from common import datecm from common import filecm from common import opencvcm from common import plotcm # 临时目录 tmp_path = './temp/cv/digits/' + datecm.now_time_str() filecm.makedir(tmp_path) # KNN算法对象(初始化并训练好) knn = cvknncm.get_hand_digits_knn() # 载入测试图片 img_test = cv2.imread('./images/cv_img_number2_test.jpg') # 图片列表 img_list = [] # 标题列表 title_list = [] img_list.append(img_test) title_list.append('原图+结果')