Skip to content

Commit fab07e1

Browse files
Lorak-mmkfruch
authored andcommitted
Fix problems introduced while removing six
six.iterkeys() returns an iterator, but Python's dict.keys() does not, so to pass it to iter() it needs to be first passed trough iter().
1 parent 2467864 commit fab07e1

5 files changed

Lines changed: 7 additions & 7 deletions

File tree

cassandra/datastax/graph/graphson.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def serialize(cls, value, writer=None):
135135

136136
@classmethod
137137
def get_specialized_serializer(cls, value):
138-
if type(value) in int and (value > MAX_INT32 or value < MIN_INT32):
138+
if type(value) is int and (value > MAX_INT32 or value < MIN_INT32):
139139
return Int64TypeIO
140140

141141
return Int32TypeIO

tests/integration/advanced/graph/fluent/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ def _write_and_read_data_types(self, schema, graphson, use_schema=True):
459459
for data in schema.fixtures.datatypes().values():
460460
typ, value, deserializer = data
461461
vertex_label = VertexLabel([typ])
462-
property_name = next(vertex_label.non_pk_properties.keys())
462+
property_name = next(iter(vertex_label.non_pk_properties.keys()))
463463
if use_schema or schema is CoreGraphSchema:
464464
schema.create_vertex_label(self.session, vertex_label, execution_profile=ep)
465465

@@ -537,7 +537,7 @@ def __test_udt(self, schema, graphson, address_class, address_with_tags_class,
537537
g = self.fetch_traversal_source(graphson)
538538
for typ, value in data.values():
539539
vertex_label = VertexLabel([typ])
540-
property_name = next(vertex_label.non_pk_properties.keys())
540+
property_name = next(iter(vertex_label.non_pk_properties.keys()))
541541
schema.create_vertex_label(self.session, vertex_label, execution_profile=ep)
542542

543543
write_traversal = g.addV(str(vertex_label.label)).property('pkid', vertex_label.id). \

tests/integration/advanced/graph/fluent/test_graph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def _send_batch_and_read_results(self, schema, graphson, add_all=False, use_sche
121121
for data in datatypes.values():
122122
typ, value, deserializer = data
123123
vertex_label = VertexLabel([typ])
124-
property_name = next(vertex_label.non_pk_properties.keys())
124+
property_name = next(iter(vertex_label.non_pk_properties.keys()))
125125
values[property_name] = value
126126
if use_schema or schema is CoreGraphSchema:
127127
schema.create_vertex_label(self.session, vertex_label, execution_profile=ep)

tests/integration/advanced/graph/test_graph_datatype.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def _test_all_datatypes(self, schema, graphson):
8787
for data in schema.fixtures.datatypes().values():
8888
typ, value, deserializer = data
8989
vertex_label = VertexLabel([typ])
90-
property_name = next(vertex_label.non_pk_properties.keys())
90+
property_name = next(iter(vertex_label.non_pk_properties.keys()))
9191
schema.create_vertex_label(self.session, vertex_label, execution_profile=ep)
9292
vertex = list(schema.add_vertex(self.session, vertex_label, property_name, value, execution_profile=ep))[0]
9393

@@ -168,7 +168,7 @@ def __test_udt(self, schema, graphson, address_class, address_with_tags_class,
168168

169169
for typ, value in data.values():
170170
vertex_label = VertexLabel([typ])
171-
property_name = next(vertex_label.non_pk_properties.keys())
171+
property_name = next(iter(vertex_label.non_pk_properties.keys()))
172172
schema.create_vertex_label(self.session, vertex_label, execution_profile=ep)
173173

174174
vertex = list(schema.add_vertex(self.session, vertex_label, property_name, value, execution_profile=ep))[0]

tests/integration/advanced/graph/test_graph_query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ def _test_basic_query_with_type_wrapper(self, schema, graphson):
587587
vl = VertexLabel(['tupleOf(Int, Bigint)'])
588588
schema.create_vertex_label(self.session, vl, execution_profile=ep)
589589

590-
prop_name = next(vl.non_pk_properties.keys())
590+
prop_name = next(iter(vl.non_pk_properties.keys()))
591591
with self.assertRaises(InvalidRequest):
592592
schema.add_vertex(self.session, vl, prop_name, (1, 42), execution_profile=ep)
593593

0 commit comments

Comments
 (0)