xbrl.ConstraintSet
¶
An xbrl.ConstraintSet
class represents a set of XBRL aspect constraints. For each aspect a constraint with an aspect value can be set. When a constraint set is passed to the xbrl.FactSet.filter()
method, facts that don’t match the specified aspect values will be filtered out.
- class xbrl.ConstraintSet(constraints=None)¶
Constructs a new
xbrl.ConstraintSet
object. If no arguments are specifed, a new empty constraint set is constructed. If constraints is of typexbrl.ConstraintSet
, a copy of the given constraint set is constructed. If constraints is of typexbrl.Fact
,xbrl.Context
orxbrl.Unit
, then a new constraint set with the aspect values of the given object will be constructed. Otherwise constraints must be an iterator of (aspect, aspect value) tuples.
Class methods¶
- classmethod xbrl.ConstraintSet.fromkeys(type cls, seq, values)¶
Creates a new constraint set with the given seq aspects and their aspect values.
Attributes¶
- xbrl.ConstraintSet.aspects¶
Returns an
xbrl.AspectSet
object which represents all aspect kinds present in this constraint set.
- xbrl.ConstraintSet.concept¶
Returns an
xbrl.ConceptAspectValue
object if the concept aspect is set, otherwise None.
- xbrl.ConstraintSet.entity_identifier¶
Returns an
xbrl.EntityIdentifierAspectValue
object if the entity identifier aspect is set, otherwise None.
- xbrl.ConstraintSet.location¶
Returns an
xbrl.LocationAspectValue
object if the location aspect is set, otherwise None.
- xbrl.ConstraintSet.non_xdt_scenario¶
Returns an
xbrl.ScenarioAspectValue
object if the non-xdt scenario aspect is set, otherwise None.
- xbrl.ConstraintSet.non_xdt_segment¶
Returns an
xbrl.SegmentAspectValue
object if the non-xdt segment aspect is set, otherwise None.
- xbrl.ConstraintSet.period¶
Returns an
xbrl.PeriodAspectValue
object if the period aspect is set, otherwise None.
- xbrl.ConstraintSet.unit¶
Returns an
xbrl.UnitAspectValue
object if the unit aspect is set, otherwise None.
Methods¶
- xbrl.ConstraintSet.add(value)¶
Sets the given aspect value.
- xbrl.ConstraintSet.clear()¶
Removes all constraints from this constraint set.
- xbrl.ConstraintSet.copy()¶
Returns an
xbrl.ConstraintSet
object which is an independent copy of the current constraint set.
- xbrl.ConstraintSet.get(aspect, default=None)¶
Returns the constraint value for the given aspect. If the constraint set doesn’t contain a constraint for the given aspect, default is returned.
- xbrl.ConstraintSet.intersection_update(other)¶
Removes any constraints that are not in this and the other constraint set.
- xbrl.ConstraintSet.items()¶
Returns a new view of the aspect constraints in this constraint set.
- xbrl.ConstraintSet.keys()¶
Returns a new view of aspects for which constraints were specified in this constraint set.
- xbrl.ConstraintSet.pop(aspect, **kargs)¶
Removes and returns the constraint value for the given aspect. If the constraint set doesn’t have a constraint for the given aspect, default will be returned. If default was not specified, a
KeyError
is raised.
- xbrl.ConstraintSet.popitem()¶
Removes a constraint value and returns a tuple of (aspect, aspect value). If the constraint set is empty a
KeyError
is raised.
- xbrl.ConstraintSet.setdefault(aspect, default=None)¶
Returns the constraint value for the given aspect. If the constraint set doesn’t contain a constraint for the given aspect, a new constraint with default as value is added and default is returned.
- xbrl.ConstraintSet.update(other)¶
Merges the constraints in this and the other constraint set or aspect value list. Existing constraints for a given aspect will be overwritten by the aspect values in the other constraint set or aspect value list.
- xbrl.ConstraintSet.values()¶
Returns a new view of constraint values in this constraint set.
Special methods¶
__contains__, __delitem__, __eq__, __ge__, __getitem__, __gt__, __iter__, __le__, __len__, __lt__, __ne__, __setitem__