# Path: puresnmp/const.py
# DEFAULT_TIMEOUT = 6
# 
# class Version:
#     """
#     The SNMP Version identifier. This is used in the SNMP :term:`PDU`.
#     """
# 
#     V2C = 0x01
#     V1 = 0x00
# 
# Path: puresnmp/pdu.py
# class Trap(PDU):
#     """
#     Represents an SNMP Trap
#     """
# 
#     TAG = 7
# 
#     def __init__(self, *args, **kwargs):
#         # type: (Any, Any) -> None
#         super().__init__(*args, **kwargs)
#         self.source = None  # type: Optional[SocketInfo]
# 
# Path: puresnmp/snmp.py
# class VarBind:
#     """
#     A "VarBind" is a 2-tuple containing an object-identifier and the
#     corresponding value.
#     """
# 
#     # TODO: This class should be split in two for both the raw and pythonic
#     #       API, that would simplify the typing of both "oid" and "value"a lot
#     #       and keep things explicit
#     oid: ObjectIdentifier = ObjectIdentifier(0)
#     value: Union[PyType, Type, None] = None
# 
#     def __init__(self, oid, value):
#         # type: (Union[ObjectIdentifier, str], PyType) -> None
#         if not isinstance(oid, (ObjectIdentifier, str)):
#             raise TypeError(
#                 "OIDs for VarBinds must be ObjectIdentifier or str"
#                 " instances! Your value: %r" % oid
#             )
#         if isinstance(oid, str):
#             oid = ObjectIdentifier.from_string(oid)
#         self.oid = oid
#         self.value = value
# 
#     def __iter__(self) -> Iterator[Union[ObjectIdentifier, PyType]]:
#         return iter([self.oid, self.value])
# 
#     def __getitem__(self, idx: int) -> Union[PyType, Type, None]:
#         return list(self)[idx]
# 
#     def __lt__(self, other):
#         # type: (Any) -> bool
#         return (self.oid, self.value) < (other.oid, other.value)
# 
#     def __eq__(self, other):
#         # type: (Any) -> bool
#         return (self.oid, self.value) == (other.oid, other.value)
# 
#     def __hash__(self):
#         # type: () -> int
#         return hash((self.oid, self.value))
# 
#     def __repr__(self):
#         # type: () -> str
#         return "VarBind(%r, %r)" % (self.oid, self.value)
# 
# Path: puresnmp/util.py
# class BulkResult:
#     """
#     A representation for results of a "bulk" request.
# 
#     These requests get both "non-repeating values" (scalars) and "repeating
#     values" (lists). This wrapper makes these terms a bit friendlier to use.
#     """
# 
#     scalars: Dict[str, Any]
#     listing: Dict[str, Any]


import logging
from collections import OrderedDict
from datetime import timedelta
from typing import TYPE_CHECKING, Generator, List, TypeVar
from warnings import warn
from x690.types import ObjectIdentifier, Type  # type: ignore
from ..const import DEFAULT_TIMEOUT, Version
from ..pdu import Trap
from ..snmp import VarBind
from ..util import BulkResult
from . import raw
    from typing import Any, Callable, Dict, Tuple, Union
    from puresnmp.typevars import PyType

if TYPE_CHECKING:  # pragma: no cover
    # pylint: disable=unused-import, invalid-name, ungrouped-imports


    T = TypeVar("T", bound=PyType)

_set = set
LOG = logging.getLogger(__name__)
OID = ObjectIdentifier.from_string
TWalkResponse = Generator[VarBind, None, None]


class TrapInfo:
    """
    This class wraps a :py:class:`puresnmp.pdu.Trap` instance (accessible via
    ``raw_trap`` and makes values available as "pythonic" values.
    """

    #: The raw Trap PDU.
    #:
    #: .. warning::
    #:     This will leak data-types which are used internally by ``puresnmp``
    #:     and may change even in minor updates. You should, if possible use
    #:     the values from the properties on this object.  This exist mainly to
    #:     expose values which can be helpful in debugging.  If something is
    #:     missing from the properties, please open a corresponding support
    #:     ticket!
    raw_trap: Trap


# Path: puresnmp/const.py
# DEFAULT_TIMEOUT = 6
# 
# class Version:
#     """
#     The SNMP Version identifier. This is used in the SNMP :term:`PDU`.
#     """
# 
#     V2C = 0x01
#     V1 = 0x00
# 
# Path: puresnmp/pdu.py
# class Trap(PDU):
#     """
#     Represents an SNMP Trap
#     """
# 
#     TAG = 7
# 
#     def __init__(self, *args, **kwargs):
#         # type: (Any, Any) -> None
#         super().__init__(*args, **kwargs)
#         self.source = None  # type: Optional[SocketInfo]
# 
# Path: puresnmp/snmp.py
# class VarBind:
#     """
#     A "VarBind" is a 2-tuple containing an object-identifier and the
#     corresponding value.
#     """
# 
#     # TODO: This class should be split in two for both the raw and pythonic
#     #       API, that would simplify the typing of both "oid" and "value"a lot
#     #       and keep things explicit
#     oid: ObjectIdentifier = ObjectIdentifier(0)
#     value: Union[PyType, Type, None] = None
# 
#     def __init__(self, oid, value):
#         # type: (Union[ObjectIdentifier, str], PyType) -> None
#         if not isinstance(oid, (ObjectIdentifier, str)):
#             raise TypeError(
#                 "OIDs for VarBinds must be ObjectIdentifier or str"
#                 " instances! Your value: %r" % oid
#             )
#         if isinstance(oid, str):
#             oid = ObjectIdentifier.from_string(oid)
#         self.oid = oid
#         self.value = value
# 
#     def __iter__(self) -> Iterator[Union[ObjectIdentifier, PyType]]:
#         return iter([self.oid, self.value])
# 
#     def __getitem__(self, idx: int) -> Union[PyType, Type, None]:
#         return list(self)[idx]
# 
#     def __lt__(self, other):
#         # type: (Any) -> bool
#         return (self.oid, self.value) < (other.oid, other.value)
# 
#     def __eq__(self, other):
#         # type: (Any) -> bool
#         return (self.oid, self.value) == (other.oid, other.value)
# 
#     def __hash__(self):
#         # type: () -> int
#         return hash((self.oid, self.value))
# 
#     def __repr__(self):
#         # type: () -> str
#         return "VarBind(%r, %r)" % (self.oid, self.value)
# 
# Path: puresnmp/util.py
# class BulkResult:
#     """
#     A representation for results of a "bulk" request.
# 
#     These requests get both "non-repeating values" (scalars) and "repeating
#     values" (lists). This wrapper makes these terms a bit friendlier to use.
#     """
# 
#     scalars: Dict[str, Any]
#     listing: Dict[str, Any]


# Path: puresnmp/api/pythonic.py
import logging
from collections import OrderedDict
from datetime import timedelta
from typing import TYPE_CHECKING, Generator, List, TypeVar
from warnings import warn
from x690.types import ObjectIdentifier, Type  # type: ignore
from ..const import DEFAULT_TIMEOUT, Version
from ..pdu import Trap
from ..snmp import VarBind
from ..util import BulkResult
from . import raw
    from typing import Any, Callable, Dict, Tuple, Union
    from puresnmp.typevars import PyType


if TYPE_CHECKING:  # pragma: no cover
    # pylint: disable=unused-import, invalid-name, ungrouped-imports


    T = TypeVar("T", bound=PyType)

_set = set
LOG = logging.getLogger(__name__)
OID = ObjectIdentifier.from_string
TWalkResponse = Generator[VarBind, None, None]


class TrapInfo:
    """
    This class wraps a :py:class:`puresnmp.pdu.Trap` instance (accessible via
    ``raw_trap`` and makes values available as "pythonic" values.
    """

    #: The raw Trap PDU.
    #:
    #: .. warning::
    #:     This will leak data-types which are used internally by ``puresnmp``
    #:     and may change even in minor updates. You should, if possible use
    #:     the values from the properties on this object.  This exist mainly to
    #:     expose values which can be helpful in debugging.  If something is
    #:     missing from the properties, please open a corresponding support
    #:     ticket!
    raw_trap: Trap


    def __init__(self, raw_trap: Trap) -> None: