Do None check before isinstance check.

This commit is contained in:
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

View file

@ -685,12 +685,12 @@ def limiter_or_none(value):
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.
'''
if isinstance(value, ratelimiter.Ratelimiter):
return value
if value is None:
return None
if isinstance(value, ratelimiter.Ratelimiter):
return value
if isinstance(value, str):
value = bytestring.parsebytes(value)