MCPcopy Index your code
hub / github.com/python/mypy / ParamSpecType

Class ParamSpecType

mypy/types.py:767–912  ·  view source on GitHub ↗

Type that refers to a ParamSpec. A ParamSpec is a type variable that represents the parameter types, names and kinds of a callable (i.e., the signature without the return type). This can be one of these forms * P (ParamSpecFlavor.BARE) * P.args (ParamSpecFlavor.ARGS)

Source from the content-addressed store, hash-verified

765
766
767class ParamSpecType(TypeVarLikeType):
768 """Type that refers to a ParamSpec.
769
770 A ParamSpec is a type variable that represents the parameter
771 types, names and kinds of a callable (i.e., the signature without
772 the return type).
773
774 This can be one of these forms
775 * P (ParamSpecFlavor.BARE)
776 * P.args (ParamSpecFlavor.ARGS)
777 * P.kwargs (ParamSpecFLavor.KWARGS)
778
779 The upper_bound is really used as a fallback type -- it's shared
780 with TypeVarType for simplicity. It can't be specified by the user
781 and the value is directly derived from the flavor (currently
782 always just 'object').
783 """
784
785 __slots__ = ("flavor", "prefix")
786
787 flavor: int
788 prefix: Parameters
789
790 def __init__(
791 self,
792 name: str,
793 fullname: str,
794 id: TypeVarId,
795 flavor: int,
796 upper_bound: Type,
797 default: Type,
798 *,
799 line: int = -1,
800 column: int = -1,
801 prefix: Parameters | None = None,
802 ) -> None:
803 super().__init__(name, fullname, id, upper_bound, default, line=line, column=column)
804 self.flavor = flavor
805 self.prefix = prefix or Parameters([], [], [])
806
807 def with_flavor(self, flavor: int) -> ParamSpecType:
808 return ParamSpecType(
809 self.name,
810 self.fullname,
811 self.id,
812 flavor,
813 upper_bound=self.upper_bound,
814 default=self.default,
815 prefix=self.prefix,
816 )
817
818 def copy_modified(
819 self,
820 *,
821 id: Bogus[TypeVarId] = _dummy,
822 flavor: int = _dummy_int,
823 prefix: Bogus[Parameters] = _dummy,
824 default: Bogus[Type] = _dummy,

Callers 11

paramspec_argsFunction · 0.90
paramspec_kwargsFunction · 0.90
fill_typevarsFunction · 0.90
bind_newMethod · 0.90
visit_param_specMethod · 0.90
with_flavorMethod · 0.85
copy_modifiedMethod · 0.85
deserializeMethod · 0.85
readMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…