MCPcopy Index your code
hub / github.com/python/cpython / resolve

Function resolve

Tools/c-analyzer/c_parser/source.py:5–19  ·  view source on GitHub ↗
(source, filename)

Source from the content-addressed store, hash-verified

3
4
5def resolve(source, filename):
6 if _looks_like_filename(source):
7 return _resolve_filename(source, filename)
8
9 if isinstance(source, str):
10 source = source.splitlines()
11
12 # At this point "source" is not a str.
13 if not filename:
14 filename = None
15 elif not isinstance(filename, str):
16 raise TypeError(f'filename should be str (or None), got {filename!r}')
17 else:
18 filename, _ = _resolve_filename(filename)
19 return source, filename
20
21
22@contextlib.contextmanager

Callers 2

openedFunction · 0.70
parse_function_bodyFunction · 0.50

Calls 3

_looks_like_filenameFunction · 0.85
_resolve_filenameFunction · 0.85
splitlinesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…