mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-16 04:35:49 +00:00
Using isinstance() instead of type() for a typecheck
This commit is contained in:
parent
86dfce0b09
commit
ff26e814d2
@ -14,7 +14,7 @@ class Config:
|
|||||||
self._config_json: dict = ujson.load(f)
|
self._config_json: dict = ujson.load(f)
|
||||||
|
|
||||||
self.DEBUG = self.get_config("debug")
|
self.DEBUG = self.get_config("debug")
|
||||||
if type(self.DEBUG) != bool:
|
if not isinstance(self.DEBUG, bool):
|
||||||
self.DEBUG = False
|
self.DEBUG = False
|
||||||
self.ADMINISTRATORS = self.get_config("administrators")
|
self.ADMINISTRATORS = self.get_config("administrators")
|
||||||
self.MYSQL = self.get_config("mysql")
|
self.MYSQL = self.get_config("mysql")
|
||||||
|
@ -38,9 +38,9 @@ class PluginsManager:
|
|||||||
self.plugin_list.append(root)
|
self.plugin_list.append(root)
|
||||||
|
|
||||||
def add_exclude(self, exclude: Union[str, List[str]]):
|
def add_exclude(self, exclude: Union[str, List[str]]):
|
||||||
if type(exclude) == str:
|
if isinstance(exclude, str):
|
||||||
self.exclude_list.append(exclude)
|
self.exclude_list.append(exclude)
|
||||||
elif type(exclude) == list:
|
elif isinstance(exclude, list):
|
||||||
self.exclude_list.extend(exclude)
|
self.exclude_list.extend(exclude)
|
||||||
else:
|
else:
|
||||||
raise TypeError
|
raise TypeError
|
||||||
|
Loading…
Reference in New Issue
Block a user