We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Implement automatic update of .po file 
The .po file needs to be updated with all static strings for translation, by running the `python manage.py makemessages`. This needs to be run upon any change to templates or database content.

This process should be automated on Travis to run when any such files are updated on `develop`.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `infrastructure/crowdin/crowdin_bot_python_package/crowdin_bot/get_complete_translations.py`
Content:
```
1 """Script to print list of file paths of all completely translated files for a given language."""
2 
3 import os
4 import argparse
5 
6 from crowdin_bot import api
7 
8 SOURCE_LANGUAGE = "en"
9 
10 def get_language_info(language):
11     """Get xml tree from language info api call.
12 
13     Args:
14         language: (str) crowdin language code
15 
16     Returns:
17         lxml.etree object
18     """
19     return api.api_call_xml(
20         "language-status",
21         language=language
22     )
23 
24 def process_item(item, parent_path=None, csu_language_code=None):
25     """Return list of completely translated file paths in a given directory tree node.
26 
27     Args:
28         item: (etree.Element): itemm node in language-status xml tree
29             (see https://support.crowdin.com/api/language-status/)
30         parent_path: (str) path to the translated file node (None if the current item is
31             the root of the directory tree).
32         csu_language_code: (str) Language code (in locale format) on CSU end
33             (may differ from crowdin language code according to language mapping
34             in yaml file)
35 
36     Returns:
37         (list) list of file paths that are completely translated
38     """
39     if item.find("node_type").text == "file":
40         filename = item.find("name").text
41         if parent_path:
42             path = os.path.join(parent_path, filename)
43         else:
44             path = filename
45 
46         # Skip full translated check for *.po - they can always be included
47         if filename.endswith(".po"):
48             return [path]
49 
50         if item.find("phrases").text == item.find("approved").text:
51             return [path]
52         else:
53             return []
54 
55     else:
56         inner_nodes = item.find("files")
57         dirname = item.find("name").text
58         if dirname == SOURCE_LANGUAGE:
59             dirname = csu_language_code
60         if parent_path:
61             path = os.path.join(parent_path, dirname)
62         else:
63             path = dirname
64         completed = []
65         for inner_node in inner_nodes:
66             completed += process_item(inner_node, parent_path=path, csu_language_code=csu_language_code)
67         return completed
68 
69 
70 if __name__ == "__main__":
71     parser = argparse.ArgumentParser()
72     parser.add_argument('--crowdin-code', required=True,
73                         help='Crowdin language code for target language')
74     parser.add_argument('--csu-code', required=True,
75                         help='CSU language code for target language')
76     args = parser.parse_args()
77     lang_info = get_language_info(args.crowdin_code)
78     files = lang_info.find("files")
79     completed = []
80     for item in files:
81         completed += process_item(item, csu_language_code=args.csu_code)
82     print('\n'.join(completed))
83
```

Path: `infrastructure/crowdin/crowdin_bot_python_package/crowdin_bot/get_crowdin_languages.py`
Content:
```
1 """Script to print list of all crowdin language codes for project."""
2 
3 from crowdin_bot import api
4 
5 NS_DICT = {
6     'ns': "urn:oasis:names:tc:xliff:document:1.2"
7 }
8 
9 def get_project_languages():
10     """Get list of crowdin language codes.
11 
12     Returns:
13         (list) list of project crowdin language codes
14     """
15     info_xml = api.api_call_xml("info")
16     languages = info_xml.find('languages')
17     translatable_languages = []
18     for language in languages:
19         # Check it's not the incontext pseudo language
20         if language.find("can_translate").text == "1":
21             translatable_languages.append(language.find('code').text)
22     return translatable_languages
23 
24 if __name__ == "__main__":
25     print('\n'.join(get_project_languages()))
26
```
--- 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/infrastructure/crowdin/crowdin_bot_python_package/crowdin_bot/get_complete_translations.py b/infrastructure/crowdin/crowdin_bot_python_package/crowdin_bot/get_complete_translations.py
--- a/infrastructure/crowdin/crowdin_bot_python_package/crowdin_bot/get_complete_translations.py
+++ b/infrastructure/crowdin/crowdin_bot_python_package/crowdin_bot/get_complete_translations.py
@@ -43,9 +43,9 @@
         else:
             path = filename
 
-        # Skip full translated check for *.po - they can always be included
+        # Skip *.po - they are handled separately
         if filename.endswith(".po"):
-            return [path]
+            return []
 
         if item.find("phrases").text == item.find("approved").text:
             return [path]
@@ -79,4 +79,5 @@
     completed = []
     for item in files:
         completed += process_item(item, csu_language_code=args.csu_code)
-    print('\n'.join(completed))
+    for path in completed:
+        print(path)
diff --git a/infrastructure/crowdin/crowdin_bot_python_package/crowdin_bot/get_crowdin_languages.py b/infrastructure/crowdin/crowdin_bot_python_package/crowdin_bot/get_crowdin_languages.py
--- a/infrastructure/crowdin/crowdin_bot_python_package/crowdin_bot/get_crowdin_languages.py
+++ b/infrastructure/crowdin/crowdin_bot_python_package/crowdin_bot/get_crowdin_languages.py
@@ -12,14 +12,14 @@
     Returns:
         (list) list of project crowdin language codes
     """
-    info_xml = api.api_call_xml("info")
-    languages = info_xml.find('languages')
-    translatable_languages = []
-    for language in languages:
-        # Check it's not the incontext pseudo language
-        if language.find("can_translate").text == "1":
-            translatable_languages.append(language.find('code').text)
-    return translatable_languages
+    active_languages = []
+    trans_status = api.api_call_json("status")
+    for language in trans_status:
+        # Check language has actually had some translation done
+        if int(language["words_approved"]) > 0:
+            active_languages.append(language["code"])
+    return active_languages
 
 if __name__ == "__main__":
-    print('\n'.join(get_project_languages()))
+    for language in get_project_languages():
+        print(language)

{"golden_diff": "diff --git a/infrastructure/crowdin/crowdin_bot_python_package/crowdin_bot/get_complete_translations.py b/infrastructure/crowdin/crowdin_bot_python_package/crowdin_bot/get_complete_translations.py\n--- a/infrastructure/crowdin/crowdin_bot_python_package/crowdin_bot/get_complete_translations.py\n+++ b/infrastructure/crowdin/crowdin_bot_python_package/crowdin_bot/get_complete_translations.py\n@@ -43,9 +43,9 @@\n         else:\n             path = filename\n \n-        # Skip full translated check for *.po - they can always be included\n+        # Skip *.po - they are handled separately\n         if filename.endswith(\".po\"):\n-            return [path]\n+            return []\n \n         if item.find(\"phrases\").text == item.find(\"approved\").text:\n             return [path]\n@@ -79,4 +79,5 @@\n     completed = []\n     for item in files:\n         completed += process_item(item, csu_language_code=args.csu_code)\n-    print('\\n'.join(completed))\n+    for path in completed:\n+        print(path)\ndiff --git a/infrastructure/crowdin/crowdin_bot_python_package/crowdin_bot/get_crowdin_languages.py b/infrastructure/crowdin/crowdin_bot_python_package/crowdin_bot/get_crowdin_languages.py\n--- a/infrastructure/crowdin/crowdin_bot_python_package/crowdin_bot/get_crowdin_languages.py\n+++ b/infrastructure/crowdin/crowdin_bot_python_package/crowdin_bot/get_crowdin_languages.py\n@@ -12,14 +12,14 @@\n     Returns:\n         (list) list of project crowdin language codes\n     \"\"\"\n-    info_xml = api.api_call_xml(\"info\")\n-    languages = info_xml.find('languages')\n-    translatable_languages = []\n-    for language in languages:\n-        # Check it's not the incontext pseudo language\n-        if language.find(\"can_translate\").text == \"1\":\n-            translatable_languages.append(language.find('code').text)\n-    return translatable_languages\n+    active_languages = []\n+    trans_status = api.api_call_json(\"status\")\n+    for language in trans_status:\n+        # Check language has actually had some translation done\n+        if int(language[\"words_approved\"]) > 0:\n+            active_languages.append(language[\"code\"])\n+    return active_languages\n \n if __name__ == \"__main__\":\n-    print('\\n'.join(get_project_languages()))\n+    for language in get_project_languages():\n+        print(language)\n", "issue": "Implement automatic update of .po file \nThe .po file needs to be updated with all static strings for translation, by running the `python manage.py makemessages`. This needs to be run upon any change to templates or database content.\r\n\r\nThis process should be automated on Travis to run when any such files are updated on `develop`.\n", "before_files": [{"content": "\"\"\"Script to print list of file paths of all completely translated files for a given language.\"\"\"\n\nimport os\nimport argparse\n\nfrom crowdin_bot import api\n\nSOURCE_LANGUAGE = \"en\"\n\ndef get_language_info(language):\n    \"\"\"Get xml tree from language info api call.\n\n    Args:\n        language: (str) crowdin language code\n\n    Returns:\n        lxml.etree object\n    \"\"\"\n    return api.api_call_xml(\n        \"language-status\",\n        language=language\n    )\n\ndef process_item(item, parent_path=None, csu_language_code=None):\n    \"\"\"Return list of completely translated file paths in a given directory tree node.\n\n    Args:\n        item: (etree.Element): itemm node in language-status xml tree\n            (see https://support.crowdin.com/api/language-status/)\n        parent_path: (str) path to the translated file node (None if the current item is\n            the root of the directory tree).\n        csu_language_code: (str) Language code (in locale format) on CSU end\n            (may differ from crowdin language code according to language mapping\n            in yaml file)\n\n    Returns:\n        (list) list of file paths that are completely translated\n    \"\"\"\n    if item.find(\"node_type\").text == \"file\":\n        filename = item.find(\"name\").text\n        if parent_path:\n            path = os.path.join(parent_path, filename)\n        else:\n            path = filename\n\n        # Skip full translated check for *.po - they can always be included\n        if filename.endswith(\".po\"):\n            return [path]\n\n        if item.find(\"phrases\").text == item.find(\"approved\").text:\n            return [path]\n        else:\n            return []\n\n    else:\n        inner_nodes = item.find(\"files\")\n        dirname = item.find(\"name\").text\n        if dirname == SOURCE_LANGUAGE:\n            dirname = csu_language_code\n        if parent_path:\n            path = os.path.join(parent_path, dirname)\n        else:\n            path = dirname\n        completed = []\n        for inner_node in inner_nodes:\n            completed += process_item(inner_node, parent_path=path, csu_language_code=csu_language_code)\n        return completed\n\n\nif __name__ == \"__main__\":\n    parser = argparse.ArgumentParser()\n    parser.add_argument('--crowdin-code', required=True,\n                        help='Crowdin language code for target language')\n    parser.add_argument('--csu-code', required=True,\n                        help='CSU language code for target language')\n    args = parser.parse_args()\n    lang_info = get_language_info(args.crowdin_code)\n    files = lang_info.find(\"files\")\n    completed = []\n    for item in files:\n        completed += process_item(item, csu_language_code=args.csu_code)\n    print('\\n'.join(completed))\n", "path": "infrastructure/crowdin/crowdin_bot_python_package/crowdin_bot/get_complete_translations.py"}, {"content": "\"\"\"Script to print list of all crowdin language codes for project.\"\"\"\n\nfrom crowdin_bot import api\n\nNS_DICT = {\n    'ns': \"urn:oasis:names:tc:xliff:document:1.2\"\n}\n\ndef get_project_languages():\n    \"\"\"Get list of crowdin language codes.\n\n    Returns:\n        (list) list of project crowdin language codes\n    \"\"\"\n    info_xml = api.api_call_xml(\"info\")\n    languages = info_xml.find('languages')\n    translatable_languages = []\n    for language in languages:\n        # Check it's not the incontext pseudo language\n        if language.find(\"can_translate\").text == \"1\":\n            translatable_languages.append(language.find('code').text)\n    return translatable_languages\n\nif __name__ == \"__main__\":\n    print('\\n'.join(get_project_languages()))\n", "path": "infrastructure/crowdin/crowdin_bot_python_package/crowdin_bot/get_crowdin_languages.py"}], "after_files": [{"content": "\"\"\"Script to print list of file paths of all completely translated files for a given language.\"\"\"\n\nimport os\nimport argparse\n\nfrom crowdin_bot import api\n\nSOURCE_LANGUAGE = \"en\"\n\ndef get_language_info(language):\n    \"\"\"Get xml tree from language info api call.\n\n    Args:\n        language: (str) crowdin language code\n\n    Returns:\n        lxml.etree object\n    \"\"\"\n    return api.api_call_xml(\n        \"language-status\",\n        language=language\n    )\n\ndef process_item(item, parent_path=None, csu_language_code=None):\n    \"\"\"Return list of completely translated file paths in a given directory tree node.\n\n    Args:\n        item: (etree.Element): itemm node in language-status xml tree\n            (see https://support.crowdin.com/api/language-status/)\n        parent_path: (str) path to the translated file node (None if the current item is\n            the root of the directory tree).\n        csu_language_code: (str) Language code (in locale format) on CSU end\n            (may differ from crowdin language code according to language mapping\n            in yaml file)\n\n    Returns:\n        (list) list of file paths that are completely translated\n    \"\"\"\n    if item.find(\"node_type\").text == \"file\":\n        filename = item.find(\"name\").text\n        if parent_path:\n            path = os.path.join(parent_path, filename)\n        else:\n            path = filename\n\n        # Skip *.po - they are handled separately\n        if filename.endswith(\".po\"):\n            return []\n\n        if item.find(\"phrases\").text == item.find(\"approved\").text:\n            return [path]\n        else:\n            return []\n\n    else:\n        inner_nodes = item.find(\"files\")\n        dirname = item.find(\"name\").text\n        if dirname == SOURCE_LANGUAGE:\n            dirname = csu_language_code\n        if parent_path:\n            path = os.path.join(parent_path, dirname)\n        else:\n            path = dirname\n        completed = []\n        for inner_node in inner_nodes:\n            completed += process_item(inner_node, parent_path=path, csu_language_code=csu_language_code)\n        return completed\n\n\nif __name__ == \"__main__\":\n    parser = argparse.ArgumentParser()\n    parser.add_argument('--crowdin-code', required=True,\n                        help='Crowdin language code for target language')\n    parser.add_argument('--csu-code', required=True,\n                        help='CSU language code for target language')\n    args = parser.parse_args()\n    lang_info = get_language_info(args.crowdin_code)\n    files = lang_info.find(\"files\")\n    completed = []\n    for item in files:\n        completed += process_item(item, csu_language_code=args.csu_code)\n    for path in completed:\n        print(path)\n", "path": "infrastructure/crowdin/crowdin_bot_python_package/crowdin_bot/get_complete_translations.py"}, {"content": "\"\"\"Script to print list of all crowdin language codes for project.\"\"\"\n\nfrom crowdin_bot import api\n\nNS_DICT = {\n    'ns': \"urn:oasis:names:tc:xliff:document:1.2\"\n}\n\ndef get_project_languages():\n    \"\"\"Get list of crowdin language codes.\n\n    Returns:\n        (list) list of project crowdin language codes\n    \"\"\"\n    active_languages = []\n    trans_status = api.api_call_json(\"status\")\n    for language in trans_status:\n        # Check language has actually had some translation done\n        if int(language[\"words_approved\"]) > 0:\n            active_languages.append(language[\"code\"])\n    return active_languages\n\nif __name__ == \"__main__\":\n    for language in get_project_languages():\n        print(language)\n", "path": "infrastructure/crowdin/crowdin_bot_python_package/crowdin_bot/get_crowdin_languages.py"}]}