Do None check before isinstance check.

master
voussoir 2021-05-18 23:26:44 -07:00
parent 2d8d51a4f1
commit 4741946eda
No known key found for this signature in database
GPG Key ID: 5F7554F8C26DACCB
1 changed files with 3 additions and 3 deletions

View File

@ -685,12 +685,12 @@ def limiter_or_none(value):
Returns a Ratelimiter object if the argument can be normalized to one, Returns a Ratelimiter object if the argument can be normalized to one,
or None if the argument is None. Saves the caller from having to if. or None if the argument is None. Saves the caller from having to if.
''' '''
if isinstance(value, ratelimiter.Ratelimiter):
return value
if value is None: if value is None:
return None return None
if isinstance(value, ratelimiter.Ratelimiter):
return value
if isinstance(value, str): if isinstance(value, str):
value = bytestring.parsebytes(value) value = bytestring.parsebytes(value)