We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Duplicated code in gitlab/config.py
## Description of the problem, including code/CLI snippet
Duplicated code found in gitlab/config.py . I think one should be get from 'global'.
```python
        self.http_username = None
        self.http_password = None
        try:
            self.http_username = self._config.get(self.gitlab_id, "http_username")
            self.http_password = self._config.get(self.gitlab_id, "http_password")
        except Exception:
            pass

        self.http_username = None
        self.http_password = None
        try:
            self.http_username = self._config.get(self.gitlab_id, "http_username")
            self.http_password = self._config.get(self.gitlab_id, "http_password")
        except Exception:
            pass
```

## Expected Behavior


## Actual Behavior


## Specifications

  - python-gitlab version: python-gitlab==2.2.0
  - API version you are using (v3/v4): v4
  - Gitlab server version (or gitlab.com): 


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `gitlab/config.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 #
3 # Copyright (C) 2013-2017 Gauvain Pocentek <gauvain@pocentek.net>
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Lesser General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU Lesser General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 
18 import os
19 import configparser
20 
21 
22 def _env_config():
23     if "PYTHON_GITLAB_CFG" in os.environ:
24         return [os.environ["PYTHON_GITLAB_CFG"]]
25     return []
26 
27 
28 _DEFAULT_FILES = _env_config() + [
29     "/etc/python-gitlab.cfg",
30     os.path.expanduser("~/.python-gitlab.cfg"),
31 ]
32 
33 
34 class ConfigError(Exception):
35     pass
36 
37 
38 class GitlabIDError(ConfigError):
39     pass
40 
41 
42 class GitlabDataError(ConfigError):
43     pass
44 
45 
46 class GitlabConfigMissingError(ConfigError):
47     pass
48 
49 
50 class GitlabConfigParser(object):
51     def __init__(self, gitlab_id=None, config_files=None):
52         self.gitlab_id = gitlab_id
53         _files = config_files or _DEFAULT_FILES
54         file_exist = False
55         for file in _files:
56             if os.path.exists(file):
57                 file_exist = True
58         if not file_exist:
59             raise GitlabConfigMissingError(
60                 "Config file not found. \nPlease create one in "
61                 "one of the following locations: {} \nor "
62                 "specify a config file using the '-c' parameter.".format(
63                     ", ".join(_DEFAULT_FILES)
64                 )
65             )
66 
67         self._config = configparser.ConfigParser()
68         self._config.read(_files)
69 
70         if self.gitlab_id is None:
71             try:
72                 self.gitlab_id = self._config.get("global", "default")
73             except Exception as e:
74                 raise GitlabIDError(
75                     "Impossible to get the gitlab id (not specified in config file)"
76                 ) from e
77 
78         try:
79             self.url = self._config.get(self.gitlab_id, "url")
80         except Exception as e:
81             raise GitlabDataError(
82                 "Impossible to get gitlab informations from "
83                 "configuration (%s)" % self.gitlab_id
84             ) from e
85 
86         self.ssl_verify = True
87         try:
88             self.ssl_verify = self._config.getboolean("global", "ssl_verify")
89         except ValueError:
90             # Value Error means the option exists but isn't a boolean.
91             # Get as a string instead as it should then be a local path to a
92             # CA bundle.
93             try:
94                 self.ssl_verify = self._config.get("global", "ssl_verify")
95             except Exception:
96                 pass
97         except Exception:
98             pass
99         try:
100             self.ssl_verify = self._config.getboolean(self.gitlab_id, "ssl_verify")
101         except ValueError:
102             # Value Error means the option exists but isn't a boolean.
103             # Get as a string instead as it should then be a local path to a
104             # CA bundle.
105             try:
106                 self.ssl_verify = self._config.get(self.gitlab_id, "ssl_verify")
107             except Exception:
108                 pass
109         except Exception:
110             pass
111 
112         self.timeout = 60
113         try:
114             self.timeout = self._config.getint("global", "timeout")
115         except Exception:
116             pass
117         try:
118             self.timeout = self._config.getint(self.gitlab_id, "timeout")
119         except Exception:
120             pass
121 
122         self.private_token = None
123         try:
124             self.private_token = self._config.get(self.gitlab_id, "private_token")
125         except Exception:
126             pass
127 
128         self.oauth_token = None
129         try:
130             self.oauth_token = self._config.get(self.gitlab_id, "oauth_token")
131         except Exception:
132             pass
133 
134         self.job_token = None
135         try:
136             self.job_token = self._config.get(self.gitlab_id, "job_token")
137         except Exception:
138             pass
139 
140         self.http_username = None
141         self.http_password = None
142         try:
143             self.http_username = self._config.get(self.gitlab_id, "http_username")
144             self.http_password = self._config.get(self.gitlab_id, "http_password")
145         except Exception:
146             pass
147 
148         self.http_username = None
149         self.http_password = None
150         try:
151             self.http_username = self._config.get(self.gitlab_id, "http_username")
152             self.http_password = self._config.get(self.gitlab_id, "http_password")
153         except Exception:
154             pass
155 
156         self.api_version = "4"
157         try:
158             self.api_version = self._config.get("global", "api_version")
159         except Exception:
160             pass
161         try:
162             self.api_version = self._config.get(self.gitlab_id, "api_version")
163         except Exception:
164             pass
165         if self.api_version not in ("4",):
166             raise GitlabDataError("Unsupported API version: %s" % self.api_version)
167 
168         self.per_page = None
169         for section in ["global", self.gitlab_id]:
170             try:
171                 self.per_page = self._config.getint(section, "per_page")
172             except Exception:
173                 pass
174         if self.per_page is not None and not 0 <= self.per_page <= 100:
175             raise GitlabDataError("Unsupported per_page number: %s" % self.per_page)
176 
177         self.pagination = None
178         try:
179             self.pagination = self._config.get(self.gitlab_id, "pagination")
180         except Exception:
181             pass
182 
183         self.order_by = None
184         try:
185             self.order_by = self._config.get(self.gitlab_id, "order_by")
186         except Exception:
187             pass
188
```
--- 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/gitlab/config.py b/gitlab/config.py
--- a/gitlab/config.py
+++ b/gitlab/config.py
@@ -145,14 +145,6 @@
         except Exception:
             pass
 
-        self.http_username = None
-        self.http_password = None
-        try:
-            self.http_username = self._config.get(self.gitlab_id, "http_username")
-            self.http_password = self._config.get(self.gitlab_id, "http_password")
-        except Exception:
-            pass
-
         self.api_version = "4"
         try:
             self.api_version = self._config.get("global", "api_version")

{"golden_diff": "diff --git a/gitlab/config.py b/gitlab/config.py\n--- a/gitlab/config.py\n+++ b/gitlab/config.py\n@@ -145,14 +145,6 @@\n         except Exception:\n             pass\n \n-        self.http_username = None\n-        self.http_password = None\n-        try:\n-            self.http_username = self._config.get(self.gitlab_id, \"http_username\")\n-            self.http_password = self._config.get(self.gitlab_id, \"http_password\")\n-        except Exception:\n-            pass\n-\n         self.api_version = \"4\"\n         try:\n             self.api_version = self._config.get(\"global\", \"api_version\")\n", "issue": "Duplicated code in gitlab/config.py\n## Description of the problem, including code/CLI snippet\r\nDuplicated code found in gitlab/config.py . I think one should be get from 'global'.\r\n```python\r\n        self.http_username = None\r\n        self.http_password = None\r\n        try:\r\n            self.http_username = self._config.get(self.gitlab_id, \"http_username\")\r\n            self.http_password = self._config.get(self.gitlab_id, \"http_password\")\r\n        except Exception:\r\n            pass\r\n\r\n        self.http_username = None\r\n        self.http_password = None\r\n        try:\r\n            self.http_username = self._config.get(self.gitlab_id, \"http_username\")\r\n            self.http_password = self._config.get(self.gitlab_id, \"http_password\")\r\n        except Exception:\r\n            pass\r\n```\r\n\r\n## Expected Behavior\r\n\r\n\r\n## Actual Behavior\r\n\r\n\r\n## Specifications\r\n\r\n  - python-gitlab version: python-gitlab==2.2.0\r\n  - API version you are using (v3/v4): v4\r\n  - Gitlab server version (or gitlab.com): \r\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n#\n# Copyright (C) 2013-2017 Gauvain Pocentek <gauvain@pocentek.net>\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Lesser General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU Lesser General Public License for more details.\n#\n# You should have received a copy of the GNU Lesser General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\nimport os\nimport configparser\n\n\ndef _env_config():\n    if \"PYTHON_GITLAB_CFG\" in os.environ:\n        return [os.environ[\"PYTHON_GITLAB_CFG\"]]\n    return []\n\n\n_DEFAULT_FILES = _env_config() + [\n    \"/etc/python-gitlab.cfg\",\n    os.path.expanduser(\"~/.python-gitlab.cfg\"),\n]\n\n\nclass ConfigError(Exception):\n    pass\n\n\nclass GitlabIDError(ConfigError):\n    pass\n\n\nclass GitlabDataError(ConfigError):\n    pass\n\n\nclass GitlabConfigMissingError(ConfigError):\n    pass\n\n\nclass GitlabConfigParser(object):\n    def __init__(self, gitlab_id=None, config_files=None):\n        self.gitlab_id = gitlab_id\n        _files = config_files or _DEFAULT_FILES\n        file_exist = False\n        for file in _files:\n            if os.path.exists(file):\n                file_exist = True\n        if not file_exist:\n            raise GitlabConfigMissingError(\n                \"Config file not found. \\nPlease create one in \"\n                \"one of the following locations: {} \\nor \"\n                \"specify a config file using the '-c' parameter.\".format(\n                    \", \".join(_DEFAULT_FILES)\n                )\n            )\n\n        self._config = configparser.ConfigParser()\n        self._config.read(_files)\n\n        if self.gitlab_id is None:\n            try:\n                self.gitlab_id = self._config.get(\"global\", \"default\")\n            except Exception as e:\n                raise GitlabIDError(\n                    \"Impossible to get the gitlab id (not specified in config file)\"\n                ) from e\n\n        try:\n            self.url = self._config.get(self.gitlab_id, \"url\")\n        except Exception as e:\n            raise GitlabDataError(\n                \"Impossible to get gitlab informations from \"\n                \"configuration (%s)\" % self.gitlab_id\n            ) from e\n\n        self.ssl_verify = True\n        try:\n            self.ssl_verify = self._config.getboolean(\"global\", \"ssl_verify\")\n        except ValueError:\n            # Value Error means the option exists but isn't a boolean.\n            # Get as a string instead as it should then be a local path to a\n            # CA bundle.\n            try:\n                self.ssl_verify = self._config.get(\"global\", \"ssl_verify\")\n            except Exception:\n                pass\n        except Exception:\n            pass\n        try:\n            self.ssl_verify = self._config.getboolean(self.gitlab_id, \"ssl_verify\")\n        except ValueError:\n            # Value Error means the option exists but isn't a boolean.\n            # Get as a string instead as it should then be a local path to a\n            # CA bundle.\n            try:\n                self.ssl_verify = self._config.get(self.gitlab_id, \"ssl_verify\")\n            except Exception:\n                pass\n        except Exception:\n            pass\n\n        self.timeout = 60\n        try:\n            self.timeout = self._config.getint(\"global\", \"timeout\")\n        except Exception:\n            pass\n        try:\n            self.timeout = self._config.getint(self.gitlab_id, \"timeout\")\n        except Exception:\n            pass\n\n        self.private_token = None\n        try:\n            self.private_token = self._config.get(self.gitlab_id, \"private_token\")\n        except Exception:\n            pass\n\n        self.oauth_token = None\n        try:\n            self.oauth_token = self._config.get(self.gitlab_id, \"oauth_token\")\n        except Exception:\n            pass\n\n        self.job_token = None\n        try:\n            self.job_token = self._config.get(self.gitlab_id, \"job_token\")\n        except Exception:\n            pass\n\n        self.http_username = None\n        self.http_password = None\n        try:\n            self.http_username = self._config.get(self.gitlab_id, \"http_username\")\n            self.http_password = self._config.get(self.gitlab_id, \"http_password\")\n        except Exception:\n            pass\n\n        self.http_username = None\n        self.http_password = None\n        try:\n            self.http_username = self._config.get(self.gitlab_id, \"http_username\")\n            self.http_password = self._config.get(self.gitlab_id, \"http_password\")\n        except Exception:\n            pass\n\n        self.api_version = \"4\"\n        try:\n            self.api_version = self._config.get(\"global\", \"api_version\")\n        except Exception:\n            pass\n        try:\n            self.api_version = self._config.get(self.gitlab_id, \"api_version\")\n        except Exception:\n            pass\n        if self.api_version not in (\"4\",):\n            raise GitlabDataError(\"Unsupported API version: %s\" % self.api_version)\n\n        self.per_page = None\n        for section in [\"global\", self.gitlab_id]:\n            try:\n                self.per_page = self._config.getint(section, \"per_page\")\n            except Exception:\n                pass\n        if self.per_page is not None and not 0 <= self.per_page <= 100:\n            raise GitlabDataError(\"Unsupported per_page number: %s\" % self.per_page)\n\n        self.pagination = None\n        try:\n            self.pagination = self._config.get(self.gitlab_id, \"pagination\")\n        except Exception:\n            pass\n\n        self.order_by = None\n        try:\n            self.order_by = self._config.get(self.gitlab_id, \"order_by\")\n        except Exception:\n            pass\n", "path": "gitlab/config.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n#\n# Copyright (C) 2013-2017 Gauvain Pocentek <gauvain@pocentek.net>\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Lesser General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU Lesser General Public License for more details.\n#\n# You should have received a copy of the GNU Lesser General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\nimport os\nimport configparser\n\n\ndef _env_config():\n    if \"PYTHON_GITLAB_CFG\" in os.environ:\n        return [os.environ[\"PYTHON_GITLAB_CFG\"]]\n    return []\n\n\n_DEFAULT_FILES = _env_config() + [\n    \"/etc/python-gitlab.cfg\",\n    os.path.expanduser(\"~/.python-gitlab.cfg\"),\n]\n\n\nclass ConfigError(Exception):\n    pass\n\n\nclass GitlabIDError(ConfigError):\n    pass\n\n\nclass GitlabDataError(ConfigError):\n    pass\n\n\nclass GitlabConfigMissingError(ConfigError):\n    pass\n\n\nclass GitlabConfigParser(object):\n    def __init__(self, gitlab_id=None, config_files=None):\n        self.gitlab_id = gitlab_id\n        _files = config_files or _DEFAULT_FILES\n        file_exist = False\n        for file in _files:\n            if os.path.exists(file):\n                file_exist = True\n        if not file_exist:\n            raise GitlabConfigMissingError(\n                \"Config file not found. \\nPlease create one in \"\n                \"one of the following locations: {} \\nor \"\n                \"specify a config file using the '-c' parameter.\".format(\n                    \", \".join(_DEFAULT_FILES)\n                )\n            )\n\n        self._config = configparser.ConfigParser()\n        self._config.read(_files)\n\n        if self.gitlab_id is None:\n            try:\n                self.gitlab_id = self._config.get(\"global\", \"default\")\n            except Exception as e:\n                raise GitlabIDError(\n                    \"Impossible to get the gitlab id (not specified in config file)\"\n                ) from e\n\n        try:\n            self.url = self._config.get(self.gitlab_id, \"url\")\n        except Exception as e:\n            raise GitlabDataError(\n                \"Impossible to get gitlab informations from \"\n                \"configuration (%s)\" % self.gitlab_id\n            ) from e\n\n        self.ssl_verify = True\n        try:\n            self.ssl_verify = self._config.getboolean(\"global\", \"ssl_verify\")\n        except ValueError:\n            # Value Error means the option exists but isn't a boolean.\n            # Get as a string instead as it should then be a local path to a\n            # CA bundle.\n            try:\n                self.ssl_verify = self._config.get(\"global\", \"ssl_verify\")\n            except Exception:\n                pass\n        except Exception:\n            pass\n        try:\n            self.ssl_verify = self._config.getboolean(self.gitlab_id, \"ssl_verify\")\n        except ValueError:\n            # Value Error means the option exists but isn't a boolean.\n            # Get as a string instead as it should then be a local path to a\n            # CA bundle.\n            try:\n                self.ssl_verify = self._config.get(self.gitlab_id, \"ssl_verify\")\n            except Exception:\n                pass\n        except Exception:\n            pass\n\n        self.timeout = 60\n        try:\n            self.timeout = self._config.getint(\"global\", \"timeout\")\n        except Exception:\n            pass\n        try:\n            self.timeout = self._config.getint(self.gitlab_id, \"timeout\")\n        except Exception:\n            pass\n\n        self.private_token = None\n        try:\n            self.private_token = self._config.get(self.gitlab_id, \"private_token\")\n        except Exception:\n            pass\n\n        self.oauth_token = None\n        try:\n            self.oauth_token = self._config.get(self.gitlab_id, \"oauth_token\")\n        except Exception:\n            pass\n\n        self.job_token = None\n        try:\n            self.job_token = self._config.get(self.gitlab_id, \"job_token\")\n        except Exception:\n            pass\n\n        self.http_username = None\n        self.http_password = None\n        try:\n            self.http_username = self._config.get(self.gitlab_id, \"http_username\")\n            self.http_password = self._config.get(self.gitlab_id, \"http_password\")\n        except Exception:\n            pass\n\n        self.api_version = \"4\"\n        try:\n            self.api_version = self._config.get(\"global\", \"api_version\")\n        except Exception:\n            pass\n        try:\n            self.api_version = self._config.get(self.gitlab_id, \"api_version\")\n        except Exception:\n            pass\n        if self.api_version not in (\"4\",):\n            raise GitlabDataError(\"Unsupported API version: %s\" % self.api_version)\n\n        self.per_page = None\n        for section in [\"global\", self.gitlab_id]:\n            try:\n                self.per_page = self._config.getint(section, \"per_page\")\n            except Exception:\n                pass\n        if self.per_page is not None and not 0 <= self.per_page <= 100:\n            raise GitlabDataError(\"Unsupported per_page number: %s\" % self.per_page)\n\n        self.pagination = None\n        try:\n            self.pagination = self._config.get(self.gitlab_id, \"pagination\")\n        except Exception:\n            pass\n\n        self.order_by = None\n        try:\n            self.order_by = self._config.get(self.gitlab_id, \"order_by\")\n        except Exception:\n            pass\n", "path": "gitlab/config.py"}]}