MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / setComponentByType

Method setComponentByType

pager_lib/pyasn1/type/univ.py:2871–2924  ·  view source on GitHub ↗

Assign |ASN.1| type component by ASN.1 tag. Parameters ---------- tagSet : :py:class:`~pyasn1.type.tag.TagSet` Object representing ASN.1 tags to identify one of |ASN.1| object component Keyword Args ------------ value: :class:

(self, tagSet, value=noValue,
                           verifyConstraints=True,
                           matchTags=True,
                           matchConstraints=True,
                           innerFlag=False)

Source from the content-addressed store, hash-verified

2869 return componentValue
2870
2871 def setComponentByType(self, tagSet, value=noValue,
2872 verifyConstraints=True,
2873 matchTags=True,
2874 matchConstraints=True,
2875 innerFlag=False):
2876 """Assign |ASN.1| type component by ASN.1 tag.
2877
2878 Parameters
2879 ----------
2880 tagSet : :py:class:`~pyasn1.type.tag.TagSet`
2881 Object representing ASN.1 tags to identify one of
2882 |ASN.1| object component
2883
2884 Keyword Args
2885 ------------
2886 value: :class:`object` or :py:class:`~pyasn1.type.base.PyAsn1Item` derivative
2887 A Python value to initialize |ASN.1| component with (if *componentType* is set)
2888 or ASN.1 value object to assign to |ASN.1| component.
2889 If `value` is not given, schema object will be set as a component.
2890
2891 verifyConstraints : :class:`bool`
2892 If :obj:`False`, skip constraints validation
2893
2894 matchTags: :class:`bool`
2895 If :obj:`False`, skip component tags matching
2896
2897 matchConstraints: :class:`bool`
2898 If :obj:`False`, skip component constraints matching
2899
2900 innerFlag: :class:`bool`
2901 If :obj:`True`, search for matching *tagSet* recursively.
2902
2903 Returns
2904 -------
2905 self
2906 """
2907 idx = self.componentType.getPositionByType(tagSet)
2908
2909 if innerFlag: # set inner component by inner tagSet
2910 componentType = self.componentType.getTypeByPosition(idx)
2911
2912 if componentType.tagSet:
2913 return self.setComponentByPosition(
2914 idx, value, verifyConstraints, matchTags, matchConstraints
2915 )
2916 else:
2917 componentType = self.getComponentByPosition(idx)
2918 return componentType.setComponentByType(
2919 tagSet, value, verifyConstraints, matchTags, matchConstraints, innerFlag=innerFlag
2920 )
2921 else: # set outer component by inner tagSet
2922 return self.setComponentByPosition(
2923 idx, value, verifyConstraints, matchTags, matchConstraints
2924 )
2925
2926 @property
2927 def componentTagMap(self):

Callers 3

valueDecoderMethod · 0.80
indefLenValueDecoderMethod · 0.80
_cloneComponentValuesMethod · 0.80

Calls 4

getPositionByTypeMethod · 0.80
getTypeByPositionMethod · 0.80

Tested by

no test coverage detected