Skip to content

Commit eee3c75

Browse files
authored
Merge pull request #1302 from pre-commit/3_6_0
Fix pre-commit in python 3.6.0-3.6.1
2 parents 0cc199d + 9e4dc7f commit eee3c75

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ repos:
1515
rev: 3.7.9
1616
hooks:
1717
- id: flake8
18+
additional_dependencies: [flake8-typing-imports==1.5.0]
1819
- repo: https://github.com/pre-commit/mirrors-autopep8
1920
rev: v1.4.4
2021
hooks:

pre_commit/languages/helpers.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@
33
import random
44
from typing import Any
55
from typing import List
6-
from typing import NoReturn
76
from typing import Optional
87
from typing import overload
98
from typing import Sequence
109
from typing import Tuple
10+
from typing import TYPE_CHECKING
1111

1212
import pre_commit.constants as C
1313
from pre_commit.hook import Hook
1414
from pre_commit.prefix import Prefix
1515
from pre_commit.util import cmd_output_b
1616
from pre_commit.xargs import xargs
1717

18+
if TYPE_CHECKING:
19+
from typing import NoReturn
20+
1821
FIXED_RANDOM_SEED = 1542676186
1922

2023

@@ -65,7 +68,7 @@ def no_install(
6568
prefix: Prefix,
6669
version: str,
6770
additional_dependencies: Sequence[str],
68-
) -> NoReturn:
71+
) -> 'NoReturn':
6972
raise AssertionError('This type is not installable')
7073

7174

pre_commit/parse_shebang.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import os.path
22
from typing import Mapping
3-
from typing import NoReturn
43
from typing import Optional
54
from typing import Tuple
5+
from typing import TYPE_CHECKING
66

77
from identify.identify import parse_shebang_from_file
88

9+
if TYPE_CHECKING:
10+
from typing import NoReturn
11+
912

1013
class ExecutableNotFoundError(OSError):
1114
def to_output(self) -> Tuple[int, bytes, None]:
@@ -44,7 +47,7 @@ def find_executable(
4447

4548

4649
def normexe(orig: str) -> str:
47-
def _error(msg: str) -> NoReturn:
50+
def _error(msg: str) -> 'NoReturn':
4851
raise ExecutableNotFoundError(f'Executable `{orig}` {msg}')
4952

5053
if os.sep not in orig and (not os.altsep or os.altsep not in orig):

0 commit comments

Comments
 (0)