# -*- coding:utf-8 -*- # title :造物主 # description :造物主 # author :Python超人 # date :2024-03-20 # link :https://gitcode.net/pythoncr/ # python_version :3.9 # ============================================================================== """ 要在PyCharm中关闭“Non-ASCII characters in an identifier”警告,您可以按照以下步骤操作: 1. 打开PyCharm,并转到"File" -> "Settings"。 2. 在设置窗口中,选择"Editor" -> "Inspections"。 3. 在右侧的搜索框中输入"Non-ASCII characters in an identifier"。 4. 在搜索结果中找到这个警告 Non-ASCII,并取消勾选相应的复选框以禁用该警告。 5. 点击"Apply"和"OK"保存更改并关闭设置窗口。 """ import inspect class 造物主: registered_objs = {} @staticmethod def 造物(名称: str, **kwargs): o = 造物主.取物(名称, **kwargs) # current_method = inspect.currentframe().f_code.co_name return o @staticmethod def 取物(名称, **kwargs): cls = 造物主.registered_objs.get(名称, None) if cls is None: return None return cls(**kwargs) @staticmethod def 登记(名称, 类型): if isinstance(名称, list): for 名 in 名称: 造物主.registered_objs[str(名).lower()] = 类型 造物主.registered_objs[str(名称).lower()] = 类型