Skip to content

Commit 95e5f00

Browse files
authored
validators: drop six usage (#186)
As python 3.4 is the required version there's no need to keep six for Python 2 compat.
1 parent f7221ba commit 95e5f00

File tree

5 files changed

+5
-22
lines changed

5 files changed

+5
-22
lines changed

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ def get_version():
3333
}
3434

3535
install_requires = [
36-
'six>=1.4.0',
3736
'decorator>=3.4.0',
3837
]
3938

tests/test_validation_failure.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import six
2-
31
import validators
42

53
obj_repr = (
@@ -19,7 +17,7 @@ def test_repr(self):
1917
assert obj_repr in repr(self.obj)
2018

2119
def test_unicode(self):
22-
assert obj_repr in six.text_type(self.obj)
20+
assert obj_repr in str(self.obj)
2321

2422
def test_arguments_as_properties(self):
2523
assert self.obj.value == 3

validators/domain.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
import re
22

3-
import six
4-
53
from .utils import validator
64

7-
if six.PY3:
8-
text_type = str
9-
unicode = str
10-
else:
11-
text_type = unicode
12-
135
pattern = re.compile(
146
r'^(?:[a-zA-Z0-9]' # First character of the domain
157
r'(?:[a-zA-Z0-9-_]{0,61}[A-Za-z0-9])?\.)' # Sub domain + hostname
@@ -22,7 +14,7 @@ def to_unicode(obj, charset='utf-8', errors='strict'):
2214
if obj is None:
2315
return None
2416
if not isinstance(obj, bytes):
25-
return text_type(obj)
17+
return str(obj)
2618
return obj.decode(charset, errors)
2719

2820

validators/truthy.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import six
2-
31
from .utils import validator
42

53

@@ -37,5 +35,5 @@ def truthy(value):
3735
"""
3836
return (
3937
value and
40-
(not isinstance(value, six.string_types) or value.strip())
38+
(not isinstance(value, str) or value.strip())
4139
)

validators/utils.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import itertools
33
from collections import OrderedDict
44

5-
import six
65
from decorator import decorator
76

87

@@ -37,10 +36,7 @@ def func_args_as_dict(func, args, kwargs):
3736
Return given function's positional and key value arguments as an ordered
3837
dictionary.
3938
"""
40-
if six.PY2:
41-
_getargspec = inspect.getargspec
42-
else:
43-
_getargspec = inspect.getfullargspec
39+
_getargspec = inspect.getfullargspec
4440

4541
arg_names = list(
4642
OrderedDict.fromkeys(
@@ -51,7 +47,7 @@ def func_args_as_dict(func, args, kwargs):
5147
)
5248
)
5349
return OrderedDict(
54-
list(six.moves.zip(arg_names, args)) +
50+
list(zip(arg_names, args)) +
5551
list(kwargs.items())
5652
)
5753

0 commit comments

Comments
 (0)