Expose ASN.1 `Null` type through `rfc1902` module

async-managed-objects
Ilya Etingof 2018-10-26 08:44:06 +02:00
parent 4aac8b23d5
commit 9ebd0c0fab
3 changed files with 41 additions and 1 deletions

View File

@ -61,6 +61,7 @@ Revision 5.0.0, released 2018-10-??
Revision 4.4.7, released 2018-11-XX
-----------------------------------
- Exposed ASN.1 `Null` type through `rfc1902` module for convenience.
- Use `compile()` before `exec`'ing MIB modules to attach filename to
the stack frames (ultimately shown in traceback/debugger)
- Fixed hlapi/v3arch transport target caching to ensure transport targets

View File

@ -441,6 +441,20 @@ data description language. PySNMP types are derived from
.. toctree::
:maxdepth: 2
.. _null:
Null type
+++++++++
.. autoclass:: pysnmp.proto.rfc1902.Null(initializer)
:members:
.. note::
The `NULL` type actually belongs to the base ASN.1 types. It is not defined
in :RFC:`1902#section-2` as an SNMP type. The `Null` type is exposed through
`rfc1902` module just for convenience.
.. _integer32:
Integer32 type

View File

@ -10,7 +10,32 @@ from pysnmp.proto import rfc1155, error
__all__ = ['Opaque', 'TimeTicks', 'Bits', 'Integer', 'OctetString',
'IpAddress', 'Counter64', 'Unsigned32', 'Gauge32', 'Integer32',
'ObjectIdentifier', 'Counter32']
'ObjectIdentifier', 'Counter32', 'Null']
class Null(univ.Null):
"""Creates an instance of SNMP Null class.
:py:class:`~pysnmp.proto.rfc1902.Null` type represents the absence
of value.
Parameters
----------
initializer: str
Python string object. Must be an empty string.
Raises
------
PyAsn1Error :
On constraint violation or bad initializer.
Examples
--------
>>> from pysnmp.proto.rfc1902 import *
>>> Null('')
Null('')
>>>
"""
class Integer32(univ.Integer):