mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[codemod][lint][fbcode/c*] Enable BLACK by default
Test Plan: manual inspection & sandcastle Reviewed By: zertosh Differential Revision: D30279364 fbshipit-source-id: c1ed77dfe43a3bde358f92737cd5535ae5d13c9a
This commit is contained in:
committed by
Facebook GitHub Bot
parent
aac3c7bd06
commit
b004307252
@ -7,18 +7,19 @@ from mypy.plugin import Plugin
|
||||
|
||||
def get_correct_mypy_version():
|
||||
# there's probably a more elegant way to do this
|
||||
match, = re.finditer(
|
||||
r'mypy==(\d+(?:\.\d+)*)',
|
||||
Path('.circleci/docker/common/install_conda.sh').read_text(),
|
||||
(match,) = re.finditer(
|
||||
r"mypy==(\d+(?:\.\d+)*)",
|
||||
Path(".circleci/docker/common/install_conda.sh").read_text(),
|
||||
)
|
||||
version, = match.groups()
|
||||
(version,) = match.groups()
|
||||
return version
|
||||
|
||||
|
||||
def plugin(version: str):
|
||||
correct_version = get_correct_mypy_version()
|
||||
if version != correct_version:
|
||||
print(f'''\
|
||||
print(
|
||||
f"""\
|
||||
You are using mypy version {version}, which is not supported
|
||||
in the PyTorch repo. Please switch to mypy version {correct_version}.
|
||||
|
||||
@ -29,5 +30,7 @@ For example, if you installed mypy via pip, run this:
|
||||
Or if you installed mypy via conda, run this:
|
||||
|
||||
conda install -c conda-forge mypy={correct_version}
|
||||
''', file=sys.stderr)
|
||||
""",
|
||||
file=sys.stderr,
|
||||
)
|
||||
return Plugin
|
||||
|
Reference in New Issue
Block a user