-
-
Notifications
You must be signed in to change notification settings - Fork 834
👷 Add ty to the CI lint check
#1477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 9 commits
c660019
6a697ef
7bb1e2c
fe68cb1
7c64801
2df08ba
b8632b9
771994f
5df54f0
90cdd30
5a7bf84
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,6 +72,7 @@ def except_hook( | |
| _original_except_hook(exc_type, exc_value, tb) | ||
| return | ||
| typer_path = os.path.dirname(__file__) | ||
| assert click.__file__ is not None | ||
svlandeg marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| click_path = os.path.dirname(click.__file__) | ||
| internal_dir_names = [typer_path, click_path] | ||
| exc = exc_value | ||
|
|
@@ -395,42 +396,34 @@ def solve_typer_info_help(typer_info: TyperInfo) -> str: | |
| if not isinstance(typer_info.help, DefaultPlaceholder): | ||
| return inspect.cleandoc(typer_info.help or "") | ||
| # Priority 2: Explicit value was set in sub_app.callback() | ||
| try: | ||
| if typer_info.typer_instance and typer_info.typer_instance.registered_callback: | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This edit and the lines below is not strictly necessary: they are "possibly-missing-attribute" warnings from
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of making these edits, we have two other options:
|
||
| callback_help = typer_info.typer_instance.registered_callback.help | ||
| if not isinstance(callback_help, DefaultPlaceholder): | ||
| return inspect.cleandoc(callback_help or "") | ||
| except AttributeError: | ||
| pass | ||
| # Priority 3: Explicit value was set in sub_app = typer.Typer() | ||
| try: | ||
| if typer_info.typer_instance and typer_info.typer_instance.info: | ||
| instance_help = typer_info.typer_instance.info.help | ||
| if not isinstance(instance_help, DefaultPlaceholder): | ||
| return inspect.cleandoc(instance_help or "") | ||
| except AttributeError: | ||
| pass | ||
| # Priority 4: Implicit inference from callback docstring in app.add_typer() | ||
| if typer_info.callback: | ||
| doc = inspect.getdoc(typer_info.callback) | ||
| if doc: | ||
| return doc | ||
| # Priority 5: Implicit inference from callback docstring in @app.callback() | ||
| try: | ||
| if typer_info.typer_instance and typer_info.typer_instance.registered_callback: | ||
| callback = typer_info.typer_instance.registered_callback.callback | ||
| if not isinstance(callback, DefaultPlaceholder): | ||
| doc = inspect.getdoc(callback or "") | ||
| if doc: | ||
| return doc | ||
| except AttributeError: | ||
| pass | ||
| # Priority 6: Implicit inference from callback docstring in typer.Typer() | ||
| try: | ||
| if typer_info.typer_instance and typer_info.typer_instance.info: | ||
| instance_callback = typer_info.typer_instance.info.callback | ||
| if not isinstance(instance_callback, DefaultPlaceholder): | ||
| doc = inspect.getdoc(instance_callback) | ||
| if doc: | ||
| return doc | ||
| except AttributeError: | ||
| pass | ||
| # Value not set, use the default | ||
| return typer_info.help.value | ||
|
|
||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.