Compute import priority from an import node.
(imp: ImportBase, toplevel_priority: int)
| 621 | |
| 622 | |
| 623 | def import_priority(imp: ImportBase, toplevel_priority: int) -> int: |
| 624 | """Compute import priority from an import node.""" |
| 625 | if not imp.is_top_level: |
| 626 | # Inside a function |
| 627 | return PRI_LOW |
| 628 | if imp.is_mypy_only: |
| 629 | # Inside "if MYPY" or "if typing.TYPE_CHECKING" |
| 630 | return max(PRI_MYPY, toplevel_priority) |
| 631 | # A regular import; priority determined by argument. |
| 632 | return toplevel_priority |
| 633 | |
| 634 | |
| 635 | def load_plugins_from_config( |
no test coverage detected
searching dependent graphs…