Skip to content

Commit 84bb48b

Browse files
fix setup.py and requirements
update dependencies to modern versions
1 parent 742d09b commit 84bb48b

File tree

7 files changed

+77
-77
lines changed

7 files changed

+77
-77
lines changed

requirements.pip

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
coverage~=4.3.4
2-
detox~=0.10.0
3-
docutils~=0.13.1
4-
mock~=2.0.0
5-
nose~=1.3.7
6-
python-coveralls~=2.9.0
7-
responses~=0.5.1
8-
requests~=2.13.0
9-
six>=1.10.0
10-
Sphinx~=1.5.3
11-
sphinx-rtd-theme~=0.2.4
12-
tox~=2.6.0
13-
virtualenv~=15.1.0
14-
watchdog~=0.8.3
15-
wheel>=0.24.0
1+
coverage==5.0.3
2+
detox==0.19
3+
docutils==0.16
4+
mock==4.0.1
5+
nose==1.3.7
6+
python-coveralls==2.9.3
7+
requests==2.23.0
8+
responses==0.10.9
9+
Sphinx==2.4.3
10+
sphinx-rtd-theme==0.4.3
11+
toml==0.10.0
12+
tox==3.14.5
13+
virtualenv==20.0.5
14+
watchdog==0.10.2

setup.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,18 @@
77

88
version = open('wiremock/VERSION', 'r').readline().strip()
99
develop_requires = [
10-
'Sphinx~=1.5.3',
11-
'coverage~=4.3.4',
12-
'detox~=0.10.0',
13-
'mock~=2.0.0',
10+
'Sphinx~=2.4.3',
11+
'coverage~=5.0.3',
12+
'detox~=0.19',
13+
'mock~=4.0.1',
1414
'nose~=1.3.7',
15-
'python-coveralls~=2.9.0',
16-
'responses~=0.5.1',
17-
'requests>=2.20.0',
18-
'six>=1.10.0',
19-
'sphinx-rtd-theme~=0.2.4',
20-
'tox~=2.6.0',
21-
'watchdog~=0.8.3',
22-
'wheel>=0.24.0']
15+
'python-coveralls~=2.9.3',
16+
'responses~=0.10.9',
17+
'requests~=2.23.0',
18+
'sphinx-rtd-theme~=0.4.3',
19+
'tox~=3.14.0',
20+
'watchdog~=0.10.2',
21+
'wheel>=0.34.2']
2322

2423
long_desc = """
2524
wiremock is an API Client to the Admin API for WireMock Standalone installation: https://wiremock.org/docs
@@ -52,13 +51,12 @@
5251
],
5352
keywords='wiremock',
5453
install_requires=[
55-
'setuptools>=35.0.1',
56-
'six>=1.10.0',
54+
'setuptools>=45.2.0',
5755
'requests>=2.20.0'
5856
],
5957
extras_require={
6058
'develop': develop_requires,
61-
'docs': ['Sphinx>=1.5.3', 'sphinx-rtd-theme>=0.2.4', 'watchdog>=0.8.3'],
59+
'docs': ['Sphinx>=2.4.3', 'sphinx-rtd-theme>=0.4.3', 'watchdog>=0.10.2'],
6260
},
6361
test_suite='nose.collector',
6462
tests_require=develop_requires,

wiremock/_compat.py

Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,44 @@
1-
from __future__ import unicode_literals
2-
import six
1+
import sys
2+
import types
33

4-
PY2 = six.PY2
5-
PY3 = six.PY3
64

7-
# conversions
8-
unichr = six.unichr
9-
if PY3:
10-
long_ = int
11-
else:
12-
long_ = long
13-
text_type = six.text_type
14-
string_types = six.string_types
15-
integer_types = six.integer_types
16-
bool_types = (bool, )
17-
binary_types = (six.binary_type, )
18-
float_types = (float, )
19-
array_types = (tuple, list)
20-
int_to_byte = six.int2byte
5+
def with_metaclass(meta, *bases):
6+
"""Create a base class with a metaclass."""
7+
# This requires a bit of explanation: the basic idea is to make a dummy
8+
# metaclass for one level of class instantiation that replaces itself with
9+
# the actual metaclass.
10+
class metaclass(type):
2111

22-
# iterator functions
23-
iterkeys = six.iterkeys
24-
itervalues = six.itervalues
25-
iteritems = six.iteritems
26-
iterlists = six.iterlists
27-
iterbytes = six.iterbytes
28-
reraise = six.reraise
12+
def __new__(cls, name, this_bases, d):
13+
if sys.version_info[:2] >= (3, 7):
14+
# This version introduced PEP 560 that requires a bit
15+
# of extra care (we mimic what is done by __build_class__).
16+
resolved_bases = types.resolve_bases(bases)
17+
if resolved_bases is not bases:
18+
d['__orig_bases__'] = bases
19+
else:
20+
resolved_bases = bases
21+
return meta(name, resolved_bases, d)
2922

30-
with_metaclass = six.with_metaclass
31-
add_metaclass = six.add_metaclass
32-
print_ = six.print_
33-
urllib = six.moves.urllib
23+
@classmethod
24+
def __prepare__(cls, name, this_bases):
25+
return meta.__prepare__(name, bases)
26+
return type.__new__(metaclass, 'temporary_class', (), {})
3427

35-
get_method_self = six.get_method_self
28+
29+
def add_metaclass(metaclass):
30+
"""Class decorator for creating a class with a metaclass."""
31+
def wrapper(cls):
32+
orig_vars = cls.__dict__.copy()
33+
slots = orig_vars.get('__slots__')
34+
if slots is not None:
35+
if isinstance(slots, str):
36+
slots = [slots]
37+
for slots_var in slots:
38+
orig_vars.pop(slots_var)
39+
orig_vars.pop('__dict__', None)
40+
orig_vars.pop('__weakref__', None)
41+
if hasattr(cls, '__qualname__'):
42+
orig_vars['__qualname__'] = cls.__qualname__
43+
return metaclass(cls.__name__, cls.__bases__, orig_vars)
44+
return wrapper

wiremock/base/base_entity.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from collections import OrderedDict
22
import json
33

4-
from wiremock._compat import add_metaclass, array_types
4+
from wiremock._compat import add_metaclass
55

66

77
class JsonPropertyValueContainer(object):
@@ -122,7 +122,7 @@ def __init__(self, **values):
122122
self._values = {}
123123
for name, prop in self._properties.items():
124124
value = values.get(prop.json_name, values.get(name, None))
125-
if prop.is_list() and isinstance(value, array_types): # This is a list with sub types
125+
if prop.is_list() and isinstance(value, (tuple, list)): # This is a list with sub types
126126
l = prop.klass()
127127
for v in value:
128128
if prop.list_klass is not None and issubclass(prop.list_klass, BaseAbstractEntity):
@@ -191,7 +191,7 @@ def get_json_data(self):
191191
if item is not None:
192192
if isinstance(item, BaseAbstractEntity):
193193
item = item.get_json_data()
194-
elif isinstance(item, array_types):
194+
elif isinstance(item, (tuple, list)):
195195
tmp = []
196196
for i in item:
197197
if isinstance(i, BaseAbstractEntity):
@@ -356,7 +356,7 @@ def get_json_data(self):
356356
if item is not None:
357357
if isinstance(item, BaseAbstractEntity):
358358
item = item.get_json_data()
359-
elif item is not None and isinstance(item, array_types):
359+
elif item is not None and isinstance(item, (tuple, list)):
360360
tmp = []
361361
for i in item:
362362
if isinstance(i, BaseAbstractEntity):

wiremock/base/base_resource.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import requests
33
from requests import exceptions as rexc
44

5-
from wiremock._compat import integer_types, float_types, array_types, string_types
65
from wiremock.base.base_entity import BaseAbstractEntity
76
from wiremock.constants import make_headers, Config, logger
87
from wiremock.exceptions import *
@@ -194,9 +193,7 @@ def get_base_uri(cls, endpoint, **id_dict):
194193

195194
@staticmethod
196195
def get_entity_id(entity_id, entityClass):
197-
if not (isinstance(entity_id, integer_types) or isinstance(entity_id, string_types)
198-
or isinstance(entity_id, entityClass)):
199-
196+
if not (isinstance(entity_id, (int, str)) or isinstance(entity_id, entityClass)):
200197
raise InvalidInputException(422, entity_id)
201198
if isinstance(entity_id, entityClass):
202199
entity_id = entity_id.id
@@ -285,7 +282,7 @@ def _retreive_all(cls, parameters=None, ids={}): # pragma: no cover
285282
return response # pragma: no cover
286283
else:
287284
response_json = response.json()
288-
if isinstance(response_json, array_types):
285+
if isinstance(response_json, (tuple, list)):
289286
results = []
290287
for r in response_json:
291288
if isinstance(r, dict):
@@ -296,7 +293,7 @@ def _retreive_all(cls, parameters=None, ids={}): # pragma: no cover
296293

297294
@classmethod
298295
def _retreive_one(cls, entity, parameters=None, ids={}): # pragma: no cover
299-
if isinstance(entity, integer_types) or isinstance(entity, float_types):
296+
if isinstance(entity, (int, float)):
300297
ids['id'] = entity
301298
response = cls.REST_CLIENT.get(
302299
cls.get_base_uri(cls.endpoint_single(), **ids), headers=make_headers(), params=parameters
@@ -321,7 +318,7 @@ def _retreive_one(cls, entity, parameters=None, ids={}): # pragma: no cover
321318

322319
@classmethod
323320
def _delete(cls, entity, parameters=None, ids={}): # pragma: no cover
324-
if isinstance(entity, integer_types) or isinstance(entity, float_types):
321+
if isinstance(entity, (int, float)):
325322
ids['id'] = entity
326323
response = cls.REST_CLIENT.delete(
327324
cls.get_base_uri(cls.endpoint_single(), **ids), headers=make_headers(), params=parameters

wiremock/constants.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import logging
44

55
from wiremock import __version__
6-
from wiremock._compat import *
76

87

98
logger = logging.getLogger('wiremock')
@@ -47,12 +46,12 @@ def make_headers(**kwargs):
4746

4847

4948
def datetime_to_ms(dt):
50-
if isinstance(dt, integer_types):
49+
if isinstance(dt, int):
5150
return dt
5251
else:
5352
tmp = timegm(dt.utctimetuple())
5453
tmp += float(dt.microsecond) / 1000000.0
55-
return long_(tmp * 1000.0)
54+
return int(tmp * 1000.0)
5655

5756

5857
__all__ = ['Config', 'make_headers', 'logger', 'datetime_to_ms']

wiremock/server/server.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
from pkg_resources import resource_filename
88
from subprocess import Popen, PIPE, STDOUT
99

10-
from six import text_type
11-
1210
from wiremock.server.exceptions import (
1311
WireMockServerAlreadyStartedError,
1412
WireMockServerNotStartedError
@@ -56,7 +54,7 @@ def start(self):
5654
raise WireMockServerNotStartedError("\n".join([
5755
"returncode: {}".format(self.__subprocess.returncode),
5856
"stdout:",
59-
text_type(self.__subprocess.stdout.read())
57+
self.__subprocess.stdout.read()
6058
]))
6159

6260
atexit.register(self.stop, raise_on_error=False)

0 commit comments

Comments
 (0)