Skip to content
Prev Previous commit
Next Next commit
Refactor
Signed-off-by: Edgar Ramírez-Mondragón <edgarrm358@gmail.com>
  • Loading branch information
edgarrmondragon committed Sep 25, 2026
commit 59e72ebe84ce565b06c8769502d4b172f0521454
13 changes: 6 additions & 7 deletions mypy/stubgenc.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,15 +332,14 @@ def add_args(
if default_value is not _Missing.VALUE:
if arg in annotations:
argtype = get_annotation(arg)
elif _is_sentinel_object(default_value):
# Reference the sentinel itself by name when possible, e.g.
# `Incomplete | _MISSING`.
incomplete = self.add_name("_typeshed.Incomplete")
ref = self._sentinel_type_ref(default_value)
argtype = f"{incomplete} | {ref}" if ref else incomplete
else:
argtype = self.get_type_annotation(default_value)
if _is_sentinel_object(default_value):
# Reference the sentinel itself by name when possible, e.g.
# `Incomplete | _MISSING`.
incomplete = self.add_name("_typeshed.Incomplete")
ref = self._sentinel_type_ref(default_value)
argtype = f"{incomplete} | {ref}" if ref else incomplete

if argtype == "None":
# None is not a useful annotation, but we can infer that the arg
# is optional
Expand Down
Loading