Skip to content

Commit 4e10416

Browse files
committed
Bump consolekit version.
1 parent 036bf48 commit 4e10416

3 files changed

Lines changed: 13 additions & 29 deletions

File tree

flake8_dunder_all/__main__.py

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Command-line entry point for flake8-dunder-all.
66
"""
77
#
8-
# Copyright (c) 2020 Dominic Davis-Foster <dominic@davis-foster.co.uk>
8+
# Copyright (c) 2020-2021 Dominic Davis-Foster <dominic@davis-foster.co.uk>
99
#
1010
# Permission is hereby granted, free of charge, to any person obtaining a copy
1111
# of this software and associated documentation files (the "Software"), to deal
@@ -28,12 +28,12 @@
2828

2929
# stdlib
3030
import sys
31-
from textwrap import indent
3231
from typing import Iterable
3332

3433
# 3rd party
3534
import click
3635
from consolekit import click_command
36+
from consolekit.commands import MarkdownHelpCommand
3737
from consolekit.options import auto_default_option
3838

3939
# this package
@@ -42,32 +42,17 @@
4242
__all__ = ["main"]
4343

4444

45-
class RawHelpCommand(click.Command):
46-
"""
47-
Subclass of :class:`click.Command` which leaves the help text unformatted.
48-
"""
49-
50-
def format_help_text(self, ctx, formatter: click.formatting.HelpFormatter):
51-
"""
52-
Writes the help text to the formatter if it exists.
53-
"""
54-
55-
formatter.write('\n')
56-
formatter.write(indent((self.help or '').replace("* ", " "), " "))
57-
formatter.write('\n')
58-
59-
6045
@click.argument("filenames", type=click.STRING, nargs=-1, metavar="FILENAME")
6146
@auto_default_option("--quote-type", type=click.STRING, help="The type of quote to use.", show_default=True)
62-
@click_command(cls=RawHelpCommand)
63-
def main(filenames: Iterable[str], quote_type: str = '"') -> int:
47+
@click_command(cls=MarkdownHelpCommand)
48+
def main(filenames: Iterable[str], quote_type: str = '"'):
6449
"""
65-
Given a list of Python source files, check each file defines '__all__'.
50+
Given a list of Python source files, check each file defines ``__all__``.
6651
6752
Exit codes:
6853
69-
* 0: The file already contains a '__all__' declaration or has no function or class definitions.
70-
* 1: A '__all__' declaration was added to the file.
54+
* 0: The file already contains a ``__all__`` declaration or has no function or class definitions.
55+
* 1: A ``__all__`` declaration was added to the file.
7156
* 4: A file could not be parsed due to a syntax error.
7257
* 5: Bitwise OR of 1 and 4.
7358
"""

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
asttokens>=1.1
22
click>=7.1.2
3-
consolekit>=0.7.0
4-
domdf-python-tools>=0.4.10
3+
consolekit>=0.8.1
4+
domdf-python-tools>=1.8.0
55
flake8>=3.7

tests/test_main_/test_main_help.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ Usage: main [OPTIONS] FILENAME
33
Given a list of Python source files, check each file defines '__all__'.
44

55
Exit codes:
6-
7-
0: The file already contains a '__all__' declaration or has no function or class definitions.
8-
1: A '__all__' declaration was added to the file.
9-
4: A file could not be parsed due to a syntax error.
10-
5: Bitwise OR of 1 and 4.
6+
* 0: The file already contains a '__all__' declaration or has no function or class definitions.
7+
* 1: A '__all__' declaration was added to the file.
8+
* 4: A file could not be parsed due to a syntax error.
9+
* 5: Bitwise OR of 1 and 4.
1110

1211
Options:
1312
--quote-type TEXT The type of quote to use. [default: "]

0 commit comments

Comments
 (0)