summaryrefslogtreecommitdiff
path: root/src/service_identity/_compat.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/service_identity/_compat.py')
-rw-r--r--src/service_identity/_compat.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/service_identity/_compat.py b/src/service_identity/_compat.py
new file mode 100644
index 0000000..65febe8
--- /dev/null
+++ b/src/service_identity/_compat.py
@@ -0,0 +1,15 @@
+"""
+Avoid depending on any particular Python 3 compatibility approach.
+"""
+
+import sys
+
+
+PY3 = sys.version_info[0] == 3
+if PY3: # pragma: nocover
+ maketrans = bytes.maketrans
+ text_type = str
+else: # pragma: nocover
+ import string
+ maketrans = string.maketrans
+ text_type = unicode # noqa