little change
This commit is contained in:
parent
5520fb88c6
commit
fe1cabb6a4
@ -4,14 +4,27 @@ mail: 3695888@qq.com
|
||||
"""
|
||||
|
||||
import re
|
||||
import bin
|
||||
import time
|
||||
import decimal
|
||||
|
||||
|
||||
def basic_number(Int=0, Float=1, unit1=None, unit2=None) -> list:
|
||||
if unit2 is None:
|
||||
unit2 = []
|
||||
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
|
||||
"""
|
||||
if unit1 is None:
|
||||
unit1 = []
|
||||
return [Int, Float, unit1, unit2]
|
||||
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]
|
||||
|
||||
|
||||
def basic_force() -> list:
|
||||
@ -22,5 +35,11 @@ def configs(name) -> dict:
|
||||
pass
|
||||
|
||||
|
||||
def name_handler(name: str, configs: dict) -> str:
|
||||
pass
|
||||
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])
|
||||
|
6
tests/dict_test.py
Normal file
6
tests/dict_test.py
Normal file
@ -0,0 +1,6 @@
|
||||
a = {'a': 'b', 're': '2'}
|
||||
|
||||
import pprint
|
||||
|
||||
for x in a:
|
||||
print(x)
|
Loading…
Reference in New Issue
Block a user