PEP8 imports (https://www.python.org/dev/peps/pep-0008/#imports). Remove unused import statements.

This commit is contained in:
Ryan Jarvis
2017-09-17 12:22:03 -07:00
parent b5fe4d9a7d
commit fa7e37aa4c
20 changed files with 75 additions and 62 deletions

View File

@@ -1,7 +1,7 @@
__all__ = ["curves", "der", "ecdsa", "ellipticcurve", "keys", "numbertheory", __all__ = ["curves", "der", "ecdsa", "ellipticcurve", "keys", "numbertheory",
"test_pyecdsa", "util", "six"] "test_pyecdsa", "util", "six"]
from .keys import SigningKey, VerifyingKey, BadSignatureError, BadDigestError
from .curves import NIST192p, NIST224p, NIST256p, NIST384p, NIST521p, SECP256k1 from .curves import NIST192p, NIST224p, NIST256p, NIST384p, NIST521p, SECP256k1
from .keys import BadDigestError, BadSignatureError, SigningKey, VerifyingKey
_hush_pyflakes = [SigningKey, VerifyingKey, BadSignatureError, BadDigestError, _hush_pyflakes = [SigningKey, VerifyingKey, BadSignatureError, BadDigestError,
NIST192p, NIST224p, NIST256p, NIST384p, NIST521p, SECP256k1] NIST192p, NIST224p, NIST256p, NIST384p, NIST521p, SECP256k1]

View File

@@ -17,7 +17,12 @@ tag_prefix = "python-ecdsa-"
parentdir_prefix = "ecdsa-" parentdir_prefix = "ecdsa-"
versionfile_source = "ecdsa/_version.py" 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): def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False):
assert isinstance(commands, list) assert isinstance(commands, list)

View File

@@ -1,8 +1,10 @@
from __future__ import division from __future__ import division
import binascii
import base64 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): class UnexpectedDER(Exception):
pass pass

View File

@@ -53,11 +53,11 @@ Revision history:
Written in 2005 by Peter Pearson and placed in the public domain. 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 import random
from . import ellipticcurve
from . import numbertheory
from .six import b, int2byte, print_
class Signature( object ): class Signature( object ):

View File

@@ -34,8 +34,9 @@
from __future__ import division from __future__ import division
from .six import print_
from . import numbertheory from . import numbertheory
from .six import print_
class CurveFp( object ): class CurveFp( object ):
"""Elliptic Curve over the field of integers modulo a prime.""" """Elliptic Curve over the field of integers modulo a prime."""

View File

@@ -1,14 +1,15 @@
import binascii import binascii
from hashlib import sha1
from . import ecdsa
from . import der from . import der
from . import ecdsa
from . import rfc6979 from . import rfc6979
from .curves import NIST192p, find_curve 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 .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): class BadSignatureError(Exception):
pass pass

View File

@@ -11,11 +11,11 @@
from __future__ import division from __future__ import division
from .six import print_, integer_types
from .six.moves import reduce
import math import math
from .six import integer_types, print_
from .six.moves import reduce
class Error( Exception ): class Error( Exception ):
"""Base class for exceptions in this module.""" """Base class for exceptions in this module."""

View File

@@ -11,8 +11,9 @@ Many thanks to Coda Hale for his implementation in Go language:
import hmac import hmac
from binascii import hexlify from binascii import hexlify
from .util import number_to_string, number_to_string_crop
from .six import b from .six import b
from .util import number_to_string, number_to_string_crop
try: try:
bin(0) bin(0)

View File

@@ -1,24 +1,25 @@
from __future__ import with_statement, division from __future__ import division, with_statement
import unittest
import os import os
import time
import shutil import shutil
import subprocess import subprocess
import time
import unittest
from binascii import hexlify, unhexlify from binascii import hexlify, unhexlify
from hashlib import sha1, sha256, sha512 from hashlib import sha1, sha256, sha512
from .six import b, print_, binary_type from . import der
from .keys import SigningKey, VerifyingKey from . import rfc6979
from .keys import BadSignatureError
from . import util 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 Curve, UnknownCurveError
from .curves import NIST192p, NIST224p, NIST256p, NIST384p, NIST521p, SECP256k1 from .curves import NIST192p, NIST224p, NIST256p, NIST384p, NIST521p, SECP256k1
from .ellipticcurve import Point from .ellipticcurve import Point
from . import der from .keys import BadSignatureError
from . import rfc6979 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): class SubprocessError(Exception):
pass pass

View File

@@ -1,12 +1,13 @@
from __future__ import division from __future__ import division
import os
import math
import binascii import binascii
import math
import os
from hashlib import sha256 from hashlib import sha256
from . import der from . import der
from .curves import orderlen from .curves import orderlen
from .six import PY3, int2byte, b, next from .six import PY3, b, int2byte, next
# RFC5480: # RFC5480:
# The "unrestricted" algorithm identifier is: # The "unrestricted" algorithm identifier is:

View File

@@ -15,15 +15,16 @@
# You should have received a copy of the GNU General Public License along with # 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 # this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
# Street, Fifth Floor, Boston, MA 02110-1301 USA. # 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 argparse
import sys
import os import os
import struct import struct
import sys
import time import time
import esptool
# Table of efuse values - (category, block, word in block, mask, write disable bit, read disable bit, register name, type, description) # 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 # Match values in efuse_reg.h & Efuse technical reference chapter
EFUSES = [ EFUSES = [

View File

@@ -15,16 +15,17 @@
# You should have received a copy of the GNU General Public License along with # 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 # this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
# Street, Fifth Floor, Boston, MA 02110-1301 USA. # 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 argparse
import sys
import os
import hashlib import hashlib
import os
import struct import struct
import pyaes import sys
import ecdsa import ecdsa
import esptool
import pyaes
def get_chunks(source, chunk_len): def get_chunks(source, chunk_len):

View File

@@ -16,21 +16,22 @@
# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin # this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
# Street, Fifth Floor, Boston, MA 02110-1301 USA. # Street, Fifth Floor, Boston, MA 02110-1301 USA.
from __future__ import print_function, division from __future__ import division, print_function
import argparse import argparse
import base64
import copy
import hashlib import hashlib
import inspect import inspect
import io
import os import os
import serial import shlex
import struct import struct
import sys import sys
import time import time
import base64
import zlib import zlib
import shlex
import copy import serial
import io
__version__ = "2.2-dev" __version__ = "2.2-dev"

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env python #!/usr/bin/env python
import sys, os.path, json import sys
# Compare the esptool stub loaders to freshly built ones # Compare the esptool stub loaders to freshly built ones
# in the build directory # in the build directory

View File

@@ -11,7 +11,8 @@
# the terms of the GNU General Public License as published by the Free Software # 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. # 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]) THIS_DIR=os.path.dirname(sys.argv[0])

View File

@@ -18,10 +18,10 @@
# Street, Fifth Floor, Boston, MA 02110-1301 USA. # Street, Fifth Floor, Boston, MA 02110-1301 USA.
import base64 import base64
import zlib
import os import os
import os.path import os.path
import sys import sys
import zlib
sys.path.append('..') sys.path.append('..')
import esptool import esptool

View File

@@ -48,6 +48,6 @@
VERSION = [1, 3, 0] VERSION = [1, 3, 0]
from .aes import AES, AESModeOfOperationCTR, AESModeOfOperationCBC, AESModeOfOperationCFB, AESModeOfOperationECB, AESModeOfOperationOFB, AESModesOfOperation, Counter from .aes import AES, AESModeOfOperationCBC, AESModeOfOperationCFB, AESModeOfOperationCTR, AESModeOfOperationECB, AESModeOfOperationOFB, AESModesOfOperation, Counter
from .blockfeeder import decrypt_stream, Decrypter, encrypt_stream, Encrypter from .blockfeeder import Decrypter, Encrypter, decrypt_stream, encrypt_stream
from .blockfeeder import PADDING_NONE, PADDING_DEFAULT from .blockfeeder import PADDING_DEFAULT, PADDING_NONE

View File

@@ -1,10 +1,11 @@
from __future__ import division, print_function from __future__ import division, print_function
from setuptools import setup
import io import io
import os import os
import re import re
from setuptools import setup
# Example code to pull version from esptool.py with regex, taken from # Example code to pull version from esptool.py with regex, taken from
# http://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/ # http://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/

View File

@@ -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.) runs on esp8266 & esp32 (some addresses will change, see below.)
""" """
import subprocess
import unittest
import sys
import os.path
import os import os
import tempfile import os.path
import warnings
import time
import re import re
import subprocess
import sys
import tempfile
import time
import unittest
# point is this file is not 4 byte aligned in length # 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" NODEMCU_FILE = "nodemcu-master-7-modules-2017-01-19-11-10-03-integer.bin"

View File

@@ -1,10 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
import os.path import os.path
import glob
import sys
import subprocess import subprocess
import difflib import sys
import warnings
import unittest import unittest
from elftools.elf.elffile import ELFFile from elftools.elf.elffile import ELFFile