Remove unnecessary elif blocks
@@ -9,7 +9,7 @@ def to_bytes(
return x
elif not isinstance(x, str):
raise TypeError(f"not expecting type {type(x).__name__}")
- elif encoding or errors:
+ if encoding or errors:
return x.encode(encoding or "utf-8", errors=errors or "strict")
return x.encode()
@@ -21,7 +21,7 @@ def to_str(
return x
elif not isinstance(x, bytes):
raise TypeError(f"not expecting type {type(x).__name__}")
- elif encoding or errors:
+ if encoding or errors:
return x.decode(encoding or "utf-8", errors=errors or "strict")
return x.decode()
