2020-12-31 23:13:11 +08:00
|
|
|
"""
|
|
|
|
writen by shenjackyuanjie
|
|
|
|
mail: 3695888@qq.com
|
|
|
|
"""
|
|
|
|
|
2021-01-25 19:23:16 +08:00
|
|
|
import re
|
2021-01-26 08:06:36 +08:00
|
|
|
import bin
|
|
|
|
import time
|
|
|
|
import decimal
|
2021-01-23 21:43:04 +08:00
|
|
|
|
2021-01-25 19:23:16 +08:00
|
|
|
|
2021-01-26 08:06:36 +08:00
|
|
|
def basic_number(int_num=0, float_num=1, unit1=None, unit2=None) -> list:
|
|
|
|
"""
|
|
|
|
|
|
|
|
:param unit2: list
|
|
|
|
:param unit1: list
|
|
|
|
:param int_num: int
|
|
|
|
:type float_num: decimal.Decimal or float
|
|
|
|
"""
|
2021-01-25 19:23:16 +08:00
|
|
|
if unit1 is None:
|
|
|
|
unit1 = []
|
2021-01-26 08:06:36 +08:00
|
|
|
if unit2 is None:
|
|
|
|
unit2 = []
|
|
|
|
if bin.tools.is_decimal(float_num):
|
|
|
|
return [int_num, float_num, unit1, unit2]
|
|
|
|
else:
|
|
|
|
return [int_num, decimal.Decimal(str(float_num)), unit1, unit2]
|
2020-12-31 23:13:11 +08:00
|
|
|
|
2021-01-23 21:43:04 +08:00
|
|
|
|
2021-01-25 19:23:16 +08:00
|
|
|
def basic_force() -> list:
|
2020-12-31 23:13:11 +08:00
|
|
|
return [basic_number(unit1=["N"]), basic_number(unit1=["N"])]
|
2021-01-01 11:02:44 +08:00
|
|
|
|
2021-01-23 21:43:04 +08:00
|
|
|
|
2021-01-25 19:23:16 +08:00
|
|
|
def configs(name) -> dict:
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2021-01-26 08:06:36 +08:00
|
|
|
def name_handler(name: str, configs: dict = None) -> str:
|
|
|
|
if configs is None:
|
|
|
|
return name
|
|
|
|
for need_replace in configs:
|
|
|
|
if need_replace == '{date}':
|
|
|
|
replace = time.strftime(configs[need_replace], time.gmtime(time.time()))
|
|
|
|
name.replace(need_replace, replace)
|
|
|
|
name.replace(need_replace, configs[need_replace])
|