Skip to content

Commit e7df322

Browse files
committed
fixed #123
1 parent 7f163a8 commit e7df322

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

swagger_py_codegen/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
"""Version information."""
22

33
# The following line *must* be the last in the module, exactly as formatted:
4-
__version__ = "0.3.3"
4+
__version__ = "0.3.4"

swagger_py_codegen/parser.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ def __init__(self, data, ref):
1919
self.ref = ref
2020
self._data = data
2121

22-
2322
def __getitem__(self, key):
2423
return self._data.__getitem__(key)
2524

@@ -33,17 +32,22 @@ def __iter__(self):
3332
return self._data.__iter__()
3433

3534
def __repr__(self):
36-
return repr({'$ref':self.ref})
35+
return repr({'$ref': self.ref})
3736

3837
def __eq__(self, other):
3938
if isinstance(other, RefNode):
4039
return self._data == other._data and self.ref == other.ref
41-
else:
40+
elif six.PY2:
4241
return object.__eq__(other)
42+
elif six.PY3:
43+
return object.__eq__(self, other)
44+
else:
45+
return False
4346

4447
def copy(self):
4548
return RefNode(self._data, self.ref)
4649

50+
4751
class Swagger(object):
4852

4953
separator = '\0'
@@ -61,7 +65,7 @@ def _process_ref(self):
6165
"""
6266
resolve all references util no reference exists
6367
"""
64-
for path, ref in self.search(['**', '$ref']):
68+
for path, ref in self.search(['**', '$ref']):
6569
data = resolve(self.data, ref)
6670
path = path[:-1]
6771
self.set(path, RefNode(data, ref))
@@ -97,15 +101,15 @@ def get_definition_refs():
97101
}
98102
if not ready:
99103
continue
100-
#msg = '$ref circular references found!\n'
101-
#raise ValueError(msg)
104+
# msg = '$ref circular references found!\n'
105+
# raise ValueError(msg)
102106
for definition in ready:
103107
del definition_refs[definition]
104108
for refs in six.itervalues(definition_refs):
105109
refs.difference_update(ready)
106110

107111
self._definitions += ready
108-
self._definitions.sort(key=lambda x :x[1])
112+
self._definitions.sort(key=lambda x: x[1])
109113

110114
def search(self, path):
111115
for p, d in dpath.util.search(

0 commit comments

Comments
 (0)