Revert D30279364: [codemod][lint][fbcode/c*] Enable BLACK by default

Test Plan: revert-hammer

Differential Revision:
D30279364 (b004307252)

Original commit changeset: c1ed77dfe43a

fbshipit-source-id: eab50857675c51e0088391af06ec0ecb14e2347e
This commit is contained in:
Shen Li
2021-08-12 11:39:31 -07:00
committed by Facebook GitHub Bot
parent ed0b8a3e83
commit 1022443168
188 changed files with 28697 additions and 56828 deletions

View File

@ -7,19 +7,18 @@ 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}.
@ -30,7 +29,5 @@ 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