Skip to content

Commit 4d2d4dc

Browse files
author
Thomas Preud'homme
committed
Fix mypy warning about short_help using __doc__
Several click.command use __doc__ for the short_help but mypy is getting confused because its type is a union between str and unicode due to changes between Python2 and Python3. This commit clarifies to Mypy that it is a string by calling str on __doc__. Reviewed By: danilaml Differential Revision: https://reviews.llvm.org/D95067
1 parent 1a7257d commit 4d2d4dc

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lnt/tests/compile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,7 @@ def file_log_handler(path):
993993
# FIXME: an equivalent to argparse's add_argument_group is not implemented
994994
# on click. Need to review it when such functionality is available.
995995
# https://github.com/pallets/click/issues/373
996-
@click.command("compile", help=usage_info, short_help=__doc__)
996+
@click.command("compile", help=usage_info, short_help=str(__doc__))
997997
@click.argument("label", default=platform.uname()[1], required=False,
998998
type=click.UNPROCESSED)
999999
@click.option("-s", "--sandbox", "sandbox_path", required=True,

lnt/tests/nt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1842,7 +1842,7 @@ def _tools_check():
18421842
# FIXME: an equivalent to argparse's add_argument_group is not implemented
18431843
# on click. Need to review it when such functionality is available.
18441844
# https://github.com/pallets/click/issues/373
1845-
@click.command("nt", help=usage_info, short_help=__doc__)
1845+
@click.command("nt", help=usage_info, short_help=str(__doc__))
18461846
@click.argument("label", default=platform.uname()[1], required=False,
18471847
type=click.UNPROCESSED)
18481848
# Sandbox

lnt/tests/test_suite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ def diagnose(self):
10241024
return lnt.util.ImportData.no_submit()
10251025

10261026

1027-
@click.command("test-suite", short_help=__doc__)
1027+
@click.command("test-suite", short_help=str(__doc__))
10281028
@click.argument("label", default=platform.uname()[1], required=False,
10291029
type=click.UNPROCESSED)
10301030
# Sandbox options

0 commit comments

Comments
 (0)