(
modules: dict[str, MypyFile], name: str, *, allow_missing: bool
)
| 387 | |
| 388 | |
| 389 | def lookup_fully_qualified_alias( |
| 390 | modules: dict[str, MypyFile], name: str, *, allow_missing: bool |
| 391 | ) -> TypeAlias: |
| 392 | stnode = lookup_fully_qualified(name, modules, raise_on_missing=not allow_missing) |
| 393 | node = stnode.node if stnode else None |
| 394 | if isinstance(node, TypeAlias): |
| 395 | return node |
| 396 | elif isinstance(node, TypeInfo): |
| 397 | if node.special_alias: |
| 398 | # Already fixed up. |
| 399 | return node.special_alias |
| 400 | if node.tuple_type: |
| 401 | alias = TypeAlias.from_tuple_type(node) |
| 402 | elif node.typeddict_type: |
| 403 | alias = TypeAlias.from_typeddict_type(node) |
| 404 | else: |
| 405 | assert allow_missing |
| 406 | return missing_alias() |
| 407 | node.special_alias = alias |
| 408 | return alias |
| 409 | else: |
| 410 | # Looks like a missing TypeAlias during an initial daemon load, put something there |
| 411 | assert ( |
| 412 | allow_missing |
| 413 | ), "Should never get here in normal mode, got {}:{} instead of TypeAlias".format( |
| 414 | type(node).__name__, node.fullname if node else "" |
| 415 | ) |
| 416 | return missing_alias() |
| 417 | |
| 418 | |
| 419 | _SUGGESTION: Final = "<missing {}: *should* have gone away during fine-grained update>" |
no test coverage detected
searching dependent graphs…