comparison env/lib/python3.9/site-packages/zipstream/compat.py @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4f3585e2f14b
1 # -*- coding: utf-8 -*-
2
3 """
4 pythoncompat
5
6 Copied from requests
7 """
8
9 import sys
10
11 # -------
12 # Pythons
13 # -------
14
15
16 PY2 = sys.version_info[0] == 2
17 PY3 = sys.version_info[0] == 3
18
19
20 # ---------
21 # Specifics
22 # ---------
23
24 if PY2:
25 builtin_str = str
26 bytes = str
27 str = unicode
28 basestring = basestring
29 numeric_types = (int, long, float)
30
31
32 elif PY3:
33 builtin_str = str
34 str = str
35 bytes = bytes
36 basestring = (str, bytes)
37 numeric_types = (int, float)
38
39
40 try:
41 from zipfile import ZIP64_VERSION
42 except ImportError:
43 ZIP64_VERSION = 45
44
45 try:
46 from zipfile import BZIP2_VERSION
47 except ImportError:
48 BZIP2_VERSION = 46
49
50 try:
51 from zipfile import ZIP_BZIP2
52 except ImportError:
53 ZIP_BZIP2 = 12
54
55 try:
56 from zipfile import LZMA_VERSION
57 except ImportError:
58 LZMA_VERSION = 63
59
60 try:
61 from zipfile import ZIP_LZMA
62 except ImportError:
63 ZIP_LZMA = 14
64
65 try:
66 from zipfile import ZIP_MAX_COMMENT
67 except ImportError:
68 ZIP_MAX_COMMENT = (1 << 16) - 1
69
70
71 # Copy from io
72 SEEK_SET = 0 # start of the stream (the default); offset should be zero or positive
73 SEEK_CUR = 1 # current stream position; offset may be negative
74 SEEK_END = 2 # end of the stream; offset is usually negative