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)
| 765 | |
| 766 | |
| 767 | class 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, |
no outgoing calls
no test coverage detected
searching dependent graphs…