diff options
author | Ilya Etingof <etingof@gmail.com> | 2017-07-23 13:32:20 +0200 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2017-07-23 13:32:20 +0200 |
commit | 3e7f2e6e1090b24a7666259302bc5bc48561011d (patch) | |
tree | f2eea8928258af69f4f3cc1720ad18ffb4fe7116 /pysnmp/proto/rfc1902.py | |
parent | 311c004d52aa6407ee767f6ec44d11bca7849ebd (diff) | |
download | pysnmp-git-3e7f2e6e1090b24a7666259302bc5bc48561011d.tar.gz |
better pyasn1 types specialization
Diffstat (limited to 'pysnmp/proto/rfc1902.py')
-rw-r--r-- | pysnmp/proto/rfc1902.py | 52 |
1 files changed, 4 insertions, 48 deletions
diff --git a/pysnmp/proto/rfc1902.py b/pysnmp/proto/rfc1902.py index d3d98d22..75ecda9f 100644 --- a/pysnmp/proto/rfc1902.py +++ b/pysnmp/proto/rfc1902.py @@ -611,16 +611,10 @@ class Bits(OctetString): """ namedValues = namedval.NamedValues() - def __init__(self, value=univ.noValue, tagSet=None, subtypeSpec=None, - encoding=None, binValue=univ.noValue, hexValue=univ.noValue, - namedValues=None): - if namedValues is None: - self.__namedValues = self.namedValues - else: - self.__namedValues = namedValues - OctetString.__init__( - self, value, tagSet, subtypeSpec, encoding, binValue, hexValue - ) + def __init__(self, *args, **kwargs): + if 'namedValues' not in kwargs: + kwargs['namedValues'] = self.namedValues + OctetString.__init__(self, *args, **kwargs) def prettyIn(self, bits): if not isinstance(bits, (tuple, list)): @@ -655,44 +649,6 @@ class Bits(OctetString): i += 1 return ', '.join([str(x) for x in names]) - def clone(self, value=univ.noValue, tagSet=None, subtypeSpec=None, - encoding=None, binValue=univ.noValue, hexValue=univ.noValue, - namedValues=None): - if value is None and tagSet is None and subtypeSpec is None \ - and namedValues is None: - return self - if value is None: - value = self._value - if tagSet is None: - tagSet = self._tagSet - if subtypeSpec is None: - subtypeSpec = self._subtypeSpec - if namedValues is None: - namedValues = self.__namedValues - return self.__class__(value, tagSet, subtypeSpec, encoding, - binValue, hexValue, namedValues) - - def subtype(self, value=univ.noValue, implicitTag=None, explicitTag=None, - subtypeSpec=None, encoding=None, binValue=univ.noValue, - hexValue=univ.noValue, namedValues=None): - if value is None: - value = self._value - if implicitTag is not None: - tagSet = self._tagSet.tagImplicitly(implicitTag) - elif explicitTag is not None: - tagSet = self._tagSet.tagExplicitly(explicitTag) - else: - tagSet = self._tagSet - if subtypeSpec is None: - subtypeSpec = self._subtypeSpec - else: - subtypeSpec = subtypeSpec + self._subtypeSpec - if namedValues is None: - namedValues = self.__namedValues - else: - namedValues = namedValues + self.__namedValues - return self.__class__(value, tagSet, subtypeSpec, namedValues=namedValues) - @classmethod def withNamedBits(cls, **values): """Creates a subclass with discreet named bits constraint. |