Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def source_to_code(self, data, path, *, _optimize=-1):
source = decode_source(data)
tree = _call_with_frames_removed(compile, source, path, 'exec', ast.PyCF_ONLY_AST,
dont_inherit=True, optimize=_optimize)
tree = TypeguardTransformer().visit(tree)
ast.fix_missing_locations(tree)
return _call_with_frames_removed(compile, tree, path, 'exec',
dont_inherit=True, optimize=_optimize)