We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
recipe-lint parser error on template
Issue:

`conda smithy recipe-lint` encounters a parser error when running on [this recipe](https://github.com/conda-forge/staged-recipes/pull/8838/files#diff-857178a7191e6e87c83b1b9b76ec0e19):

```
   100% (...)   ~/src/staged-recipes/recipes/itk-meshtopolydata     cf2ec104  add-itk-meshtopolydata  INSERT  conda smithy recipe-lint .    Traceback (most recent call last):
  File "/home/matt/bin/miniconda3/bin/conda-smithy", line 10, in <module>
    sys.exit(main())
  File "/home/matt/bin/miniconda3/lib/python3.7/site-packages/conda_smithy/cli.py", line 471, in main
    args.subcommand_func(args)
  File "/home/matt/bin/miniconda3/lib/python3.7/site-packages/conda_smithy/cli.py", line 366, in __call__
    return_hints=True,
  File "/home/matt/bin/miniconda3/lib/python3.7/site-packages/conda_smithy/lint_recipe.py", line 536, in main
    meta = ruamel.yaml.load(content, ruamel.yaml.RoundTripLoader)
  File "/home/matt/bin/miniconda3/lib/python3.7/site-packages/ruamel/yaml/main.py", line 935, in load
    return loader._constructor.get_single_data()
  File "/home/matt/bin/miniconda3/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 109, in get_single_data
    node = self.composer.get_single_node()
  File "/home/matt/bin/miniconda3/lib/python3.7/site-packages/ruamel/yaml/composer.py", line 78, in get_single_node
    document = self.compose_document()
  File "/home/matt/bin/miniconda3/lib/python3.7/site-packages/ruamel/yaml/composer.py", line 101, in compose_document
    node = self.compose_node(None, None)
  File "/home/matt/bin/miniconda3/lib/python3.7/site-packages/ruamel/yaml/composer.py", line 138, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/home/matt/bin/miniconda3/lib/python3.7/site-packages/ruamel/yaml/composer.py", line 218, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
  File "/home/matt/bin/miniconda3/lib/python3.7/site-packages/ruamel/yaml/composer.py", line 138, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/home/matt/bin/miniconda3/lib/python3.7/site-packages/ruamel/yaml/composer.py", line 211, in compose_mapping_node
    while not self.parser.check_event(MappingEndEvent):
  File "/home/matt/bin/miniconda3/lib/python3.7/site-packages/ruamel/yaml/parser.py", line 141, in check_event
    self.current_event = self.state()
  File "/home/matt/bin/miniconda3/lib/python3.7/site-packages/ruamel/yaml/parser.py", line 581, in parse_block_mapping_key
    token.start_mark,
ruamel.yaml.parser.ParserError: while parsing a block mapping
  in "<unicode string>", line 30, column 3:
      number: 0
      ^ (line: 30)
expected <block end>, but found '<scalar>'
  in "<unicode string>", line 35, column 71:
     ... vv itk_meshtopolydata-0.3.4-cp["0"]["2"]-cp["0"]["2"]m-macosx_10 ...
                                         ^ (line: 35)


```
<br/>
Environment (<code>conda list</code>):
<details>

```
$ conda list
# packages in environment at /home/matt/bin/miniconda3/envs/itk-recipes:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
asn1crypto                0.24.0                py37_1003    conda-forge
beautifulsoup4            4.7.1                 py37_1001    conda-forge
bzip2                     1.0.8                h516909a_0    conda-forge
ca-certificates           2019.6.16            hecc5488_0    conda-forge
certifi                   2019.6.16                py37_1    conda-forge
cffi                      1.12.3           py37h8022711_0    conda-forge
chardet                   3.0.4                 py37_1003    conda-forge
click                     7.0                        py_0    conda-forge
conda                     4.7.5                    py37_0    conda-forge
conda-build               3.18.7                   py37_1    conda-forge
conda-package-handling    1.3.11                   py37_0    conda-forge
conda-verify              3.1.1                 py37_1000    conda-forge
cryptography              2.7              py37h72c5cf5_0    conda-forge
filelock                  3.0.10                     py_0    conda-forge
future                    0.17.1                py37_1000    conda-forge
glob2                     0.7                        py_0    conda-forge
icu                       58.2              hf484d3e_1000    conda-forge
idna                      2.8                   py37_1000    conda-forge
jinja2                    2.10.1                     py_0    conda-forge
libarchive                3.3.3             hb44662c_1005    conda-forge
libffi                    3.2.1             he1b5a44_1006    conda-forge
libgcc-ng                 9.1.0                hdf63c60_0  
libiconv                  1.15              h516909a_1005    conda-forge
liblief                   0.9.0                hf8a498c_1    conda-forge
libstdcxx-ng              9.1.0                hdf63c60_0  
libxml2                   2.9.9                h13577e0_1    conda-forge
lz4-c                     1.8.3             he1b5a44_1001    conda-forge
lzo                       2.10              h14c3975_1000    conda-forge
markupsafe                1.1.1            py37h14c3975_0    conda-forge
ncurses                   6.1               hf484d3e_1002    conda-forge
openssl                   1.1.1c               h516909a_0    conda-forge
patchelf                  0.10                 he1b5a44_0    conda-forge
pip                       19.1.1                   py37_0    conda-forge
pkginfo                   1.5.0.1                    py_0    conda-forge
psutil                    5.6.3            py37h516909a_0    conda-forge
py-lief                   0.9.0            py37he1b5a44_1    conda-forge
pycosat                   0.6.3           py37h14c3975_1001    conda-forge
pycparser                 2.19                     py37_1    conda-forge
pyopenssl                 19.0.0                   py37_0    conda-forge
pysocks                   1.7.0                    py37_0    conda-forge
python                    3.7.3                h33d41f4_1    conda-forge
python-libarchive-c       2.8                   py37_1004    conda-forge
pytz                      2019.1                     py_0    conda-forge
pyyaml                    5.1.1            py37h516909a_0    conda-forge
readline                  8.0                  hf8c457e_0    conda-forge
requests                  2.22.0                   py37_1    conda-forge
ruamel_yaml               0.15.71         py37h14c3975_1000    conda-forge
setuptools                41.0.1                   py37_0    conda-forge
six                       1.12.0                py37_1000    conda-forge
soupsieve                 1.9.2                    py37_0    conda-forge
sqlite                    3.29.0               hcee41ef_0    conda-forge
tk                        8.6.9             hed695b0_1002    conda-forge
tqdm                      4.32.2                     py_0    conda-forge
urllib3                   1.25.3                   py37_0    conda-forge
wheel                     0.33.4                   py37_0    conda-forge
xz                        5.2.4             h14c3975_1001    conda-forge
yaml                      0.1.7             h14c3975_1001    conda-forge
zlib                      1.2.11            h516909a_1005    conda-forge
zstd                      1.4.0                h3b9ef0a_0    conda-forge

```
</details>

<br/>
Details about  <code>conda</code> and system ( <code>conda info</code> ):
<details>

```
$ conda info

     active environment : itk-recipes
    active env location : /home/matt/bin/miniconda3/envs/itk-recipes
            shell level : 2
       user config file : /home/matt/.condarc
 populated config files : /home/matt/.condarc
          conda version : 4.7.8
    conda-build version : 3.18.8
         python version : 3.7.3.final.0
       virtual packages : __cuda=9.1
       base environment : /home/matt/bin/miniconda3  (writable)
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/matt/bin/miniconda3/pkgs
                          /home/matt/.conda/pkgs
       envs directories : /home/matt/bin/miniconda3/envs
                          /home/matt/.conda/envs
               platform : linux-64
             user-agent : conda/4.7.8 requests/2.21.0 CPython/3.7.3 Linux/4.15.0-54-generic ubuntu/18.04.2 glibc/2.27
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False


```
</details>

@scopatz @ocefpaf 

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `conda_smithy/utils.py`
Content:
```
1 import shutil
2 import tempfile
3 import jinja2
4 import datetime
5 import time
6 import os
7 from collections import defaultdict
8 from contextlib import contextmanager
9 
10 import ruamel.yaml
11 
12 
13 # define global yaml API
14 # roundrip-loader and allowing duplicate keys
15 # for handling # [filter] / # [not filter]
16 yaml = ruamel.yaml.YAML(typ='rt')
17 yaml.allow_duplicate_keys = True
18 
19 
20 @contextmanager
21 def tmp_directory():
22     tmp_dir = tempfile.mkdtemp("_recipe")
23     yield tmp_dir
24     shutil.rmtree(tmp_dir)
25 
26 
27 class NullUndefined(jinja2.Undefined):
28     def __unicode__(self):
29         return self._undefined_name
30 
31     def __getattr__(self, name):
32         return "{}.{}".format(self, name)
33 
34     def __getitem__(self, name):
35         return '{}["{}"]'.format(self, name)
36 
37 
38 class MockOS(dict):
39     def __init__(self):
40         self.environ = defaultdict(lambda: "")
41         self.sep = "/"
42 
43 
44 def render_meta_yaml(text):
45     env = jinja2.Environment(undefined=NullUndefined)
46 
47     # stub out cb3 jinja2 functions - they are not important for linting
48     #    if we don't stub them out, the ruamel.yaml load fails to interpret them
49     #    we can't just use conda-build's api.render functionality, because it would apply selectors
50     env.globals.update(
51         dict(
52             compiler=lambda x: x + "_compiler_stub",
53             pin_subpackage=lambda *args, **kwargs: "subpackage_stub",
54             pin_compatible=lambda *args, **kwargs: "compatible_pin_stub",
55             cdt=lambda *args, **kwargs: "cdt_stub",
56             load_file_regex=lambda *args, **kwargs: defaultdict(lambda: ""),
57             datetime=datetime,
58             time=time,
59             target_platform="linux-64",
60         )
61     )
62     mockos = MockOS()
63     content = env.from_string(text).render(os=mockos, environ=mockos.environ)
64     return content
65 
66 
67 @contextmanager
68 def update_conda_forge_config(feedstock_directory):
69     """Utility method used to update conda forge configuration files
70 
71     Uage:
72     >>> with update_conda_forge_config(somepath) as cfg:
73     ...     cfg['foo'] = 'bar'
74     """
75     forge_yaml = os.path.join(feedstock_directory, "conda-forge.yml")
76     if os.path.exists(forge_yaml):
77         with open(forge_yaml, "r") as fh:
78             code = yaml.load(fh)
79     else:
80         code = {}
81 
82     # Code could come in as an empty list.
83     if not code:
84         code = {}
85 
86     yield code
87 
88     with open(forge_yaml, "w") as fh:
89         fh.write(yaml.dump(code))
90
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/conda_smithy/utils.py b/conda_smithy/utils.py
--- a/conda_smithy/utils.py
+++ b/conda_smithy/utils.py
@@ -4,6 +4,7 @@
 import datetime
 import time
 import os
+import sys
 from collections import defaultdict
 from contextlib import contextmanager
 
@@ -13,7 +14,7 @@
 # define global yaml API
 # roundrip-loader and allowing duplicate keys
 # for handling # [filter] / # [not filter]
-yaml = ruamel.yaml.YAML(typ='rt')
+yaml = ruamel.yaml.YAML(typ="rt")
 yaml.allow_duplicate_keys = True
 
 
@@ -60,7 +61,9 @@
         )
     )
     mockos = MockOS()
-    content = env.from_string(text).render(os=mockos, environ=mockos.environ)
+    py_ver = "3.7"
+    context = {"os": mockos, "environ": mockos.environ, "PY_VER": py_ver}
+    content = env.from_string(text).render(context)
     return content

{"golden_diff": "diff --git a/conda_smithy/utils.py b/conda_smithy/utils.py\n--- a/conda_smithy/utils.py\n+++ b/conda_smithy/utils.py\n@@ -4,6 +4,7 @@\n import datetime\n import time\n import os\n+import sys\n from collections import defaultdict\n from contextlib import contextmanager\n \n@@ -13,7 +14,7 @@\n # define global yaml API\n # roundrip-loader and allowing duplicate keys\n # for handling # [filter] / # [not filter]\n-yaml = ruamel.yaml.YAML(typ='rt')\n+yaml = ruamel.yaml.YAML(typ=\"rt\")\n yaml.allow_duplicate_keys = True\n \n \n@@ -60,7 +61,9 @@\n         )\n     )\n     mockos = MockOS()\n-    content = env.from_string(text).render(os=mockos, environ=mockos.environ)\n+    py_ver = \"3.7\"\n+    context = {\"os\": mockos, \"environ\": mockos.environ, \"PY_VER\": py_ver}\n+    content = env.from_string(text).render(context)\n     return content\n", "issue": "recipe-lint parser error on template\nIssue:\r\n\r\n`conda smithy recipe-lint` encounters a parser error when running on [this recipe](https://github.com/conda-forge/staged-recipes/pull/8838/files#diff-857178a7191e6e87c83b1b9b76ec0e19):\r\n\r\n```\r\n \uf240  100% (...) \ue0b0 \uf07c ~/src/staged-recipes/recipes/itk-meshtopolydata \ue0b0 \uf113  \ue729 cf2ec104 \uf126 add-itk-meshtopolydata \ue0b0 INSERT \ue0b0 conda smithy recipe-lint .    Traceback (most recent call last):\r\n  File \"/home/matt/bin/miniconda3/bin/conda-smithy\", line 10, in <module>\r\n    sys.exit(main())\r\n  File \"/home/matt/bin/miniconda3/lib/python3.7/site-packages/conda_smithy/cli.py\", line 471, in main\r\n    args.subcommand_func(args)\r\n  File \"/home/matt/bin/miniconda3/lib/python3.7/site-packages/conda_smithy/cli.py\", line 366, in __call__\r\n    return_hints=True,\r\n  File \"/home/matt/bin/miniconda3/lib/python3.7/site-packages/conda_smithy/lint_recipe.py\", line 536, in main\r\n    meta = ruamel.yaml.load(content, ruamel.yaml.RoundTripLoader)\r\n  File \"/home/matt/bin/miniconda3/lib/python3.7/site-packages/ruamel/yaml/main.py\", line 935, in load\r\n    return loader._constructor.get_single_data()\r\n  File \"/home/matt/bin/miniconda3/lib/python3.7/site-packages/ruamel/yaml/constructor.py\", line 109, in get_single_data\r\n    node = self.composer.get_single_node()\r\n  File \"/home/matt/bin/miniconda3/lib/python3.7/site-packages/ruamel/yaml/composer.py\", line 78, in get_single_node\r\n    document = self.compose_document()\r\n  File \"/home/matt/bin/miniconda3/lib/python3.7/site-packages/ruamel/yaml/composer.py\", line 101, in compose_document\r\n    node = self.compose_node(None, None)\r\n  File \"/home/matt/bin/miniconda3/lib/python3.7/site-packages/ruamel/yaml/composer.py\", line 138, in compose_node\r\n    node = self.compose_mapping_node(anchor)\r\n  File \"/home/matt/bin/miniconda3/lib/python3.7/site-packages/ruamel/yaml/composer.py\", line 218, in compose_mapping_node\r\n    item_value = self.compose_node(node, item_key)\r\n  File \"/home/matt/bin/miniconda3/lib/python3.7/site-packages/ruamel/yaml/composer.py\", line 138, in compose_node\r\n    node = self.compose_mapping_node(anchor)\r\n  File \"/home/matt/bin/miniconda3/lib/python3.7/site-packages/ruamel/yaml/composer.py\", line 211, in compose_mapping_node\r\n    while not self.parser.check_event(MappingEndEvent):\r\n  File \"/home/matt/bin/miniconda3/lib/python3.7/site-packages/ruamel/yaml/parser.py\", line 141, in check_event\r\n    self.current_event = self.state()\r\n  File \"/home/matt/bin/miniconda3/lib/python3.7/site-packages/ruamel/yaml/parser.py\", line 581, in parse_block_mapping_key\r\n    token.start_mark,\r\nruamel.yaml.parser.ParserError: while parsing a block mapping\r\n  in \"<unicode string>\", line 30, column 3:\r\n      number: 0\r\n      ^ (line: 30)\r\nexpected <block end>, but found '<scalar>'\r\n  in \"<unicode string>\", line 35, column 71:\r\n     ... vv itk_meshtopolydata-0.3.4-cp[\"0\"][\"2\"]-cp[\"0\"][\"2\"]m-macosx_10 ...\r\n                                         ^ (line: 35)\r\n\r\n\r\n```\r\n<br/>\r\nEnvironment (<code>conda list</code>):\r\n<details>\r\n\r\n```\r\n$ conda list\r\n# packages in environment at /home/matt/bin/miniconda3/envs/itk-recipes:\r\n#\r\n# Name                    Version                   Build  Channel\r\n_libgcc_mutex             0.1                        main  \r\nasn1crypto                0.24.0                py37_1003    conda-forge\r\nbeautifulsoup4            4.7.1                 py37_1001    conda-forge\r\nbzip2                     1.0.8                h516909a_0    conda-forge\r\nca-certificates           2019.6.16            hecc5488_0    conda-forge\r\ncertifi                   2019.6.16                py37_1    conda-forge\r\ncffi                      1.12.3           py37h8022711_0    conda-forge\r\nchardet                   3.0.4                 py37_1003    conda-forge\r\nclick                     7.0                        py_0    conda-forge\r\nconda                     4.7.5                    py37_0    conda-forge\r\nconda-build               3.18.7                   py37_1    conda-forge\r\nconda-package-handling    1.3.11                   py37_0    conda-forge\r\nconda-verify              3.1.1                 py37_1000    conda-forge\r\ncryptography              2.7              py37h72c5cf5_0    conda-forge\r\nfilelock                  3.0.10                     py_0    conda-forge\r\nfuture                    0.17.1                py37_1000    conda-forge\r\nglob2                     0.7                        py_0    conda-forge\r\nicu                       58.2              hf484d3e_1000    conda-forge\r\nidna                      2.8                   py37_1000    conda-forge\r\njinja2                    2.10.1                     py_0    conda-forge\r\nlibarchive                3.3.3             hb44662c_1005    conda-forge\r\nlibffi                    3.2.1             he1b5a44_1006    conda-forge\r\nlibgcc-ng                 9.1.0                hdf63c60_0  \r\nlibiconv                  1.15              h516909a_1005    conda-forge\r\nliblief                   0.9.0                hf8a498c_1    conda-forge\r\nlibstdcxx-ng              9.1.0                hdf63c60_0  \r\nlibxml2                   2.9.9                h13577e0_1    conda-forge\r\nlz4-c                     1.8.3             he1b5a44_1001    conda-forge\r\nlzo                       2.10              h14c3975_1000    conda-forge\r\nmarkupsafe                1.1.1            py37h14c3975_0    conda-forge\r\nncurses                   6.1               hf484d3e_1002    conda-forge\r\nopenssl                   1.1.1c               h516909a_0    conda-forge\r\npatchelf                  0.10                 he1b5a44_0    conda-forge\r\npip                       19.1.1                   py37_0    conda-forge\r\npkginfo                   1.5.0.1                    py_0    conda-forge\r\npsutil                    5.6.3            py37h516909a_0    conda-forge\r\npy-lief                   0.9.0            py37he1b5a44_1    conda-forge\r\npycosat                   0.6.3           py37h14c3975_1001    conda-forge\r\npycparser                 2.19                     py37_1    conda-forge\r\npyopenssl                 19.0.0                   py37_0    conda-forge\r\npysocks                   1.7.0                    py37_0    conda-forge\r\npython                    3.7.3                h33d41f4_1    conda-forge\r\npython-libarchive-c       2.8                   py37_1004    conda-forge\r\npytz                      2019.1                     py_0    conda-forge\r\npyyaml                    5.1.1            py37h516909a_0    conda-forge\r\nreadline                  8.0                  hf8c457e_0    conda-forge\r\nrequests                  2.22.0                   py37_1    conda-forge\r\nruamel_yaml               0.15.71         py37h14c3975_1000    conda-forge\r\nsetuptools                41.0.1                   py37_0    conda-forge\r\nsix                       1.12.0                py37_1000    conda-forge\r\nsoupsieve                 1.9.2                    py37_0    conda-forge\r\nsqlite                    3.29.0               hcee41ef_0    conda-forge\r\ntk                        8.6.9             hed695b0_1002    conda-forge\r\ntqdm                      4.32.2                     py_0    conda-forge\r\nurllib3                   1.25.3                   py37_0    conda-forge\r\nwheel                     0.33.4                   py37_0    conda-forge\r\nxz                        5.2.4             h14c3975_1001    conda-forge\r\nyaml                      0.1.7             h14c3975_1001    conda-forge\r\nzlib                      1.2.11            h516909a_1005    conda-forge\r\nzstd                      1.4.0                h3b9ef0a_0    conda-forge\r\n\r\n```\r\n</details>\r\n\r\n<br/>\r\nDetails about  <code>conda</code> and system ( <code>conda info</code> ):\r\n<details>\r\n\r\n```\r\n$ conda info\r\n\r\n     active environment : itk-recipes\r\n    active env location : /home/matt/bin/miniconda3/envs/itk-recipes\r\n            shell level : 2\r\n       user config file : /home/matt/.condarc\r\n populated config files : /home/matt/.condarc\r\n          conda version : 4.7.8\r\n    conda-build version : 3.18.8\r\n         python version : 3.7.3.final.0\r\n       virtual packages : __cuda=9.1\r\n       base environment : /home/matt/bin/miniconda3  (writable)\r\n           channel URLs : https://conda.anaconda.org/conda-forge/linux-64\r\n                          https://conda.anaconda.org/conda-forge/noarch\r\n                          https://repo.anaconda.com/pkgs/main/linux-64\r\n                          https://repo.anaconda.com/pkgs/main/noarch\r\n                          https://repo.anaconda.com/pkgs/r/linux-64\r\n                          https://repo.anaconda.com/pkgs/r/noarch\r\n          package cache : /home/matt/bin/miniconda3/pkgs\r\n                          /home/matt/.conda/pkgs\r\n       envs directories : /home/matt/bin/miniconda3/envs\r\n                          /home/matt/.conda/envs\r\n               platform : linux-64\r\n             user-agent : conda/4.7.8 requests/2.21.0 CPython/3.7.3 Linux/4.15.0-54-generic ubuntu/18.04.2 glibc/2.27\r\n                UID:GID : 1000:1000\r\n             netrc file : None\r\n           offline mode : False\r\n\r\n\r\n```\r\n</details>\r\n\r\n@scopatz @ocefpaf \n", "before_files": [{"content": "import shutil\nimport tempfile\nimport jinja2\nimport datetime\nimport time\nimport os\nfrom collections import defaultdict\nfrom contextlib import contextmanager\n\nimport ruamel.yaml\n\n\n# define global yaml API\n# roundrip-loader and allowing duplicate keys\n# for handling # [filter] / # [not filter]\nyaml = ruamel.yaml.YAML(typ='rt')\nyaml.allow_duplicate_keys = True\n\n\n@contextmanager\ndef tmp_directory():\n    tmp_dir = tempfile.mkdtemp(\"_recipe\")\n    yield tmp_dir\n    shutil.rmtree(tmp_dir)\n\n\nclass NullUndefined(jinja2.Undefined):\n    def __unicode__(self):\n        return self._undefined_name\n\n    def __getattr__(self, name):\n        return \"{}.{}\".format(self, name)\n\n    def __getitem__(self, name):\n        return '{}[\"{}\"]'.format(self, name)\n\n\nclass MockOS(dict):\n    def __init__(self):\n        self.environ = defaultdict(lambda: \"\")\n        self.sep = \"/\"\n\n\ndef render_meta_yaml(text):\n    env = jinja2.Environment(undefined=NullUndefined)\n\n    # stub out cb3 jinja2 functions - they are not important for linting\n    #    if we don't stub them out, the ruamel.yaml load fails to interpret them\n    #    we can't just use conda-build's api.render functionality, because it would apply selectors\n    env.globals.update(\n        dict(\n            compiler=lambda x: x + \"_compiler_stub\",\n            pin_subpackage=lambda *args, **kwargs: \"subpackage_stub\",\n            pin_compatible=lambda *args, **kwargs: \"compatible_pin_stub\",\n            cdt=lambda *args, **kwargs: \"cdt_stub\",\n            load_file_regex=lambda *args, **kwargs: defaultdict(lambda: \"\"),\n            datetime=datetime,\n            time=time,\n            target_platform=\"linux-64\",\n        )\n    )\n    mockos = MockOS()\n    content = env.from_string(text).render(os=mockos, environ=mockos.environ)\n    return content\n\n\n@contextmanager\ndef update_conda_forge_config(feedstock_directory):\n    \"\"\"Utility method used to update conda forge configuration files\n\n    Uage:\n    >>> with update_conda_forge_config(somepath) as cfg:\n    ...     cfg['foo'] = 'bar'\n    \"\"\"\n    forge_yaml = os.path.join(feedstock_directory, \"conda-forge.yml\")\n    if os.path.exists(forge_yaml):\n        with open(forge_yaml, \"r\") as fh:\n            code = yaml.load(fh)\n    else:\n        code = {}\n\n    # Code could come in as an empty list.\n    if not code:\n        code = {}\n\n    yield code\n\n    with open(forge_yaml, \"w\") as fh:\n        fh.write(yaml.dump(code))\n", "path": "conda_smithy/utils.py"}], "after_files": [{"content": "import shutil\nimport tempfile\nimport jinja2\nimport datetime\nimport time\nimport os\nimport sys\nfrom collections import defaultdict\nfrom contextlib import contextmanager\n\nimport ruamel.yaml\n\n\n# define global yaml API\n# roundrip-loader and allowing duplicate keys\n# for handling # [filter] / # [not filter]\nyaml = ruamel.yaml.YAML(typ=\"rt\")\nyaml.allow_duplicate_keys = True\n\n\n@contextmanager\ndef tmp_directory():\n    tmp_dir = tempfile.mkdtemp(\"_recipe\")\n    yield tmp_dir\n    shutil.rmtree(tmp_dir)\n\n\nclass NullUndefined(jinja2.Undefined):\n    def __unicode__(self):\n        return self._undefined_name\n\n    def __getattr__(self, name):\n        return \"{}.{}\".format(self, name)\n\n    def __getitem__(self, name):\n        return '{}[\"{}\"]'.format(self, name)\n\n\nclass MockOS(dict):\n    def __init__(self):\n        self.environ = defaultdict(lambda: \"\")\n        self.sep = \"/\"\n\n\ndef render_meta_yaml(text):\n    env = jinja2.Environment(undefined=NullUndefined)\n\n    # stub out cb3 jinja2 functions - they are not important for linting\n    #    if we don't stub them out, the ruamel.yaml load fails to interpret them\n    #    we can't just use conda-build's api.render functionality, because it would apply selectors\n    env.globals.update(\n        dict(\n            compiler=lambda x: x + \"_compiler_stub\",\n            pin_subpackage=lambda *args, **kwargs: \"subpackage_stub\",\n            pin_compatible=lambda *args, **kwargs: \"compatible_pin_stub\",\n            cdt=lambda *args, **kwargs: \"cdt_stub\",\n            load_file_regex=lambda *args, **kwargs: defaultdict(lambda: \"\"),\n            datetime=datetime,\n            time=time,\n            target_platform=\"linux-64\",\n        )\n    )\n    mockos = MockOS()\n    py_ver = \"3.7\"\n    context = {\"os\": mockos, \"environ\": mockos.environ, \"PY_VER\": py_ver}\n    content = env.from_string(text).render(context)\n    return content\n\n\n@contextmanager\ndef update_conda_forge_config(feedstock_directory):\n    \"\"\"Utility method used to update conda forge configuration files\n\n    Uage:\n    >>> with update_conda_forge_config(somepath) as cfg:\n    ...     cfg['foo'] = 'bar'\n    \"\"\"\n    forge_yaml = os.path.join(feedstock_directory, \"conda-forge.yml\")\n    if os.path.exists(forge_yaml):\n        with open(forge_yaml, \"r\") as fh:\n            code = yaml.load(fh)\n    else:\n        code = {}\n\n    # Code could come in as an empty list.\n    if not code:\n        code = {}\n\n    yield code\n\n    with open(forge_yaml, \"w\") as fh:\n        fh.write(yaml.dump(code))\n", "path": "conda_smithy/utils.py"}]}