mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 16:24:40 +04:00
Clean up calls to .encode() / .decode()
This commit is contained in:
parent
b2faf339ce
commit
aefbe71765
11 changed files with 17 additions and 18 deletions
|
|
@ -2,11 +2,11 @@ from typing import Union
|
|||
|
||||
|
||||
def to_text(s: Union[str, bytes]) -> str:
|
||||
return s if isinstance(s, str) else s.decode('UTF-8')
|
||||
return s if isinstance(s, str) else s.decode()
|
||||
|
||||
|
||||
def to_bytes(s: Union[str, bytes]) -> bytes:
|
||||
return s if isinstance(s, bytes) else s.encode('UTF-8')
|
||||
return s if isinstance(s, bytes) else s.encode()
|
||||
|
||||
|
||||
n = to_text
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue