aboutsummaryrefslogtreecommitdiff
path: root/pyasn1/type/opentype.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyasn1/type/opentype.py')
-rw-r--r--pyasn1/type/opentype.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/pyasn1/type/opentype.py b/pyasn1/type/opentype.py
index c8f0e64..4e093d6 100644
--- a/pyasn1/type/opentype.py
+++ b/pyasn1/type/opentype.py
@@ -14,7 +14,8 @@ class OpenType(object):
The *DefinedBy* object models the ASN.1 *DEFINED BY* clause which maps
values to ASN.1 types in the context of the ASN.1 SEQUENCE/SET type.
- DefinedBy objects are immutable and duck-type Python :class:`dict` objects
+ OpenType objects are duck-type a read-only Python :class:`dict` objects,
+ however the passed `typeMap` is stored by reference.
Parameters
----------
@@ -24,6 +25,23 @@ class OpenType(object):
typeMap: :py:class:`dict`:
A map of value->ASN.1 type. It's stored by reference and can be
mutated later to register new mappings.
+
+ Examples
+ --------
+
+ .. code-block::
+
+ openType = OpenType(
+ 'id',
+ {1: Integer(),
+ 2: OctetString()}
+ )
+ Sequence(
+ componentType=NamedTypes(
+ NamedType('id', Integer()),
+ NamedType('blob', Any(), openType=openType)
+ )
+ )
"""
def __init__(self, name, typeMap=None):