Skip to content

Commit

Permalink
Don't specify 'utf-8' argument to bytes.decode() (#590)
Browse files Browse the repository at this point in the history
`bytes.decode()` defaults to the `utf-8` encoding.
  • Loading branch information
brainix authored Jan 12, 2022
1 parent a7afbcc commit 7594f31
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pottery/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def _encode(decoded_value: JSONTypes) -> str:
@staticmethod
def _decode(encoded_value: AnyStr) -> JSONTypes:
if isinstance(encoded_value, bytes):
string = encoded_value.decode('utf-8')
string = encoded_value.decode()
else:
string = encoded_value
decoded_value: JSONTypes = json.loads(string)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def test_decoded_responses(self):
# File "/Users/rajiv.shah/Documents/Code/pottery/pottery/dict.py", line 116, in <dictcomp>
# dict_ = {self._decode(key): self._decode(value) for key, value in items}
# File "/Users/rajiv.shah/Documents/Code/pottery/pottery/base.py", line 154, in _decode
# decoded: JSONTypes = json.loads(value.decode('utf-8'))
# decoded: JSONTypes = json.loads(value.decode())
# AttributeError: 'str' object has no attribute 'decode'
repr(tel)

Expand Down

0 comments on commit 7594f31

Please sign in to comment.