From 5520fb88c6b25baa0fe0e11a41f2be346d0e8965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E7=91=97=E6=9D=B0?= <3695888@qq.com> Date: Mon, 25 Jan 2021 19:23:16 +0800 Subject: [PATCH] reeee configs.py --- SR-PY.py | 2 +- bin/configs.py | 16 +++++++++++++--- bin/main.py | 8 ++++---- bin/tools.py | 10 +++++----- configs/logging.json5 | 3 ++- 5 files changed, 25 insertions(+), 14 deletions(-) diff --git a/SR-PY.py b/SR-PY.py index 4508bca..5ab2279 100644 --- a/SR-PY.py +++ b/SR-PY.py @@ -16,7 +16,7 @@ def main(): if py_v_info[0] == 2: raise Exception("Simple Rocket need python vision 3+") # start games - game = bin.main.Game() + game = bin.bin.main.Game() if __name__ == "__main__": diff --git a/bin/configs.py b/bin/configs.py index ed4414a..7152c71 100644 --- a/bin/configs.py +++ b/bin/configs.py @@ -3,14 +3,24 @@ writen by shenjackyuanjie mail: 3695888@qq.com """ +import re -def basic_number(Int=0, Float=1, unit1=[], unit2=[]): + +def basic_number(Int=0, Float=1, unit1=None, unit2=None) -> list: + if unit2 is None: + unit2 = [] + if unit1 is None: + unit1 = [] return [Int, Float, unit1, unit2] -def basic_force(): +def basic_force() -> list: return [basic_number(unit1=["N"]), basic_number(unit1=["N"])] -def configs(name): +def configs(name) -> dict: + pass + + +def name_handler(name: str, configs: dict) -> str: pass diff --git a/bin/main.py b/bin/main.py index 11a2111..355f3f1 100644 --- a/bin/main.py +++ b/bin/main.py @@ -22,12 +22,12 @@ class Game(): self.start_time = time.strftime("%Y-%m-%d %H-%M-%S", time.gmtime(time.time())) self.configs = '' # share memory - self.dics = share().dict() + self.dicts = share().dict() self.lists = share().list() # logger self.server_logger = logging.getLogger('server') self.client_logger = logging.getLogger('client') - self.log_file_hander = logging.FileHandler('') + self.log_file_handler = logging.FileHandler('') # client and server - self.client = client.RenderThread(self.lists, self.dics, self.client_logger, net_mode='local') - self.server = server.server(self.lists, self.dics, self.server_logger, net_mode='local') + self.client = client.RenderThread(self.lists, self.dicts, self.client_logger, net_mode='local') + self.server = server.server(self.lists, self.dicts, self.server_logger, net_mode='local') diff --git a/bin/tools.py b/bin/tools.py index e1503ff..768e3ca 100644 --- a/bin/tools.py +++ b/bin/tools.py @@ -26,14 +26,14 @@ Physics calculation """ -def is_decimal(A): +def is_decimal(A: any) -> bool: if type(A) == type(decimal.Decimal): return True else: return False -def F_D(A, B): +def F_D(A: decimal, B: decimal) -> decimal: if is_decimal(A) and is_decimal(B): return A / B @@ -42,7 +42,7 @@ def F_Mu(): pass -def D_C(listA, listB): # stand for Duplicate check +def D_C(listA: list, listB: list) -> '1': # stand for Duplicate check """ usage:\n input two list\n @@ -57,10 +57,10 @@ def D_C(listA, listB): # stand for Duplicate check continue listA.sort() listB.sort() - return + return 1 -def S_C_float_check(SC): # stand for Scientific notation's float check +def S_C_float_check(SC) -> dict: # stand for Scientific notation's float check """ formats: SC list format:docs.basic_config.json:basic_number""" diff --git a/configs/logging.json5 b/configs/logging.json5 index 59e8347..68edf5c 100644 --- a/configs/logging.json5 +++ b/configs/logging.json5 @@ -17,8 +17,9 @@ 'filename': { 'main': '{date} SR.log', // {date} -> date - '{date}': '%Y-%m-%d %H-%M-%S', + '{date}': '%Y-%m-%d %H-%M-%S' // format at https://docs.python.org/zh-cn/3.8/library/time.html#time.strftime + // can and more {xx} by adding more obj EZ } } } \ No newline at end of file