<s> import operator , sys , math <EOL> from pyasn1 . type import base , tag , constraint , namedtype , namedval , tagmap <EOL> from pyasn1 . codec . ber import eoo <EOL> from pyasn1 . compat import octets <EOL> from pyasn1 import error <EOL> class Integer ( base . AbstractSimpleAsn1Item ) : <EOL> tagSet = baseTagSet = tag . initTagSet ( <EOL> tag . Tag ( tag . tagClassUniversal , tag . tagFormatSimple , <NUM_LIT> ) <EOL> ) <EOL> namedValues = namedval . NamedValues ( ) <EOL> def __init__ ( self , value = None , tagSet = None , subtypeSpec = None , <EOL> namedValues = None ) : <EOL> if namedValues is None : <EOL> self . __namedValues = self . namedValues <EOL> else : <EOL> self . __namedValues = namedValues <EOL> base . AbstractSimpleAsn1Item . __init__ ( <EOL> self , value , tagSet , subtypeSpec <EOL> ) <EOL> def __repr__ ( self ) : <EOL> if self . __namedValues is not self . namedValues : <EOL> return '<STR_LIT>' % ( base . AbstractSimpleAsn1Item . __repr__ ( self ) [ : - <NUM_LIT:1> ] , self . __namedValues ) <EOL> else : <EOL> return base . AbstractSimpleAsn1Item . __repr__ ( self ) <EOL> def __and__ ( self , value ) : return self . clone ( self . _value & value ) <EOL> def __rand__ ( self , value ) : return self . clone ( value & self . _value ) <EOL> def __or__ ( self , value ) : return self . clone ( self . _value | value ) <EOL> def __ror__ ( self , value ) : return self . clone ( value | self . _value ) <EOL> def __xor__ ( self , value ) : return self . clone ( self . _value ^ value ) <EOL> def __rxor__ ( self , value ) : return self . clone ( value ^ self . _value ) <EOL> def __lshift__ ( self , value ) : return self . clone ( self . _value << value ) <EOL> def __rshift__ ( self , value ) : return self . clone ( self . _value >> value ) <EOL> def __add__ ( self , value ) : return self . clone ( self . _value + value ) <EOL> def __radd__ ( self , value ) : return self . clone ( value + self . _value ) <EOL> def __sub__ ( self , value ) : return self . clone ( self . _value - value ) <EOL> def __rsub__ ( self , value ) : return self . clone ( value - self . _value ) <EOL> def __mul__ ( self , value ) : return self . clone ( self . _value * value ) <EOL> def __rmul__ ( self , value ) : return self . clone ( value * self . _value ) <EOL> def __mod__ ( self , value ) : return self . clone ( self . _value % value ) <EOL> def __rmod__ ( self , value ) : return self . clone ( value % self . _value ) <EOL> def __pow__ ( self , value , modulo = None ) : return self . clone ( pow ( self . _value , value , modulo ) ) <EOL> def __rpow__ ( self , value ) : return self . clone ( pow ( value , self . _value ) ) <EOL> if sys . version_info [ <NUM_LIT:0> ] <= <NUM_LIT:2> : <EOL> def __div__ ( self , value ) : return self . clone ( self . _value // value ) <EOL> def __rdiv__ ( self , value ) : return self . clone ( value // self . _value ) <EOL> else : <EOL> def __truediv__ ( self , value ) : return self . clone ( self . _value / value ) <EOL> def __rtruediv__ ( self , value ) : return self . clone ( value / self . _value ) <EOL> def __divmod__ ( self , value ) : return self . clone ( self . _value // value ) <EOL> def __rdivmod__ ( self , value ) : return self . clone ( value // self . _value ) <EOL> __hash__ = base . AbstractSimpleAsn1Item . __hash__ <EOL> def __int__ ( self ) : return int ( self . _value ) <EOL> if sys . version_info [ <NUM_LIT:0> ] <= <NUM_LIT:2> : <EOL> def __long__ ( self ) : return long ( self . _value ) <EOL> def __float__ ( self ) : return float ( self . _value ) <EOL> def __abs__ ( self ) : return self . clone ( abs ( self . _value ) ) <EOL> def __index__ ( self ) : return int ( self . _value ) <EOL> def __pos__ ( self ) : return self . clone ( + self . _value ) <EOL> def __neg__ ( self ) : return self . clone ( - self . _value ) <EOL> def __invert__ ( self ) : return self . clone ( ~ self . _value ) <EOL> def __round__ ( self , n = <NUM_LIT:0> ) : <EOL> r = round ( self . _value , n ) <EOL> if n : <EOL> return self . clone ( r ) <EOL> else : <EOL> return r <EOL> def __floor__ ( self ) : return math . floor ( self . _value ) <EOL> def __ceil__ ( self ) : return math . ceil ( self . _value ) <EOL> if sys . version_info [ <NUM_LIT:0> : <NUM_LIT:2> ] > ( <NUM_LIT:2> , <NUM_LIT:5> ) : <EOL> def __trunc__ ( self ) : return self . clone ( math . trunc ( self . _value ) ) <EOL> def __lt__ ( self , value ) : return self . _value < value <EOL> def __le__ ( self , value ) : return self . _value <= value <EOL> def __eq__ ( self , value ) : return self . _value == value <EOL> def __ne__ ( self , value ) : return self . _value != value <EOL> def __gt__ ( self , value ) : return self . _value > value <EOL> def __ge__ ( self , value ) : return self . _value >= value <EOL> def prettyIn ( self , value ) : <EOL> if not isinstance ( value , str ) : <EOL> try : <EOL> return int ( value ) <EOL> except : <EOL> raise error . PyAsn1Error ( <EOL> '<STR_LIT>' % ( value , sys . exc_info ( ) [ <NUM_LIT:1> ] ) <EOL> ) <EOL> r = self . __namedValues . getValue ( value ) <EOL> if r is not None : <EOL> return r <EOL> try : <EOL> return int ( value ) <EOL> except : <EOL> raise error . PyAsn1Error ( <EOL> '<STR_LIT>' % ( value , sys . exc_info ( ) [ <NUM_LIT:1> ] ) <EOL> ) <EOL> def prettyOut ( self , value ) : <EOL> r = self . __namedValues . getName ( value ) <EOL> return r is None and str ( value ) or repr ( r ) <EOL> def getNamedValues ( self ) : return self . __namedValues <EOL> def clone ( self , value = None , tagSet = None , subtypeSpec = None , <EOL> namedValues = None ) : <EOL> if value is None and tagSet is None and subtypeSpec is None and namedValues is None : <EOL> return self <EOL> if value is None : <EOL> value = self . _value <EOL> if tagSet is None : <EOL> tagSet = self . _tagSet <EOL> if subtypeSpec is None : <EOL> subtypeSpec = self . _subtypeSpec <EOL> if namedValues is None : <EOL> namedValues = self . __namedValues <EOL> return self . __class__ ( value , tagSet , subtypeSpec , namedValues ) <EOL> def subtype ( self , value = None , implicitTag = None , explicitTag = None , <EOL> subtypeSpec = None , namedValues = None ) : <EOL> if value is None : <EOL> value = self . _value <EOL> if implicitTag is not None : <EOL> tagSet = self . _tagSet . tagImplicitly ( implicitTag ) <EOL> elif explicitTag is not None : <EOL> tagSet = self . _tagSet . tagExplicitly ( explicitTag ) <EOL> else : <EOL> tagSet = self . _tagSet <EOL> if subtypeSpec is None : <EOL> subtypeSpec = self . _subtypeSpec <EOL> else : <EOL> subtypeSpec = subtypeSpec + self . _subtypeSpec <EOL> if namedValues is None : <EOL> namedValues = self . __namedValues <EOL> else : <EOL> namedValues = namedValues + self . __namedValues <EOL> return self . __class__ ( value , tagSet , subtypeSpec , namedValues ) <EOL> class Boolean ( Integer ) : <EOL> tagSet = baseTagSet = tag . initTagSet ( <EOL> tag . Tag ( tag . tagClassUniversal , tag . tagFormatSimple , <NUM_LIT> ) , <EOL> ) <EOL> subtypeSpec = Integer . subtypeSpec + constraint . SingleValueConstraint ( <NUM_LIT:0> , <NUM_LIT:1> ) <EOL> namedValues = Integer . namedValues . clone ( ( '<STR_LIT:False>' , <NUM_LIT:0> ) , ( '<STR_LIT:True>' , <NUM_LIT:1> ) ) <EOL> class BitString ( base . AbstractSimpleAsn1Item ) : <EOL> tagSet = baseTagSet = tag . initTagSet ( <EOL> tag . Tag ( tag . tagClassUniversal , tag . tagFormatSimple , <NUM_LIT> ) <EOL> ) <EOL> namedValues = namedval . NamedValues ( ) <EOL> def __init__ ( self , value = None , tagSet = None , subtypeSpec = None , <EOL> namedValues = None ) : <EOL> if namedValues is None : <EOL> self . __namedValues = self . namedValues <EOL> else : <EOL> self . __namedValues = namedValues <EOL> base . AbstractSimpleAsn1Item . __init__ ( <EOL> self , value , tagSet , subtypeSpec <EOL> ) <EOL> def clone ( self , value = None , tagSet = None , subtypeSpec = None , <EOL> namedValues = None ) : <EOL> if value is None and tagSet is None and subtypeSpec is None and namedValues is None : <EOL> return self <EOL> if value is None : <EOL> value = self . _value <EOL> if tagSet is None : <EOL> tagSet = self . _tagSet <EOL> if subtypeSpec is None : <EOL> subtypeSpec = self . _subtypeSpec <EOL> if namedValues is None : <EOL> namedValues = self . __namedValues <EOL> return self . __class__ ( value , tagSet , subtypeSpec , namedValues ) <EOL> def subtype ( self , value = None , implicitTag = None , explicitTag = None , <EOL> subtypeSpec = None , namedValues = None ) : <EOL> if value is None : <EOL> value = self . _value <EOL> if implicitTag is not None : <EOL> tagSet = self . _tagSet . tagImplicitly ( implicitTag ) <EOL> elif explicitTag is not None : <EOL> tagSet = self . _tagSet . tagExplicitly ( explicitTag ) <EOL> else : <EOL> tagSet = self . _tagSet <EOL> if subtypeSpec is None : <EOL> subtypeSpec = self . _subtypeSpec <EOL> else : <EOL> subtypeSpec = subtypeSpec + self . _subtypeSpec <EOL> if namedValues is None : <EOL> namedValues = self . __namedValues <EOL> else : <EOL> namedValues = namedValues + self . __namedValues <EOL> return self . __class__ ( value , tagSet , subtypeSpec , namedValues ) <EOL> def __str__ ( self ) : return str ( tuple ( self ) ) <EOL> def __len__ ( self ) : <EOL> if self . _len is None : <EOL> self . _len = len ( self . _value ) <EOL> return self . _len <EOL> def __getitem__ ( self , i ) : <EOL> if isinstance ( i , slice ) : <EOL> return self . clone ( operator . getitem ( self . _value , i ) ) <EOL> else : <EOL> return self . _value [ i ] <EOL> def __add__ ( self , value ) : return self . clone ( self . _value + value ) <EOL> def __radd__ ( self , value ) : return self . clone ( value + self . _value ) <EOL> def __mul__ ( self , value ) : return self . clone ( self . _value * value ) <EOL> def __rmul__ ( self , value ) : return self * value <EOL> def prettyIn ( self , value ) : <EOL> r = [ ] <EOL> if not value : <EOL> return ( ) <EOL> elif isinstance ( value , str ) : <EOL> if value [ <NUM_LIT:0> ] == '<STR_LIT>' : <EOL> if value [ - <NUM_LIT:2> : ] == '<STR_LIT>' : <EOL> for v in value [ <NUM_LIT:1> : - <NUM_LIT:2> ] : <EOL> if v == '<STR_LIT:0>' : <EOL> r . append ( <NUM_LIT:0> ) <EOL> elif v == '<STR_LIT:1>' : <EOL> r . append ( <NUM_LIT:1> ) <EOL> else : <EOL> raise error . PyAsn1Error ( <EOL> '<STR_LIT>' % ( v , ) <EOL> ) <EOL> return tuple ( r ) <EOL> elif value [ - <NUM_LIT:2> : ] == '<STR_LIT>' : <EOL> for v in value [ <NUM_LIT:1> : - <NUM_LIT:2> ] : <EOL> i = <NUM_LIT:4> <EOL> v = int ( v , <NUM_LIT:16> ) <EOL> while i : <EOL> i = i - <NUM_LIT:1> <EOL> r . append ( ( v >> i ) & <NUM_LIT> ) <EOL> return tuple ( r ) <EOL> else : <EOL> raise error . PyAsn1Error ( <EOL> '<STR_LIT>' % ( value , ) <EOL> ) <EOL> else : <EOL> for i in value . split ( '<STR_LIT:U+002C>' ) : <EOL> j = self . __namedValues . getValue ( i ) <EOL> if j is None : <EOL> raise error . PyAsn1Error ( <EOL> '<STR_LIT>' % ( i , ) <EOL> ) <EOL> if j >= len ( r ) : <EOL> r . extend ( [ <NUM_LIT:0> ] * ( j - len ( r ) + <NUM_LIT:1> ) ) <EOL> r [ j ] = <NUM_LIT:1> <EOL> return tuple ( r ) <EOL> elif isinstance ( value , ( tuple , list ) ) : <EOL> r = tuple ( value ) <EOL> for b in r : <EOL> if b and b != <NUM_LIT:1> : <EOL> raise error . PyAsn1Error ( <EOL> '<STR_LIT>' % ( r , ) <EOL> ) <EOL> return r <EOL> elif isinstance ( value , BitString ) : <EOL> return tuple ( value ) <EOL> else : <EOL> raise error . PyAsn1Error ( <EOL> '<STR_LIT>' % ( value , ) <EOL> ) <EOL> def prettyOut ( self , value ) : <EOL> return '<STR_LIT>' % '<STR_LIT>' . join ( [ str ( x ) for x in value ] ) <EOL> try : <EOL> all <EOL> except NameError : <EOL> def all ( iterable ) : <EOL> for element in iterable : <EOL> if not element : <EOL> return False <EOL> return True <EOL> class OctetString ( base . AbstractSimpleAsn1Item ) : <EOL> tagSet = baseTagSet = tag . initTagSet ( <EOL> tag . Tag ( tag . tagClassUniversal , tag . tagFormatSimple , <NUM_LIT> ) <EOL> ) <EOL> defaultBinValue = defaultHexValue = base . noValue <EOL> encoding = '<STR_LIT>' <EOL> def __init__ ( self , value = None , tagSet = None , subtypeSpec = None , <EOL> encoding = None , binValue = None , hexValue = None ) : <EOL> if encoding is None : <EOL> self . _encoding = self . encoding <EOL> else : <EOL> self . _encoding = encoding <EOL> if binValue is not None : <EOL> value = self . fromBinaryString ( binValue ) <EOL> if hexValue is not None : <EOL> value = self . fromHexString ( hexValue ) <EOL> if value is None or value is base . noValue : <EOL> value = self . defaultHexValue <EOL> if value is None or value is base . noValue : <EOL> value = self . defaultBinValue <EOL> self . __asNumbersCache = None <EOL> base . AbstractSimpleAsn1Item . __init__ ( self , value , tagSet , subtypeSpec ) <EOL> def clone ( self , value = None , tagSet = None , subtypeSpec = None , <EOL> encoding = None , binValue = None , hexValue = None ) : <EOL> if value is None and tagSet is None and subtypeSpec is None and encoding is None and binValue is None and hexValue is None : <EOL> return self <EOL> if value is None and binValue is None and hexValue is None : <EOL> value = self . _value <EOL> if tagSet is None : <EOL> tagSet = self . _tagSet <EOL> if subtypeSpec is None : <EOL> subtypeSpec = self . _subtypeSpec <EOL> if encoding is None : <EOL> encoding = self . _encoding <EOL> return self . __class__ ( <EOL> value , tagSet , subtypeSpec , encoding , binValue , hexValue <EOL> ) <EOL> if sys . version_info [ <NUM_LIT:0> ] <= <NUM_LIT:2> : <EOL> def prettyIn ( self , value ) : <EOL> if isinstance ( value , str ) : <EOL> return value <EOL> elif isinstance ( value , unicode ) : <EOL> try : <EOL> return value . encode ( self . _encoding ) <EOL> except ( LookupError , UnicodeEncodeError ) : <EOL> raise error . PyAsn1Error ( <EOL> '<STR_LIT>' % ( value , self . _encoding ) <EOL> ) <EOL> elif isinstance ( value , ( tuple , list ) ) : <EOL> try : <EOL> return '<STR_LIT>' . join ( [ chr ( x ) for x in value ] ) <EOL> except ValueError : <EOL> raise error . PyAsn1Error ( <EOL> '<STR_LIT>' % ( value , ) <EOL> ) <EOL> else : <EOL> return str ( value ) <EOL> else : <EOL> def prettyIn ( self , value ) : <EOL> if isinstance ( value , bytes ) : <EOL> return value <EOL> elif isinstance ( value , str ) : <EOL> try : <EOL> return value . encode ( self . _encoding ) <EOL> except UnicodeEncodeError : <EOL> raise error . PyAsn1Error ( <EOL> '<STR_LIT>' % ( value , self . _encoding ) <EOL> ) <EOL> elif isinstance ( value , OctetString ) : <EOL> return value . asOctets ( ) <EOL> elif isinstance ( value , ( tuple , list , map ) ) : <EOL> try : <EOL> return bytes ( value ) <EOL> except ValueError : <EOL> raise error . PyAsn1Error ( <EOL> '<STR_LIT>' % ( value , ) <EOL> ) <EOL> else : <EOL> try : <EOL> return str ( value ) . encode ( self . _encoding ) <EOL> except UnicodeEncodeError : <EOL> raise error . PyAsn1Error ( <EOL> '<STR_LIT>' % ( value , self . _encoding ) <EOL> ) <EOL> def fromBinaryString ( self , value ) : <EOL> bitNo = <NUM_LIT:8> ; byte = <NUM_LIT:0> ; r = ( ) <EOL> for v in value : <EOL> if bitNo : <EOL> bitNo = bitNo - <NUM_LIT:1> <EOL> else : <EOL> bitNo = <NUM_LIT:7> <EOL> r = r + ( byte , ) <EOL> byte = <NUM_LIT:0> <EOL> if v == '<STR_LIT:0>' : <EOL> v = <NUM_LIT:0> <EOL> elif v == '<STR_LIT:1>' : <EOL> v = <NUM_LIT:1> <EOL> else : <EOL> raise error . PyAsn1Error ( <EOL> '<STR_LIT>' % ( v , ) <EOL> ) <EOL> byte = byte | ( v << bitNo ) <EOL> return octets . ints2octs ( r + ( byte , ) ) <EOL> def fromHexString ( self , value ) : <EOL> r = p = ( ) <EOL> for v in value : <EOL> if p : <EOL> r = r + ( int ( p + v , <NUM_LIT:16> ) , ) <EOL> p = ( ) <EOL> else : <EOL> p = v <EOL> if p : <EOL> r = r + ( int ( p + '<STR_LIT:0>' , <NUM_LIT:16> ) , ) <EOL> return octets . ints2octs ( r ) <EOL> def prettyOut ( self , value ) : <EOL> if sys . version_info [ <NUM_LIT:0> ] <= <NUM_LIT:2> : <EOL> numbers = tuple ( ( ord ( x ) for x in value ) ) <EOL> else : <EOL> numbers = tuple ( value ) <EOL> if all ( x >= <NUM_LIT:32> and x <= <NUM_LIT> for x in numbers ) : <EOL> return str ( value ) <EOL> else : <EOL> return '<STR_LIT>' + '<STR_LIT>' . join ( ( '<STR_LIT>' % x for x in numbers ) ) <EOL> def __repr__ ( self ) : <EOL> r = [ ] <EOL> doHex = False <EOL> if self . _value is not self . defaultValue : <EOL> for x in self . asNumbers ( ) : <EOL> if x < <NUM_LIT:32> or x > <NUM_LIT> : <EOL> doHex = True <EOL> break <EOL> if not doHex : <EOL> r . append ( '<STR_LIT>' % ( self . _value , ) ) <EOL> if self . _tagSet is not self . tagSet : <EOL> r . append ( '<STR_LIT>' % ( self . _tagSet , ) ) <EOL> if self . _subtypeSpec is not self . subtypeSpec : <EOL> r . append ( '<STR_LIT>' % ( self . _subtypeSpec , ) ) <EOL> if self . encoding is not self . _encoding : <EOL> r . append ( '<STR_LIT>' % ( self . _encoding , ) ) <EOL> if doHex : <EOL> r . append ( '<STR_LIT>' % '<STR_LIT>' . join ( [ '<STR_LIT>' % x for x in self . asNumbers ( ) ] ) ) <EOL> return '<STR_LIT>' % ( self . __class__ . __name__ , '<STR_LIT:U+002CU+0020>' . join ( r ) ) <EOL> if sys . version_info [ <NUM_LIT:0> ] <= <NUM_LIT:2> : <EOL> def __str__ ( self ) : return str ( self . _value ) <EOL> def __unicode__ ( self ) : <EOL> return self . _value . decode ( self . _encoding , '<STR_LIT:ignore>' ) <EOL> def asOctets ( self ) : return self . _value <EOL> def asNumbers ( self ) : <EOL> if self . __asNumbersCache is None : <EOL> self . __asNumbersCache = tuple ( [ ord ( x ) for x in self . _value ] ) <EOL> return self . __asNumbersCache <EOL> else : <EOL> def __str__ ( self ) : return self . _value . decode ( self . _encoding , '<STR_LIT:ignore>' ) <EOL> def __bytes__ ( self ) : return self . _value <EOL> def asOctets ( self ) : return self . _value <EOL> def asNumbers ( self ) : <EOL> if self . __asNumbersCache is None : <EOL> self . __asNumbersCache = tuple ( self . _value ) <EOL> return self . __asNumbersCache <EOL> def __len__ ( self ) : <EOL> if self . _len is None : <EOL> self . _len = len ( self . _value ) <EOL> return self . _len <EOL> def __getitem__ ( self , i ) : <EOL> if isinstance ( i , slice ) : <EOL> return self . clone ( operator . getitem ( self . _value , i ) ) <EOL> else : <EOL> return self . _value [ i ] <EOL> def __add__ ( self , value ) : return self . clone ( self . _value + self . prettyIn ( value ) ) <EOL> def __radd__ ( self , value ) : return self . clone ( self . prettyIn ( value ) + self . _value ) <EOL> def __mul__ ( self , value ) : return self . clone ( self . _value * value ) <EOL> def __rmul__ ( self , value ) : return self * value <EOL> def __int__ ( self ) : return int ( self . _value ) <EOL> def __float__ ( self ) : return float ( self . _value ) <EOL> class Null ( OctetString ) : <EOL> defaultValue = '<STR_LIT>' . encode ( ) <EOL> tagSet = baseTagSet = tag . initTagSet ( <EOL> tag . Tag ( tag . tagClassUniversal , tag . tagFormatSimple , <NUM_LIT> ) <EOL> ) <EOL> subtypeSpec = OctetString . subtypeSpec + constraint . SingleValueConstraint ( '<STR_LIT>' . encode ( ) ) <EOL> if sys . version_info [ <NUM_LIT:0> ] <= <NUM_LIT:2> : <EOL> intTypes = ( int , long ) <EOL> else : <EOL> intTypes = ( int , ) <EOL> numericTypes = intTypes + ( float , ) <EOL> class ObjectIdentifier ( base . AbstractSimpleAsn1Item ) : <EOL> tagSet = baseTagSet = tag . initTagSet ( <EOL> tag . Tag ( tag . tagClassUniversal , tag . tagFormatSimple , <NUM_LIT> ) <EOL> ) <EOL> def __add__ ( self , other ) : return self . clone ( self . _value + other ) <EOL> def __radd__ ( self , other ) : return self . clone ( other + self . _value ) <EOL> def asTuple ( self ) : return self . _value <EOL> def __len__ ( self ) : <EOL> if self . _len is None : <EOL> self . _len = len ( self . _value ) <EOL> return self . _len <EOL> def __getitem__ ( self , i ) : <EOL> if isinstance ( i , slice ) : <EOL> return self . clone ( <EOL> operator . getitem ( self . _value , i ) <EOL> ) <EOL> else : <EOL> return self . _value [ i ] <EOL> def __str__ ( self ) : return self . prettyPrint ( ) <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' % ( self . __class__ . __name__ , self . prettyPrint ( ) ) <EOL> def index ( self , suboid ) : return self . _value . index ( suboid ) <EOL> def isPrefixOf ( self , value ) : <EOL> """<STR_LIT>""" <EOL> l = len ( self ) <EOL> if l <= len ( value ) : <EOL> if self . _value [ : l ] == value [ : l ] : <EOL> return <NUM_LIT:1> <EOL> return <NUM_LIT:0> <EOL> def prettyIn ( self , value ) : <EOL> """<STR_LIT>""" <EOL> if isinstance ( value , tuple ) : <EOL> pass <EOL> elif isinstance ( value , ObjectIdentifier ) : <EOL> return tuple ( value ) <EOL> elif isinstance ( value , str ) : <EOL> r = [ ] <EOL> for element in [ x for x in value . split ( '<STR_LIT:.>' ) if x != '<STR_LIT>' ] : <EOL> try : <EOL> r . append ( int ( element , <NUM_LIT:0> ) ) <EOL> except ValueError : <EOL> raise error . PyAsn1Error ( <EOL> '<STR_LIT>' % <EOL> ( str ( value ) , self . __class__ . __name__ , sys . exc_info ( ) [ <NUM_LIT:1> ] ) <EOL> ) <EOL> value = tuple ( r ) <EOL> else : <EOL> try : <EOL> value = tuple ( value ) <EOL> except TypeError : <EOL> raise error . PyAsn1Error ( <EOL> '<STR_LIT>' % <EOL> ( str ( value ) , self . __class__ . __name__ , sys . exc_info ( ) [ <NUM_LIT:1> ] ) <EOL> ) <EOL> for x in value : <EOL> if not isinstance ( x , intTypes ) or x < <NUM_LIT:0> : <EOL> raise error . PyAsn1Error ( <EOL> '<STR_LIT>' % ( value , self . __class__ . __name__ ) <EOL> ) <EOL> return value <EOL> def prettyOut ( self , value ) : return '<STR_LIT:.>' . join ( [ str ( x ) for x in value ] ) <EOL> class Real ( base . AbstractSimpleAsn1Item ) : <EOL> binEncBase = None <EOL> try : <EOL> _plusInf = float ( '<STR_LIT>' ) <EOL> _minusInf = float ( '<STR_LIT>' ) <EOL> _inf = ( _plusInf , _minusInf ) <EOL> except ValueError : <EOL> _plusInf = _minusInf = None <EOL> _inf = ( ) <EOL> tagSet = baseTagSet = tag . initTagSet ( <EOL> tag . Tag ( tag . tagClassUniversal , tag . tagFormatSimple , <NUM_LIT> ) <EOL> ) <EOL> def __normalizeBase10 ( self , value ) : <EOL> m , b , e = value <EOL> while m and m % <NUM_LIT:10> == <NUM_LIT:0> : <EOL> m = m / <NUM_LIT:10> <EOL> e = e + <NUM_LIT:1> <EOL> return m , b , e <EOL> def prettyIn ( self , value ) : <EOL> if isinstance ( value , tuple ) and len ( value ) == <NUM_LIT:3> : <EOL> if not isinstance ( value [ <NUM_LIT:0> ] , numericTypes ) or not isinstance ( value [ <NUM_LIT:1> ] , intTypes ) or not isinstance ( value [ <NUM_LIT:2> ] , intTypes ) : <EOL> raise error . PyAsn1Error ( '<STR_LIT>' % ( value , ) ) <EOL> if isinstance ( value [ <NUM_LIT:0> ] , float ) and self . _inf and value [ <NUM_LIT:0> ] in self . _inf : <EOL> return value [ <NUM_LIT:0> ] <EOL> if value [ <NUM_LIT:1> ] not in ( <NUM_LIT:2> , <NUM_LIT:10> ) : <EOL> raise error . PyAsn1Error ( <EOL> '<STR_LIT>' % ( value [ <NUM_LIT:1> ] , ) <EOL> ) <EOL> if value [ <NUM_LIT:1> ] == <NUM_LIT:10> : <EOL> value = self . __normalizeBase10 ( value ) <EOL> return value <EOL> elif isinstance ( value , intTypes ) : <EOL> return self . __normalizeBase10 ( ( value , <NUM_LIT:10> , <NUM_LIT:0> ) ) <EOL> elif isinstance ( value , ( str , float ) ) : <EOL> if isinstance ( value , str ) : <EOL> try : <EOL> value = float ( value ) <EOL> except ValueError : <EOL> raise error . PyAsn1Error ( <EOL> '<STR_LIT>' % ( value , ) <EOL> ) <EOL> if self . _inf and value in self . _inf : <EOL> return value <EOL> else : <EOL> e = <NUM_LIT:0> <EOL> while int ( value ) != value : <EOL> value = value * <NUM_LIT:10> <EOL> e = e - <NUM_LIT:1> <EOL> return self . __normalizeBase10 ( ( int ( value ) , <NUM_LIT:10> , e ) ) <EOL> elif isinstance ( value , Real ) : <EOL> return tuple ( value ) <EOL> raise error . PyAsn1Error ( <EOL> '<STR_LIT>' % ( value , ) <EOL> ) <EOL> def prettyOut ( self , value ) : <EOL> if value in self . _inf : <EOL> return '<STR_LIT>' % value <EOL> else : <EOL> return str ( value ) <EOL> def prettyPrint ( self , scope = <NUM_LIT:0> ) : <EOL> if self . isInfinity ( ) : <EOL> return self . prettyOut ( self . _value ) <EOL> else : <EOL> return str ( float ( self ) ) <EOL> def isPlusInfinity ( self ) : return self . _value == self . _plusInf <EOL> def isMinusInfinity ( self ) : return self . _value == self . _minusInf <EOL> def isInfinity ( self ) : return self . _value in self . _inf <EOL> def __str__ ( self ) : return str ( float ( self ) ) <EOL> def __add__ ( self , value ) : return self . clone ( float ( self ) + value ) <EOL> def __radd__ ( self , value ) : return self + value <EOL> def __mul__ ( self , value ) : return self . clone ( float ( self ) * value ) <EOL> def __rmul__ ( self , value ) : return self * value <EOL> def __sub__ ( self , value ) : return self . clone ( float ( self ) - value ) <EOL> def __rsub__ ( self , value ) : return self . clone ( value - float ( self ) ) <EOL> def __mod__ ( self , value ) : return self . clone ( float ( self ) % value ) <EOL> def __rmod__ ( self , value ) : return self . clone ( value % float ( self ) ) <EOL> def __pow__ ( self , value , modulo = None ) : return self . clone ( pow ( float ( self ) , value , modulo ) ) <EOL> def __rpow__ ( self , value ) : return self . clone ( pow ( value , float ( self ) ) ) <EOL> if sys . version_info [ <NUM_LIT:0> ] <= <NUM_LIT:2> : <EOL> def __div__ ( self , value ) : return self . clone ( float ( self ) / value ) <EOL> def __rdiv__ ( self , value ) : return self . clone ( value / float ( self ) ) <EOL> else : <EOL> def __truediv__ ( self , value ) : return self . clone ( float ( self ) / value ) <EOL> def __rtruediv__ ( self , value ) : return self . clone ( value / float ( self ) ) <EOL> def __divmod__ ( self , value ) : return self . clone ( float ( self ) // value ) <EOL> def __rdivmod__ ( self , value ) : return self . clone ( value // float ( self ) ) <EOL> def __int__ ( self ) : return int ( float ( self ) ) <EOL> if sys . version_info [ <NUM_LIT:0> ] <= <NUM_LIT:2> : <EOL> def __long__ ( self ) : return long ( float ( self ) ) <EOL> def __float__ ( self ) : <EOL> if self . _value in self . _inf : <EOL> return self . _value <EOL> else : <EOL> return float ( <EOL> self . _value [ <NUM_LIT:0> ] * pow ( self . _value [ <NUM_LIT:1> ] , self . _value [ <NUM_LIT:2> ] ) <EOL> ) <EOL> def __abs__ ( self ) : return self . clone ( abs ( float ( self ) ) ) <EOL> def __pos__ ( self ) : return self . clone ( + float ( self ) ) <EOL> def __neg__ ( self ) : return self . clone ( - float ( self ) ) <EOL> def __round__ ( self , n = <NUM_LIT:0> ) : <EOL> r = round ( float ( self ) , n ) <EOL> if n : <EOL> return self . clone ( r ) <EOL> else : <EOL> return r <EOL> def __floor__ ( self ) : return self . clone ( math . floor ( float ( self ) ) ) <EOL> def __ceil__ ( self ) : return self . clone ( math . ceil ( float ( self ) ) ) <EOL> if sys . version_info [ <NUM_LIT:0> : <NUM_LIT:2> ] > ( <NUM_LIT:2> , <NUM_LIT:5> ) : <EOL> def __trunc__ ( self ) : return self . clone ( math . trunc ( float ( self ) ) ) <EOL> def __lt__ ( self , value ) : return float ( self ) < value <EOL> def __le__ ( self , value ) : return float ( self ) <= value <EOL> def __eq__ ( self , value ) : return float ( self ) == value <EOL> def __ne__ ( self , value ) : return float ( self ) != value <EOL> def __gt__ ( self , value ) : return float ( self ) > value <EOL> def __ge__ ( self , value ) : return float ( self ) >= value <EOL> if sys . version_info [ <NUM_LIT:0> ] <= <NUM_LIT:2> : <EOL> def __nonzero__ ( self ) : return bool ( float ( self ) ) <EOL> else : <EOL> def __bool__ ( self ) : return bool ( float ( self ) ) <EOL> __hash__ = base . AbstractSimpleAsn1Item . __hash__ <EOL> def __getitem__ ( self , idx ) : <EOL> if self . _value in self . _inf : <EOL> raise error . PyAsn1Error ( '<STR_LIT>' ) <EOL> else : <EOL> return self . _value [ idx ] <EOL> class Enumerated ( Integer ) : <EOL> tagSet = baseTagSet = tag . initTagSet ( <EOL> tag . Tag ( tag . tagClassUniversal , tag . tagFormatSimple , <NUM_LIT> ) <EOL> ) <EOL> class SetOf ( base . AbstractConstructedAsn1Item ) : <EOL> componentType = None <EOL> tagSet = baseTagSet = tag . initTagSet ( <EOL> tag . Tag ( tag . tagClassUniversal , tag . tagFormatConstructed , <NUM_LIT> ) <EOL> ) <EOL> typeId = <NUM_LIT:1> <EOL> strictConstraints = False <EOL> def _cloneComponentValues ( self , myClone , cloneValueFlag ) : <EOL> idx = <NUM_LIT:0> ; l = len ( self . _componentValues ) <EOL> while idx < l : <EOL> c = self . _componentValues [ idx ] <EOL> if c is not None : <EOL> if isinstance ( c , base . AbstractConstructedAsn1Item ) : <EOL> myClone . setComponentByPosition ( <EOL> idx , c . clone ( cloneValueFlag = cloneValueFlag ) <EOL> ) <EOL> else : <EOL> myClone . setComponentByPosition ( idx , c . clone ( ) ) <EOL> idx = idx + <NUM_LIT:1> <EOL> def _verifyComponent ( self , idx , value ) : <EOL> t = self . _componentType <EOL> if t is None : <EOL> return <EOL> if not t . isSameTypeWith ( value , matchConstraints = self . strictConstraints ) : <EOL> raise error . PyAsn1Error ( '<STR_LIT>' % ( value , t ) ) <EOL> if self . strictConstraints and not t . isSuperTypeOf ( value , matchTags = False ) : <EOL> raise error . PyAsn1Error ( '<STR_LIT>' % ( value , t ) ) <EOL> def getComponentByPosition ( self , idx ) : return self . _componentValues [ idx ] <EOL> def setComponentByPosition ( self , idx , value = None , verifyConstraints = True ) : <EOL> l = len ( self . _componentValues ) <EOL> if idx >= l : <EOL> self . _componentValues = self . _componentValues + ( idx - l + <NUM_LIT:1> ) * [ None ] <EOL> if value is None : <EOL> if self . _componentValues [ idx ] is None : <EOL> if self . _componentType is None : <EOL> raise error . PyAsn1Error ( '<STR_LIT>' ) <EOL> self . _componentValues [ idx ] = self . _componentType . clone ( ) <EOL> self . _componentValuesSet = self . _componentValuesSet + <NUM_LIT:1> <EOL> return self <EOL> elif not isinstance ( value , base . Asn1Item ) : <EOL> if self . _componentType is None : <EOL> raise error . PyAsn1Error ( '<STR_LIT>' ) <EOL> if isinstance ( self . _componentType , base . AbstractSimpleAsn1Item ) : <EOL> value = self . _componentType . clone ( value = value ) <EOL> else : <EOL> raise error . PyAsn1Error ( '<STR_LIT>' ) <EOL> if verifyConstraints : <EOL> if self . _componentType is not None : <EOL> self . _verifyComponent ( idx , value ) <EOL> self . _verifySubtypeSpec ( value , idx ) <EOL> if self . _componentValues [ idx ] is None : <EOL> self . _componentValuesSet = self . _componentValuesSet + <NUM_LIT:1> <EOL> self . _componentValues [ idx ] = value <EOL> return self <EOL> def getComponentTagMap ( self ) : <EOL> if self . _componentType is not None : <EOL> return self . _componentType . getTagMap ( ) <EOL> def prettyPrint ( self , scope = <NUM_LIT:0> ) : <EOL> scope = scope + <NUM_LIT:1> <EOL> r = self . __class__ . __name__ + '<STR_LIT>' <EOL> for idx in range ( len ( self . _componentValues ) ) : <EOL> r = r + '<STR_LIT:U+0020>' * scope <EOL> if self . _componentValues [ idx ] is None : <EOL> r = r + '<STR_LIT>' <EOL> else : <EOL> r = r + self . _componentValues [ idx ] . prettyPrint ( scope ) <EOL> return r <EOL> def prettyPrintType ( self , scope = <NUM_LIT:0> ) : <EOL> scope = scope + <NUM_LIT:1> <EOL> r = '<STR_LIT>' % ( self . getTagSet ( ) , self . __class__ . __name__ ) <EOL> if self . _componentType is not None : <EOL> r = r + '<STR_LIT:U+0020>' * scope <EOL> r = r + self . _componentType . prettyPrintType ( scope ) <EOL> return r + '<STR_LIT:\n>' + '<STR_LIT:U+0020>' * ( scope - <NUM_LIT:1> ) + '<STR_LIT:}>' <EOL> class SequenceOf ( SetOf ) : <EOL> tagSet = baseTagSet = tag . initTagSet ( <EOL> tag . Tag ( tag . tagClassUniversal , tag . tagFormatConstructed , <NUM_LIT> ) <EOL> ) <EOL> typeId = <NUM_LIT:2> <EOL> class SequenceAndSetBase ( base . AbstractConstructedAsn1Item ) : <EOL> componentType = namedtype . NamedTypes ( ) <EOL> strictConstraints = False <EOL> def __init__ ( self , componentType = None , tagSet = None , <EOL> subtypeSpec = None , sizeSpec = None ) : <EOL> if componentType is None : <EOL> componentType = self . componentType <EOL> base . AbstractConstructedAsn1Item . __init__ ( <EOL> self , componentType . clone ( ) , tagSet , subtypeSpec , sizeSpec <EOL> ) <EOL> self . _componentTypeLen = len ( self . _componentType ) <EOL> def __getitem__ ( self , idx ) : <EOL> if isinstance ( idx , str ) : <EOL> return self . getComponentByName ( idx ) <EOL> else : <EOL> return base . AbstractConstructedAsn1Item . __getitem__ ( self , idx ) <EOL> def __setitem__ ( self , idx , value ) : <EOL> if isinstance ( idx , str ) : <EOL> self . setComponentByName ( idx , value ) <EOL> else : <EOL> base . AbstractConstructedAsn1Item . __setitem__ ( self , idx , value ) <EOL> def _cloneComponentValues ( self , myClone , cloneValueFlag ) : <EOL> idx = <NUM_LIT:0> ; l = len ( self . _componentValues ) <EOL> while idx < l : <EOL> c = self . _componentValues [ idx ] <EOL> if c is not None : <EOL> if isinstance ( c , base . AbstractConstructedAsn1Item ) : <EOL> myClone . setComponentByPosition ( <EOL> idx , c . clone ( cloneValueFlag = cloneValueFlag ) <EOL> ) <EOL> else : <EOL> myClone . setComponentByPosition ( idx , c . clone ( ) ) <EOL> idx = idx + <NUM_LIT:1> <EOL> def _verifyComponent ( self , idx , value ) : <EOL> if idx >= self . _componentTypeLen : <EOL> raise error . PyAsn1Error ( <EOL> '<STR_LIT>' <EOL> ) <EOL> t = self . _componentType [ idx ] . getType ( ) <EOL> if not t . isSameTypeWith ( value , matchConstraints = self . strictConstraints ) : <EOL> raise error . PyAsn1Error ( '<STR_LIT>' % ( value , t ) ) <EOL> if self . strictConstraints and not t . isSuperTypeOf ( value , matchTags = False ) : <EOL> raise error . PyAsn1Error ( '<STR_LIT>' % ( value , t ) ) <EOL> def getComponentByName ( self , name ) : <EOL> return self . getComponentByPosition ( <EOL> self . _componentType . getPositionByName ( name ) <EOL> ) <EOL> def setComponentByName ( self , name , value = None , verifyConstraints = True ) : <EOL> return self . setComponentByPosition ( <EOL> self . _componentType . getPositionByName ( name ) , value , verifyConstraints <EOL> ) <EOL> def getComponentByPosition ( self , idx ) : <EOL> try : <EOL> return self . _componentValues [ idx ] <EOL> except IndexError : <EOL> if idx < self . _componentTypeLen : <EOL> return <EOL> raise <EOL> def setComponentByPosition ( self , idx , value = None , <EOL> verifyConstraints = True , <EOL> exactTypes = False , <EOL> matchTags = True , <EOL> matchConstraints = True ) : <EOL> l = len ( self . _componentValues ) <EOL> if idx >= l : <EOL> self . _componentValues = self . _componentValues + ( idx - l + <NUM_LIT:1> ) * [ None ] <EOL> if value is None : <EOL> if self . _componentValues [ idx ] is None : <EOL> self . _componentValues [ idx ] = self . _componentType . getTypeByPosition ( idx ) . clone ( ) <EOL> self . _componentValuesSet = self . _componentValuesSet + <NUM_LIT:1> <EOL> return self <EOL> elif not isinstance ( value , base . Asn1Item ) : <EOL> t = self . _componentType . getTypeByPosition ( idx ) <EOL> if isinstance ( t , base . AbstractSimpleAsn1Item ) : <EOL> value = t . clone ( value = value ) <EOL> else : <EOL> raise error . PyAsn1Error ( '<STR_LIT>' ) <EOL> if verifyConstraints : <EOL> if self . _componentTypeLen : <EOL> self . _verifyComponent ( idx , value ) <EOL> self . _verifySubtypeSpec ( value , idx ) <EOL> if self . _componentValues [ idx ] is None : <EOL> self . _componentValuesSet = self . _componentValuesSet + <NUM_LIT:1> <EOL> self . _componentValues [ idx ] = value <EOL> return self <EOL> def getNameByPosition ( self , idx ) : <EOL> if self . _componentTypeLen : <EOL> return self . _componentType . getNameByPosition ( idx ) <EOL> def getDefaultComponentByPosition ( self , idx ) : <EOL> if self . _componentTypeLen and self . _componentType [ idx ] . isDefaulted : <EOL> return self . _componentType [ idx ] . getType ( ) <EOL> def getComponentType ( self ) : <EOL> if self . _componentTypeLen : <EOL> return self . _componentType <EOL> def setDefaultComponents ( self ) : <EOL> if self . _componentTypeLen == self . _componentValuesSet : <EOL> return <EOL> idx = self . _componentTypeLen <EOL> while idx : <EOL> idx = idx - <NUM_LIT:1> <EOL> if self . _componentType [ idx ] . isDefaulted : <EOL> if self . getComponentByPosition ( idx ) is None : <EOL> self . setComponentByPosition ( idx ) <EOL> elif not self . _componentType [ idx ] . isOptional : <EOL> if self . getComponentByPosition ( idx ) is None : <EOL> raise error . PyAsn1Error ( <EOL> '<STR_LIT>' % ( idx , self ) <EOL> ) <EOL> def prettyPrint ( self , scope = <NUM_LIT:0> ) : <EOL> scope = scope + <NUM_LIT:1> <EOL> r = self . __class__ . __name__ + '<STR_LIT>' <EOL> for idx in range ( len ( self . _componentValues ) ) : <EOL> if self . _componentValues [ idx ] is not None : <EOL> r = r + '<STR_LIT:U+0020>' * scope <EOL> componentType = self . getComponentType ( ) <EOL> if componentType is None : <EOL> r = r + '<STR_LIT>' <EOL> else : <EOL> r = r + componentType . getNameByPosition ( idx ) <EOL> r = '<STR_LIT>' % ( <EOL> r , self . _componentValues [ idx ] . prettyPrint ( scope ) <EOL> ) <EOL> return r <EOL> def prettyPrintType ( self , scope = <NUM_LIT:0> ) : <EOL> scope = scope + <NUM_LIT:1> <EOL> r = '<STR_LIT>' % ( self . getTagSet ( ) , self . __class__ . __name__ ) <EOL> for idx in range ( len ( self . componentType ) ) : <EOL> r = r + '<STR_LIT:U+0020>' * scope <EOL> r = r + '<STR_LIT>' % self . componentType . getNameByPosition ( idx ) <EOL> r = '<STR_LIT>' % ( <EOL> r , self . _componentType . getTypeByPosition ( idx ) . prettyPrintType ( scope ) <EOL> ) <EOL> return r + '<STR_LIT:\n>' + '<STR_LIT:U+0020>' * ( scope - <NUM_LIT:1> ) + '<STR_LIT:}>' <EOL> class Sequence ( SequenceAndSetBase ) : <EOL> tagSet = baseTagSet = tag . initTagSet ( <EOL> tag . Tag ( tag . tagClassUniversal , tag . tagFormatConstructed , <NUM_LIT> ) <EOL> ) <EOL> typeId = <NUM_LIT:3> <EOL> def getComponentTagMapNearPosition ( self , idx ) : <EOL> if self . _componentType : <EOL> return self . _componentType . getTagMapNearPosition ( idx ) <EOL> def getComponentPositionNearType ( self , tagSet , idx ) : <EOL> if self . _componentType : <EOL> return self . _componentType . getPositionNearType ( tagSet , idx ) <EOL> else : <EOL> return idx <EOL> class Set ( SequenceAndSetBase ) : <EOL> tagSet = baseTagSet = tag . initTagSet ( <EOL> tag . Tag ( tag . tagClassUniversal , tag . tagFormatConstructed , <NUM_LIT> ) <EOL> ) <EOL> typeId = <NUM_LIT:4> <EOL> def getComponent ( self , innerFlag = <NUM_LIT:0> ) : return self <EOL> def getComponentByType ( self , tagSet , innerFlag = <NUM_LIT:0> ) : <EOL> c = self . getComponentByPosition ( <EOL> self . _componentType . getPositionByType ( tagSet ) <EOL> ) <EOL> if innerFlag and isinstance ( c , Set ) : <EOL> return c . getComponent ( <NUM_LIT:1> ) <EOL> else : <EOL> return c <EOL> def setComponentByType ( self , tagSet , value = None , innerFlag = <NUM_LIT:0> , <EOL> verifyConstraints = True ) : <EOL> idx = self . _componentType . getPositionByType ( tagSet ) <EOL> t = self . _componentType . getTypeByPosition ( idx ) <EOL> if innerFlag : <EOL> if t . getTagSet ( ) : <EOL> return self . setComponentByPosition ( <EOL> idx , value , verifyConstraints <EOL> ) <EOL> else : <EOL> t = self . setComponentByPosition ( idx ) . getComponentByPosition ( idx ) <EOL> return t . setComponentByType ( <EOL> tagSet , value , innerFlag , verifyConstraints <EOL> ) <EOL> else : <EOL> return self . setComponentByPosition ( <EOL> idx , value , verifyConstraints <EOL> ) <EOL> def getComponentTagMap ( self ) : <EOL> if self . _componentType : <EOL> return self . _componentType . getTagMap ( True ) <EOL> def getComponentPositionByType ( self , tagSet ) : <EOL> if self . _componentType : <EOL> return self . _componentType . getPositionByType ( tagSet ) <EOL> class Choice ( Set ) : <EOL> tagSet = baseTagSet = tag . TagSet ( ) <EOL> sizeSpec = constraint . ConstraintsIntersection ( <EOL> constraint . ValueSizeConstraint ( <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> ) <EOL> typeId = <NUM_LIT:5> <EOL> _currentIdx = None <EOL> def __eq__ ( self , other ) : <EOL> if self . _componentValues : <EOL> return self . _componentValues [ self . _currentIdx ] == other <EOL> return NotImplemented <EOL> def __ne__ ( self , other ) : <EOL> if self . _componentValues : <EOL> return self . _componentValues [ self . _currentIdx ] != other <EOL> return NotImplemented <EOL> def __lt__ ( self , other ) : <EOL> if self . _componentValues : <EOL> return self . _componentValues [ self . _currentIdx ] < other <EOL> return NotImplemented <EOL> def __le__ ( self , other ) : <EOL> if self . _componentValues : <EOL> return self . _componentValues [ self . _currentIdx ] <= other <EOL> return NotImplemented <EOL> def __gt__ ( self , other ) : <EOL> if self . _componentValues : <EOL> return self . _componentValues [ self . _currentIdx ] > other <EOL> return NotImplemented <EOL> def __ge__ ( self , other ) : <EOL> if self . _componentValues : <EOL> return self . _componentValues [ self . _currentIdx ] >= other <EOL> return NotImplemented <EOL> if sys . version_info [ <NUM_LIT:0> ] <= <NUM_LIT:2> : <EOL> def __nonzero__ ( self ) : return bool ( self . _componentValues ) <EOL> else : <EOL> def __bool__ ( self ) : return bool ( self . _componentValues ) <EOL> def __len__ ( self ) : return self . _currentIdx is not None and <NUM_LIT:1> or <NUM_LIT:0> <EOL> def verifySizeSpec ( self ) : <EOL> if self . _currentIdx is None : <EOL> raise error . PyAsn1Error ( '<STR_LIT>' ) <EOL> else : <EOL> self . _sizeSpec ( '<STR_LIT:U+0020>' ) <EOL> def _cloneComponentValues ( self , myClone , cloneValueFlag ) : <EOL> try : <EOL> c = self . getComponent ( ) <EOL> except error . PyAsn1Error : <EOL> pass <EOL> else : <EOL> if isinstance ( c , Choice ) : <EOL> tagSet = c . getEffectiveTagSet ( ) <EOL> else : <EOL> tagSet = c . getTagSet ( ) <EOL> if isinstance ( c , base . AbstractConstructedAsn1Item ) : <EOL> myClone . setComponentByType ( <EOL> tagSet , c . clone ( cloneValueFlag = cloneValueFlag ) <EOL> ) <EOL> else : <EOL> myClone . setComponentByType ( tagSet , c . clone ( ) ) <EOL> def setComponentByPosition ( self , idx , value = None , verifyConstraints = True ) : <EOL> l = len ( self . _componentValues ) <EOL> if idx >= l : <EOL> self . _componentValues = self . _componentValues + ( idx - l + <NUM_LIT:1> ) * [ None ] <EOL> if self . _currentIdx is not None : <EOL> self . _componentValues [ self . _currentIdx ] = None <EOL> if value is None : <EOL> if self . _componentValues [ idx ] is None : <EOL> self . _componentValues [ idx ] = self . _componentType . getTypeByPosition ( idx ) . clone ( ) <EOL> self . _componentValuesSet = <NUM_LIT:1> <EOL> self . _currentIdx = idx <EOL> return self <EOL> elif not isinstance ( value , base . Asn1Item ) : <EOL> value = self . _componentType . getTypeByPosition ( idx ) . clone ( <EOL> value = value <EOL> ) <EOL> if verifyConstraints : <EOL> if self . _componentTypeLen : <EOL> self . _verifyComponent ( idx , value ) <EOL> self . _verifySubtypeSpec ( value , idx ) <EOL> self . _componentValues [ idx ] = value <EOL> self . _currentIdx = idx <EOL> self . _componentValuesSet = <NUM_LIT:1> <EOL> return self <EOL> def getMinTagSet ( self ) : <EOL> if self . _tagSet : <EOL> return self . _tagSet <EOL> else : <EOL> return self . _componentType . genMinTagSet ( ) <EOL> def getEffectiveTagSet ( self ) : <EOL> if self . _tagSet : <EOL> return self . _tagSet <EOL> else : <EOL> c = self . getComponent ( ) <EOL> if isinstance ( c , Choice ) : <EOL> return c . getEffectiveTagSet ( ) <EOL> else : <EOL> return c . getTagSet ( ) <EOL> def getTagMap ( self ) : <EOL> if self . _tagSet : <EOL> return Set . getTagMap ( self ) <EOL> else : <EOL> return Set . getComponentTagMap ( self ) <EOL> def getComponent ( self , innerFlag = <NUM_LIT:0> ) : <EOL> if self . _currentIdx is None : <EOL> raise error . PyAsn1Error ( '<STR_LIT>' ) <EOL> else : <EOL> c = self . _componentValues [ self . _currentIdx ] <EOL> if innerFlag and isinstance ( c , Choice ) : <EOL> return c . getComponent ( innerFlag ) <EOL> else : <EOL> return c <EOL> def getName ( self , innerFlag = <NUM_LIT:0> ) : <EOL> if self . _currentIdx is None : <EOL> raise error . PyAsn1Error ( '<STR_LIT>' ) <EOL> else : <EOL> if innerFlag : <EOL> c = self . _componentValues [ self . _currentIdx ] <EOL> if isinstance ( c , Choice ) : <EOL> return c . getName ( innerFlag ) <EOL> return self . _componentType . getNameByPosition ( self . _currentIdx ) <EOL> def setDefaultComponents ( self ) : pass <EOL> class Any ( OctetString ) : <EOL> tagSet = baseTagSet = tag . TagSet ( ) <EOL> typeId = <NUM_LIT:6> <EOL> def getTagMap ( self ) : <EOL> return tagmap . TagMap ( <EOL> { self . getTagSet ( ) : self } , <EOL> { eoo . endOfOctets . getTagSet ( ) : eoo . endOfOctets } , <EOL> self <EOL> ) </s>
