Skip to content

Commit c26053a

Browse files
committed
Use "true" enums instead of classes. Use enun34 backport for old Python versions.
1 parent c95729f commit c26053a

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
future==0.16.0
2+
enum34==1.1.6
3+

src/asn1.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@
2222
from builtins import int
2323
from builtins import range
2424
from builtins import str
25+
from enum import IntEnum
2526

2627
__version__ = "2.1.1"
2728

2829

29-
class Numbers(object):
30+
class Numbers(IntEnum):
3031
Boolean = 0x01
3132
Integer = 0x02
3233
BitString = 0x03
@@ -43,12 +44,12 @@ class Numbers(object):
4344
UnicodeString = 0x1e
4445

4546

46-
class Types(object):
47+
class Types(IntEnum):
4748
Constructed = 0x20
4849
Primitive = 0x00
4950

5051

51-
class Classes(object):
52+
class Classes(IntEnum):
5253
Universal = 0x00
5354
Application = 0x40
5455
Context = 0x80

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ deps =
2929
pytest-cov
3030
nose
3131
future
32+
enum34
3233
commands =
3334
{posargs:py.test --cov --cov-report=term-missing -vv tests}
3435

0 commit comments

Comments
 (0)