Skip to content

Commit

Permalink
Reverted some name changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
lextm committed Nov 6, 2024
1 parent df8a1a4 commit c9c775a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pysnmp/proto/rfc1902.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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."""
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit c9c775a

Please sign in to comment.