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