(
self,
t: Type,
nested: bool = True,
*,
allow_param_spec: bool = False,
allow_unpack: bool = False,
allow_ellipsis: bool = False,
allow_typed_dict_special_forms: bool = False,
allow_final: bool = False,
)
| 1906 | return self.check_unpacks_in_list(res) |
| 1907 | |
| 1908 | def anal_type( |
| 1909 | self, |
| 1910 | t: Type, |
| 1911 | nested: bool = True, |
| 1912 | *, |
| 1913 | allow_param_spec: bool = False, |
| 1914 | allow_unpack: bool = False, |
| 1915 | allow_ellipsis: bool = False, |
| 1916 | allow_typed_dict_special_forms: bool = False, |
| 1917 | allow_final: bool = False, |
| 1918 | ) -> Type: |
| 1919 | if nested: |
| 1920 | self.nesting_level += 1 |
| 1921 | old_allow_typed_dict_special_forms = self.allow_typed_dict_special_forms |
| 1922 | self.allow_typed_dict_special_forms = allow_typed_dict_special_forms |
| 1923 | self.allow_final = allow_final |
| 1924 | old_allow_ellipsis = self.allow_ellipsis |
| 1925 | self.allow_ellipsis = allow_ellipsis |
| 1926 | old_allow_unpack = self.allow_unpack |
| 1927 | self.allow_unpack = allow_unpack |
| 1928 | try: |
| 1929 | analyzed = t.accept(self) |
| 1930 | finally: |
| 1931 | if nested: |
| 1932 | self.nesting_level -= 1 |
| 1933 | self.allow_typed_dict_special_forms = old_allow_typed_dict_special_forms |
| 1934 | self.allow_ellipsis = old_allow_ellipsis |
| 1935 | self.allow_unpack = old_allow_unpack |
| 1936 | if ( |
| 1937 | not allow_param_spec |
| 1938 | and isinstance(analyzed, ParamSpecType) |
| 1939 | and analyzed.flavor == ParamSpecFlavor.BARE |
| 1940 | ): |
| 1941 | if analyzed.prefix.arg_types: |
| 1942 | self.fail("Invalid location for Concatenate", t, code=codes.VALID_TYPE) |
| 1943 | self.note("You can use Concatenate as the first argument to Callable", t) |
| 1944 | analyzed = AnyType(TypeOfAny.from_error) |
| 1945 | else: |
| 1946 | self.fail( |
| 1947 | INVALID_PARAM_SPEC_LOCATION.format(format_type(analyzed, self.options)), |
| 1948 | t, |
| 1949 | code=codes.VALID_TYPE, |
| 1950 | ) |
| 1951 | self.note( |
| 1952 | INVALID_PARAM_SPEC_LOCATION_NOTE.format(analyzed.name), |
| 1953 | t, |
| 1954 | code=codes.VALID_TYPE, |
| 1955 | ) |
| 1956 | analyzed = AnyType(TypeOfAny.from_error) |
| 1957 | return analyzed |
| 1958 | |
| 1959 | def anal_var_def(self, var_def: TypeVarLikeType) -> TypeVarLikeType: |
| 1960 | if isinstance(var_def, TypeVarType): |
no test coverage detected