Skip to content

Commit

Permalink
🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Dec 12, 2024
1 parent 9164116 commit c6a7347
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion typer/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def docs(
if not hasattr(ctx, "obj") or ctx.obj is None:
ctx.ensure_object(dict)
if isinstance(ctx.obj, dict):
ctx.obj['TYPER_RICH_MARKUP_MODE'] = typer_obj.rich_markup_mode
ctx.obj["TYPER_RICH_MARKUP_MODE"] = typer_obj.rich_markup_mode
click_obj = typer.main.get_command(typer_obj)
docs = get_docs_for_click(obj=click_obj, ctx=ctx, name=name, title=title)
clean_docs = f"{docs.strip()}\n"
Expand Down
6 changes: 3 additions & 3 deletions typer/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def get_help_record(self, ctx: click.Context) -> Optional[Tuple[str, str]]:
extra_str = f"[{extra_str}]"
rich_markup_mode = None
if hasattr(ctx, "obj") and isinstance(ctx.obj, dict):
rich_markup_mode = ctx.obj.get('TYPER_RICH_MARKUP_MODE', None)
rich_markup_mode = ctx.obj.get("TYPER_RICH_MARKUP_MODE", None)
if rich is not None and rich_markup_mode == "rich":
# This is needed for when we want to export to HTML
extra_str = rich.markup.escape(extra_str).strip()
Expand Down Expand Up @@ -571,7 +571,7 @@ def _write_opts(opts: Sequence[str]) -> str:

rich_markup_mode = None
if hasattr(ctx, "obj") and isinstance(ctx.obj, dict):
rich_markup_mode = ctx.obj.get('TYPER_RICH_MARKUP_MODE', None)
rich_markup_mode = ctx.obj.get("TYPER_RICH_MARKUP_MODE", None)
if rich is not None and rich_markup_mode == "rich":
# This is needed for when we want to export to HTML
extra_str = rich.markup.escape(extra_str).strip()
Expand Down Expand Up @@ -700,7 +700,7 @@ def format_help(self, ctx: click.Context, formatter: click.HelpFormatter) -> Non
if not hasattr(ctx, "obj") or ctx.obj is None:
ctx.ensure_object(dict)
if isinstance(ctx.obj, dict):
ctx.obj['TYPER_RICH_MARKUP_MODE'] = self.rich_markup_mode
ctx.obj["TYPER_RICH_MARKUP_MODE"] = self.rich_markup_mode
return super().format_help(ctx, formatter)
return rich_utils.rich_format_help(
obj=self,
Expand Down

0 comments on commit c6a7347

Please sign in to comment.