Method 'download_emoji' was expected to be 'non-async', found it instead as 'async'
189 break
190 return os.path.isdir('./resources/emoji/twemoji')
191
192 async def download_emoji(self, download_url: str = None, savepath='./resources/emoji/twemoji.zip', proxy=None):193 # 如果本地已存在,便无需重新下载
194 if os.path.isdir('./resources/emoji/twemoji'):
195 return
Description
You're changing the method's type while overriding it in the child class. This may lead to unintentional bugs during runtime because of the incinsistency. Some of the cases where this issue would be raised are:
- Overriding a method as a property, or the other way around.
- Changing a method to async during overriding, or vice versa.
class BaseClass(metaclass=abc.ABCMeta):
@property
@abc.abstractmethod
def prop(self):
...
@abc.abstractmethod
def credit(self):
...
async def yell(self):
...
Bad practice
class InvalidDerived(BaseClass):
def prop(self): # Method was a property in the base class.
...
@property
def credit(self): # Method is being overridden as a `property`
...
def yell(self): # This was async in the base class
...
Recommended
class ValidDerived(BaseClass):
@property
def prop(self):
return None
def credit(self):
return None
async def yell(self):
...