diff --git a/pysnmp/proto/rfc1902.py b/pysnmp/proto/rfc1902.py index 4f0ffc8a..0ca62ba0 100644 --- a/pysnmp/proto/rfc1902.py +++ b/pysnmp/proto/rfc1902.py @@ -177,7 +177,7 @@ def with_named_values(cls, **values): enums.update(values.items()) class X(cls): - named_values = namedval.NamedValues(*enums) + namedValues = namedval.NamedValues(*enums) subtypeSpec = cls.subtypeSpec + constraint.SingleValueConstraint( *values.values() ) # noqa: N815 @@ -683,7 +683,7 @@ class Bits(OctetString): """ - named_values = namedval.NamedValues() + namedValues: namedval.NamedValues = namedval.NamedValues() def __new__(cls, *args, **kwargs): """Create a new instance of the class.""" @@ -699,7 +699,7 @@ def prettyIn(self, bits): # noqa: N802 return OctetString.prettyIn(self, bits) # raw bitstring octets = [] for bit in bits: # tuple of named bits - v = self.named_values.getValue(bit) + v = self.namedValues.getValue(bit) if v is None: raise error.ProtocolError("Unknown named bit %s" % bit) d, m = divmod(v, 8) @@ -717,7 +717,7 @@ def prettyOut(self, value): # noqa: N802 j = 7 while j >= 0: if v & (0x01 << j): - name = self.named_values.getName(i * 8 + 7 - j) + name = self.namedValues.getName(i * 8 + 7 - j) if name is None: name = f"UnknownBit-{i * 8 + 7 - j}" names.append(name) @@ -730,11 +730,11 @@ def with_named_bits(cls, **values): Reduce fully duplicate enumerations along the way. """ - enums = set(cls.named_values.items()) + enums = set(cls.namedValues.items()) enums.update(values.items()) class X(cls): - named_values = namedval.NamedValues(*enums) + namedValues = namedval.NamedValues(*enums) X.__name__ = cls.__name__ return X