diff options
author | Ilya Etingof <ietingof@redhat.com> | 2017-03-10 18:22:21 +0100 |
---|---|---|
committer | Ilya Etingof <ietingof@redhat.com> | 2017-03-10 18:22:21 +0100 |
commit | d4256a8a5c1ab6827a1ad8974a6e78fa8bbb04e9 (patch) | |
tree | c2093e51c3859700e9a2c57cf320ece788310677 /pyasn1/type/base.py | |
parent | 17b7cfe20f055417a15137607f4b1f4422b1f26a (diff) | |
download | pyasn1-d4256a8a5c1ab6827a1ad8974a6e78fa8bbb04e9.tar.gz |
faster decoders lookup by setting typeId to every ASN.1 type
Diffstat (limited to 'pyasn1/type/base.py')
-rw-r--r-- | pyasn1/type/base.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/pyasn1/type/base.py b/pyasn1/type/base.py index f1d5251..e6e4cad 100644 --- a/pyasn1/type/base.py +++ b/pyasn1/type/base.py @@ -12,7 +12,13 @@ __all__ = ['Asn1Item', 'Asn1ItemBase', 'AbstractSimpleAsn1Item', 'AbstractConstr class Asn1Item(object): - pass + @classmethod + def getTypeId(cls, increment=1): + try: + Asn1Item._typeCounter += increment + except AttributeError: + Asn1Item._typeCounter = increment + return Asn1Item._typeCounter class Asn1ItemBase(Asn1Item): @@ -24,7 +30,7 @@ class Asn1ItemBase(Asn1Item): #: object imposing constraints on initialization values. subtypeSpec = constraint.ConstraintsIntersection() - # Used for ambiguous ASN.1 types identification + # Disambiguation ASN.1 types identification typeId = None def __init__(self, tagSet=None, subtypeSpec=None): |