aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/cython/Cython/Tempita/compat3.py
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:15 +0300
commit72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch)
treeda2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /contrib/tools/cython/Cython/Tempita/compat3.py
parent778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff)
downloadydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/tools/cython/Cython/Tempita/compat3.py')
-rw-r--r--contrib/tools/cython/Cython/Tempita/compat3.py88
1 files changed, 44 insertions, 44 deletions
diff --git a/contrib/tools/cython/Cython/Tempita/compat3.py b/contrib/tools/cython/Cython/Tempita/compat3.py
index 9905530757..98cdb8fa36 100644
--- a/contrib/tools/cython/Cython/Tempita/compat3.py
+++ b/contrib/tools/cython/Cython/Tempita/compat3.py
@@ -1,47 +1,47 @@
-import sys
-
+import sys
+
__all__ = ['b', 'basestring_', 'bytes', 'unicode_', 'next', 'is_unicode']
-
-if sys.version < "3":
- b = bytes = str
- basestring_ = basestring
+
+if sys.version < "3":
+ b = bytes = str
+ basestring_ = basestring
unicode_ = unicode
-else:
-
- def b(s):
- if isinstance(s, str):
- return s.encode('latin1')
- return bytes(s)
- basestring_ = (bytes, str)
- bytes = bytes
+else:
+
+ def b(s):
+ if isinstance(s, str):
+ return s.encode('latin1')
+ return bytes(s)
+ basestring_ = (bytes, str)
+ bytes = bytes
unicode_ = str
-text = str
-
-if sys.version < "3":
-
- def next(obj):
- return obj.next()
-else:
- next = next
-
-if sys.version < "3":
-
- def is_unicode(obj):
- return isinstance(obj, unicode)
-else:
-
- def is_unicode(obj):
- return isinstance(obj, str)
-
-
-def coerce_text(v):
- if not isinstance(v, basestring_):
- if sys.version < "3":
- attr = '__unicode__'
- else:
- attr = '__str__'
- if hasattr(v, attr):
- return unicode(v)
- else:
- return bytes(v)
- return v
+text = str
+
+if sys.version < "3":
+
+ def next(obj):
+ return obj.next()
+else:
+ next = next
+
+if sys.version < "3":
+
+ def is_unicode(obj):
+ return isinstance(obj, unicode)
+else:
+
+ def is_unicode(obj):
+ return isinstance(obj, str)
+
+
+def coerce_text(v):
+ if not isinstance(v, basestring_):
+ if sys.version < "3":
+ attr = '__unicode__'
+ else:
+ attr = '__str__'
+ if hasattr(v, attr):
+ return unicode(v)
+ else:
+ return bytes(v)
+ return v