def _literals_to_types(evaluator, result): # Changes literals ('a', 1, 1.0, etc) to its type instances (str(), # int(), float(), etc). for i, r in enumerate(result): if is_literal(r): # Literals are only valid as long as the operations are # correct. Otherwise add a value-free instance. cls = builtin.get_by_name(r.name.get_code()) result[i] = evaluator.execute(cls)[0] return list(set(result))
def _literals_to_types(evaluator, result): # Changes literals ('a', 1, 1.0, etc) to its type instances (str(), # int(), float(), etc). for i, r in enumerate(result): if is_literal(r): # Literals are only valid as long as the operations are # correct. Otherwise add a value-free instance. cls = builtin.get_by_name(r.name) from jedi.evaluate import representation as er result[i] = er.Instance(evaluator, cls) return list(set(result))