MCPcopy Index your code
hub / github.com/apache/airflow / write_python_script

Function write_python_script

airflow/utils/python_virtualenv.py:72–85  ·  view source on GitHub ↗

Renders the python script to a file to execute in the virtual environment. :param jinja_context: The jinja context variables to unpack and replace with its placeholders in the template file. :type jinja_context: dict :param filename: The name of the file to dump the rendere

(jinja_context: dict, filename: str)

Source from the content-addressed store, hash-verified

70
71
72def write_python_script(jinja_context: dict, filename: str):
73 """
74 Renders the python script to a file to execute in the virtual environment.
75
76 :param jinja_context: The jinja context variables to unpack and replace with its placeholders in the
77 template file.
78 :type jinja_context: dict
79 :param filename: The name of the file to dump the rendered script to.
80 :type filename: str
81 """
82 template_loader = jinja2.FileSystemLoader(searchpath=os.path.dirname(__file__))
83 template_env = jinja2.Environment(loader=template_loader, undefined=jinja2.StrictUndefined)
84 template = template_env.get_template('python_virtualenv_script.jinja2')
85 template.stream(**jinja_context).dump(filename)

Callers 1

execute_callableMethod · 0.90

Calls 1

streamMethod · 0.80

Tested by

no test coverage detected