MCPcopy Create free account
hub / github.com/modelscope/ms-agent / ImportInfo

Class ImportInfo

ms_agent/utils/parser_utils.py:11–30  ·  view source on GitHub ↗

Detailed information about an import statement

Source from the content-addressed store, hash-verified

9
10@dataclass
11class ImportInfo:
12 """Detailed information about an import statement"""
13 # Source file path (resolved path)
14 source_file: str
15 # Original import statement
16 raw_statement: str
17 # What's being imported (e.g., ['User', 'UserRole'] or ['*'] or ['default'])
18 imported_items: List[str] = field(default_factory=list)
19 # Import type: 'named', 'default', 'namespace', 'side-effect'
20 import_type: str = 'named'
21 # Alias if any (e.g., 'import * as utils' -> 'utils')
22 alias: Optional[str] = None
23 # Whether this is a type-only import (TypeScript)
24 is_type_only: bool = False
25
26 def __repr__(self):
27 items_str = ', '.join(
28 self.imported_items) if self.imported_items else 'all'
29 alias_str = f' as {self.alias}' if self.alias else ''
30 return f"ImportInfo(file='{self.source_file}', items=[{items_str}]{alias_str})"
31
32
33class BaseImportParser(ABC):

Calls

no outgoing calls

Tested by

no test coverage detected