Skip to content

Commit 95ee20f

Browse files
committed
Remove six
1 parent 0182620 commit 95ee20f

File tree

5 files changed

+20
-24
lines changed

5 files changed

+20
-24
lines changed

openapi_schema_validator/_format.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
from jsonschema._format import FormatChecker
77
from jsonschema.exceptions import FormatError
8-
from six import binary_type, text_type, integer_types
98

109
DATETIME_HAS_RFC3339_VALIDATOR = False
1110
DATETIME_HAS_STRICT_RFC3339 = False
@@ -38,11 +37,11 @@
3837

3938

4039
def is_int32(instance):
41-
return isinstance(instance, integer_types)
40+
return isinstance(instance, int)
4241

4342

4443
def is_int64(instance):
45-
return isinstance(instance, integer_types)
44+
return isinstance(instance, int)
4645

4746

4847
def is_float(instance):
@@ -56,11 +55,11 @@ def is_double(instance):
5655

5756

5857
def is_binary(instance):
59-
return isinstance(instance, binary_type)
58+
return isinstance(instance, bytes)
6059

6160

6261
def is_byte(instance):
63-
if isinstance(instance, text_type):
62+
if isinstance(instance, str):
6463
instance = instance.encode()
6564

6665
try:
@@ -70,7 +69,7 @@ def is_byte(instance):
7069

7170

7271
def is_datetime(instance):
73-
if not isinstance(instance, (binary_type, text_type)):
72+
if not isinstance(instance, (bytes, str)):
7473
return False
7574

7675
if DATETIME_HAS_RFC3339_VALIDATOR:
@@ -86,23 +85,23 @@ def is_datetime(instance):
8685

8786

8887
def is_date(instance):
89-
if not isinstance(instance, (binary_type, text_type)):
88+
if not isinstance(instance, (bytes, str)):
9089
return False
9190

92-
if isinstance(instance, binary_type):
91+
if isinstance(instance, bytes):
9392
instance = instance.decode()
9493

9594
return datetime.strptime(instance, "%Y-%m-%d")
9695

9796

9897
def is_uuid(instance):
99-
if not isinstance(instance, (binary_type, text_type)):
98+
if not isinstance(instance, (bytes, str)):
10099
return False
101100

102-
if isinstance(instance, binary_type):
101+
if isinstance(instance, bytes):
103102
instance = instance.decode()
104103

105-
return text_type(UUID(instance)).lower() == instance.lower()
104+
return str(UUID(instance)).lower() == instance.lower()
106105

107106

108107
def is_password(instance):

openapi_schema_validator/_types.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
TypeChecker, is_array, is_bool, is_integer,
33
is_object, is_number,
44
)
5-
from six import text_type, binary_type
65

76

87
def is_string(checker, instance):
9-
return isinstance(instance, (text_type, binary_type))
8+
return isinstance(instance, (str, bytes))
109

1110

1211
oas30_type_checker = TypeChecker(

poetry.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ classifiers = [
3333

3434
[tool.poetry.dependencies]
3535
python = "^3.6.2"
36-
six = "*"
3736
jsonschema = "*"
3837
rfc3339-validator = {version = "*", optional = true}
3938
strict-rfc3339 = {version = "*", optional = true}

tests/integration/test_validators.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from jsonschema import ValidationError
22
import pytest
3-
from six import u
43

54
from openapi_schema_validator import OAS30Validator, oas30_format_checker
65

@@ -36,8 +35,8 @@ def test_nullable(self, schema_type):
3635
assert result is None
3736

3837
@pytest.mark.parametrize('value', [
39-
u('1989-01-02T00:00:00Z'),
40-
u('2018-01-02T23:59:59Z'),
38+
u'1989-01-02T00:00:00Z',
39+
u'2018-01-02T23:59:59Z',
4140
])
4241
@mock.patch(
4342
'openapi_schema_validator._format.'
@@ -61,8 +60,8 @@ def test_string_format_no_datetime_validator(self, value):
6160
assert result is None
6261

6362
@pytest.mark.parametrize('value', [
64-
u('1989-01-02T00:00:00Z'),
65-
u('2018-01-02T23:59:59Z'),
63+
u'1989-01-02T00:00:00Z',
64+
u'2018-01-02T23:59:59Z',
6665
])
6766
@mock.patch(
6867
'openapi_schema_validator._format.'
@@ -86,8 +85,8 @@ def test_string_format_datetime_rfc3339_validator(self, value):
8685
assert result is None
8786

8887
@pytest.mark.parametrize('value', [
89-
u('1989-01-02T00:00:00Z'),
90-
u('2018-01-02T23:59:59Z'),
88+
u'1989-01-02T00:00:00Z',
89+
u'2018-01-02T23:59:59Z',
9190
])
9291
@mock.patch(
9392
'openapi_schema_validator._format.'
@@ -111,8 +110,8 @@ def test_string_format_datetime_strict_rfc3339(self, value):
111110
assert result is None
112111

113112
@pytest.mark.parametrize('value', [
114-
u('1989-01-02T00:00:00Z'),
115-
u('2018-01-02T23:59:59Z'),
113+
u'1989-01-02T00:00:00Z',
114+
u'2018-01-02T23:59:59Z',
116115
])
117116
@mock.patch(
118117
'openapi_schema_validator._format.'

0 commit comments

Comments
 (0)