Skip to content

Commit

Permalink
Fix Code Quality check
Browse files Browse the repository at this point in the history
  • Loading branch information
PProfizi committed Nov 19, 2024
1 parent 6224cb3 commit d8c7b1e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/ansys/dpf/core/collection_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,11 +424,11 @@ def __getitem__(self, index: int | slice):
"""
if isinstance(index, slice):
# handle slice
indices = list(range(
index.start if index.start else 0,
index.stop,
index.step if index.step else 1
))
indices = list(
range(
index.start if index.start else 0, index.stop, index.step if index.step else 1
)
)
out_collection = self.__class__()
out_collection.set_labels(labels=self._get_labels())
if hasattr(out_collection, "add_entry"):
Expand All @@ -441,7 +441,7 @@ def __getitem__(self, index: int | slice):
for i in indices:
func(
label_space=self.get_label_space(index=i),
entry=self._get_entries(label_space_or_index=i)
entry=self._get_entries(label_space_or_index=i),
)
return out_collection
self_len = len(self)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,14 @@ def test_connect_collection_workflow(server_type, subtype_creator):
assert out is not None
assert len(out) == 1


def test_generic_data_containers_collection_slice(server_type):
coll = GenericDataContainersCollection(server=server_type)

coll.labels = ["id1", "id2"]
for i in range(5):
coll.add_entry(
label_space={"id1": i, "id2": 0},
entry=create_dummy_gdc(server_type=server_type)
label_space={"id1": i, "id2": 0}, entry=create_dummy_gdc(server_type=server_type)
)
assert len(coll) == 5
print(coll)
Expand All @@ -268,7 +268,7 @@ def test_string_containers_collection_slice(server_type):
for i in range(5):
coll.add_entry(
label_space={"id1": i, "id2": 0},
entry=create_dummy_string_field(server_type=server_type)
entry=create_dummy_string_field(server_type=server_type),
)
assert len(coll) == 5
print(coll)
Expand Down

0 comments on commit d8c7b1e

Please sign in to comment.