We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Harden maintainers linting
As addressed in https://github.com/conda-forge/pyutilib-feedstock/pull/1:

```
Running command: ['python', '/home/travis/build/conda-forge/conda-forge.github.io/scripts/update_teams.py', './feedstocks_repo/feedstocks']
Traceback (most recent call last):
  File "/home/travis/build/conda-forge/conda-forge.github.io/scripts/update_teams.py", line 85, in <module>
    contributors = data.get('extra', {}).get('recipe-maintainers', [])
AttributeError: 'list' object has no attribute 'get'
CalledProcessError: Command '['python', '/home/travis/build/conda-forge/conda-forge.github.io/scripts/update_teams.py',
```


--- 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/lint_recipe.py`
Content:
```
1 import os
2 import re
3 
4 import jinja2
5 import ruamel.yaml
6 
7 
8 EXPECTED_SECTION_ORDER = ['package', 'source', 'build', 'requirements',
9                           'test', 'app', 'about', 'extra']
10 
11 REQUIREMENTS_ORDER = ['build', 'run']
12 
13 
14 class NullUndefined(jinja2.Undefined):
15     def __unicode__(self):
16         return unicode(self._undefined_name)
17 
18 
19 def lintify(meta, recipe_dir=None):
20     lints = []
21     major_sections = list(meta.keys())
22 
23     # If the recipe_dir exists (no guarantee within this function) , we can
24     # find the meta.yaml within it.
25     meta_fname = os.path.join(recipe_dir or '', 'meta.yaml')
26 
27     # 1: Top level meta.yaml keys should have a specific order.
28     section_order_sorted = sorted(major_sections,
29                                   key=EXPECTED_SECTION_ORDER.index)
30     if major_sections != section_order_sorted:
31         lints.append('The top level meta keys are in an unexpected order. '
32                      'Expecting {}.'.format(section_order_sorted))
33 
34     # 2: The about section should have a home, license and summary.
35     for about_item in ['home', 'license', 'summary']:
36         about_section = meta.get('about', {}) or {}
37         # if the section doesn't exist, or is just empty, lint it.
38         if not about_section.get(about_item, ''):
39             lints.append('The {} item is expected in the about section.'
40                          ''.format(about_item))
41 
42     # 3: The recipe should have some maintainers.
43     extra_section = meta.get('extra', {}) or {}
44     if not extra_section.get('recipe-maintainers', []):
45         lints.append('The recipe could do with some maintainers listed in '
46                      'the "extra/recipe-maintainers" section.')
47 
48     # 4: The recipe should have some tests.
49     if 'test' not in major_sections:
50         test_files = ['run_test.py', 'run_test.sh', 'run_test.bat',
51                       'run_test.pl']
52         a_test_file_exists = (recipe_dir is not None and
53                               any(os.path.exists(os.path.join(recipe_dir,
54                                                               test_file))
55                                   for test_file in test_files))
56         if not a_test_file_exists:
57             lints.append('The recipe must have some tests.')
58 
59     # 5: License cannot be 'unknown.'
60     license = meta.get('about', {}).get('license', '').lower()
61     if 'unknown' == license.strip():
62         lints.append('The recipe license cannot be unknown.')
63 
64     # 6: Selectors should be in a tidy form.
65     if recipe_dir is not None and os.path.exists(meta_fname):
66         bad_selectors = []
67         # Good selectors look like ".*\s\s#\s[...]"
68         good_selectors_pat = re.compile(r'(.+?)\s{2,}#\s\[(.+)\](?(2).*)$')
69         with open(meta_fname, 'r') as fh:
70             for selector_line in selector_lines(fh):
71                 if not good_selectors_pat.match(selector_line):
72                     bad_selectors.append(selector_line)
73         if bad_selectors:
74             lints.append('Selectors are suggested to take a '
75                          '"  # [<selector>]" form.')
76 
77     # 7: The build section should have a build number.
78     build_section = meta.get('build', {}) or {}
79     build_number = build_section.get('number', None)
80     if build_number is None:
81         lints.append('The recipe must have a `build/number` section.')
82 
83     # 8: The build section should be before the run section in requirements.
84     requirements_section = meta.get('requirements', {}) or {}
85     requirements_order_sorted = sorted(requirements_section,
86                                        key=REQUIREMENTS_ORDER.index)
87     if requirements_section.keys() != requirements_order_sorted:
88         lints.append('The `requirements/build` section should be defined '
89                      'before the `requirements/run` section.')
90 
91     # 9: Files downloaded should have a hash.
92     source_section = meta.get('source', {}) or {}
93     if ('url' in source_section and
94             not ({'sha1', 'sha256', 'md5'} & set(source_section.keys()))):
95         lints.append('When defining a source/url please add a sha256, sha1 '
96                      'or md5 checksum (sha256 preferably).')
97 
98     return lints
99 
100 
101 def selector_lines(lines):
102     # Using the same pattern defined in conda-build (metadata.py),
103     # we identify selectors.
104     sel_pat = re.compile(r'(.+?)\s*(#.*)?\[(.+)\](?(2).*)$')
105 
106     for line in lines:
107         line = line.rstrip()
108         if line.lstrip().startswith('#'):
109             # Don't bother with comment only lines
110             continue
111         m = sel_pat.match(line)
112         if m:
113             m.group(3)
114             yield line
115 
116 
117 def main(recipe_dir):
118     recipe_dir = os.path.abspath(recipe_dir)
119     recipe_meta = os.path.join(recipe_dir, 'meta.yaml')
120     if not os.path.exists(recipe_dir):
121         raise IOError('Feedstock has no recipe/meta.yaml.')
122 
123     env = jinja2.Environment(undefined=NullUndefined)
124 
125     with open(recipe_meta, 'r') as fh:
126         content = env.from_string(''.join(fh)).render()
127         meta = ruamel.yaml.load(content, ruamel.yaml.RoundTripLoader)
128     results = lintify(meta, recipe_dir)
129     return results
130
```
--- 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/lint_recipe.py b/conda_smithy/lint_recipe.py
--- a/conda_smithy/lint_recipe.py
+++ b/conda_smithy/lint_recipe.py
@@ -16,6 +16,15 @@
         return unicode(self._undefined_name)
 
 
+def get_section(parent, name, lints):
+    section = parent.get(name, {})
+    if not isinstance(section, dict):
+        lints.append('The "{}" section was expected to be a dictionary, but '
+                     'got a {}.'.format(name, type(section).__name__))
+        section = {}
+    return section
+
+
 def lintify(meta, recipe_dir=None):
     lints = []
     major_sections = list(meta.keys())
@@ -24,6 +33,12 @@
     # find the meta.yaml within it.
     meta_fname = os.path.join(recipe_dir or '', 'meta.yaml')
 
+    source_section = get_section(meta, 'source', lints)
+    build_section = get_section(meta, 'build', lints)
+    requirements_section = get_section(meta, 'requirements', lints)
+    about_section = get_section(meta, 'about', lints)
+    extra_section = get_section(meta, 'extra', lints)
+
     # 1: Top level meta.yaml keys should have a specific order.
     section_order_sorted = sorted(major_sections,
                                   key=EXPECTED_SECTION_ORDER.index)
@@ -33,14 +48,12 @@
 
     # 2: The about section should have a home, license and summary.
     for about_item in ['home', 'license', 'summary']:
-        about_section = meta.get('about', {}) or {}
         # if the section doesn't exist, or is just empty, lint it.
         if not about_section.get(about_item, ''):
             lints.append('The {} item is expected in the about section.'
                          ''.format(about_item))
 
     # 3: The recipe should have some maintainers.
-    extra_section = meta.get('extra', {}) or {}
     if not extra_section.get('recipe-maintainers', []):
         lints.append('The recipe could do with some maintainers listed in '
                      'the "extra/recipe-maintainers" section.')
@@ -57,7 +70,7 @@
             lints.append('The recipe must have some tests.')
 
     # 5: License cannot be 'unknown.'
-    license = meta.get('about', {}).get('license', '').lower()
+    license = about_section.get('license', '').lower()
     if 'unknown' == license.strip():
         lints.append('The recipe license cannot be unknown.')
 
@@ -75,13 +88,10 @@
                          '"  # [<selector>]" form.')
 
     # 7: The build section should have a build number.
-    build_section = meta.get('build', {}) or {}
-    build_number = build_section.get('number', None)
-    if build_number is None:
+    if build_section.get('number', None) is None:
         lints.append('The recipe must have a `build/number` section.')
 
     # 8: The build section should be before the run section in requirements.
-    requirements_section = meta.get('requirements', {}) or {}
     requirements_order_sorted = sorted(requirements_section,
                                        key=REQUIREMENTS_ORDER.index)
     if requirements_section.keys() != requirements_order_sorted:
@@ -89,7 +99,6 @@
                      'before the `requirements/run` section.')
 
     # 9: Files downloaded should have a hash.
-    source_section = meta.get('source', {}) or {}
     if ('url' in source_section and
             not ({'sha1', 'sha256', 'md5'} & set(source_section.keys()))):
         lints.append('When defining a source/url please add a sha256, sha1 '

{"golden_diff": "diff --git a/conda_smithy/lint_recipe.py b/conda_smithy/lint_recipe.py\n--- a/conda_smithy/lint_recipe.py\n+++ b/conda_smithy/lint_recipe.py\n@@ -16,6 +16,15 @@\n         return unicode(self._undefined_name)\n \n \n+def get_section(parent, name, lints):\n+    section = parent.get(name, {})\n+    if not isinstance(section, dict):\n+        lints.append('The \"{}\" section was expected to be a dictionary, but '\n+                     'got a {}.'.format(name, type(section).__name__))\n+        section = {}\n+    return section\n+\n+\n def lintify(meta, recipe_dir=None):\n     lints = []\n     major_sections = list(meta.keys())\n@@ -24,6 +33,12 @@\n     # find the meta.yaml within it.\n     meta_fname = os.path.join(recipe_dir or '', 'meta.yaml')\n \n+    source_section = get_section(meta, 'source', lints)\n+    build_section = get_section(meta, 'build', lints)\n+    requirements_section = get_section(meta, 'requirements', lints)\n+    about_section = get_section(meta, 'about', lints)\n+    extra_section = get_section(meta, 'extra', lints)\n+\n     # 1: Top level meta.yaml keys should have a specific order.\n     section_order_sorted = sorted(major_sections,\n                                   key=EXPECTED_SECTION_ORDER.index)\n@@ -33,14 +48,12 @@\n \n     # 2: The about section should have a home, license and summary.\n     for about_item in ['home', 'license', 'summary']:\n-        about_section = meta.get('about', {}) or {}\n         # if the section doesn't exist, or is just empty, lint it.\n         if not about_section.get(about_item, ''):\n             lints.append('The {} item is expected in the about section.'\n                          ''.format(about_item))\n \n     # 3: The recipe should have some maintainers.\n-    extra_section = meta.get('extra', {}) or {}\n     if not extra_section.get('recipe-maintainers', []):\n         lints.append('The recipe could do with some maintainers listed in '\n                      'the \"extra/recipe-maintainers\" section.')\n@@ -57,7 +70,7 @@\n             lints.append('The recipe must have some tests.')\n \n     # 5: License cannot be 'unknown.'\n-    license = meta.get('about', {}).get('license', '').lower()\n+    license = about_section.get('license', '').lower()\n     if 'unknown' == license.strip():\n         lints.append('The recipe license cannot be unknown.')\n \n@@ -75,13 +88,10 @@\n                          '\"  # [<selector>]\" form.')\n \n     # 7: The build section should have a build number.\n-    build_section = meta.get('build', {}) or {}\n-    build_number = build_section.get('number', None)\n-    if build_number is None:\n+    if build_section.get('number', None) is None:\n         lints.append('The recipe must have a `build/number` section.')\n \n     # 8: The build section should be before the run section in requirements.\n-    requirements_section = meta.get('requirements', {}) or {}\n     requirements_order_sorted = sorted(requirements_section,\n                                        key=REQUIREMENTS_ORDER.index)\n     if requirements_section.keys() != requirements_order_sorted:\n@@ -89,7 +99,6 @@\n                      'before the `requirements/run` section.')\n \n     # 9: Files downloaded should have a hash.\n-    source_section = meta.get('source', {}) or {}\n     if ('url' in source_section and\n             not ({'sha1', 'sha256', 'md5'} & set(source_section.keys()))):\n         lints.append('When defining a source/url please add a sha256, sha1 '\n", "issue": "Harden maintainers linting\nAs addressed in https://github.com/conda-forge/pyutilib-feedstock/pull/1:\n\n```\nRunning command: ['python', '/home/travis/build/conda-forge/conda-forge.github.io/scripts/update_teams.py', './feedstocks_repo/feedstocks']\nTraceback (most recent call last):\n  File \"/home/travis/build/conda-forge/conda-forge.github.io/scripts/update_teams.py\", line 85, in <module>\n    contributors = data.get('extra', {}).get('recipe-maintainers', [])\nAttributeError: 'list' object has no attribute 'get'\nCalledProcessError: Command '['python', '/home/travis/build/conda-forge/conda-forge.github.io/scripts/update_teams.py',\n```\n\n", "before_files": [{"content": "import os\nimport re\n\nimport jinja2\nimport ruamel.yaml\n\n\nEXPECTED_SECTION_ORDER = ['package', 'source', 'build', 'requirements',\n                          'test', 'app', 'about', 'extra']\n\nREQUIREMENTS_ORDER = ['build', 'run']\n\n\nclass NullUndefined(jinja2.Undefined):\n    def __unicode__(self):\n        return unicode(self._undefined_name)\n\n\ndef lintify(meta, recipe_dir=None):\n    lints = []\n    major_sections = list(meta.keys())\n\n    # If the recipe_dir exists (no guarantee within this function) , we can\n    # find the meta.yaml within it.\n    meta_fname = os.path.join(recipe_dir or '', 'meta.yaml')\n\n    # 1: Top level meta.yaml keys should have a specific order.\n    section_order_sorted = sorted(major_sections,\n                                  key=EXPECTED_SECTION_ORDER.index)\n    if major_sections != section_order_sorted:\n        lints.append('The top level meta keys are in an unexpected order. '\n                     'Expecting {}.'.format(section_order_sorted))\n\n    # 2: The about section should have a home, license and summary.\n    for about_item in ['home', 'license', 'summary']:\n        about_section = meta.get('about', {}) or {}\n        # if the section doesn't exist, or is just empty, lint it.\n        if not about_section.get(about_item, ''):\n            lints.append('The {} item is expected in the about section.'\n                         ''.format(about_item))\n\n    # 3: The recipe should have some maintainers.\n    extra_section = meta.get('extra', {}) or {}\n    if not extra_section.get('recipe-maintainers', []):\n        lints.append('The recipe could do with some maintainers listed in '\n                     'the \"extra/recipe-maintainers\" section.')\n\n    # 4: The recipe should have some tests.\n    if 'test' not in major_sections:\n        test_files = ['run_test.py', 'run_test.sh', 'run_test.bat',\n                      'run_test.pl']\n        a_test_file_exists = (recipe_dir is not None and\n                              any(os.path.exists(os.path.join(recipe_dir,\n                                                              test_file))\n                                  for test_file in test_files))\n        if not a_test_file_exists:\n            lints.append('The recipe must have some tests.')\n\n    # 5: License cannot be 'unknown.'\n    license = meta.get('about', {}).get('license', '').lower()\n    if 'unknown' == license.strip():\n        lints.append('The recipe license cannot be unknown.')\n\n    # 6: Selectors should be in a tidy form.\n    if recipe_dir is not None and os.path.exists(meta_fname):\n        bad_selectors = []\n        # Good selectors look like \".*\\s\\s#\\s[...]\"\n        good_selectors_pat = re.compile(r'(.+?)\\s{2,}#\\s\\[(.+)\\](?(2).*)$')\n        with open(meta_fname, 'r') as fh:\n            for selector_line in selector_lines(fh):\n                if not good_selectors_pat.match(selector_line):\n                    bad_selectors.append(selector_line)\n        if bad_selectors:\n            lints.append('Selectors are suggested to take a '\n                         '\"  # [<selector>]\" form.')\n\n    # 7: The build section should have a build number.\n    build_section = meta.get('build', {}) or {}\n    build_number = build_section.get('number', None)\n    if build_number is None:\n        lints.append('The recipe must have a `build/number` section.')\n\n    # 8: The build section should be before the run section in requirements.\n    requirements_section = meta.get('requirements', {}) or {}\n    requirements_order_sorted = sorted(requirements_section,\n                                       key=REQUIREMENTS_ORDER.index)\n    if requirements_section.keys() != requirements_order_sorted:\n        lints.append('The `requirements/build` section should be defined '\n                     'before the `requirements/run` section.')\n\n    # 9: Files downloaded should have a hash.\n    source_section = meta.get('source', {}) or {}\n    if ('url' in source_section and\n            not ({'sha1', 'sha256', 'md5'} & set(source_section.keys()))):\n        lints.append('When defining a source/url please add a sha256, sha1 '\n                     'or md5 checksum (sha256 preferably).')\n\n    return lints\n\n\ndef selector_lines(lines):\n    # Using the same pattern defined in conda-build (metadata.py),\n    # we identify selectors.\n    sel_pat = re.compile(r'(.+?)\\s*(#.*)?\\[(.+)\\](?(2).*)$')\n\n    for line in lines:\n        line = line.rstrip()\n        if line.lstrip().startswith('#'):\n            # Don't bother with comment only lines\n            continue\n        m = sel_pat.match(line)\n        if m:\n            m.group(3)\n            yield line\n\n\ndef main(recipe_dir):\n    recipe_dir = os.path.abspath(recipe_dir)\n    recipe_meta = os.path.join(recipe_dir, 'meta.yaml')\n    if not os.path.exists(recipe_dir):\n        raise IOError('Feedstock has no recipe/meta.yaml.')\n\n    env = jinja2.Environment(undefined=NullUndefined)\n\n    with open(recipe_meta, 'r') as fh:\n        content = env.from_string(''.join(fh)).render()\n        meta = ruamel.yaml.load(content, ruamel.yaml.RoundTripLoader)\n    results = lintify(meta, recipe_dir)\n    return results\n", "path": "conda_smithy/lint_recipe.py"}], "after_files": [{"content": "import os\nimport re\n\nimport jinja2\nimport ruamel.yaml\n\n\nEXPECTED_SECTION_ORDER = ['package', 'source', 'build', 'requirements',\n                          'test', 'app', 'about', 'extra']\n\nREQUIREMENTS_ORDER = ['build', 'run']\n\n\nclass NullUndefined(jinja2.Undefined):\n    def __unicode__(self):\n        return unicode(self._undefined_name)\n\n\ndef get_section(parent, name, lints):\n    section = parent.get(name, {})\n    if not isinstance(section, dict):\n        lints.append('The \"{}\" section was expected to be a dictionary, but '\n                     'got a {}.'.format(name, type(section).__name__))\n        section = {}\n    return section\n\n\ndef lintify(meta, recipe_dir=None):\n    lints = []\n    major_sections = list(meta.keys())\n\n    # If the recipe_dir exists (no guarantee within this function) , we can\n    # find the meta.yaml within it.\n    meta_fname = os.path.join(recipe_dir or '', 'meta.yaml')\n\n    source_section = get_section(meta, 'source', lints)\n    build_section = get_section(meta, 'build', lints)\n    requirements_section = get_section(meta, 'requirements', lints)\n    about_section = get_section(meta, 'about', lints)\n    extra_section = get_section(meta, 'extra', lints)\n\n    # 1: Top level meta.yaml keys should have a specific order.\n    section_order_sorted = sorted(major_sections,\n                                  key=EXPECTED_SECTION_ORDER.index)\n    if major_sections != section_order_sorted:\n        lints.append('The top level meta keys are in an unexpected order. '\n                     'Expecting {}.'.format(section_order_sorted))\n\n    # 2: The about section should have a home, license and summary.\n    for about_item in ['home', 'license', 'summary']:\n        # if the section doesn't exist, or is just empty, lint it.\n        if not about_section.get(about_item, ''):\n            lints.append('The {} item is expected in the about section.'\n                         ''.format(about_item))\n\n    # 3: The recipe should have some maintainers.\n    if not extra_section.get('recipe-maintainers', []):\n        lints.append('The recipe could do with some maintainers listed in '\n                     'the \"extra/recipe-maintainers\" section.')\n\n    # 4: The recipe should have some tests.\n    if 'test' not in major_sections:\n        test_files = ['run_test.py', 'run_test.sh', 'run_test.bat',\n                      'run_test.pl']\n        a_test_file_exists = (recipe_dir is not None and\n                              any(os.path.exists(os.path.join(recipe_dir,\n                                                              test_file))\n                                  for test_file in test_files))\n        if not a_test_file_exists:\n            lints.append('The recipe must have some tests.')\n\n    # 5: License cannot be 'unknown.'\n    license = about_section.get('license', '').lower()\n    if 'unknown' == license.strip():\n        lints.append('The recipe license cannot be unknown.')\n\n    # 6: Selectors should be in a tidy form.\n    if recipe_dir is not None and os.path.exists(meta_fname):\n        bad_selectors = []\n        # Good selectors look like \".*\\s\\s#\\s[...]\"\n        good_selectors_pat = re.compile(r'(.+?)\\s{2,}#\\s\\[(.+)\\](?(2).*)$')\n        with open(meta_fname, 'r') as fh:\n            for selector_line in selector_lines(fh):\n                if not good_selectors_pat.match(selector_line):\n                    bad_selectors.append(selector_line)\n        if bad_selectors:\n            lints.append('Selectors are suggested to take a '\n                         '\"  # [<selector>]\" form.')\n\n    # 7: The build section should have a build number.\n    if build_section.get('number', None) is None:\n        lints.append('The recipe must have a `build/number` section.')\n\n    # 8: The build section should be before the run section in requirements.\n    requirements_order_sorted = sorted(requirements_section,\n                                       key=REQUIREMENTS_ORDER.index)\n    if requirements_section.keys() != requirements_order_sorted:\n        lints.append('The `requirements/build` section should be defined '\n                     'before the `requirements/run` section.')\n\n    # 9: Files downloaded should have a hash.\n    if ('url' in source_section and\n            not ({'sha1', 'sha256', 'md5'} & set(source_section.keys()))):\n        lints.append('When defining a source/url please add a sha256, sha1 '\n                     'or md5 checksum (sha256 preferably).')\n\n    return lints\n\n\ndef selector_lines(lines):\n    # Using the same pattern defined in conda-build (metadata.py),\n    # we identify selectors.\n    sel_pat = re.compile(r'(.+?)\\s*(#.*)?\\[(.+)\\](?(2).*)$')\n\n    for line in lines:\n        line = line.rstrip()\n        if line.lstrip().startswith('#'):\n            # Don't bother with comment only lines\n            continue\n        m = sel_pat.match(line)\n        if m:\n            m.group(3)\n            yield line\n\n\ndef main(recipe_dir):\n    recipe_dir = os.path.abspath(recipe_dir)\n    recipe_meta = os.path.join(recipe_dir, 'meta.yaml')\n    if not os.path.exists(recipe_dir):\n        raise IOError('Feedstock has no recipe/meta.yaml.')\n\n    env = jinja2.Environment(undefined=NullUndefined)\n\n    with open(recipe_meta, 'r') as fh:\n        content = env.from_string(''.join(fh)).render()\n        meta = ruamel.yaml.load(content, ruamel.yaml.RoundTripLoader)\n    results = lintify(meta, recipe_dir)\n    return results\n", "path": "conda_smithy/lint_recipe.py"}]}