ConstraintList

class ConstraintList

List-like container of Constraint objects.

Methods

__init__

__init__

append

Append a constraint to the end of the list.

clear

Remove all constraints from the list.

copy

Return a shallow copy of the constraint list.

count

Return the number of occurrences of a constraint in the list.

extend

Extend the list with constraints from a sequence.

index

Return the index of the first occurrence of a constraint.

insert

Insert a constraint at a given position.

pop

Remove and return a constraint.

remove

Remove the first matching constraint from the list.

reverse

Reverse the constraint list in place.

class Iterator
__init__(*args, **kwargs)
__iter__(self) → Iterator
戻り値の型:

Iterator

__next__(self) → Constraint
戻り値の型:

Constraint

__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.

戻り値の型:

ConstraintList

__deepcopy__(self, memo: object | None = None) → ConstraintList

Give a copy of the list that holds a copy of every constraint.

パラメータ:

memo (object | None) -- Dictionary that copy.deepcopy() uses. Defaults to None.

戻り値の型:

ConstraintList

__eq__(self, arg: object, /) → bool

Tell whether the two lists hold the same constraints in the same order.

パラメータ:

arg (object)

戻り値の型:

bool

__getitem__(self, key: int) → Constraint

Give the constraint at the index. A negative index counts from the end.

パラメータ:

key (int) -- Index of the constraint.

戻り値の型:

Constraint

例外:

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.

パラメータ:

arg (float)

戻り値の型:

ConstraintList

__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])

__iter__(self) → Iterator
戻り値の型:

Iterator

__itruediv__(self, arg: float, /) → ConstraintList

Divide the weight of every constraint in the list by the coefficient.

パラメータ:

arg (float)

戻り値の型:

ConstraintList

__len__(self) → int

Number of constraints in the list.

戻り値の型:

int

__mul__(self, arg: float, /) → ConstraintList

Give a new list in which the weight of every constraint is multiplied by the coefficient.

パラメータ:

arg (float)

戻り値の型:

ConstraintList

__ne__(self, arg: object, /) → bool

Tell whether the two lists differ. This is the negation of ==.

パラメータ:

arg (object)

戻り値の型:

bool

__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:

__repr__(self) → str
戻り値の型:

str

__rmul__(self, arg: float, /) → ConstraintList

Give a new list in which the weight of every constraint is multiplied by the coefficient.

パラメータ:

arg (float)

戻り値の型:

ConstraintList

__setitem__(self, key: int, value: Constraint) → None

Replace the constraint at the index. A negative index counts from the end.

パラメータ:
  • key (int) -- Index of the constraint.

  • value (Constraint) -- Constraint that takes its place.

例外:

IndexError -- The index is outside the list.

__str__(self) → str
戻り値の型:

str

__truediv__(self, arg: float, /) → ConstraintList

Give a new list in which the weight of every constraint is divided by the coefficient.

パラメータ:

arg (float)

戻り値の型:

ConstraintList

append(self, value: Constraint) → None

Append a constraint to the end of the list.

パラメータ:

value (Constraint)

clear(self) → None

Remove all constraints from the list.

copy(self) → ConstraintList

Return a shallow copy of the constraint list.

戻り値の型:

ConstraintList

count(self, value: Constraint) → int

Return the number of occurrences of a constraint in the list.

パラメータ:

value (Constraint) -- Constraint to count.

戻り値:

Number of occurrences.

戻り値の型:

int

extend(self, sequence: Sequence[Constraint]) → None

Extend the list with constraints from a sequence.

パラメータ:

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.

パラメータ:
pop(self, index: int | None = None) → Constraint

Remove and return a constraint.

パラメータ:

index (int | None) -- Index to pop. If omitted, pop the last item. Defaults to None.

戻り値:

Popped constraint.

戻り値の型:

Constraint

remove(self, value: Constraint) → None

Remove the first matching constraint from the list.

パラメータ:

value (Constraint)

reverse(self) → None

Reverse the constraint list in place.