diff --git a/ecdsa/__init__.py b/ecdsa/__init__.py index e834b3a..539ca99 100644 --- a/ecdsa/__init__.py +++ b/ecdsa/__init__.py @@ -1,7 +1,7 @@ __all__ = ["curves", "der", "ecdsa", "ellipticcurve", "keys", "numbertheory", "test_pyecdsa", "util", "six"] -from .keys import SigningKey, VerifyingKey, BadSignatureError, BadDigestError from .curves import NIST192p, NIST224p, NIST256p, NIST384p, NIST521p, SECP256k1 +from .keys import BadDigestError, BadSignatureError, SigningKey, VerifyingKey _hush_pyflakes = [SigningKey, VerifyingKey, BadSignatureError, BadDigestError, NIST192p, NIST224p, NIST256p, NIST384p, NIST521p, SECP256k1] diff --git a/ecdsa/_version.py b/ecdsa/_version.py index 3e833e6..75c9950 100644 --- a/ecdsa/_version.py +++ b/ecdsa/_version.py @@ -17,7 +17,12 @@ tag_prefix = "python-ecdsa-" parentdir_prefix = "ecdsa-" versionfile_source = "ecdsa/_version.py" -import os, sys, re, subprocess, errno +import errno +import os +import re +import subprocess +import sys + def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False): assert isinstance(commands, list) diff --git a/ecdsa/der.py b/ecdsa/der.py index b045952..ba58efc 100644 --- a/ecdsa/der.py +++ b/ecdsa/der.py @@ -1,8 +1,10 @@ from __future__ import division -import binascii import base64 -from .six import int2byte, b, integer_types, text_type +import binascii + +from .six import b, int2byte, integer_types, text_type + class UnexpectedDER(Exception): pass diff --git a/ecdsa/ecdsa.py b/ecdsa/ecdsa.py index 4eb2d39..b9cf827 100644 --- a/ecdsa/ecdsa.py +++ b/ecdsa/ecdsa.py @@ -53,11 +53,11 @@ Revision history: Written in 2005 by Peter Pearson and placed in the public domain. """ -from .six import int2byte, b, print_ -from . import ellipticcurve -from . import numbertheory import random +from . import ellipticcurve +from . import numbertheory +from .six import b, int2byte, print_ class Signature( object ): diff --git a/ecdsa/ellipticcurve.py b/ecdsa/ellipticcurve.py index 390bb35..dc9a42c 100644 --- a/ecdsa/ellipticcurve.py +++ b/ecdsa/ellipticcurve.py @@ -34,8 +34,9 @@ from __future__ import division -from .six import print_ from . import numbertheory +from .six import print_ + class CurveFp( object ): """Elliptic Curve over the field of integers modulo a prime.""" diff --git a/ecdsa/keys.py b/ecdsa/keys.py index 5b52125..032bb7f 100644 --- a/ecdsa/keys.py +++ b/ecdsa/keys.py @@ -1,14 +1,15 @@ import binascii +from hashlib import sha1 -from . import ecdsa from . import der +from . import ecdsa from . import rfc6979 from .curves import NIST192p, find_curve -from .util import string_to_number, number_to_string, randrange -from .util import sigencode_string, sigdecode_string -from .util import oid_ecPublicKey, encoded_oid_ecPublicKey from .six import PY3, b -from hashlib import sha1 +from .util import encoded_oid_ecPublicKey, oid_ecPublicKey +from .util import number_to_string, randrange, string_to_number +from .util import sigdecode_string, sigencode_string + class BadSignatureError(Exception): pass diff --git a/ecdsa/numbertheory.py b/ecdsa/numbertheory.py index 7ace0dc..b20d60f 100644 --- a/ecdsa/numbertheory.py +++ b/ecdsa/numbertheory.py @@ -11,11 +11,11 @@ from __future__ import division -from .six import print_, integer_types -from .six.moves import reduce - import math +from .six import integer_types, print_ +from .six.moves import reduce + class Error( Exception ): """Base class for exceptions in this module.""" diff --git a/ecdsa/rfc6979.py b/ecdsa/rfc6979.py index 6190ebd..a792598 100644 --- a/ecdsa/rfc6979.py +++ b/ecdsa/rfc6979.py @@ -11,8 +11,9 @@ Many thanks to Coda Hale for his implementation in Go language: import hmac from binascii import hexlify -from .util import number_to_string, number_to_string_crop + from .six import b +from .util import number_to_string, number_to_string_crop try: bin(0) diff --git a/ecdsa/test_pyecdsa.py b/ecdsa/test_pyecdsa.py index 326cac4..2a8c5b4 100644 --- a/ecdsa/test_pyecdsa.py +++ b/ecdsa/test_pyecdsa.py @@ -1,24 +1,25 @@ -from __future__ import with_statement, division +from __future__ import division, with_statement -import unittest import os -import time import shutil import subprocess +import time +import unittest from binascii import hexlify, unhexlify from hashlib import sha1, sha256, sha512 -from .six import b, print_, binary_type -from .keys import SigningKey, VerifyingKey -from .keys import BadSignatureError +from . import der +from . import rfc6979 from . import util -from .util import sigencode_der, sigencode_strings -from .util import sigdecode_der, sigdecode_strings from .curves import Curve, UnknownCurveError from .curves import NIST192p, NIST224p, NIST256p, NIST384p, NIST521p, SECP256k1 from .ellipticcurve import Point -from . import der -from . import rfc6979 +from .keys import BadSignatureError +from .keys import SigningKey, VerifyingKey +from .six import b, binary_type, print_ +from .util import sigdecode_der, sigdecode_strings +from .util import sigencode_der, sigencode_strings + class SubprocessError(Exception): pass diff --git a/ecdsa/util.py b/ecdsa/util.py index c51ed3d..206d038 100644 --- a/ecdsa/util.py +++ b/ecdsa/util.py @@ -1,12 +1,13 @@ from __future__ import division -import os -import math import binascii +import math +import os from hashlib import sha256 + from . import der from .curves import orderlen -from .six import PY3, int2byte, b, next +from .six import PY3, b, int2byte, next # RFC5480: # The "unrestricted" algorithm identifier is: diff --git a/espefuse.py b/espefuse.py index e9725ff..7985b94 100755 --- a/espefuse.py +++ b/espefuse.py @@ -15,15 +15,16 @@ # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 51 Franklin # Street, Fifth Floor, Boston, MA 02110-1301 USA. -from __future__ import print_function, division +from __future__ import division, print_function -import esptool import argparse -import sys import os import struct +import sys import time +import esptool + # Table of efuse values - (category, block, word in block, mask, write disable bit, read disable bit, register name, type, description) # Match values in efuse_reg.h & Efuse technical reference chapter EFUSES = [ diff --git a/espsecure.py b/espsecure.py index 1d09e2d..0859b18 100755 --- a/espsecure.py +++ b/espsecure.py @@ -15,16 +15,17 @@ # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 51 Franklin # Street, Fifth Floor, Boston, MA 02110-1301 USA. -from __future__ import print_function, division +from __future__ import division, print_function -import esptool import argparse -import sys -import os import hashlib +import os import struct -import pyaes +import sys + import ecdsa +import esptool +import pyaes def get_chunks(source, chunk_len): diff --git a/esptool.py b/esptool.py index 5e783bb..4c2d1ee 100755 --- a/esptool.py +++ b/esptool.py @@ -16,21 +16,22 @@ # this program; if not, write to the Free Software Foundation, Inc., 51 Franklin # Street, Fifth Floor, Boston, MA 02110-1301 USA. -from __future__ import print_function, division +from __future__ import division, print_function import argparse +import base64 +import copy import hashlib import inspect +import io import os -import serial +import shlex import struct import sys import time -import base64 import zlib -import shlex -import copy -import io + +import serial __version__ = "2.2-dev" diff --git a/flasher_stub/compare_stubs.py b/flasher_stub/compare_stubs.py index f17311d..757493f 100755 --- a/flasher_stub/compare_stubs.py +++ b/flasher_stub/compare_stubs.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -import sys, os.path, json +import sys # Compare the esptool stub loaders to freshly built ones # in the build directory diff --git a/flasher_stub/esptool_test_stub.py b/flasher_stub/esptool_test_stub.py index 926a209..3f242ec 100755 --- a/flasher_stub/esptool_test_stub.py +++ b/flasher_stub/esptool_test_stub.py @@ -11,7 +11,8 @@ # the terms of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later version. # -import sys, os.path, json +import os.path +import sys THIS_DIR=os.path.dirname(sys.argv[0]) diff --git a/flasher_stub/wrap_stub.py b/flasher_stub/wrap_stub.py index 2f7761d..6cdbf24 100755 --- a/flasher_stub/wrap_stub.py +++ b/flasher_stub/wrap_stub.py @@ -18,10 +18,10 @@ # Street, Fifth Floor, Boston, MA 02110-1301 USA. import base64 -import zlib import os import os.path import sys +import zlib sys.path.append('..') import esptool diff --git a/pyaes/__init__.py b/pyaes/__init__.py index 5712f79..ea65dbd 100644 --- a/pyaes/__init__.py +++ b/pyaes/__init__.py @@ -48,6 +48,6 @@ VERSION = [1, 3, 0] -from .aes import AES, AESModeOfOperationCTR, AESModeOfOperationCBC, AESModeOfOperationCFB, AESModeOfOperationECB, AESModeOfOperationOFB, AESModesOfOperation, Counter -from .blockfeeder import decrypt_stream, Decrypter, encrypt_stream, Encrypter -from .blockfeeder import PADDING_NONE, PADDING_DEFAULT +from .aes import AES, AESModeOfOperationCBC, AESModeOfOperationCFB, AESModeOfOperationCTR, AESModeOfOperationECB, AESModeOfOperationOFB, AESModesOfOperation, Counter +from .blockfeeder import Decrypter, Encrypter, decrypt_stream, encrypt_stream +from .blockfeeder import PADDING_DEFAULT, PADDING_NONE diff --git a/setup.py b/setup.py index 68dbf68..e5d18fd 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,11 @@ from __future__ import division, print_function -from setuptools import setup import io import os import re +from setuptools import setup + # Example code to pull version from esptool.py with regex, taken from # http://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/ diff --git a/test/test_esptool.py b/test/test_esptool.py index e139e8b..4304839 100755 --- a/test/test_esptool.py +++ b/test/test_esptool.py @@ -8,15 +8,14 @@ Chip name & serial port are passed in as arguments to test. Same test suite runs on esp8266 & esp32 (some addresses will change, see below.) """ -import subprocess -import unittest -import sys -import os.path import os -import tempfile -import warnings -import time +import os.path import re +import subprocess +import sys +import tempfile +import time +import unittest # point is this file is not 4 byte aligned in length NODEMCU_FILE = "nodemcu-master-7-modules-2017-01-19-11-10-03-integer.bin" diff --git a/test/test_imagegen.py b/test/test_imagegen.py index 1bce63c..d69f063 100755 --- a/test/test_imagegen.py +++ b/test/test_imagegen.py @@ -1,10 +1,7 @@ #!/usr/bin/env python import os.path -import glob -import sys import subprocess -import difflib -import warnings +import sys import unittest from elftools.elf.elffile import ELFFile