Method: pylint.lint.pylinter.PyLinter._get_file_descr_from_stdin
Calls: 6, Exceptions: 0, Paths: 2Back
Path 1: 5 calls (0.83)
'a/b.py' (2) '/Users/andrehora/Documents/git/projects-pathspotter/pylint/tests/mymodule.py' (1) 'mymodule.py' (1) 'a.py' (1)
FileItem (5) None (5)
1def _get_file_descr_from_stdin(self, filepath: str) -> Iterator[FileItem]:
2 """Return file description (tuple of module name, file path, base name) from
3 given file path.
4
5 This method is used for creating suitable file description for _check_files when the
6 source is standard input.
7 """
8 if _is_ignored_file(
9 filepath,
10 self.config.ignore,
11 self.config.ignore_patterns,
12 self.config.ignore_paths,
13 ):
14 return
15
16 try:
17 # Note that this function does not really perform an
18 # __import__ but may raise an ImportError exception, which
19 # we want to catch here.
20 modname = ".".join(astroid.modutils.modpath_from_file(filepath))
21 except ImportError:
22 modname = os.path.splitext(os.path.basename(filepath))[0]
23
24 yield FileItem(modname, filepath, filepath)
Path 2: 1 calls (0.17)
'mymodule.py' (1)
None (1)
1def _get_file_descr_from_stdin(self, filepath: str) -> Iterator[FileItem]:
2 """Return file description (tuple of module name, file path, base name) from
3 given file path.
4
5 This method is used for creating suitable file description for _check_files when the
6 source is standard input.
7 """
8 if _is_ignored_file(
9 filepath,
10 self.config.ignore,
11 self.config.ignore_patterns,
12 self.config.ignore_paths,
13 ):
14 return
15
16 try:
17 # Note that this function does not really perform an
18 # __import__ but may raise an ImportError exception, which
19 # we want to catch here.
20 modname = ".".join(astroid.modutils.modpath_from_file(filepath))
21 except ImportError:
22 modname = os.path.splitext(os.path.basename(filepath))[0]
23
24 yield FileItem(modname, filepath, filepath)