From 3cae125ac526f614021274337b5992a418191ab8 Mon Sep 17 00:00:00 2001 From: Ilya Etingof Date: Wed, 28 Aug 2019 10:02:35 +0200 Subject: Add an afterthought on WITH COMPONENTS constraint --- pyasn1/type/constraint.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pyasn1/type/constraint.py b/pyasn1/type/constraint.py index b8aa0af..0049f97 100644 --- a/pyasn1/type/constraint.py +++ b/pyasn1/type/constraint.py @@ -411,12 +411,12 @@ class ComponentAbsentConstraint(AbstractConstraint): class WithComponentsConstraint(AbstractConstraint): """Create a WithComponentsConstraint object. - The WithComponentsConstraint satisfies any mapping object that has + The `WithComponentsConstraint` satisfies any mapping object that has constrained fields present or absent, what is indicated by `ComponentPresentConstraint` and `ComponentAbsentConstraint` objects respectively. - The WithComponentsConstraint object is typically applied + The `WithComponentsConstraint` object is typically applied to :class:`~pyasn1.type.univ.Set` or :class:`~pyasn1.type.univ.Sequence` types. @@ -426,6 +426,16 @@ class WithComponentsConstraint(AbstractConstraint): Zero or more tuples of (`field`, `constraint`) indicating constrained fields. + Notes + ----- + On top of the primary use of `WithComponentsConstraint` (ensuring presence + or absence of particular components of a :class:`~pyasn1.type.univ.Set` or + :class:`~pyasn1.type.univ.Sequence`), it is also possible to pass any other + constraint objects or their combinations. In case of scalar fields, these + constraints will be verified in addition to the constraints belonging to + scalar components themselves. However, formally, these additional + constraints do not change the type of these ASN.1 objects. + Examples -------- -- cgit v1.2.3