Merge pull request #1302 from pre-commit/3_6_0

Fix pre-commit in python 3.6.0-3.6.1
This commit is contained in:
Anthony Sottile 2020-01-29 17:56:15 -08:00 committed by GitHub
commit eee3c759b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View file

@ -15,6 +15,7 @@ repos:
rev: 3.7.9 rev: 3.7.9
hooks: hooks:
- id: flake8 - id: flake8
additional_dependencies: [flake8-typing-imports==1.5.0]
- repo: https://github.com/pre-commit/mirrors-autopep8 - repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.4.4 rev: v1.4.4
hooks: hooks:

View file

@ -3,11 +3,11 @@ import os
import random import random
from typing import Any from typing import Any
from typing import List from typing import List
from typing import NoReturn
from typing import Optional from typing import Optional
from typing import overload from typing import overload
from typing import Sequence from typing import Sequence
from typing import Tuple from typing import Tuple
from typing import TYPE_CHECKING
import pre_commit.constants as C import pre_commit.constants as C
from pre_commit.hook import Hook from pre_commit.hook import Hook
@ -15,6 +15,9 @@ from pre_commit.prefix import Prefix
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
if TYPE_CHECKING:
from typing import NoReturn
FIXED_RANDOM_SEED = 1542676186 FIXED_RANDOM_SEED = 1542676186
@ -65,7 +68,7 @@ def no_install(
prefix: Prefix, prefix: Prefix,
version: str, version: str,
additional_dependencies: Sequence[str], additional_dependencies: Sequence[str],
) -> NoReturn: ) -> 'NoReturn':
raise AssertionError('This type is not installable') raise AssertionError('This type is not installable')

View file

@ -1,11 +1,14 @@
import os.path import os.path
from typing import Mapping from typing import Mapping
from typing import NoReturn
from typing import Optional from typing import Optional
from typing import Tuple from typing import Tuple
from typing import TYPE_CHECKING
from identify.identify import parse_shebang_from_file from identify.identify import parse_shebang_from_file
if TYPE_CHECKING:
from typing import NoReturn
class ExecutableNotFoundError(OSError): class ExecutableNotFoundError(OSError):
def to_output(self) -> Tuple[int, bytes, None]: def to_output(self) -> Tuple[int, bytes, None]:
@ -44,7 +47,7 @@ def find_executable(
def normexe(orig: str) -> str: def normexe(orig: str) -> str:
def _error(msg: str) -> NoReturn: def _error(msg: str) -> 'NoReturn':
raise ExecutableNotFoundError(f'Executable `{orig}` {msg}') raise ExecutableNotFoundError(f'Executable `{orig}` {msg}')
if os.sep not in orig and (not os.altsep or os.altsep not in orig): if os.sep not in orig and (not os.altsep or os.altsep not in orig):