ConstraintListΒΆ
- class ConstraintListΒΆ
List-like container of
Constraintobjects.Methods
__init__
Append a constraint to the end of the list.
Remove all constraints from the list.
Return a shallow copy of the constraint list.
Return the number of occurrences of a constraint in the list.
Extend the list with constraints from a sequence.
Return the index of the first occurrence of a constraint.
Insert a constraint at a given position.
Remove and return a constraint.
Remove the first matching constraint from the list.
Reverse the constraint list in place.
- class IteratorΒΆ
- __init__(*args, **kwargs)ΒΆ
- __next__(self) ConstraintΒΆ
- Return type:
- __add__(self, arg: ConstraintList, /) ConstraintListΒΆ
- __add__(self, arg: Constraint, /) ConstraintList
Give a new constraint list that holds the constraints of both sides.
Overload 1.
- Args:
arg (amplify.ConstraintList)
- Returns:
amplify.ConstraintList:
Overload 2.
- Args:
arg (amplify.Constraint)
- Returns:
amplify.ConstraintList:
- __copy__(self) ConstraintListΒΆ
Return a shallow copy of the constraint list.
- Return type:
- __deepcopy__(self, memo: object | None = None) ConstraintListΒΆ
Give a copy of the list that holds a copy of every constraint.
- Parameters:
memo (object | None) β Dictionary that
copy.deepcopy()uses. Defaults toNone.- Return type:
- __eq__(self, arg: object, /) boolΒΆ
Tell whether the two lists hold the same constraints in the same order.
- __getitem__(self, key: int) ConstraintΒΆ
Give the constraint at the index. A negative index counts from the end.
- Parameters:
key (int) β Index of the constraint.
- Return type:
- Raises:
IndexError β The index is outside the list.
- __iadd__(self, arg: ConstraintList, /) ConstraintListΒΆ
- __iadd__(self, arg: Constraint, /) ConstraintList
Add the constraints of the right side to the constraint list.
Overload 1.
- Args:
arg (amplify.ConstraintList)
- Returns:
amplify.ConstraintList:
Overload 2.
- Args:
arg (amplify.Constraint)
- Returns:
amplify.ConstraintList:
- __imul__(self, arg: float, /) ConstraintListΒΆ
Multiply the weight of every constraint in the list by the coefficient.
- Parameters:
arg (float)
- Return type:
- __init__(self) NoneΒΆ
- __init__(self, arg: Sequence[Constraint]) None
- __init__(self, arg: Iterable[Constraint]) None
__init__
Overload 2.
- Args:
arg (collections.abc.Sequence[amplify.Constraint])
Overload 3.
- Args:
arg (collections.abc.Iterable[amplify.Constraint])
- __itruediv__(self, arg: float, /) ConstraintListΒΆ
Divide the weight of every constraint in the list by the coefficient.
- Parameters:
arg (float)
- Return type:
- __mul__(self, arg: float, /) ConstraintListΒΆ
Give a new list in which the weight of every constraint is multiplied by the coefficient.
- Parameters:
arg (float)
- Return type:
- __radd__(self, arg: Constraint, /) ConstraintListΒΆ
- __radd__(self, arg: int, /) ConstraintList
Give a new constraint list that holds the constraints of both sides.
Overload 1.
- Args:
arg (amplify.Constraint)
- Returns:
amplify.ConstraintList:
Overload 2.
- Args:
arg (int)
- Returns:
amplify.ConstraintList:
- __rmul__(self, arg: float, /) ConstraintListΒΆ
Give a new list in which the weight of every constraint is multiplied by the coefficient.
- Parameters:
arg (float)
- Return type:
- __setitem__(self, key: int, value: Constraint) NoneΒΆ
Replace the constraint at the index. A negative index counts from the end.
- Parameters:
key (int) β Index of the constraint.
value (Constraint) β Constraint that takes its place.
- Raises:
IndexError β The index is outside the list.
- __truediv__(self, arg: float, /) ConstraintListΒΆ
Give a new list in which the weight of every constraint is divided by the coefficient.
- Parameters:
arg (float)
- Return type:
- append(self, value: Constraint) NoneΒΆ
Append a constraint to the end of the list.
- Parameters:
value (Constraint)
- copy(self) ConstraintListΒΆ
Return a shallow copy of the constraint list.
- Return type:
- count(self, value: Constraint) intΒΆ
Return the number of occurrences of a constraint in the list.
- Parameters:
value (Constraint) β Constraint to count.
- Returns:
Number of occurrences.
- Return type:
- extend(self, sequence: Sequence[Constraint]) NoneΒΆ
Extend the list with constraints from a sequence.
- Parameters:
sequence (Sequence[Constraint])
- index(self, value: Constraint) intΒΆ
- index(self, value: Constraint, start: int) int
- index(self, value: Constraint, start: int, end: int) int
Return the index of the first occurrence of a constraint.
Overload 1.
- Args:
value (amplify.Constraint): Constraint to find.
- Returns:
int: Index of the first match.
Overload 2.
- Args:
value (amplify.Constraint): Constraint to find.
start (int): Start index.
- Returns:
int: Index of the first match.
Overload 3.
- Args:
value (amplify.Constraint): Constraint to find.
start (int): Start index.
end (int): End index.
- Returns:
int: Index of the first match.
- insert(self, index: int, value: Constraint) NoneΒΆ
Insert a constraint at a given position.
- Parameters:
index (int)
value (Constraint)
- pop(self, index: int | None = None) ConstraintΒΆ
Remove and return a constraint.
- Parameters:
index (int | None) β Index to pop. If omitted, pop the last item. Defaults to
None.- Returns:
Popped constraint.
- Return type:
- remove(self, value: Constraint) NoneΒΆ
Remove the first matching constraint from the list.
- Parameters:
value (Constraint)