Files
pre-commit/pre_commit/five.py
2017-03-08 14:25:54 -08:00

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