slither.core.declarations.import_directive
1from pathlib import Path 2from typing import Optional, TYPE_CHECKING, Dict 3 4from slither.core.source_mapping.source_mapping import SourceMapping 5 6if TYPE_CHECKING: 7 from slither.core.scope.scope import FileScope 8 9 10class Import(SourceMapping): 11 def __init__(self, filename: Path, scope: "FileScope") -> None: 12 super().__init__() 13 self._filename: Path = filename 14 self.scope: "FileScope" = scope 15 self._alias: Optional[str] = None 16 # Map local name -> original name 17 self.renaming: Dict[str, str] = {} 18 19 self._pattern = "import" 20 21 @property 22 def filename(self) -> str: 23 """ 24 Return the absolute filename 25 26 :return: 27 :rtype: 28 """ 29 return self._filename.as_posix() 30 31 @property 32 def filename_path(self) -> Path: 33 """ 34 Return the absolute filename 35 36 :return: 37 :rtype: 38 """ 39 40 return self._filename 41 42 @property 43 def alias(self) -> Optional[str]: 44 return self._alias 45 46 @alias.setter 47 def alias(self, a: str): 48 self._alias = a 49 50 def __str__(self): 51 return self.filename
11class Import(SourceMapping): 12 def __init__(self, filename: Path, scope: "FileScope") -> None: 13 super().__init__() 14 self._filename: Path = filename 15 self.scope: "FileScope" = scope 16 self._alias: Optional[str] = None 17 # Map local name -> original name 18 self.renaming: Dict[str, str] = {} 19 20 self._pattern = "import" 21 22 @property 23 def filename(self) -> str: 24 """ 25 Return the absolute filename 26 27 :return: 28 :rtype: 29 """ 30 return self._filename.as_posix() 31 32 @property 33 def filename_path(self) -> Path: 34 """ 35 Return the absolute filename 36 37 :return: 38 :rtype: 39 """ 40 41 return self._filename 42 43 @property 44 def alias(self) -> Optional[str]: 45 return self._alias 46 47 @alias.setter 48 def alias(self, a: str): 49 self._alias = a 50 51 def __str__(self): 52 return self.filename
Import(filename: pathlib.Path, scope: slither.core.scope.scope.FileScope)
12 def __init__(self, filename: Path, scope: "FileScope") -> None: 13 super().__init__() 14 self._filename: Path = filename 15 self.scope: "FileScope" = scope 16 self._alias: Optional[str] = None 17 # Map local name -> original name 18 self.renaming: Dict[str, str] = {} 19 20 self._pattern = "import"
filename: str
22 @property 23 def filename(self) -> str: 24 """ 25 Return the absolute filename 26 27 :return: 28 :rtype: 29 """ 30 return self._filename.as_posix()
Return the absolute filename