Commit e8330efc authored by Stefan Behnel's avatar Stefan Behnel

support passing code strings into analyse()

parent 8b5aec39
......@@ -16,12 +16,14 @@ default_type_map = {
}
def analyse(source_path):
def analyse(source_path=None, code=None):
"""
Analyse a Python source code file with Jedi.
Returns a mapping from (scope-name, (line, column)) pairs to a name-types mapping.
"""
script = Script(path=source_path)
if not source_path and code is None:
raise ValueError("Either 'source_path' or 'code' is required.")
script = Script(source=code, path=source_path)
evaluator = script._evaluator
scoped_names = {}
for statements in script._parser.module().used_names.values():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment