MCPcopy
hub / github.com/python/mypy / visit_parameters

Method visit_parameters

mypy/types.py:3796–3823  ·  view source on GitHub ↗
(self, t: Parameters, /)

Source from the content-addressed store, hash-verified

3794 return s
3795
3796 def visit_parameters(self, t: Parameters, /) -> str:
3797 # This is copied from visit_callable -- is there a way to decrease duplication?
3798 if t.is_ellipsis_args:
3799 return "..."
3800
3801 s = ""
3802 bare_asterisk = False
3803 for i in range(len(t.arg_types)):
3804 if s != "":
3805 s += ", "
3806 if t.arg_kinds[i].is_named() and not bare_asterisk:
3807 s += "*, "
3808 bare_asterisk = True
3809 if t.arg_kinds[i] == ARG_STAR:
3810 s += "*"
3811 if t.arg_kinds[i] == ARG_STAR2:
3812 s += "**"
3813 name = t.arg_names[i]
3814 if name:
3815 s += f"{name}: "
3816 r = t.arg_types[i].accept(self)
3817
3818 s += r
3819
3820 if t.arg_kinds[i].is_optional():
3821 s += " ="
3822
3823 return f"[{s}]"
3824
3825 def visit_type_var_tuple(self, t: TypeVarTupleType, /) -> str:
3826 if not self.options.reveal_verbose_types:

Callers 1

acceptMethod · 0.45

Calls 5

rangeClass · 0.85
lenFunction · 0.85
is_namedMethod · 0.80
acceptMethod · 0.45
is_optionalMethod · 0.45

Tested by

no test coverage detected