Skip to content

Commit 80c68b6

Browse files
committed
Correct init cell loop, docstrings
1 parent 69ce49b commit 80c68b6

File tree

1 file changed

+29
-47
lines changed

1 file changed

+29
-47
lines changed

src/compas/datastructures/halfface/halfface.py

Lines changed: 29 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ def data(self, data):
180180
attr = cell_data.get(c) or {}
181181
faces = []
182182
for u in cell[c]:
183-
faces.append(cell[c][u][v])
183+
for v in cell[c][u]:
184+
faces.append(cell[c][u][v])
184185
self.add_cell(faces, ckey=int(c), attr_dict=attr)
185186

186187
for e in edge_data:
@@ -329,7 +330,7 @@ def vertex_index(self):
329330

330331
def index_vertex(self):
331332
"""Returns a dictionary that maps the indices of a vertex list to
332-
keys in a vertex dictionary.
333+
keys in the vertex dictionary.
333334
334335
Returns
335336
-------
@@ -729,10 +730,9 @@ def vertices_where(self, conditions, data=False):
729730
730731
Yields
731732
------
732-
key: hashable
733-
The next vertex that matches the condition.
734-
2-tuple
735-
The next vertex and its attributes, if ``data=True``.
733+
int | tuple[int, dict[str, Any]]
734+
If `data` is False, the next vertex that matches the condition.
735+
If `data` is True, the next vertex and its attributes.
736736
737737
"""
738738
for key, attr in self.vertices(True):
@@ -801,14 +801,10 @@ def vertices_where_predicate(self, predicate, data=False):
801801
802802
Yields
803803
------
804-
key: hashable
805-
The next vertex that matches the condition.
806-
2-tuple
807-
The next vertex and its attributes, if ``data=True``.
804+
int | tuple[int, dict[str, Any]]
805+
If `data` is False, the next vertex that matches the condition.
806+
If `data` is True, the next vertex and its attributes.
808807
809-
Examples
810-
--------
811-
>>>
812808
"""
813809
for key, attr in self.vertices(True):
814810
if predicate(key, attr):
@@ -832,10 +828,10 @@ def edges_where(self, conditions, data=False):
832828
833829
Yields
834830
------
835-
2-tuple
836-
The next edge as a (u, v) tuple, if ``data=False``.
837-
3-tuple
838-
The next edge as a (u, v, data) tuple, if ``data=True``.
831+
tuple[int, int] | tuple[tuple[int, int], dict[str, Any]]
832+
If `data` is False, the next edge as a (u, v) tuple.
833+
If `data` is True, the next edge as a (u, v, data) tuple.
834+
839835
"""
840836
for key in self.edges():
841837
is_match = True
@@ -887,14 +883,10 @@ def edges_where_predicate(self, predicate, data=False):
887883
888884
Yields
889885
------
890-
2-tuple
891-
The next edge as a (u, v) tuple, if ``data=False``.
892-
3-tuple
893-
The next edge as a (u, v, data) tuple, if ``data=True``.
886+
tuple[int, int] | tuple[tuple[int, int], dict[str, Any]]
887+
If `data` is False, the next edge as a (u, v) tuple.
888+
If `data` is True, the next edge as a (u, v, data) tuple.
894889
895-
Examples
896-
--------
897-
>>>
898890
"""
899891
for key, attr in self.edges(True):
900892
if predicate(key, attr):
@@ -918,10 +910,9 @@ def faces_where(self, conditions, data=False):
918910
919911
Yields
920912
------
921-
key: hashable
922-
The next face that matches the condition.
923-
2-tuple
924-
The next face and its attributes, if ``data=True``.
913+
int | tuple[int, dict[str, Any]]
914+
If `data` is False, the next face that matches the condition.
915+
If `data` is True, the next face and its attributes.
925916
926917
"""
927918
for fkey in self.faces():
@@ -974,14 +965,10 @@ def faces_where_predicate(self, predicate, data=False):
974965
975966
Yields
976967
------
977-
key: hashable
978-
The next face that matches the condition.
979-
2-tuple
980-
The next face and its attributes, if ``data=True``.
968+
int | tuple[int, dict[str, Any]]
969+
If `data` is False, the next face that matches the condition.
970+
If `data` is True, the next face and its attributes.
981971
982-
Examples
983-
--------
984-
>>>
985972
"""
986973
for fkey, attr in self.faces(True):
987974
if predicate(fkey, attr):
@@ -1005,10 +992,9 @@ def cells_where(self, conditions, data=False):
1005992
1006993
Yields
1007994
------
1008-
key: hashable
1009-
The next cell that matches the condition.
1010-
2-tuple
1011-
The next cell and its attributes, if ``data=True``.
995+
int | tuple[int, dict[str, Any]]
996+
If `data` is False, the next cell that matches the condition.
997+
If `data` is True, the next cell and its attributes.
1012998
1013999
"""
10141000
for ckey in self.cells():
@@ -1061,14 +1047,10 @@ def cells_where_predicate(self, predicate, data=False):
10611047
10621048
Yields
10631049
------
1064-
key: hashable
1065-
The next cell that matches the condition.
1066-
2-tuple
1067-
The next cell and its attributes, if ``data=True``.
1068-
1069-
Examples
1070-
--------
1071-
>>>
1050+
int | tuple[int, dict[str, Any]]
1051+
If `data` is False, the next cell that matches the condition.
1052+
If `data` is True, the next cell and its attributes.
1053+
10721054
"""
10731055
for ckey, attr in self.cells(True):
10741056
if predicate(ckey, attr):

0 commit comments

Comments
 (0)