Commit e028cf28 authored by Kirill Smelkov's avatar Kirill Smelkov

golang: qq: Don't depend on six

Just use builtins and cimported things that we have at pyx level.
parent 3073ac98
...@@ -770,7 +770,6 @@ cdef DType parse_dtype(dtype) except <DType>-1: ...@@ -770,7 +770,6 @@ cdef DType parse_dtype(dtype) except <DType>-1:
# ---- strings ---- # ---- strings ----
from golang import strconv as pystrconv from golang import strconv as pystrconv
import six
def pyb(s): # -> bytes def pyb(s): # -> bytes
"""b converts str/unicode/bytes s to UTF-8 encoded bytestring. """b converts str/unicode/bytes s to UTF-8 encoded bytestring.
...@@ -821,14 +820,14 @@ def pyqq(obj): ...@@ -821,14 +820,14 @@ def pyqq(obj):
# make sure obj is text | bytes # make sure obj is text | bytes
# py2: unicode | str # py2: unicode | str
# py3: str | bytes # py3: str | bytes
if not isinstance(obj, (six.text_type, six.binary_type)): if not isinstance(obj, (unicode, bytes)):
obj = str(obj) obj = str(obj)
qobj = pystrconv.quote(obj) qobj = pystrconv.quote(obj)
# `printf('%s', qq(obj))` should work. For this make sure qobj is always a # `printf('%s', qq(obj))` should work. For this make sure qobj is always a
# str - not bytes under py3 (if it was bytes it will print e.g. as b'...') # str - not bytes under py3 (if it was bytes it will print e.g. as b'...')
if six.PY3: if PY_MAJOR_VERSION >= 3:
qobj = pyu(qobj) qobj = pyu(qobj)
return qobj return qobj
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment