Move imports to the top of files to resolve flake8 E402

This commit is contained in:
Chris Mayo 2020-05-25 19:50:57 +01:00
parent 0f3444e906
commit 6dda2f9669
3 changed files with 11 additions and 10 deletions

View file

@ -34,6 +34,10 @@
import sys
import os
import keyword
pykeywords = set(keyword.kwlist)
def parse_py_statement(line):
state = 0
@ -90,9 +94,6 @@ def parse_py_statement(line):
elif state == 6: yield ("comment", curtoken)
import keyword
pykeywords = set(keyword.kwlist)
def grep_full_py_identifiers(tokens):
global pykeywords
tokens = list(tokens)

View file

@ -26,14 +26,13 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from ctypes import (windll, byref, Structure, c_char, c_short, c_uint32,
c_ushort, ArgumentError, WinError)
# from winbase.h
STDOUT = -11
STDERR = -12
from ctypes import (windll, byref, Structure, c_char, c_short, c_uint32,
c_ushort, ArgumentError, WinError)
handles = {
STDOUT: windll.kernel32.GetStdHandle(STDOUT),
STDERR: windll.kernel32.GetStdHandle(STDERR),

View file

@ -21,10 +21,6 @@
Various string utility functions. Note that these functions are not
necessarily optimised for large strings, so use with care.
"""
# some handy time constants
SECONDS_PER_MINUTE = 60
SECONDS_PER_HOUR = 60 * SECONDS_PER_MINUTE
SECONDS_PER_DAY = 24 * SECONDS_PER_HOUR
import re
import textwrap
@ -37,6 +33,11 @@ import locale
import pydoc
from . import i18n
# some handy time constants
SECONDS_PER_MINUTE = 60
SECONDS_PER_HOUR = 60 * SECONDS_PER_MINUTE
SECONDS_PER_DAY = 24 * SECONDS_PER_HOUR
def unicode_safe(s, encoding=i18n.default_encoding, errors='replace'):
"""Get unicode string without raising encoding errors. Unknown