Skip to content

Commit 0b98756

Browse files
committed
[LIB-566] python3.4 support added; check if old circle tets will pass for python 2.7.5
1 parent 095f4ec commit 0b98756

28 files changed

+112
-84
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ junit
1313
reports
1414
run_it.py
1515
syncano.egg-info
16+
.tox/*
17+
test

.isort.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
line_length=120
33
multi_line_output=3
44
default_section=THIRDPARTY
5-
skip=base.py
5+
skip=base.py,.tox

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ python-slugify==0.1.0
1313
requests==2.7.0
1414
six==1.9.0
1515
validictory==1.0.0
16-
wsgiref==0.1.2

syncano/connection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,9 @@ def make_request(self, method_name, path, **kwargs):
236236
files = data.pop('files', None)
237237

238238
if files is None:
239-
files = {k: v for k, v in data.iteritems() if isinstance(v, file)}
239+
files = {k: v for k, v in six.iteritems(data) if hasattr(v, 'read')}
240240
if data:
241-
kwargs['data'] = data = {k: v for k, v in data.iteritems() if k not in files}
241+
kwargs['data'] = {k: v for k, v in six.iteritems(data) if k not in files}
242242

243243
params = self.build_params(kwargs)
244244
method = getattr(self.session, method_name.lower(), None)

syncano/models/accounts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from __future__ import unicode_literals
1+
22

33
from . import fields
44
from .base import Model

syncano/models/archetypes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from __future__ import unicode_literals
1+
22

33
import inspect
44

@@ -39,7 +39,7 @@ def __new__(cls, name, bases, attrs):
3939
new_class.add_to_class(n, v)
4040

4141
for abstract in abstracts:
42-
for n, v in abstract.__dict__.iteritems():
42+
for n, v in six.iteritems(abstract.__dict__):
4343
if isinstance(v, fields.Field) or n in ['LINKS']: # extend this condition if required;
4444
new_class.add_to_class(n, v)
4545

syncano/models/billing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from __future__ import unicode_literals
1+
22

33
from . import fields
44
from .base import Model

syncano/models/bulk.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class BaseBulkCreate(object):
1212
instances = ObjectBulkCreate(objects, manager).process()
1313
"""
1414
__metaclass__ = ABCMeta
15-
1615
MAX_BATCH_SIZE = 50
1716

1817
@abstractmethod

syncano/models/classes.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from __future__ import unicode_literals
1+
22

33
from copy import deepcopy
44

@@ -146,7 +146,7 @@ def __new__(cls, **kwargs):
146146
raise SyncanoValidationError('Field "class_name" is required.')
147147

148148
model = cls.get_subclass_model(instance_name, class_name)
149-
return model(**kwargs)
149+
return model()
150150

151151
@classmethod
152152
def _set_up_object_class(cls, model):
@@ -165,6 +165,7 @@ def create_subclass(cls, name, schema):
165165
attrs = {
166166
'Meta': deepcopy(Object._meta),
167167
'__new__': Model.__new__, # We don't want to have maximum recursion depth exceeded error
168+
'__init__': Model.__init__,
168169
}
169170

170171
for field in schema:

syncano/models/data_views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from __future__ import unicode_literals
1+
22

33
from . import fields
44
from .base import Model

0 commit comments

Comments
 (0)