prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Generation from "Pumped storage" in France FR
  At the moment, the bar charts on the map only show pumped storage consumption for France. But RTE also has data for pumped storage generation. This is currently not displayed on the map, because the "hydro" category of RTE includes all three types "hydro storage+run of river+pumped storage". But there is a seperate "pumping" category for consumption of the pumped storages (pumping).
  http://www.rte-france.com/en/eco2mix/eco2mix-mix-energetique-en
  
  ![image](https://user-images.githubusercontent.com/25743609/36091018-a6c4db5a-0fe2-11e8-8913-b87ddf4b8419.png)
  
  After selecting the hydro category, you'll see "details" below it. Selecting "details" you will see this, incuding the breakdown by hydro type:
  ![image](https://user-images.githubusercontent.com/25743609/36091149-122d4940-0fe3-11e8-80ad-7ddce689c08f.png)
  
  The most recent dataset for France can also be downloaded here:
  http://www.rte-france.com/en/eco2mix/eco2mix-telechargement-en
  
  The FR.py parser seems to use this URL http://www.rte-france.com/getEco2MixXml.php?type=donneesMarche&dateDeb={}&dateFin={}&mode=NORM for getting the data. Maybe there is a similar one for the hydro breakdown by type to seperate pumped storage generation from it.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `parsers/FR.py`
  Content:
  ```
  1 #!/usr/bin/env python3
  2 
  3 import arrow
  4 import requests
  5 import xml.etree.ElementTree as ET
  6 
  7 MAP_GENERATION = {
  8     u'Nucl\xe9aire': 'nuclear',
  9     'Charbon': 'coal',
  10     'Gaz': 'gas',
  11     'Fioul': 'oil',
  12     'Hydraulique': 'hydro',
  13     'Eolien': 'wind',
  14     'Solaire': 'solar',
  15     'Autres': 'biomass'
  16 }
  17 MAP_STORAGE = {
  18     'Pompage': 'hydro',
  19 }
  20 
  21 
  22 def fetch_production(country_code='FR', session=None):
  23     r = session or requests.session()
  24     formatted_date = arrow.now(tz='Europe/Paris').format('DD/MM/YYYY')
  25     url = 'http://www.rte-france.com/getEco2MixXml.php?type=mix&&dateDeb={}&dateFin={}&mode=NORM'.format(formatted_date, formatted_date)
  26     response = r.get(url)
  27     obj = ET.fromstring(response.content)
  28     mixtr = obj[7]
  29     data = {
  30         'countryCode': country_code,
  31         'production': {},
  32         'storage': {},
  33         'source': 'rte-france.com',
  34     }
  35     for item in mixtr.getchildren():
  36         if item.get('granularite') != 'Global':
  37             continue
  38         key = item.get('v')
  39         value = None
  40         for value in item.getchildren():
  41             pass
  42         if key in MAP_GENERATION:
  43             data['production'][MAP_GENERATION[key]] = float(value.text)
  44         elif key in MAP_STORAGE:
  45             data['storage'][MAP_STORAGE[key]] = -1 * float(value.text)
  46 
  47     data['datetime'] = arrow.get(arrow.get(obj[1].text).datetime,
  48         'Europe/Paris').replace(minutes=+(int(value.attrib['periode']) * 15.0)).datetime
  49 
  50     # Fetch imports
  51     # url = 'http://www.rte-france.com/getEco2MixXml.php?type=echcom&&dateDeb={}&dateFin={}&mode=NORM'.format(formatted_date, formatted_date)
  52     # response = r.get(url)
  53     # obj = ET.fromstring(response.content)
  54     # parsed = {}
  55     # for item in obj[7].getchildren():
  56     #     value = None
  57     #     for value in item: pass
  58     #     parsed[item.get('v')] = float(value.text)
  59 
  60     # data['exchange'] = {
  61     #     'CH': parsed['CH'],
  62     #     'GB': parsed['GB'],
  63     #     'ES': parsed['ES'],
  64     #     'IT': parsed['IT'],
  65     #     'DE': parsed['DB'] # Germany + Belgium redirected to Germany
  66     # }
  67 
  68     return data
  69 
  70 
  71 def fetch_price(country_code, session=None, from_date=None, to_date=None):
  72     r = session or requests.session()
  73     dt_now = arrow.now(tz='Europe/Paris')
  74     formatted_from = from_date or dt_now.format('DD/MM/YYYY')
  75     formatted_to = to_date or dt_now.format('DD/MM/YYYY')
  76 
  77     url = 'http://www.rte-france.com/getEco2MixXml.php?type=donneesMarche&dateDeb={}&dateFin={}&mode=NORM'.format(formatted_from, formatted_to)
  78     response = r.get(url)
  79     obj = ET.fromstring(response.content)
  80     mixtr = obj[5]
  81 
  82     prices = []
  83     datetimes = []
  84 
  85     date_str = mixtr.get('date')
  86     date = arrow.get(arrow.get(date_str).datetime, 'Europe/Paris')
  87     for country_item in mixtr.getchildren():
  88         if country_item.get('granularite') != 'Global':
  89             continue
  90         country_c = country_item.get('perimetre')
  91         if country_code != country_c:
  92             continue
  93         value = None
  94         for value in country_item.getchildren():
  95             if value.text == 'ND':
  96                 continue
  97             datetime = date.replace(hours=+int(value.attrib['periode'])).datetime
  98             if datetime > dt_now:
  99                 continue
  100             datetimes.append(datetime)
  101             prices.append(float(value.text))
  102 
  103     data = {
  104         'countryCode': country_code,
  105         'currency': 'EUR',
  106         'datetime': datetimes[-1],
  107         'price': prices[-1],
  108         'source': 'rte-france.com',
  109     }
  110     return data
  111 
  112 
  113 if __name__ == '__main__':
  114     print(fetch_production())
  115
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/parsers/FR.py b/parsers/FR.py
  --- a/parsers/FR.py
  +++ b/parsers/FR.py
  @@ -16,6 +16,7 @@
   }
   MAP_STORAGE = {
       'Pompage': 'hydro',
  +    'Hydraulique': 'hydro',
   }
   
   
  @@ -33,38 +34,36 @@
           'source': 'rte-france.com',
       }
       for item in mixtr.getchildren():
  -        if item.get('granularite') != 'Global':
  -            continue
           key = item.get('v')
  +        granularite = item.get('granularite')
           value = None
           for value in item.getchildren():
               pass
  -        if key in MAP_GENERATION:
  -            data['production'][MAP_GENERATION[key]] = float(value.text)
  -        elif key in MAP_STORAGE:
  -            data['storage'][MAP_STORAGE[key]] = -1 * float(value.text)
  +        if key == 'Hydraulique':
  +            # Hydro is a special case!
  +            if granularite == 'Global':
  +                continue
  +            elif granularite in ['FEE', 'LAC']:
  +                if not MAP_GENERATION[key] in data['production']:
  +                    data['production'][MAP_GENERATION[key]] = 0
  +                # Run of the river or conventional
  +                data['production'][MAP_GENERATION[key]] += float(value.text)
  +            elif granularite == 'STT':
  +                if not MAP_STORAGE[key] in data['storage']:
  +                    data['storage'][MAP_STORAGE[key]] = 0
  +                # Pumped storage generation
  +                data['storage'][MAP_STORAGE[key]] += -1 * float(value.text)
  +        elif granularite == 'Global':
  +            if key in MAP_GENERATION:
  +                data['production'][MAP_GENERATION[key]] = float(value.text)
  +            elif key in MAP_STORAGE:
  +                if not MAP_STORAGE[key] in data['storage']:
  +                    data['storage'][MAP_STORAGE[key]] = 0
  +                data['storage'][MAP_STORAGE[key]] += -1 * float(value.text)
   
       data['datetime'] = arrow.get(arrow.get(obj[1].text).datetime,
           'Europe/Paris').replace(minutes=+(int(value.attrib['periode']) * 15.0)).datetime
   
  -    # Fetch imports
  -    # url = 'http://www.rte-france.com/getEco2MixXml.php?type=echcom&&dateDeb={}&dateFin={}&mode=NORM'.format(formatted_date, formatted_date)
  -    # response = r.get(url)
  -    # obj = ET.fromstring(response.content)
  -    # parsed = {}
  -    # for item in obj[7].getchildren():
  -    #     value = None
  -    #     for value in item: pass
  -    #     parsed[item.get('v')] = float(value.text)
  -
  -    # data['exchange'] = {
  -    #     'CH': parsed['CH'],
  -    #     'GB': parsed['GB'],
  -    #     'ES': parsed['ES'],
  -    #     'IT': parsed['IT'],
  -    #     'DE': parsed['DB'] # Germany + Belgium redirected to Germany
  -    # }
  -
       return data
  
verification_info: {"golden_diff": "diff --git a/parsers/FR.py b/parsers/FR.py\n--- a/parsers/FR.py\n+++ b/parsers/FR.py\n@@ -16,6 +16,7 @@\n }\n MAP_STORAGE = {\n     'Pompage': 'hydro',\n+    'Hydraulique': 'hydro',\n }\n \n \n@@ -33,38 +34,36 @@\n         'source': 'rte-france.com',\n     }\n     for item in mixtr.getchildren():\n-        if item.get('granularite') != 'Global':\n-            continue\n         key = item.get('v')\n+        granularite = item.get('granularite')\n         value = None\n         for value in item.getchildren():\n             pass\n-        if key in MAP_GENERATION:\n-            data['production'][MAP_GENERATION[key]] = float(value.text)\n-        elif key in MAP_STORAGE:\n-            data['storage'][MAP_STORAGE[key]] = -1 * float(value.text)\n+        if key == 'Hydraulique':\n+            # Hydro is a special case!\n+            if granularite == 'Global':\n+                continue\n+            elif granularite in ['FEE', 'LAC']:\n+                if not MAP_GENERATION[key] in data['production']:\n+                    data['production'][MAP_GENERATION[key]] = 0\n+                # Run of the river or conventional\n+                data['production'][MAP_GENERATION[key]] += float(value.text)\n+            elif granularite == 'STT':\n+                if not MAP_STORAGE[key] in data['storage']:\n+                    data['storage'][MAP_STORAGE[key]] = 0\n+                # Pumped storage generation\n+                data['storage'][MAP_STORAGE[key]] += -1 * float(value.text)\n+        elif granularite == 'Global':\n+            if key in MAP_GENERATION:\n+                data['production'][MAP_GENERATION[key]] = float(value.text)\n+            elif key in MAP_STORAGE:\n+                if not MAP_STORAGE[key] in data['storage']:\n+                    data['storage'][MAP_STORAGE[key]] = 0\n+                data['storage'][MAP_STORAGE[key]] += -1 * float(value.text)\n \n     data['datetime'] = arrow.get(arrow.get(obj[1].text).datetime,\n         'Europe/Paris').replace(minutes=+(int(value.attrib['periode']) * 15.0)).datetime\n \n-    # Fetch imports\n-    # url = 'http://www.rte-france.com/getEco2MixXml.php?type=echcom&&dateDeb={}&dateFin={}&mode=NORM'.format(formatted_date, formatted_date)\n-    # response = r.get(url)\n-    # obj = ET.fromstring(response.content)\n-    # parsed = {}\n-    # for item in obj[7].getchildren():\n-    #     value = None\n-    #     for value in item: pass\n-    #     parsed[item.get('v')] = float(value.text)\n-\n-    # data['exchange'] = {\n-    #     'CH': parsed['CH'],\n-    #     'GB': parsed['GB'],\n-    #     'ES': parsed['ES'],\n-    #     'IT': parsed['IT'],\n-    #     'DE': parsed['DB'] # Germany + Belgium redirected to Germany\n-    # }\n-\n     return data\n", "issue": "Generation from \"Pumped storage\" in France FR\nAt the moment, the bar charts on the map only show pumped storage consumption for France. But RTE also has data for pumped storage generation. This is currently not displayed on the map, because the \"hydro\" category of RTE includes all three types \"hydro storage+run of river+pumped storage\". But there is a seperate \"pumping\" category for consumption of the pumped storages (pumping).\r\nhttp://www.rte-france.com/en/eco2mix/eco2mix-mix-energetique-en\r\n\r\n![image](https://user-images.githubusercontent.com/25743609/36091018-a6c4db5a-0fe2-11e8-8913-b87ddf4b8419.png)\r\n\r\nAfter selecting the hydro category, you'll see \"details\" below it. Selecting \"details\" you will see this, incuding the breakdown by hydro type:\r\n![image](https://user-images.githubusercontent.com/25743609/36091149-122d4940-0fe3-11e8-80ad-7ddce689c08f.png)\r\n\r\nThe most recent dataset for France can also be downloaded here:\r\nhttp://www.rte-france.com/en/eco2mix/eco2mix-telechargement-en\r\n\r\nThe FR.py parser seems to use this URL http://www.rte-france.com/getEco2MixXml.php?type=donneesMarche&dateDeb={}&dateFin={}&mode=NORM for getting the data. Maybe there is a similar one for the hydro breakdown by type to seperate pumped storage generation from it.\n", "before_files": [{"content": "#!/usr/bin/env python3\n\nimport arrow\nimport requests\nimport xml.etree.ElementTree as ET\n\nMAP_GENERATION = {\n    u'Nucl\\xe9aire': 'nuclear',\n    'Charbon': 'coal',\n    'Gaz': 'gas',\n    'Fioul': 'oil',\n    'Hydraulique': 'hydro',\n    'Eolien': 'wind',\n    'Solaire': 'solar',\n    'Autres': 'biomass'\n}\nMAP_STORAGE = {\n    'Pompage': 'hydro',\n}\n\n\ndef fetch_production(country_code='FR', session=None):\n    r = session or requests.session()\n    formatted_date = arrow.now(tz='Europe/Paris').format('DD/MM/YYYY')\n    url = 'http://www.rte-france.com/getEco2MixXml.php?type=mix&&dateDeb={}&dateFin={}&mode=NORM'.format(formatted_date, formatted_date)\n    response = r.get(url)\n    obj = ET.fromstring(response.content)\n    mixtr = obj[7]\n    data = {\n        'countryCode': country_code,\n        'production': {},\n        'storage': {},\n        'source': 'rte-france.com',\n    }\n    for item in mixtr.getchildren():\n        if item.get('granularite') != 'Global':\n            continue\n        key = item.get('v')\n        value = None\n        for value in item.getchildren():\n            pass\n        if key in MAP_GENERATION:\n            data['production'][MAP_GENERATION[key]] = float(value.text)\n        elif key in MAP_STORAGE:\n            data['storage'][MAP_STORAGE[key]] = -1 * float(value.text)\n\n    data['datetime'] = arrow.get(arrow.get(obj[1].text).datetime,\n        'Europe/Paris').replace(minutes=+(int(value.attrib['periode']) * 15.0)).datetime\n\n    # Fetch imports\n    # url = 'http://www.rte-france.com/getEco2MixXml.php?type=echcom&&dateDeb={}&dateFin={}&mode=NORM'.format(formatted_date, formatted_date)\n    # response = r.get(url)\n    # obj = ET.fromstring(response.content)\n    # parsed = {}\n    # for item in obj[7].getchildren():\n    #     value = None\n    #     for value in item: pass\n    #     parsed[item.get('v')] = float(value.text)\n\n    # data['exchange'] = {\n    #     'CH': parsed['CH'],\n    #     'GB': parsed['GB'],\n    #     'ES': parsed['ES'],\n    #     'IT': parsed['IT'],\n    #     'DE': parsed['DB'] # Germany + Belgium redirected to Germany\n    # }\n\n    return data\n\n\ndef fetch_price(country_code, session=None, from_date=None, to_date=None):\n    r = session or requests.session()\n    dt_now = arrow.now(tz='Europe/Paris')\n    formatted_from = from_date or dt_now.format('DD/MM/YYYY')\n    formatted_to = to_date or dt_now.format('DD/MM/YYYY')\n\n    url = 'http://www.rte-france.com/getEco2MixXml.php?type=donneesMarche&dateDeb={}&dateFin={}&mode=NORM'.format(formatted_from, formatted_to)\n    response = r.get(url)\n    obj = ET.fromstring(response.content)\n    mixtr = obj[5]\n\n    prices = []\n    datetimes = []\n\n    date_str = mixtr.get('date')\n    date = arrow.get(arrow.get(date_str).datetime, 'Europe/Paris')\n    for country_item in mixtr.getchildren():\n        if country_item.get('granularite') != 'Global':\n            continue\n        country_c = country_item.get('perimetre')\n        if country_code != country_c:\n            continue\n        value = None\n        for value in country_item.getchildren():\n            if value.text == 'ND':\n                continue\n            datetime = date.replace(hours=+int(value.attrib['periode'])).datetime\n            if datetime > dt_now:\n                continue\n            datetimes.append(datetime)\n            prices.append(float(value.text))\n\n    data = {\n        'countryCode': country_code,\n        'currency': 'EUR',\n        'datetime': datetimes[-1],\n        'price': prices[-1],\n        'source': 'rte-france.com',\n    }\n    return data\n\n\nif __name__ == '__main__':\n    print(fetch_production())\n", "path": "parsers/FR.py"}], "after_files": [{"content": "#!/usr/bin/env python3\n\nimport arrow\nimport requests\nimport xml.etree.ElementTree as ET\n\nMAP_GENERATION = {\n    u'Nucl\\xe9aire': 'nuclear',\n    'Charbon': 'coal',\n    'Gaz': 'gas',\n    'Fioul': 'oil',\n    'Hydraulique': 'hydro',\n    'Eolien': 'wind',\n    'Solaire': 'solar',\n    'Autres': 'biomass'\n}\nMAP_STORAGE = {\n    'Pompage': 'hydro',\n    'Hydraulique': 'hydro',\n}\n\n\ndef fetch_production(country_code='FR', session=None):\n    r = session or requests.session()\n    formatted_date = arrow.now(tz='Europe/Paris').format('DD/MM/YYYY')\n    url = 'http://www.rte-france.com/getEco2MixXml.php?type=mix&&dateDeb={}&dateFin={}&mode=NORM'.format(formatted_date, formatted_date)\n    response = r.get(url)\n    obj = ET.fromstring(response.content)\n    mixtr = obj[7]\n    data = {\n        'countryCode': country_code,\n        'production': {},\n        'storage': {},\n        'source': 'rte-france.com',\n    }\n    for item in mixtr.getchildren():\n        key = item.get('v')\n        granularite = item.get('granularite')\n        value = None\n        for value in item.getchildren():\n            pass\n        if key == 'Hydraulique':\n            # Hydro is a special case!\n            if granularite == 'Global':\n                continue\n            elif granularite in ['FEE', 'LAC']:\n                if not MAP_GENERATION[key] in data['production']:\n                    data['production'][MAP_GENERATION[key]] = 0\n                # Run of the river or conventional\n                data['production'][MAP_GENERATION[key]] += float(value.text)\n            elif granularite == 'STT':\n                if not MAP_STORAGE[key] in data['storage']:\n                    data['storage'][MAP_STORAGE[key]] = 0\n                # Pumped storage generation\n                data['storage'][MAP_STORAGE[key]] += -1 * float(value.text)\n        elif granularite == 'Global':\n            if key in MAP_GENERATION:\n                data['production'][MAP_GENERATION[key]] = float(value.text)\n            elif key in MAP_STORAGE:\n                if not MAP_STORAGE[key] in data['storage']:\n                    data['storage'][MAP_STORAGE[key]] = 0\n                data['storage'][MAP_STORAGE[key]] += -1 * float(value.text)\n\n    data['datetime'] = arrow.get(arrow.get(obj[1].text).datetime,\n        'Europe/Paris').replace(minutes=+(int(value.attrib['periode']) * 15.0)).datetime\n\n    return data\n\n\ndef fetch_price(country_code, session=None, from_date=None, to_date=None):\n    r = session or requests.session()\n    dt_now = arrow.now(tz='Europe/Paris')\n    formatted_from = from_date or dt_now.format('DD/MM/YYYY')\n    formatted_to = to_date or dt_now.format('DD/MM/YYYY')\n\n    url = 'http://www.rte-france.com/getEco2MixXml.php?type=donneesMarche&dateDeb={}&dateFin={}&mode=NORM'.format(formatted_from, formatted_to)\n    response = r.get(url)\n    obj = ET.fromstring(response.content)\n    mixtr = obj[5]\n\n    prices = []\n    datetimes = []\n\n    date_str = mixtr.get('date')\n    date = arrow.get(arrow.get(date_str).datetime, 'Europe/Paris')\n    for country_item in mixtr.getchildren():\n        if country_item.get('granularite') != 'Global':\n            continue\n        country_c = country_item.get('perimetre')\n        if country_code != country_c:\n            continue\n        value = None\n        for value in country_item.getchildren():\n            if value.text == 'ND':\n                continue\n            datetime = date.replace(hours=+int(value.attrib['periode'])).datetime\n            if datetime > dt_now:\n                continue\n            datetimes.append(datetime)\n            prices.append(float(value.text))\n\n    data = {\n        'countryCode': country_code,\n        'currency': 'EUR',\n        'datetime': datetimes[-1],\n        'price': prices[-1],\n        'source': 'rte-france.com',\n    }\n    return data\n\n\nif __name__ == '__main__':\n    print(fetch_production())\n", "path": "parsers/FR.py"}]}