Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def get_version():
}

install_requires = [
'six>=1.4.0',
'decorator>=3.4.0',
]

Expand Down
4 changes: 1 addition & 3 deletions tests/test_validation_failure.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import six

import validators

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

def test_unicode(self):
assert obj_repr in six.text_type(self.obj)
assert obj_repr in str(self.obj)

def test_arguments_as_properties(self):
assert self.obj.value == 3
Expand Down
10 changes: 1 addition & 9 deletions validators/domain.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
import re

import six

from .utils import validator

if six.PY3:
text_type = str
unicode = str
else:
text_type = unicode

pattern = re.compile(
r'^(?:[a-zA-Z0-9]' # First character of the domain
r'(?:[a-zA-Z0-9-_]{0,61}[A-Za-z0-9])?\.)' # Sub domain + hostname
Expand All @@ -22,7 +14,7 @@ def to_unicode(obj, charset='utf-8', errors='strict'):
if obj is None:
return None
if not isinstance(obj, bytes):
return text_type(obj)
return str(obj)
return obj.decode(charset, errors)


Expand Down
4 changes: 1 addition & 3 deletions validators/truthy.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import six

from .utils import validator


Expand Down Expand Up @@ -37,5 +35,5 @@ def truthy(value):
"""
return (
value and
(not isinstance(value, six.string_types) or value.strip())
(not isinstance(value, str) or value.strip())
)
8 changes: 2 additions & 6 deletions validators/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import itertools
from collections import OrderedDict

import six
from decorator import decorator


Expand Down Expand Up @@ -37,10 +36,7 @@ def func_args_as_dict(func, args, kwargs):
Return given function's positional and key value arguments as an ordered
dictionary.
"""
if six.PY2:
_getargspec = inspect.getargspec
else:
_getargspec = inspect.getfullargspec
_getargspec = inspect.getfullargspec

arg_names = list(
OrderedDict.fromkeys(
Expand All @@ -51,7 +47,7 @@ def func_args_as_dict(func, args, kwargs):
)
)
return OrderedDict(
list(six.moves.zip(arg_names, args)) +
list(zip(arg_names, args)) +
list(kwargs.items())
)

Expand Down