File: compat.py

package info (click to toggle)
python-translationstring 1.4-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 248 kB
  • sloc: python: 797; makefile: 70
file content (18 lines) | stat: -rw-r--r-- 342 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import sys

PY3 = sys.version_info[0] == 3

if PY3: # pragma: no cover
    string_types = (str,)
    text_type = str
else: # pragma: no cover
    string_types = (basestring,)
    text_type = unicode

if PY3: # pragma: no cover
    def u(s):
        return s
else: # pragma: no cover
    def u(s):
        return unicode(s, 'unicode_escape')