Skip to content

Commit bd98584

Browse files
committed
⏪️ Revert implementation to previous for compat
1 parent 1cbcbc1 commit bd98584

File tree

2 files changed

+2
-24
lines changed

2 files changed

+2
-24
lines changed

typer/_compat.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

typer/core.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import click.shell_completion
2626
import click.types
2727
import click.utils
28-
from typer._compat import add_ctx_arg
2928

3029
from ._typing import Literal
3130

@@ -376,9 +375,7 @@ def get_help_record(self, ctx: click.Context) -> Optional[Tuple[str, str]]:
376375
help = f"{help} {extra_str}" if help else f"{extra_str}"
377376
return name, help
378377

379-
# TODO: When deprecating Click < 8.2, make context required
380-
@add_ctx_arg
381-
def make_metavar(self, ctx: Union[click.Context, None]) -> str:
378+
def make_metavar(self, ctx: Union[click.Context, None] = None) -> str:
382379
# Modified version of click.core.Argument.make_metavar()
383380
# to include Argument name
384381
if self.metavar is not None:
@@ -492,8 +489,7 @@ def _extract_default_help_str(
492489
) -> Optional[Union[Any, Callable[[], Any]]]:
493490
return _extract_default_help_str(self, ctx=ctx)
494491

495-
@add_ctx_arg
496-
def make_metavar(self, ctx: Union[click.Context, None]) -> str:
492+
def make_metavar(self, ctx: Union[click.Context, None] = None) -> str:
497493
signature = inspect.signature(super().make_metavar)
498494
if "ctx" in signature.parameters:
499495
# Click >= 8.2

0 commit comments

Comments
 (0)