mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-01-13 12:30:08 -06:00
15 lines
256 B
Python
15 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
|