Skip to content

Commit

Permalink
Added and revised annotations.
Browse files Browse the repository at this point in the history
lextm committed Feb 13, 2024
1 parent 11bda09 commit 4c30869
Showing 8 changed files with 1,152 additions and 574 deletions.
12 changes: 6 additions & 6 deletions pysnmp/entity/engine.py
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
import shutil
import sys
import tempfile
from typing import Tuple
from typing import Any, Dict, Tuple
from pyasn1.compat.octets import str2octs
from pysnmp.carrier.base import AbstractTransportAddress, AbstractTransportDispatcher
from pysnmp.proto.rfc3412 import MsgAndPduDispatcher
@@ -58,7 +58,7 @@ class SnmpEngine:
"""

transportDispatcher: AbstractTransportDispatcher
transportDispatcher: AbstractTransportDispatcher | None

def __init__(
self, snmpEngineID=None, maxMessageSize: int = 65507, msgAndPduDsp=None
@@ -92,21 +92,21 @@ def __init__(
raise error.PySnmpError("MIB instrumentation does not yet exist")
(
snmpEngineMaxMessageSize,
) = self.msgAndPduDsp.mibInstrumController.mibBuilder.importSymbols(
) = self.msgAndPduDsp.mibInstrumController.mibBuilder.importSymbols( # type: ignore
"__SNMP-FRAMEWORK-MIB", "snmpEngineMaxMessageSize"
)
snmpEngineMaxMessageSize.syntax = snmpEngineMaxMessageSize.syntax.clone(
maxMessageSize
)
(
snmpEngineBoots,
) = self.msgAndPduDsp.mibInstrumController.mibBuilder.importSymbols(
) = self.msgAndPduDsp.mibInstrumController.mibBuilder.importSymbols( # type: ignore
"__SNMP-FRAMEWORK-MIB", "snmpEngineBoots"
)
snmpEngineBoots.syntax += 1
(
origSnmpEngineID,
) = self.msgAndPduDsp.mibInstrumController.mibBuilder.importSymbols(
) = self.msgAndPduDsp.mibInstrumController.mibBuilder.importSymbols( # type: ignore
"__SNMP-FRAMEWORK-MIB", "snmpEngineID"
)

@@ -215,7 +215,7 @@ def getMibBuilder(self):
def setUserContext(self, **kwargs):
self.cache.update({"__%s" % k: kwargs[k] for k in kwargs})

def getUserContext(self, arg):
def getUserContext(self, arg) -> Dict[str, Any] | None: # TODO: fix this type check
return self.cache.get("__%s" % arg)

def delUserContext(self, arg):
Loading

0 comments on commit 4c30869

Please sign in to comment.