tidied and sorted imports

removed ones not required as well, groups and spaced.
This commit is contained in:
Mark Mayo 2022-12-10 10:51:56 +13:00
parent cb0bcfd67f
commit cd00569d64
18 changed files with 4 additions and 24 deletions

View file

@ -2,6 +2,5 @@ from __future__ import annotations
from pre_commit.main import main from pre_commit.main import main
if __name__ == '__main__': if __name__ == '__main__':
raise SystemExit(main()) raise SystemExit(main())

View file

@ -6,13 +6,8 @@ import sys
if sys.platform == 'win32': # pragma: no cover (windows) if sys.platform == 'win32': # pragma: no cover (windows)
def _enable() -> None: def _enable() -> None:
from ctypes import POINTER from ctypes import POINTER, WINFUNCTYPE, WinError, windll
from ctypes import windll from ctypes.wintypes import BOOL, DWORD, HANDLE
from ctypes import WinError
from ctypes import WINFUNCTYPE
from ctypes.wintypes import BOOL
from ctypes.wintypes import DWORD
from ctypes.wintypes import HANDLE
STD_ERROR_HANDLE = -12 STD_ERROR_HANDLE = -12
ENABLE_VIRTUAL_TERMINAL_PROCESSING = 4 ENABLE_VIRTUAL_TERMINAL_PROCESSING = 4

View file

@ -16,7 +16,6 @@ from pre_commit.store import Store
from pre_commit.util import make_executable from pre_commit.util import make_executable
from pre_commit.util import resource_text from pre_commit.util import resource_text
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
# This is used to identify the hook file we install # This is used to identify the hook file we install

View file

@ -28,7 +28,6 @@ from pre_commit.staged_files_only import staged_files_only
from pre_commit.store import Store from pre_commit.store import Store
from pre_commit.util import cmd_output_b from pre_commit.util import cmd_output_b
logger = logging.getLogger('pre_commit') logger = logging.getLogger('pre_commit')

View file

@ -1,4 +1,5 @@
from __future__ import annotations from __future__ import annotations
SAMPLE_CONFIG = '''\ SAMPLE_CONFIG = '''\
# See https://pre-commit.com for more information # See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks # See https://pre-commit.com/hooks.html for more hooks

View file

@ -6,12 +6,10 @@ import sys
from typing import Callable from typing import Callable
from typing import Generator from typing import Generator
if sys.platform == 'win32': # pragma: no cover (windows) if sys.platform == 'win32': # pragma: no cover (windows)
import msvcrt import msvcrt
# https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/locking # https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/locking
# on windows we lock "regions" of files, we don't care about the actual # on windows we lock "regions" of files, we don't care about the actual
# byte region so we'll just pick *some* number here. # byte region so we'll just pick *some* number here.
_region = 0xffff _region = 0xffff

View file

@ -5,7 +5,6 @@ from typing import Sequence
from pre_commit.hook import Hook from pre_commit.hook import Hook
from pre_commit.languages import helpers from pre_commit.languages import helpers
ENVIRONMENT_DIR = None ENVIRONMENT_DIR = None
get_default_version = helpers.basic_get_default_version get_default_version = helpers.basic_get_default_version
health_check = helpers.basic_health_check health_check = helpers.basic_health_check

View file

@ -27,7 +27,6 @@ from pre_commit.error_handler import error_handler
from pre_commit.logging_handler import logging_handler from pre_commit.logging_handler import logging_handler
from pre_commit.store import Store from pre_commit.store import Store
logger = logging.getLogger('pre_commit') logger = logging.getLogger('pre_commit')
# https://github.com/pre-commit/pre-commit/issues/217 # https://github.com/pre-commit/pre-commit/issues/217

View file

@ -18,7 +18,6 @@ from pre_commit.store import Store
from pre_commit.util import parse_version from pre_commit.util import parse_version
from pre_commit.util import rmtree from pre_commit.util import rmtree
logger = logging.getLogger('pre_commit') logger = logging.getLogger('pre_commit')

View file

@ -1,4 +1,3 @@
from setuptools import setup from setuptools import setup
setup(name='pre-commit-placeholder-package', version='0.0.0') setup(name='pre-commit-placeholder-package', version='0.0.0')

View file

@ -12,7 +12,6 @@ from pre_commit.util import cmd_output
from pre_commit.util import cmd_output_b from pre_commit.util import cmd_output_b
from pre_commit.xargs import xargs from pre_commit.xargs import xargs
logger = logging.getLogger('pre_commit') logger = logging.getLogger('pre_commit')
# without forcing submodule.recurse=0, changes in nested submodules will be # without forcing submodule.recurse=0, changes in nested submodules will be

View file

@ -18,7 +18,6 @@ from pre_commit.util import cmd_output_b
from pre_commit.util import resource_text from pre_commit.util import resource_text
from pre_commit.util import rmtree from pre_commit.util import rmtree
logger = logging.getLogger('pre_commit') logger = logging.getLogger('pre_commit')

View file

@ -153,8 +153,8 @@ def cmd_output(*cmd: str, **kwargs: Any) -> tuple[int, str, str | None]:
if os.name != 'nt': # pragma: win32 no cover if os.name != 'nt': # pragma: win32 no cover
from os import openpty
import termios import termios
from os import openpty
class Pty: class Pty:
def __init__(self) -> None: def __init__(self) -> None:

View file

@ -10,7 +10,6 @@ import tarfile
import tempfile import tempfile
from typing import Sequence from typing import Sequence
# This is a script for generating the tarred resources for git repo # This is a script for generating the tarred resources for git repo
# dependencies. Currently it's just for "vendoring" ruby support packages. # dependencies. Currently it's just for "vendoring" ruby support packages.

View file

@ -12,7 +12,6 @@ from pre_commit.util import cmd_output
from pre_commit.util import cmd_output_b from pre_commit.util import cmd_output_b
from testing.auto_namedtuple import auto_namedtuple from testing.auto_namedtuple import auto_namedtuple
TESTING_DIR = os.path.abspath(os.path.dirname(__file__)) TESTING_DIR = os.path.abspath(os.path.dirname(__file__))

View file

@ -16,7 +16,6 @@ from pre_commit.prefix import Prefix
from pre_commit.util import cmd_output from pre_commit.util import cmd_output
from testing.util import xfailif_windows from testing.util import xfailif_windows
ACTUAL_GET_DEFAULT_VERSION = node.get_default_version.__wrapped__ ACTUAL_GET_DEFAULT_VERSION = node.get_default_version.__wrapped__

View file

@ -14,7 +14,6 @@ from pre_commit.util import cmd_output
from pre_commit.util import resource_bytesio from pre_commit.util import resource_bytesio
from testing.util import xfailif_windows from testing.util import xfailif_windows
ACTUAL_GET_DEFAULT_VERSION = ruby.get_default_version.__wrapped__ ACTUAL_GET_DEFAULT_VERSION = ruby.get_default_version.__wrapped__

View file

@ -15,7 +15,6 @@ from testing.util import cwd
from testing.util import get_resource_path from testing.util import get_resource_path
from testing.util import git_commit from testing.util import git_commit
FOO_CONTENTS = '\n'.join(('1', '2', '3', '4', '5', '6', '7', '8', '')) FOO_CONTENTS = '\n'.join(('1', '2', '3', '4', '5', '6', '7', '8', ''))