File: remove_six.patch

package info (click to toggle)
python-srptools 1.0.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 216 kB
  • sloc: python: 656; makefile: 5; sh: 5
file content (61 lines) | stat: -rw-r--r-- 1,708 bytes parent folder | download
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
--- a/setup.py
+++ b/setup.py
@@ -44,7 +44,7 @@
     include_package_data=True,
     zip_safe=False,
 
-    install_requires=['six'],
+    install_requires=[],
     setup_requires=[] + PYTEST_RUNNER,
     extras_require={'cli':  ['click>=2.0']},
     tests_require=['pytest'],
--- a/srptools/context.py
+++ b/srptools/context.py
@@ -1,7 +1,6 @@
 from __future__ import unicode_literals
 from random import SystemRandom as random
 
-from six import integer_types, PY3
 
 from .utils import int_from_hex, int_to_bytes, hex_from, value_encode, b64_from
 from .constants import PRIME_1024, PRIME_1024_GEN, HASH_SHA_1
@@ -82,10 +81,10 @@
         as_bytes = kwargs.get('as_bytes', False)
 
         def conv(arg):
-            if isinstance(arg, integer_types):
+            if isinstance(arg, int):
                 arg = int_to_bytes(arg)
 
-            if PY3:
+            if True:
                 if isinstance(arg, str):
                     arg = arg.encode('utf-8')
                 return arg
--- a/srptools/utils.py
+++ b/srptools/utils.py
@@ -2,7 +2,6 @@
 from binascii import unhexlify, hexlify
 from base64 import b64encode, b64decode
 
-from six import integer_types
 
 
 def value_encode(val, base64=False):
@@ -25,7 +24,7 @@
     :param bytes|str|unicode|int|long val:
     :rtype: bytes|str
     """
-    if isinstance(val, integer_types):
+    if isinstance(val, int):
         hex_str = '%x' % val
         if len(hex_str) % 2:
             hex_str = '0' + hex_str
@@ -59,6 +58,6 @@
     :param int|long|bytes val:
     :rtype: bytes|str
     """
-    if isinstance(val, integer_types):
+    if isinstance(val, int):
         val = int_to_bytes(val)
     return b64encode(val).decode('ascii')