Using isinstance() instead of type() for a typecheck

This commit is contained in:
洛水居室 2022-06-27 23:40:32 +08:00
parent 86dfce0b09
commit ff26e814d2
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC
2 changed files with 3 additions and 3 deletions

View File

@ -14,7 +14,7 @@ class Config:
self._config_json: dict = ujson.load(f)
self.DEBUG = self.get_config("debug")
if type(self.DEBUG) != bool:
if not isinstance(self.DEBUG, bool):
self.DEBUG = False
self.ADMINISTRATORS = self.get_config("administrators")
self.MYSQL = self.get_config("mysql")

View File

@ -38,9 +38,9 @@ class PluginsManager:
self.plugin_list.append(root)
def add_exclude(self, exclude: Union[str, List[str]]):
if type(exclude) == str:
if isinstance(exclude, str):
self.exclude_list.append(exclude)
elif type(exclude) == list:
elif isinstance(exclude, list):
self.exclude_list.extend(exclude)
else:
raise TypeError