mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
14 lines
256 B
Python
14 lines
256 B
Python
from __future__ import unicode_literals
|
|
|
|
import six
|
|
|
|
|
|
def to_text(s):
|
|
return s if isinstance(s, six.text_type) else s.decode('UTF-8')
|
|
|
|
|
|
def to_bytes(s):
|
|
return s if isinstance(s, bytes) else s.encode('UTF-8')
|
|
|
|
|
|
n = to_bytes if six.PY2 else to_text
|