Skip to content

Commit

Permalink
imports pep8'ed and optimized
Browse files Browse the repository at this point in the history
  • Loading branch information
etingof committed Nov 23, 2017
1 parent bb8afab commit 5662c43
Show file tree
Hide file tree
Showing 48 changed files with 239 additions and 73 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ python:
install:
- pip install codecov
- pip install -r requirements.txt
- pip install --no-deps .
- pip install -e .
script:
- PYTHONPATH=.:$PYTHONPATH python tests/__main__.py
after_success:
Expand Down
3 changes: 2 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

Revision 0.2.1, released 21-11-2017
Revision 0.2.1, released 23-11-2017
-----------------------------------

- Allow ANY DEFINED BY objects expanding automatically if requested
- Imports PEP8'ed

Revision 0.1.5, released 10-10-2017
-----------------------------------
Expand Down
5 changes: 4 additions & 1 deletion pyasn1_modules/rfc1155.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
# Sample captures from:
# http://wiki.wireshark.org/SampleCaptures/
#
from pyasn1.type import univ, namedtype, tag, constraint
from pyasn1.type import constraint
from pyasn1.type import namedtype
from pyasn1.type import tag
from pyasn1.type import univ


class ObjectName(univ.ObjectIdentifier):
Expand Down
6 changes: 5 additions & 1 deletion pyasn1_modules/rfc1157.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
# Sample captures from:
# http://wiki.wireshark.org/SampleCaptures/
#
from pyasn1.type import univ, namedtype, namedval, tag
from pyasn1.type import namedtype
from pyasn1.type import namedval
from pyasn1.type import tag
from pyasn1.type import univ

from pyasn1_modules import rfc1155


Expand Down
4 changes: 3 additions & 1 deletion pyasn1_modules/rfc1901.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
# ASN.1 source from:
# http://www.ietf.org/rfc/rfc1901.txt
#
from pyasn1.type import univ, namedtype, namedval
from pyasn1.type import namedtype
from pyasn1.type import namedval
from pyasn1.type import univ


class Message(univ.Sequence):
Expand Down
5 changes: 4 additions & 1 deletion pyasn1_modules/rfc1902.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
# ASN.1 source from:
# http://www.ietf.org/rfc/rfc1902.txt
#
from pyasn1.type import univ, namedtype, tag, constraint
from pyasn1.type import constraint
from pyasn1.type import namedtype
from pyasn1.type import tag
from pyasn1.type import univ


class Integer(univ.Integer):
Expand Down
7 changes: 6 additions & 1 deletion pyasn1_modules/rfc1905.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
# ASN.1 source from:
# http://www.ietf.org/rfc/rfc1905.txt
#
from pyasn1.type import univ, namedtype, namedval, tag, constraint
from pyasn1.type import constraint
from pyasn1.type import namedtype
from pyasn1.type import namedval
from pyasn1.type import tag
from pyasn1.type import univ

from pyasn1_modules import rfc1902

max_bindings = rfc1902.Integer(2147483647)
Expand Down
6 changes: 5 additions & 1 deletion pyasn1_modules/rfc2251.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
# Sample captures from:
# http://wiki.wireshark.org/SampleCaptures/
#
from pyasn1.type import tag, namedtype, namedval, univ, constraint
from pyasn1.type import constraint
from pyasn1.type import namedtype
from pyasn1.type import namedval
from pyasn1.type import tag
from pyasn1.type import univ

maxInt = univ.Integer(2147483647)

Expand Down
5 changes: 4 additions & 1 deletion pyasn1_modules/rfc2437.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
#
# Sample captures could be obtained with "openssl genrsa" command
#
from pyasn1.type import tag, namedtype, univ
from pyasn1.type import namedtype
from pyasn1.type import tag
from pyasn1.type import univ

from pyasn1_modules.rfc2459 import AlgorithmIdentifier

pkcs_1 = univ.ObjectIdentifier('1.2.840.113549.1.1')
Expand Down
9 changes: 8 additions & 1 deletion pyasn1_modules/rfc2459.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@
# Sample captures from:
# http://wiki.wireshark.org/SampleCaptures/
#
from pyasn1.type import tag, namedtype, namedval, opentype, univ, constraint, char, useful
from pyasn1.type import char
from pyasn1.type import constraint
from pyasn1.type import namedtype
from pyasn1.type import namedval
from pyasn1.type import opentype
from pyasn1.type import tag
from pyasn1.type import univ
from pyasn1.type import useful

MAX = float('inf')

Expand Down
2 changes: 1 addition & 1 deletion pyasn1_modules/rfc2511.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#
# Sample captures could be obtained with OpenSSL
#
from pyasn1_modules.rfc2459 import *
from pyasn1_modules import rfc2315
from pyasn1_modules.rfc2459 import *

MAX = float('inf')

Expand Down
7 changes: 6 additions & 1 deletion pyasn1_modules/rfc2560.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
# * dates are left as strings in GeneralizedTime format -- datetime.datetime
# would be nicer
#
from pyasn1.type import tag, namedtype, namedval, univ, useful
from pyasn1.type import namedtype
from pyasn1.type import namedval
from pyasn1.type import tag
from pyasn1.type import univ
from pyasn1.type import useful

from pyasn1_modules import rfc2459


Expand Down
4 changes: 3 additions & 1 deletion pyasn1_modules/rfc3279.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
#
# Derived from RFC 3279
#
from pyasn1.type import univ, char, namedtype, namedval, tag, constraint, useful
from pyasn1.type import namedtype
from pyasn1.type import namedval
from pyasn1.type import univ


def _OID(*components):
Expand Down
8 changes: 7 additions & 1 deletion pyasn1_modules/rfc3280.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
# ASN.1 source from:
# http://www.ietf.org/rfc/rfc3280.txt
#
from pyasn1.type import univ, char, namedtype, namedval, tag, constraint, useful
from pyasn1.type import char
from pyasn1.type import constraint
from pyasn1.type import namedtype
from pyasn1.type import namedval
from pyasn1.type import tag
from pyasn1.type import univ
from pyasn1.type import useful

MAX = float('inf')

Expand Down
4 changes: 2 additions & 2 deletions pyasn1_modules/rfc3281.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
# ASN.1 source from:
# http://www.ietf.org/rfc/rfc3281.txt
#
from pyasn1.type import univ
from pyasn1.type import char
from pyasn1.type import constraint
from pyasn1.type import namedtype
from pyasn1.type import namedval
from pyasn1.type import tag
from pyasn1.type import constraint
from pyasn1.type import univ
from pyasn1.type import useful

from pyasn1_modules import rfc3280
Expand Down
5 changes: 4 additions & 1 deletion pyasn1_modules/rfc3412.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
# ASN.1 source from:
# http://www.ietf.org/rfc/rfc3412.txt
#
from pyasn1.type import univ, namedtype, constraint
from pyasn1.type import constraint
from pyasn1.type import namedtype
from pyasn1.type import univ

from pyasn1_modules import rfc1905


Expand Down
4 changes: 3 additions & 1 deletion pyasn1_modules/rfc3414.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
# ASN.1 source from:
# http://www.ietf.org/rfc/rfc3414.txt
#
from pyasn1.type import univ, namedtype, constraint
from pyasn1.type import constraint
from pyasn1.type import namedtype
from pyasn1.type import univ


class UsmSecurityParameters(univ.Sequence):
Expand Down
4 changes: 3 additions & 1 deletion pyasn1_modules/rfc3447.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
#
# Sample captures could be obtained with "openssl genrsa" command
#
from pyasn1.type import constraint, namedval
from pyasn1.type import constraint
from pyasn1.type import namedval

from pyasn1_modules.rfc2437 import *


Expand Down
7 changes: 6 additions & 1 deletion pyasn1_modules/rfc3852.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
# ASN.1 source from:
# http://www.ietf.org/rfc/rfc3852.txt
#
from pyasn1.type import univ, namedtype, namedval, tag, constraint, useful
from pyasn1.type import constraint
from pyasn1.type import namedtype
from pyasn1.type import namedval
from pyasn1.type import tag
from pyasn1.type import univ
from pyasn1.type import useful

from pyasn1_modules import rfc3280
from pyasn1_modules import rfc3281
Expand Down
13 changes: 11 additions & 2 deletions pyasn1_modules/rfc4210.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,17 @@
#
# Based on Alex Railean's work
#
from pyasn1.type import tag, namedtype, namedval, univ, constraint, char, useful
from pyasn1_modules import rfc2459, rfc2511, rfc2314
from pyasn1.type import char
from pyasn1.type import constraint
from pyasn1.type import namedtype
from pyasn1.type import namedval
from pyasn1.type import tag
from pyasn1.type import univ
from pyasn1.type import useful

from pyasn1_modules import rfc2314
from pyasn1_modules import rfc2459
from pyasn1_modules import rfc2511

MAX = float('inf')

Expand Down
7 changes: 6 additions & 1 deletion pyasn1_modules/rfc4211.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
# ASN.1 source from:
# http://www.ietf.org/rfc/rfc4211.txt
#
from pyasn1.type import univ, char, namedtype, namedval, tag, constraint
from pyasn1.type import char
from pyasn1.type import constraint
from pyasn1.type import namedtype
from pyasn1.type import namedval
from pyasn1.type import tag
from pyasn1.type import univ

from pyasn1_modules import rfc3280
from pyasn1_modules import rfc3852
Expand Down
2 changes: 1 addition & 1 deletion pyasn1_modules/rfc5208.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#
# Sample captures could be obtained with "openssl pkcs8 -topk8" command
#
from pyasn1_modules.rfc2459 import *
from pyasn1_modules import rfc2251
from pyasn1_modules.rfc2459 import *


class KeyEncryptionAlgorithms(AlgorithmIdentifier):
Expand Down
5 changes: 3 additions & 2 deletions pyasn1_modules/rfc5280.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@
# ASN.1 source from:
# http://www.ietf.org/rfc/rfc5280.txt
#
from pyasn1.type import univ
from pyasn1.type import char
from pyasn1.type import constraint
from pyasn1.type import namedtype
from pyasn1.type import namedval
from pyasn1.type import opentype
from pyasn1.type import tag
from pyasn1.type import constraint
from pyasn1.type import univ
from pyasn1.type import useful

MAX = float('inf')


def _buildOid(*components):
output = []
for x in tuple(components):
Expand Down
8 changes: 7 additions & 1 deletion pyasn1_modules/rfc6402.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@
# ASN.1 source from:
# http://www.ietf.org/rfc/rfc6402.txt
#
from pyasn1.type import univ, char, namedtype, namedval, tag, constraint, useful
from pyasn1.type import char
from pyasn1.type import constraint
from pyasn1.type import namedtype
from pyasn1.type import namedval
from pyasn1.type import tag
from pyasn1.type import univ
from pyasn1.type import useful

from pyasn1_modules import rfc4211
from pyasn1_modules import rfc5280
Expand Down
5 changes: 4 additions & 1 deletion tests/test_rfc2314.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
# License: http://pyasn1.sf.net/license.html
#
import sys

from pyasn1.codec.der import decoder as der_decoder
from pyasn1.codec.der import encoder as der_encoder

from pyasn1_modules import rfc2314, pem
from pyasn1_modules import pem
from pyasn1_modules import rfc2314

try:
import unittest2 as unittest

except ImportError:
import unittest

Expand Down
5 changes: 4 additions & 1 deletion tests/test_rfc2315.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
# License: http://pyasn1.sf.net/license.html
#
import sys

from pyasn1.codec.der import decoder as der_decoder
from pyasn1.codec.der import encoder as der_encoder

from pyasn1_modules import rfc2315, pem
from pyasn1_modules import pem
from pyasn1_modules import rfc2315

try:
import unittest2 as unittest

except ImportError:
import unittest

Expand Down
5 changes: 4 additions & 1 deletion tests/test_rfc2437.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
# License: http://pyasn1.sf.net/license.html
#
import sys

from pyasn1.codec.der import decoder as der_decoder
from pyasn1.codec.der import encoder as der_encoder

from pyasn1_modules import rfc2437, pem
from pyasn1_modules import pem
from pyasn1_modules import rfc2437

try:
import unittest2 as unittest

except ImportError:
import unittest

Expand Down
5 changes: 4 additions & 1 deletion tests/test_rfc2459.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
# License: http://pyasn1.sf.net/license.html
#
import sys

from pyasn1.codec.der import decoder as der_decoder
from pyasn1.codec.der import encoder as der_encoder

from pyasn1_modules import rfc2459, pem
from pyasn1_modules import pem
from pyasn1_modules import rfc2459

try:
import unittest2 as unittest

except ImportError:
import unittest

Expand Down
Loading

0 comments on commit 5662c43

Please sign in to comment.