We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Simplify current version
As discuss at YunoHost Meeting 06/10/2022, remove the comment after the shipped version
Close #1522

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `tools/README-generator/make_readme.py`
Content:
```
1 #! /usr/bin/env python3
2 
3 import argparse
4 import json
5 import os
6 import yaml
7 from pathlib import Path
8 
9 from jinja2 import Environment, FileSystemLoader
10 
11 def value_for_lang(values, lang):
12      if not isinstance(values, dict):
13          return values
14      if lang in values:
15          return values[lang]
16      elif "en" in values:
17          return values["en"]
18      else:
19          return list(values.values())[0]
20 
21 def generate_READMEs(app_path: str):
22 
23     app_path = Path(app_path)
24 
25     if not app_path.exists():
26         raise Exception("App path provided doesn't exists ?!")
27 
28     manifest = json.load(open(app_path / "manifest.json"))
29     upstream = manifest.get("upstream", {})
30 
31     catalog = json.load(open(Path(os.path.abspath(__file__)).parent.parent.parent / "apps.json"))
32     from_catalog = catalog.get(manifest['id'], {})
33 
34     antifeatures_list = yaml.load(open(Path(os.path.abspath(__file__)).parent.parent.parent / "antifeatures.yml"), Loader=yaml.SafeLoader)
35     antifeatures_list = {e['id']: e for e in antifeatures_list}
36 
37     if not upstream and not (app_path / "doc" / "DISCLAIMER.md").exists():
38         print(
39             "There's no 'upstream' key in the manifest, and doc/DISCLAIMER.md doesn't exists - therefore assuming that we shall not auto-update the README.md for this app yet."
40         )
41         return
42 
43     env = Environment(loader=FileSystemLoader(Path(__file__).parent / "templates"))
44 
45     for lang, lang_suffix in [("en", ""), ("fr", "_fr")]:
46 
47         template = env.get_template(f"README{lang_suffix}.md.j2")
48 
49         if (app_path / "doc" / f"DESCRIPTION{lang_suffix}.md").exists():
50             description = (app_path / "doc" / f"DESCRIPTION{lang_suffix}.md").read_text()
51         # Fallback to english if maintainer too lazy to translate the description
52         elif (app_path / "doc" / "DESCRIPTION.md").exists():
53             description = (app_path / "doc" / "DESCRIPTION.md").read_text()
54         else:
55             description = None
56 
57         if (app_path / "doc" / "screenshots").exists():
58             screenshots = os.listdir(os.path.join(app_path, "doc", "screenshots"))
59             if ".gitkeep" in screenshots:
60                 screenshots.remove(".gitkeep")
61         else:
62             screenshots = []
63 
64         if (app_path / "doc" / f"DISCLAIMER{lang_suffix}.md").exists():
65             disclaimer = (app_path / "doc" / f"DISCLAIMER{lang_suffix}.md").read_text()
66         # Fallback to english if maintainer too lazy to translate the disclaimer idk
67         elif (app_path / "doc" / "DISCLAIMER.md").exists():
68             disclaimer = (app_path / "doc" / "DISCLAIMER.md").read_text()
69         else:
70             disclaimer = None
71 
72         # Get the current branch using git inside the app path
73         default_branch = from_catalog.get('branch', 'master')
74         current_branch = os.popen(f"git -C {app_path} rev-parse --abbrev-ref HEAD").read().strip()
75 
76         if default_branch != current_branch:
77             os.system(f"git -C {app_path} fetch origin {default_branch} 2>/dev/null")
78             default_branch_version = os.popen(f"git -C {app_path} show FETCH_HEAD:manifest.json | jq -r .version").read().strip()
79         else:
80             default_branch_version = None  # we don't care in that case
81 
82         # TODO: Add url to the documentation... and actually create that documentation :D
83         antifeatures = {a: antifeatures_list[a] for a in from_catalog.get('antifeatures', [])}
84         for k, v in antifeatures.items():
85             antifeatures[k]['title'] = value_for_lang(v['title'], lang_suffix)
86             if manifest.get("antifeatures", {}).get(k, None):
87                 antifeatures[k]['description'] = value_for_lang(manifest.get("antifeatures", {}).get(k, None), lang_suffix)
88             else:
89                 antifeatures[k]['description'] = value_for_lang(antifeatures[k]['description'], lang_suffix)
90 
91         out = template.render(
92             lang=lang,
93             upstream=upstream,
94             description=description,
95             screenshots=screenshots,
96             disclaimer=disclaimer,
97             antifeatures=antifeatures,
98             manifest=manifest,
99             current_branch=current_branch,
100             default_branch=default_branch,
101             default_branch_version=default_branch_version,
102         )
103         (app_path / f"README{lang_suffix}.md").write_text(out)
104 
105 
106 if __name__ == "__main__":
107     parser = argparse.ArgumentParser(
108         description="Automatically (re)generate README for apps"
109     )
110     parser.add_argument(
111         "app_path", help="Path to the app to generate/update READMEs for"
112     )
113 
114     args = parser.parse_args()
115     generate_READMEs(args.app_path)
116
```
--- 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/tools/README-generator/make_readme.py b/tools/README-generator/make_readme.py
--- a/tools/README-generator/make_readme.py
+++ b/tools/README-generator/make_readme.py
@@ -32,7 +32,7 @@
     from_catalog = catalog.get(manifest['id'], {})
 
     antifeatures_list = yaml.load(open(Path(os.path.abspath(__file__)).parent.parent.parent / "antifeatures.yml"), Loader=yaml.SafeLoader)
-    antifeatures_list = {e['id']: e for e in antifeatures_list}
+    antifeatures_list = { e['id']: e for e in antifeatures_list }
 
     if not upstream and not (app_path / "doc" / "DISCLAIMER.md").exists():
         print(
@@ -69,18 +69,8 @@
         else:
             disclaimer = None
 
-        # Get the current branch using git inside the app path
-        default_branch = from_catalog.get('branch', 'master')
-        current_branch = os.popen(f"git -C {app_path} rev-parse --abbrev-ref HEAD").read().strip()
-
-        if default_branch != current_branch:
-            os.system(f"git -C {app_path} fetch origin {default_branch} 2>/dev/null")
-            default_branch_version = os.popen(f"git -C {app_path} show FETCH_HEAD:manifest.json | jq -r .version").read().strip()
-        else:
-            default_branch_version = None  # we don't care in that case
-
         # TODO: Add url to the documentation... and actually create that documentation :D
-        antifeatures = {a: antifeatures_list[a] for a in from_catalog.get('antifeatures', [])}
+        antifeatures = { a: antifeatures_list[a] for a in from_catalog.get('antifeatures', [])}
         for k, v in antifeatures.items():
             antifeatures[k]['title'] = value_for_lang(v['title'], lang_suffix)
             if manifest.get("antifeatures", {}).get(k, None):
@@ -96,9 +86,6 @@
             disclaimer=disclaimer,
             antifeatures=antifeatures,
             manifest=manifest,
-            current_branch=current_branch,
-            default_branch=default_branch,
-            default_branch_version=default_branch_version,
         )
         (app_path / f"README{lang_suffix}.md").write_text(out)

{"golden_diff": "diff --git a/tools/README-generator/make_readme.py b/tools/README-generator/make_readme.py\n--- a/tools/README-generator/make_readme.py\n+++ b/tools/README-generator/make_readme.py\n@@ -32,7 +32,7 @@\n     from_catalog = catalog.get(manifest['id'], {})\n \n     antifeatures_list = yaml.load(open(Path(os.path.abspath(__file__)).parent.parent.parent / \"antifeatures.yml\"), Loader=yaml.SafeLoader)\n-    antifeatures_list = {e['id']: e for e in antifeatures_list}\n+    antifeatures_list = { e['id']: e for e in antifeatures_list }\n \n     if not upstream and not (app_path / \"doc\" / \"DISCLAIMER.md\").exists():\n         print(\n@@ -69,18 +69,8 @@\n         else:\n             disclaimer = None\n \n-        # Get the current branch using git inside the app path\n-        default_branch = from_catalog.get('branch', 'master')\n-        current_branch = os.popen(f\"git -C {app_path} rev-parse --abbrev-ref HEAD\").read().strip()\n-\n-        if default_branch != current_branch:\n-            os.system(f\"git -C {app_path} fetch origin {default_branch} 2>/dev/null\")\n-            default_branch_version = os.popen(f\"git -C {app_path} show FETCH_HEAD:manifest.json | jq -r .version\").read().strip()\n-        else:\n-            default_branch_version = None  # we don't care in that case\n-\n         # TODO: Add url to the documentation... and actually create that documentation :D\n-        antifeatures = {a: antifeatures_list[a] for a in from_catalog.get('antifeatures', [])}\n+        antifeatures = { a: antifeatures_list[a] for a in from_catalog.get('antifeatures', [])}\n         for k, v in antifeatures.items():\n             antifeatures[k]['title'] = value_for_lang(v['title'], lang_suffix)\n             if manifest.get(\"antifeatures\", {}).get(k, None):\n@@ -96,9 +86,6 @@\n             disclaimer=disclaimer,\n             antifeatures=antifeatures,\n             manifest=manifest,\n-            current_branch=current_branch,\n-            default_branch=default_branch,\n-            default_branch_version=default_branch_version,\n         )\n         (app_path / f\"README{lang_suffix}.md\").write_text(out)\n", "issue": "Simplify current version\nAs discuss at YunoHost Meeting 06/10/2022, remove the comment after the shipped version\r\nClose #1522\n", "before_files": [{"content": "#! /usr/bin/env python3\n\nimport argparse\nimport json\nimport os\nimport yaml\nfrom pathlib import Path\n\nfrom jinja2 import Environment, FileSystemLoader\n\ndef value_for_lang(values, lang):\n     if not isinstance(values, dict):\n         return values\n     if lang in values:\n         return values[lang]\n     elif \"en\" in values:\n         return values[\"en\"]\n     else:\n         return list(values.values())[0]\n\ndef generate_READMEs(app_path: str):\n\n    app_path = Path(app_path)\n\n    if not app_path.exists():\n        raise Exception(\"App path provided doesn't exists ?!\")\n\n    manifest = json.load(open(app_path / \"manifest.json\"))\n    upstream = manifest.get(\"upstream\", {})\n\n    catalog = json.load(open(Path(os.path.abspath(__file__)).parent.parent.parent / \"apps.json\"))\n    from_catalog = catalog.get(manifest['id'], {})\n\n    antifeatures_list = yaml.load(open(Path(os.path.abspath(__file__)).parent.parent.parent / \"antifeatures.yml\"), Loader=yaml.SafeLoader)\n    antifeatures_list = {e['id']: e for e in antifeatures_list}\n\n    if not upstream and not (app_path / \"doc\" / \"DISCLAIMER.md\").exists():\n        print(\n            \"There's no 'upstream' key in the manifest, and doc/DISCLAIMER.md doesn't exists - therefore assuming that we shall not auto-update the README.md for this app yet.\"\n        )\n        return\n\n    env = Environment(loader=FileSystemLoader(Path(__file__).parent / \"templates\"))\n\n    for lang, lang_suffix in [(\"en\", \"\"), (\"fr\", \"_fr\")]:\n\n        template = env.get_template(f\"README{lang_suffix}.md.j2\")\n\n        if (app_path / \"doc\" / f\"DESCRIPTION{lang_suffix}.md\").exists():\n            description = (app_path / \"doc\" / f\"DESCRIPTION{lang_suffix}.md\").read_text()\n        # Fallback to english if maintainer too lazy to translate the description\n        elif (app_path / \"doc\" / \"DESCRIPTION.md\").exists():\n            description = (app_path / \"doc\" / \"DESCRIPTION.md\").read_text()\n        else:\n            description = None\n\n        if (app_path / \"doc\" / \"screenshots\").exists():\n            screenshots = os.listdir(os.path.join(app_path, \"doc\", \"screenshots\"))\n            if \".gitkeep\" in screenshots:\n                screenshots.remove(\".gitkeep\")\n        else:\n            screenshots = []\n\n        if (app_path / \"doc\" / f\"DISCLAIMER{lang_suffix}.md\").exists():\n            disclaimer = (app_path / \"doc\" / f\"DISCLAIMER{lang_suffix}.md\").read_text()\n        # Fallback to english if maintainer too lazy to translate the disclaimer idk\n        elif (app_path / \"doc\" / \"DISCLAIMER.md\").exists():\n            disclaimer = (app_path / \"doc\" / \"DISCLAIMER.md\").read_text()\n        else:\n            disclaimer = None\n\n        # Get the current branch using git inside the app path\n        default_branch = from_catalog.get('branch', 'master')\n        current_branch = os.popen(f\"git -C {app_path} rev-parse --abbrev-ref HEAD\").read().strip()\n\n        if default_branch != current_branch:\n            os.system(f\"git -C {app_path} fetch origin {default_branch} 2>/dev/null\")\n            default_branch_version = os.popen(f\"git -C {app_path} show FETCH_HEAD:manifest.json | jq -r .version\").read().strip()\n        else:\n            default_branch_version = None  # we don't care in that case\n\n        # TODO: Add url to the documentation... and actually create that documentation :D\n        antifeatures = {a: antifeatures_list[a] for a in from_catalog.get('antifeatures', [])}\n        for k, v in antifeatures.items():\n            antifeatures[k]['title'] = value_for_lang(v['title'], lang_suffix)\n            if manifest.get(\"antifeatures\", {}).get(k, None):\n                antifeatures[k]['description'] = value_for_lang(manifest.get(\"antifeatures\", {}).get(k, None), lang_suffix)\n            else:\n                antifeatures[k]['description'] = value_for_lang(antifeatures[k]['description'], lang_suffix)\n\n        out = template.render(\n            lang=lang,\n            upstream=upstream,\n            description=description,\n            screenshots=screenshots,\n            disclaimer=disclaimer,\n            antifeatures=antifeatures,\n            manifest=manifest,\n            current_branch=current_branch,\n            default_branch=default_branch,\n            default_branch_version=default_branch_version,\n        )\n        (app_path / f\"README{lang_suffix}.md\").write_text(out)\n\n\nif __name__ == \"__main__\":\n    parser = argparse.ArgumentParser(\n        description=\"Automatically (re)generate README for apps\"\n    )\n    parser.add_argument(\n        \"app_path\", help=\"Path to the app to generate/update READMEs for\"\n    )\n\n    args = parser.parse_args()\n    generate_READMEs(args.app_path)\n", "path": "tools/README-generator/make_readme.py"}], "after_files": [{"content": "#! /usr/bin/env python3\n\nimport argparse\nimport json\nimport os\nimport yaml\nfrom pathlib import Path\n\nfrom jinja2 import Environment, FileSystemLoader\n\ndef value_for_lang(values, lang):\n     if not isinstance(values, dict):\n         return values\n     if lang in values:\n         return values[lang]\n     elif \"en\" in values:\n         return values[\"en\"]\n     else:\n         return list(values.values())[0]\n\ndef generate_READMEs(app_path: str):\n\n    app_path = Path(app_path)\n\n    if not app_path.exists():\n        raise Exception(\"App path provided doesn't exists ?!\")\n\n    manifest = json.load(open(app_path / \"manifest.json\"))\n    upstream = manifest.get(\"upstream\", {})\n\n    catalog = json.load(open(Path(os.path.abspath(__file__)).parent.parent.parent / \"apps.json\"))\n    from_catalog = catalog.get(manifest['id'], {})\n\n    antifeatures_list = yaml.load(open(Path(os.path.abspath(__file__)).parent.parent.parent / \"antifeatures.yml\"), Loader=yaml.SafeLoader)\n    antifeatures_list = { e['id']: e for e in antifeatures_list }\n\n    if not upstream and not (app_path / \"doc\" / \"DISCLAIMER.md\").exists():\n        print(\n            \"There's no 'upstream' key in the manifest, and doc/DISCLAIMER.md doesn't exists - therefore assuming that we shall not auto-update the README.md for this app yet.\"\n        )\n        return\n\n    env = Environment(loader=FileSystemLoader(Path(__file__).parent / \"templates\"))\n\n    for lang, lang_suffix in [(\"en\", \"\"), (\"fr\", \"_fr\")]:\n\n        template = env.get_template(f\"README{lang_suffix}.md.j2\")\n\n        if (app_path / \"doc\" / f\"DESCRIPTION{lang_suffix}.md\").exists():\n            description = (app_path / \"doc\" / f\"DESCRIPTION{lang_suffix}.md\").read_text()\n        # Fallback to english if maintainer too lazy to translate the description\n        elif (app_path / \"doc\" / \"DESCRIPTION.md\").exists():\n            description = (app_path / \"doc\" / \"DESCRIPTION.md\").read_text()\n        else:\n            description = None\n\n        if (app_path / \"doc\" / \"screenshots\").exists():\n            screenshots = os.listdir(os.path.join(app_path, \"doc\", \"screenshots\"))\n            if \".gitkeep\" in screenshots:\n                screenshots.remove(\".gitkeep\")\n        else:\n            screenshots = []\n\n        if (app_path / \"doc\" / f\"DISCLAIMER{lang_suffix}.md\").exists():\n            disclaimer = (app_path / \"doc\" / f\"DISCLAIMER{lang_suffix}.md\").read_text()\n        # Fallback to english if maintainer too lazy to translate the disclaimer idk\n        elif (app_path / \"doc\" / \"DISCLAIMER.md\").exists():\n            disclaimer = (app_path / \"doc\" / \"DISCLAIMER.md\").read_text()\n        else:\n            disclaimer = None\n\n        # TODO: Add url to the documentation... and actually create that documentation :D\n        antifeatures = { a: antifeatures_list[a] for a in from_catalog.get('antifeatures', [])}\n        for k, v in antifeatures.items():\n            antifeatures[k]['title'] = value_for_lang(v['title'], lang_suffix)\n            if manifest.get(\"antifeatures\", {}).get(k, None):\n                antifeatures[k]['description'] = value_for_lang(manifest.get(\"antifeatures\", {}).get(k, None), lang_suffix)\n            else:\n                antifeatures[k]['description'] = value_for_lang(antifeatures[k]['description'], lang_suffix)\n\n        out = template.render(\n            lang=lang,\n            upstream=upstream,\n            description=description,\n            screenshots=screenshots,\n            disclaimer=disclaimer,\n            antifeatures=antifeatures,\n            manifest=manifest,\n        )\n        (app_path / f\"README{lang_suffix}.md\").write_text(out)\n\n\nif __name__ == \"__main__\":\n    parser = argparse.ArgumentParser(\n        description=\"Automatically (re)generate README for apps\"\n    )\n    parser.add_argument(\n        \"app_path\", help=\"Path to the app to generate/update READMEs for\"\n    )\n\n    args = parser.parse_args()\n    generate_READMEs(args.app_path)\n", "path": "tools/README-generator/make_readme.py"}]}