forked from arjan-s/python-zipstream
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompat.py
More file actions
68 lines (50 loc) · 991 Bytes
/
compat.py
File metadata and controls
68 lines (50 loc) · 991 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# -*- coding: utf-8 -*-
"""
pythoncompat
Copied from requests
"""
import sys
# -------
# Pythons
# -------
PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
# ---------
# Specifics
# ---------
if PY2:
builtin_str = str
bytes = str
str = unicode
basestring = basestring
numeric_types = (int, long, float)
elif PY3:
builtin_str = str
str = str
bytes = bytes
basestring = (str, bytes)
numeric_types = (int, float)
try:
from zipfile import ZIP64_VERSION
except ImportError:
ZIP64_VERSION = 45
try:
from zipfile import BZIP2_VERSION
except ImportError:
BZIP2_VERSION = 46
try:
from zipfile import ZIP_BZIP2
except ImportError:
ZIP_BZIP2 = 12
try:
from zipfile import LZMA_VERSION
except ImportError:
LZMA_VERSION = 63
try:
from zipfile import ZIP_LZMA
except ImportError:
ZIP_LZMA = 14
try:
from zipfile import ZIP_MAX_COMMENT
except ImportError:
ZIP_MAX_COMMENT = (1 << 16) - 1