Do None check before isinstance check.
This commit is contained in:
parent
2d8d51a4f1
commit
4741946eda
1 changed files with 3 additions and 3 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue