@contextlib.contextmanager
def create_file_backed_module(code):
 with create_tempfile() as temp:
  module = test_utils.build_module(code)
  module.file = temp
  (yield module)

@ contextlib . contextmanager def create_file_backed_module ( code ) : with create_tempfile ( ) as temp : module = test_utils . build_module ( code ) module . file = temp ( yield module )
create an astroid module for the given code .