ClsBehaviorAttrs
- class PlasmaCalcs.dimensions.behavior.ClsBehaviorAttrs(iterable=(), /)
Bases:
listlist of attrs which control behavior of a class.
also provides a method to register a new behavior attr.might also know cls_associated_with.Methods
append(object, /)Append object to the end of the list.
clear()Remove all items from list.
copy()Return a shallow copy of the list.
count(value, /)Return number of occurrences of value.
extend(iterable, /)Extend list by appending elements from the iterable.
index(value[, start, stop])Return first index of value.
insert(index, object, /)Insert object before index.
pop([index])Remove and return item at index (default last).
register(*attrs[, is_dimension, default, ...])register attrs as BehaviorAttrs for self.cls_associated_with.
remove(value, /)Remove first occurrence of value.
reverse()Reverse *IN PLACE*.
sort(*[, key, reverse])Sort the list in ascending order and return None.
Attributes
class with which this list of behavior attrs is associated.
- append(object, /)
Append object to the end of the list.
- behavior_attr_cls
alias of
BehaviorAttr
- clear()
Remove all items from list.
- property cls_associated_with
class with which this list of behavior attrs is associated.
- copy()
Return a shallow copy of the list.
- count(value, /)
Return number of occurrences of value.
- extend(iterable, /)
Extend list by appending elements from the iterable.
- index(value, start=0, stop=9223372036854775807, /)
Return first index of value.
Raises ValueError if the value is not present.
- insert(index, object, /)
Insert object before index.
- pop(index=-1, /)
Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
- register(*attrs, is_dimension=False, default=ATTR_UNSET, getdefault=ATTR_UNSET)
register attrs as BehaviorAttrs for self.cls_associated_with.
returns list of newly registered BehaviorAttr objects.default: ATTR_UNSET or any objectif provided (i.e. not ATTR_UNSET), tells behavior management code the “default” value.E.g. calculator.behavior.nondefault() includes only the non-default values.Does NOT affect the attribute itself (e.g. doesn’t mess with fget & fset if property).getdefault: ATTR_UNSET or callable of 1 argsimilar to default but callable of BehaviorHaver: default=getdefault(behavior_haver),instead of being the same value for all BehaviorHavers.cannot provide both default and getdefault
- remove(value, /)
Remove first occurrence of value.
Raises ValueError if the value is not present.
- reverse()
Reverse *IN PLACE*.
- sort(*, key=None, reverse=False)
Sort the list in ascending order and return None.
The sort is in-place (i.e. the list itself is modified) and stable (i.e. the
order of two equal elements is maintained).If a key function is given, apply it once to each list item and sort them,ascending or descending, according to their function values.The reverse flag can be set to sort in descending order.