mirror of
https://github.com/espressif/esptool.git
synced 2025-10-15 12:37:18 +08:00
PEP8 imports (https://www.python.org/dev/peps/pep-0008/#imports). Remove unused import statements.
This commit is contained in:
@@ -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]
|
||||
|
@@ -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)
|
||||
|
@@ -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
|
||||
|
@@ -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 ):
|
||||
|
@@ -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."""
|
||||
|
@@ -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
|
||||
|
@@ -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."""
|
||||
|
@@ -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)
|
||||
|
@@ -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
|
||||
|
@@ -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:
|
||||
|
@@ -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 = [
|
||||
|
11
espsecure.py
11
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):
|
||||
|
13
esptool.py
13
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"
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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])
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
3
setup.py
3
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/
|
||||
|
@@ -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"
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user