Files
pre-commit/pre_commit/five.py
Anthony Sottile 18c9e061d8 Small cleanups
2017-09-30 15:53:44 -07:00

16 lines
295 B
Python

from __future__ import absolute_import
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