Skip to content

Commit d677b84

Browse files
committed
updated python bindings
1 parent 5c6f430 commit d677b84

2 files changed

Lines changed: 91 additions & 13 deletions

File tree

src/python_bindings/bindings/gate_pin_group.cpp

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,30 +151,69 @@ namespace hal
151151
)");
152152

153153
py_gate_pin_group.def_property_readonly("ascending", &PinGroup<GatePin>::is_ascending, R"(
154-
``True`` if the pin order of a pin group comprising n pins is ascending (from 0 to n-1), ``False`` if it is descending (from n-1 to 0).
154+
``True`` if the pin order of a pin group comprising n pins is ascending, e.g., from index ``0`` to ``n-1``, ``False`` otherwise.
155155
156156
:type: bool
157157
)");
158158

159159
py_gate_pin_group.def("is_ascending", &PinGroup<GatePin>::is_ascending, R"(
160-
Check whether the pin order of a pin group comprising n pins is ascending (from 0 to n-1) or descending (from n-1 to 0).
160+
Check whether the pin order of a pin group comprising n pins is ascending, e.g., from index ``0`` to ``n-1``.
161161
162162
:returns: ``True`` for ascending bit order, ``False`` otherwise.
163163
:rtype: bool
164164
)");
165165

166+
py_gate_pin_group.def_property_readonly("descending", &PinGroup<GatePin>::is_descending, R"(
167+
``True`` if the pin order of a pin group comprising n pins is descending, e.g., from index ``n-1`` to ``0``, ``False`` otherwise.
168+
169+
:type: bool
170+
)");
171+
172+
py_gate_pin_group.def("is_descending", &PinGroup<GatePin>::is_descending, R"(
173+
Check whether the pin order of a pin group comprising n pins is descending, e.g., from index ``n-1`` to ``0``.
174+
175+
:returns: ``True`` for descending bit order, ``False`` otherwise.
176+
:rtype: bool
177+
)");
178+
179+
py_gate_pin_group.def_property_readonly("lowest_index", &PinGroup<GatePin>::get_lowest_index, R"(
180+
The numerically lowest index of the pin group.
181+
182+
:type: int
183+
)");
184+
185+
py_gate_pin_group.def("get_lowest_index", &PinGroup<GatePin>::get_lowest_index, R"(
186+
Get the numerically lowest index of the pin group.
187+
188+
:returns: The lowest index.
189+
:rtype: int
190+
)");
191+
192+
py_gate_pin_group.def_property_readonly("highest_index", &PinGroup<GatePin>::get_highest_index, R"(
193+
The numerically highest index of the pin group.
194+
195+
:type: int
196+
)");
197+
198+
py_gate_pin_group.def("get_highest_index", &PinGroup<GatePin>::get_highest_index, R"(
199+
Get the numerically highest index of the pin group.
200+
201+
:returns: The highest index.
202+
:rtype: int
203+
)");
204+
166205
py_gate_pin_group.def_property_readonly("start_index", &PinGroup<GatePin>::get_start_index, R"(
167206
The start index of the pin group.
168-
Commonly, pin groups start at index 0, but this may not always be the case.
169-
Note that the start index for a pin group comprising n pins is 0 independent of whether it is ascending or descending.
207+
For ascending pin groups, this index equals the lowest index of the pin group.
208+
For descending pin groups, it is equal to the highest index of the pin group.
170209
171210
:type: int
172211
)");
173212

174213
py_gate_pin_group.def("get_start_index", &PinGroup<GatePin>::get_start_index, R"(
175214
Get the start index of the pin group.
176-
Commonly, pin groups start at index 0, but this may not always be the case.
177-
Note that the start index for a pin group comprising n pins is 0 independent of whether it is ascending or descending.
215+
For ascending pin groups, this index equals the lowest index of the pin group.
216+
For descending pin groups, it is equal to the highest index of the pin group.
178217
179218
:returns: The start index.
180219
:rtype: int

src/python_bindings/bindings/module_pin_group.cpp

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,30 +151,69 @@ namespace hal
151151
)");
152152

153153
py_module_pin_group.def_property_readonly("ascending", &PinGroup<ModulePin>::is_ascending, R"(
154-
True if the pin order of a pin group comprising n pins is ascending (from 0 to n-1), False if it is descending (from n-1 to 0).
154+
``True`` if the pin order of a pin group comprising n pins is ascending, e.g., from index ``0`` to ``n-1``, ``False`` otherwise.
155155
156156
:type: bool
157157
)");
158158

159159
py_module_pin_group.def("is_ascending", &PinGroup<ModulePin>::is_ascending, R"(
160-
Check whether the pin order of a pin group comprising n pins is ascending (from 0 to n-1) or descending (from n-1 to 0).
160+
Check whether the pin order of a pin group comprising n pins is ascending, e.g., from index ``0`` to ``n-1``.
161161
162-
:returns: True for ascending bit order, False otherwise.
162+
:returns: ``True`` for ascending bit order, ``False`` otherwise.
163163
:rtype: bool
164164
)");
165165

166+
py_module_pin_group.def_property_readonly("descending", &PinGroup<ModulePin>::is_descending, R"(
167+
``True`` if the pin order of a pin group comprising n pins is descending, e.g., from index ``n-1`` to ``0``, ``False`` otherwise.
168+
169+
:type: bool
170+
)");
171+
172+
py_module_pin_group.def("is_descending", &PinGroup<ModulePin>::is_descending, R"(
173+
Check whether the pin order of a pin group comprising n pins is descending, e.g., from index ``n-1`` to ``0``.
174+
175+
:returns: ``True`` for descending bit order, ``False`` otherwise.
176+
:rtype: bool
177+
)");
178+
179+
py_module_pin_group.def_property_readonly("lowest_index", &PinGroup<ModulePin>::get_lowest_index, R"(
180+
The numerically lowest index of the pin group.
181+
182+
:type: int
183+
)");
184+
185+
py_module_pin_group.def("get_lowest_index", &PinGroup<ModulePin>::get_lowest_index, R"(
186+
Get the numerically lowest index of the pin group.
187+
188+
:returns: The lowest index.
189+
:rtype: int
190+
)");
191+
192+
py_module_pin_group.def_property_readonly("highest_index", &PinGroup<ModulePin>::get_highest_index, R"(
193+
The numerically highest index of the pin group.
194+
195+
:type: int
196+
)");
197+
198+
py_module_pin_group.def("get_highest_index", &PinGroup<ModulePin>::get_highest_index, R"(
199+
Get the numerically highest index of the pin group.
200+
201+
:returns: The highest index.
202+
:rtype: int
203+
)");
204+
166205
py_module_pin_group.def_property_readonly("start_index", &PinGroup<ModulePin>::get_start_index, R"(
167206
The start index of the pin group.
168-
Commonly, pin groups start at index 0, but this may not always be the case.
169-
Note that the start index for a pin group comprising n pins is 0 independent of whether it is ascending or descending.
207+
For ascending pin groups, this index equals the lowest index of the pin group.
208+
For descending pin groups, it is equal to the highest index of the pin group.
170209
171210
:type: int
172211
)");
173212

174213
py_module_pin_group.def("get_start_index", &PinGroup<ModulePin>::get_start_index, R"(
175214
Get the start index of the pin group.
176-
Commonly, pin groups start at index 0, but this may not always be the case.
177-
Note that the start index for a pin group comprising n pins is 0 independent of whether it is ascending or descending.
215+
For ascending pin groups, this index equals the lowest index of the pin group.
216+
For descending pin groups, it is equal to the highest index of the pin group.
178217
179218
:returns: The start index.
180219
:rtype: int

0 commit comments

Comments
 (0)