From 934c20320aeedeee0a37aad337cfd67d53866cd7 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Thu, 18 Mar 2021 22:00:42 +0000 Subject: [PATCH] Fix black issues I should probably automate this. Signed-off-by: Stephen Finucane --- examples/commandcollections/cli.py | 10 +++------- examples/setup.py | 2 +- setup.py | 3 ++- sphinx_click/ext.py | 26 +++++++++++++++++--------- tests/test_formatter.py | 3 +-- 5 files changed, 24 insertions(+), 20 deletions(-) diff --git a/examples/commandcollections/cli.py b/examples/commandcollections/cli.py index 91e58a9..199090a 100644 --- a/examples/commandcollections/cli.py +++ b/examples/commandcollections/cli.py @@ -6,7 +6,7 @@ name='Principal Commands', help="Principal commands that are used in ``cli``.\n\n" "The section name and description are obtained using the name and " - "description of the group passed as sources for |CommandCollection|_." + "description of the group passed as sources for |CommandCollection|_.", ) @@ -15,10 +15,7 @@ def cmd1(): print('call cmd 1') -helpers = click.Group( - name='Helper Commands', - help="Helper commands for ``cli``." -) +helpers = click.Group(name='Helper Commands', help="Helper commands for ``cli``.") @helpers.command() @@ -35,6 +32,5 @@ def cmd3(user): cli = click.CommandCollection( - name='cli', sources=[main, helpers], - help='Some general info on ``cli``.' + name='cli', sources=[main, helpers], help='Some general info on ``cli``.' ) diff --git a/examples/setup.py b/examples/setup.py index 93c48a0..93a037b 100644 --- a/examples/setup.py +++ b/examples/setup.py @@ -3,5 +3,5 @@ setup( name='sphinx_click_examples', packages=find_packages('.'), - install_requires=['click'] + install_requires=['click'], ) diff --git a/setup.py b/setup.py index bae36e2..26f5ba6 100644 --- a/setup.py +++ b/setup.py @@ -3,5 +3,6 @@ from setuptools import setup setup( - setup_requires=['pbr>=2.0'], pbr=True, + setup_requires=['pbr>=2.0'], + pbr=True, ) diff --git a/sphinx_click/ext.py b/sphinx_click/ext.py index c7b0cec..32903eb 100644 --- a/sphinx_click/ext.py +++ b/sphinx_click/ext.py @@ -407,8 +407,9 @@ def _load_module(self, module_path): ) return parser - def _generate_nodes(self, name, command, parent, nested, commands=None, - semantic_group=False): + def _generate_nodes( + self, name, command, parent, nested, commands=None, semantic_group=False + ): """Generate the relevant Sphinx nodes. Format a `click.Group` or `click.Command`. @@ -457,17 +458,24 @@ def _generate_nodes(self, name, command, parent, nested, commands=None, if nested == NESTED_FULL: if isinstance(command, click.CommandCollection): for source in command.sources: - section.extend(self._generate_nodes( - source.name, source, parent=ctx, nested=nested, - semantic_group=True - )) + section.extend( + self._generate_nodes( + source.name, + source, + parent=ctx, + nested=nested, + semantic_group=True, + ) + ) else: commands = _filter_commands(ctx, commands) for command in commands: parent = ctx if not semantic_group else ctx.parent - section.extend(self._generate_nodes( - command.name, command, parent=parent, nested=nested - )) + section.extend( + self._generate_nodes( + command.name, command, parent=parent, nested=nested + ) + ) return [section] diff --git a/tests/test_formatter.py b/tests/test_formatter.py index 17d04fe..f6c7a7a 100644 --- a/tests/test_formatter.py +++ b/tests/test_formatter.py @@ -697,8 +697,7 @@ def world(): """A world command.""" cli = click.CommandCollection( - name='cli', sources=[grp1, grp2], - help='A simple CommandCollection.' + name='cli', sources=[grp1, grp2], help='A simple CommandCollection.' ) ctx = click.Context(cli, info_name='cli') output = list(ext._format_command(ctx, nested='full'))