From c9c775a26c401841332bb56740e6fc8a8d819090 Mon Sep 17 00:00:00 2001 From: Lex Li Date: Wed, 6 Nov 2024 13:43:26 -0500 Subject: [PATCH] Reverted some name changes. --- pysnmp/proto/rfc1902.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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