Todo: 集成多平台 解决因SaiNiu线程抢占资源问题 本地提交测试环境打包 和 正式打包脚本与正式环境打包bat 提交Python32环境包 改进多日志文件生成情况修改打包日志细节
This commit is contained in:
@@ -0,0 +1 @@
|
||||
from .utility_functions import pop_from_dict_by_set, check_kwargs_empty
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
def pop_from_dict_by_set(dictionary: dict, valid_keys: set) -> dict:
|
||||
""" remove and create new dict with key value pairs of dictionary, where key is in valid_keys """
|
||||
new_dictionary = {}
|
||||
|
||||
for key in list(dictionary.keys()):
|
||||
if key in valid_keys:
|
||||
new_dictionary[key] = dictionary.pop(key)
|
||||
|
||||
return new_dictionary
|
||||
|
||||
|
||||
def check_kwargs_empty(kwargs_dict, raise_error=False) -> bool:
|
||||
""" returns True if kwargs are empty, False otherwise, raises error if not empty """
|
||||
|
||||
if len(kwargs_dict) > 0:
|
||||
if raise_error:
|
||||
raise ValueError(f"{list(kwargs_dict.keys())} are not supported arguments. Look at the documentation for supported arguments.")
|
||||
else:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
Reference in New Issue
Block a user