Composition of tags

class pyasn1.type.tag.TagSet(baseTag=(), *superTags)

Create a collection of ASN.1 tags

Represents a combination of Tag objects that can be attached to a ASN.1 type to make types distinguishable from each other.

TagSet objects are immutable and duck-type Python tuple objects holding arbitrary number of Tag objects.

Parameters:
  • baseTag (Tag) – Base Tag object. This tag survives IMPLICIT tagging.
  • *superTags (Tag) – Additional Tag objects taking part in subtyping.
baseTag

Return base ASN.1 tag

Returns:class:~pyasn1.type.tag.Tag: – Base tag of this TagSet
superTags

Return ASN.1 tags

Returns:py:class:tuple: – Tuple of Tag objects that this TagSet contains
tagExplicitly(superTag)

Return explicitly tagged TagSet

Create a new TagSet representing callee TagSet explicitly tagged with passed tag(s). With explicit tagging mode, new tags are appended to existing tag(s).

Parameters:superTag (Tag) – Tag object to tag this TagSet
Returns:class:~pyasn1.type.tag.TagSet: – New TagSet object
tagImplicitly(superTag)

Return implicitly tagged TagSet

Create a new TagSet representing callee TagSet implicitly tagged with passed tag(s). With implicit tagging mode, new tag(s) replace the last existing tag.

Parameters:superTag (Tag) – Tag object to tag this TagSet
Returns:class:~pyasn1.type.tag.TagSet: – New TagSet object
isSuperTagSetOf(tagSet)

Test type relationship against given TagSet

The callee is considered to be a supertype of given TagSet tag-wise if all tags in TagSet are present in the callee and they are in the same order.

Parameters:tagSet (TagSet) – TagSet object to evaluate against the callee
Returns:py:bool: – True if callee is a supertype of tagSet