(self, value: object, n: AST)
| 2077 | return self.invalid_type(n) |
| 2078 | |
| 2079 | def numeric_type(self, value: object, n: AST) -> Type: |
| 2080 | # The node's field has the type complex, but complex isn't *really* |
| 2081 | # a parent of int and float, and this causes isinstance below |
| 2082 | # to think that the complex branch is always picked. Avoid |
| 2083 | # this by throwing away the type. |
| 2084 | if isinstance(value, int): |
| 2085 | numeric_value: int | None = value |
| 2086 | type_name = "builtins.int" |
| 2087 | else: |
| 2088 | # Other kinds of numbers (floats, complex) are not valid parameters for |
| 2089 | # RawExpressionType so we just pass in 'None' for now. We'll report the |
| 2090 | # appropriate error at a later stage. |
| 2091 | numeric_value = None |
| 2092 | type_name = f"builtins.{type(value).__name__}" |
| 2093 | return RawExpressionType( |
| 2094 | numeric_value, type_name, line=self.line, column=getattr(n, "col_offset", -1) |
| 2095 | ) |
| 2096 | |
| 2097 | def visit_Slice(self, n: ast3.Slice) -> Type: |
| 2098 | return self.invalid_type(n, note="did you mean to use ',' instead of ':' ?") |
no test coverage detected