Skip to content

Commit 77a02d0

Browse files
style: Ruff formatting
1 parent d508352 commit 77a02d0

File tree

6 files changed

+151
-128
lines changed

6 files changed

+151
-128
lines changed

src/thread-cli/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@
1010
Copyright (c) 2020, thread.ngjx.org. All rights reserved.
1111
"""
1212

13-
__version__ = "0.1.0"
13+
__version__ = '0.1.0'
1414
from .utils.logging import ColorLogger, logging
1515

1616
# Export Core
1717
from .base import cli_base as app
1818
from .process import process as process_cli
1919

2020
app.command(
21-
name="process",
21+
name='process',
2222
no_args_is_help=True,
23-
context_settings={"allow_extra_args": True},
23+
context_settings={'allow_extra_args': True},
2424
)(process_cli)
2525

2626

@@ -29,4 +29,4 @@
2929

3030

3131
# Wildcard export
32-
__all__ = ["app"]
32+
__all__ = ['app']

src/thread-cli/base.py

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33

44
from . import __version__
55
from .utils import DebugOption, VerboseOption, QuietOption, verbose_args_processor
6+
67
logger = logging.getLogger('base')
78

89

910
cli_base = typer.Typer(
10-
no_args_is_help = True,
11-
rich_markup_mode = 'rich',
12-
context_settings = {
13-
'help_option_names': ['-h', '--help', 'help']
14-
}
11+
no_args_is_help=True,
12+
rich_markup_mode='rich',
13+
context_settings={'help_option_names': ['-h', '--help', 'help']},
1514
)
1615

1716

@@ -21,19 +20,19 @@ def version_callback(value: bool):
2120
raise typer.Exit()
2221

2322

24-
@cli_base.callback(invoke_without_command = True)
23+
@cli_base.callback(invoke_without_command=True)
2524
def callback(
2625
version: bool = typer.Option(
27-
None, '--version',
28-
callback = version_callback,
29-
help = 'Get the current installed version',
30-
is_eager = True
26+
None,
27+
'--version',
28+
callback=version_callback,
29+
help='Get the current installed version',
30+
is_eager=True,
3131
),
32-
3332
debug: bool = DebugOption,
3433
verbose: bool = VerboseOption,
35-
quiet: bool = QuietOption
36-
):
34+
quiet: bool = QuietOption,
35+
):
3736
"""
3837
[b]Thread CLI[/b]\b\n
3938
[white]Use thread from the terminal![/white]
@@ -45,20 +44,17 @@ def callback(
4544
verbose_args_processor(debug, verbose, quiet)
4645

4746

48-
4947
# Help and Others
50-
@cli_base.command(rich_help_panel = 'Help and Others')
48+
@cli_base.command(rich_help_panel='Help and Others')
5149
def help():
5250
"""Get [yellow]help[/yellow] from the community. :question:"""
5351
typer.echo('Feel free to search for or ask questions here!')
5452
try:
5553
logger.info('Attempting to open in web browser...')
5654

5755
import webbrowser
58-
webbrowser.open(
59-
'https://github.com/python-thread/thread/issues',
60-
new = 2
61-
)
56+
57+
webbrowser.open('https://github.com/python-thread/thread/issues', new=2)
6258
typer.echo('Opening in web browser!')
6359

6460
except Exception as e:
@@ -67,17 +63,16 @@ def help():
6763
typer.echo('https://github.com/python-thread/thread/issues')
6864

6965

70-
71-
@cli_base.command(rich_help_panel = 'Help and Others')
66+
@cli_base.command(rich_help_panel='Help and Others')
7267
def docs():
7368
"""View our [yellow]documentation.[/yellow] :book:"""
7469
typer.echo('Thanks for using Thread, here is our documentation!')
7570
try:
7671
logger.info('Attempting to open in web browser...')
7772
import webbrowser
73+
7874
webbrowser.open(
79-
'https://github.com/python-thread/thread/blob/main/docs/command-line.md',
80-
new = 2
75+
'https://github.com/python-thread/thread/blob/main/docs/command-line.md', new=2
8176
)
8277
typer.echo('Opening in web browser!')
8378

@@ -87,18 +82,15 @@ def docs():
8782
typer.echo('https://github.com/python-thread/thread/blob/main/docs/command-line.md')
8883

8984

90-
91-
@cli_base.command(rich_help_panel = 'Help and Others')
85+
@cli_base.command(rich_help_panel='Help and Others')
9286
def report():
9387
"""[yellow]Report[/yellow] an issue. :bug:"""
9488
typer.echo('Sorry you run into an issue, report it here!')
9589
try:
9690
logger.info('Attempting to open in web browser...')
9791
import webbrowser
98-
webbrowser.open(
99-
'https://github.com/python-thread/thread/issues',
100-
new = 2
101-
)
92+
93+
webbrowser.open('https://github.com/python-thread/thread/issues', new=2)
10294
typer.echo('Opening in web browser!')
10395

10496
except Exception as e:
@@ -107,11 +99,10 @@ def report():
10799
typer.echo('https://github.com/python-thread/thread/issues')
108100

109101

110-
111102
# Utils and Configs
112-
@cli_base.command(rich_help_panel = 'Utils and Configs')
103+
@cli_base.command(rich_help_panel='Utils and Configs')
113104
def config(configuration: str):
114105
"""
115106
[blue]Configure[/blue] the system. :wrench:
116107
"""
117-
typer.echo('Coming soon!')
108+
typer.echo('Coming soon!')

0 commit comments

Comments
 (0)