Remove multiple returns

This commit is contained in:
Bo Maryniuk 2018-09-18 23:56:04 +02:00
parent 3fde850640
commit d05999e28d

View file

@ -62,9 +62,7 @@ def text_(s, encoding='latin-1', errors='strict'):
If ``s`` is an instance of ``binary_type``, return
``s.decode(encoding, errors)``, otherwise return ``s``
'''
if isinstance(s, binary_type):
return s.decode(encoding, errors)
return s
return s.decode(encoding, errors) if isinstance(s, binary_type) else s
def bytes_(s, encoding='latin-1', errors='strict'):
@ -72,9 +70,7 @@ def bytes_(s, encoding='latin-1', errors='strict'):
If ``s`` is an instance of ``text_type``, return
``s.encode(encoding, errors)``, otherwise return ``s``
'''
if isinstance(s, text_type):
return s.encode(encoding, errors)
return s
return s.encode(encoding, errors) if isinstance(s, text_type) else s
def ascii_native_(s):