We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Allow setting `name` for upload_asset
Currently, PyGithub uses `path.basename` for the `name` of the file assets -- could it be added that I can choose my own name? I can of course rename the file before upload, but it would be easier if I could just specify the name.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `github/GitRelease.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 
3 ############################ Copyrights and license ############################
4 #                                                                              #
5 # Copyright 2015 Ed Holland <eholland@alertlogic.com>                          #
6 # Copyright 2016 Benjamin Whitney <benjamin.whitney@ironnetcybersecurity.com>  #
7 # Copyright 2016 Jannis Gebauer <ja.geb@me.com>                                #
8 # Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com>          #
9 # Copyright 2017 Chris McBride <thehighlander@users.noreply.github.com>        #
10 # Copyright 2017 Simon <spam@esemi.ru>                                         #
11 # Copyright 2018 Daniel Kesler <kesler.daniel@gmail.com>                       #
12 # Copyright 2018 Kuba <jakub.glapa@adspired.com>                               #
13 # Copyright 2018 Maarten Fonville <mfonville@users.noreply.github.com>         #
14 # Copyright 2018 Shinichi TAMURA <shnch.tmr@gmail.com>                         #
15 # Copyright 2018 Wan Liuyang <tsfdye@gmail.com>                                #
16 # Copyright 2018 edquist <edquist@users.noreply.github.com>                    #
17 # Copyright 2018 nurupo <nurupo.contributions@gmail.com>                       #
18 # Copyright 2018 sfdye <tsfdye@gmail.com>                                      #
19 #                                                                              #
20 # This file is part of PyGithub.                                               #
21 # http://pygithub.readthedocs.io/                                              #
22 #                                                                              #
23 # PyGithub is free software: you can redistribute it and/or modify it under    #
24 # the terms of the GNU Lesser General Public License as published by the Free  #
25 # Software Foundation, either version 3 of the License, or (at your option)    #
26 # any later version.                                                           #
27 #                                                                              #
28 # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY  #
29 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS    #
30 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
31 # details.                                                                     #
32 #                                                                              #
33 # You should have received a copy of the GNU Lesser General Public License     #
34 # along with PyGithub. If not, see <http://www.gnu.org/licenses/>.             #
35 #                                                                              #
36 ################################################################################
37 
38 from os.path import basename
39 import github.GithubObject
40 import github.NamedUser
41 import github.GitReleaseAsset
42 
43 
44 class GitRelease(github.GithubObject.CompletableGithubObject):
45     """
46     This class represents GitReleases. The reference can be found here https://developer.github.com/v3/repos/releases
47     """
48 
49     def __repr__(self):
50         return self.get__repr__({"title": self._title.value})
51 
52     @property
53     def id(self):
54         """
55         :type: integer
56         """
57         self._completeIfNotSet(self._id)
58         return self._id.value
59 
60     @property
61     def body(self):
62         """
63         :type: string
64         """
65         self._completeIfNotSet(self._body)
66         return self._body.value
67 
68     @property
69     def title(self):
70         """
71         :type: string
72         """
73         self._completeIfNotSet(self._title)
74         return self._title.value
75 
76     @property
77     def tag_name(self):
78         """
79         :type: string
80         """
81         self._completeIfNotSet(self._tag_name)
82         return self._tag_name.value
83 
84     @property
85     def target_commitish(self):
86         """
87         :type: string
88         """
89         self._completeIfNotSet(self._target_commitish)
90         return self._target_commitish.value
91 
92     @property
93     def draft(self):
94         """
95         :type: bool
96         """
97         self._completeIfNotSet(self._draft)
98         return self._draft.value
99 
100     @property
101     def prerelease(self):
102         """
103         :type: bool
104         """
105         self._completeIfNotSet(self._prerelease)
106         return self._prerelease.value
107 
108     @property
109     def author(self):
110         """
111         :type: :class:`github.NamedUser.NamedUser`
112         """
113         self._completeIfNotSet(self._author)
114         return self._author.value
115 
116     @property
117     def created_at(self):
118         """
119         :type: datetime.datetime
120         """
121         self._completeIfNotSet(self._created_at)
122         return self._created_at.value
123 
124     @property
125     def published_at(self):
126         """
127         :type: datetime.datetime
128         """
129         self._completeIfNotSet(self._published_at)
130         return self._published_at.value
131 
132     @property
133     def url(self):
134         """
135         :type: string
136         """
137         self._completeIfNotSet(self._url)
138         return self._url.value
139 
140     @property
141     def upload_url(self):
142         """
143         :type: string
144         """
145         self._completeIfNotSet(self._upload_url)
146         return self._upload_url.value
147 
148     @property
149     def html_url(self):
150         """
151         :type: string
152         """
153         self._completeIfNotSet(self._html_url)
154         return self._html_url.value
155 
156     @property
157     def tarball_url(self):
158         """
159         :type: string
160         """
161         self._completeIfNotSet(self._tarball_url)
162         return self._tarball_url.value
163 
164     @property
165     def zipball_url(self):
166         """
167         :type: string
168         """
169         self._completeIfNotSet(self._zipball_url)
170         return self._zipball_url.value
171 
172     def delete_release(self):
173         """
174         :calls: `DELETE /repos/:owner/:repo/releases/:release_id <https://developer.github.com/v3/repos/releases/#delete-a-release>`_
175         :rtype: None
176         """
177         headers, data = self._requester.requestJsonAndCheck(
178             "DELETE",
179             self.url
180         )
181 
182     def update_release(self, name, message, draft=False, prerelease=False,
183                        tag_name=github.GithubObject.NotSet,
184                        target_commitish=github.GithubObject.NotSet):
185         """
186         :calls: `PATCH /repos/:owner/:repo/releases/:release_id <https://developer.github.com/v3/repos/releases/#edit-a-release>`_
187         :rtype: :class:`github.GitRelease.GitRelease`
188         """
189         assert tag_name is github.GithubObject.NotSet              \
190             or isinstance(tag_name, (str, unicode)),               \
191             'tag_name must be a str/unicode object'
192         assert target_commitish is github.GithubObject.NotSet      \
193             or isinstance(target_commitish, (str, unicode)),       \
194             'target_commitish must be a str/unicode object'
195         assert isinstance(name, (str, unicode)), name
196         assert isinstance(message, (str, unicode)), message
197         assert isinstance(draft, bool), draft
198         assert isinstance(prerelease, bool), prerelease
199         if tag_name is github.GithubObject.NotSet:
200             tag_name = self.tag_name
201         post_parameters = {
202             "tag_name": tag_name,
203             "name": name,
204             "body": message,
205             "draft": draft,
206             "prerelease": prerelease,
207         }
208         # Do not set target_commitish to self.target_commitish when ommited, just don't send it
209         # alltogether in that case, in order to match the Github API behaviour. Only send it when set.
210         if target_commitish is not github.GithubObject.NotSet:
211             post_parameters['target_commitish'] = target_commitish
212         headers, data = self._requester.requestJsonAndCheck(
213             "PATCH",
214             self.url,
215             input=post_parameters
216         )
217         return github.GitRelease.GitRelease(self._requester, headers, data, completed=True)
218 
219     def upload_asset(self, path, label="", content_type=""):
220         """
221         :calls: `POST https://<upload_url>/repos/:owner/:repo/releases/:release_id/assets?name=foo.zip <https://developer.github.com/v3/repos/releases/#upload-a-release-asset>`_
222         :rtype: :class:`github.GitReleaseAsset.GitReleaseAsset`
223         """
224         assert isinstance(path, (str, unicode)), path
225         assert isinstance(label, (str, unicode)), label
226 
227         post_parameters = {
228             "name": basename(path),
229             "label": label
230         }
231         headers = {}
232         if len(content_type) > 0:
233             headers["Content-Type"] = content_type
234         resp_headers, data = self._requester.requestBlobAndCheck(
235             "POST",
236             self.upload_url.split("{?")[0],
237             parameters=post_parameters,
238             headers=headers,
239             input=path
240         )
241         return github.GitReleaseAsset.GitReleaseAsset(self._requester, resp_headers, data, completed=True)
242 
243     def get_assets(self):
244         """
245         :calls: `GET /repos/:owner/:repo/releases/:release_id/assets <https://developer.github.com/v3/repos/releases/#list-assets-for-a-release>`_
246         :rtype: :class:`github.PaginatedList.PaginatedList`
247         """
248         return github.PaginatedList.PaginatedList(
249             github.GitReleaseAsset.GitReleaseAsset,
250             self._requester,
251             self.url + "/assets",
252             None
253         )
254 
255     def _initAttributes(self):
256         self._id = github.GithubObject.NotSet
257         self._body = github.GithubObject.NotSet
258         self._title = github.GithubObject.NotSet
259         self._tag_name = github.GithubObject.NotSet
260         self._target_commitish = github.GithubObject.NotSet
261         self._draft = github.GithubObject.NotSet
262         self._prerelease = github.GithubObject.NotSet
263         self._author = github.GithubObject.NotSet
264         self._url = github.GithubObject.NotSet
265         self._upload_url = github.GithubObject.NotSet
266         self._html_url = github.GithubObject.NotSet
267         self._created_at = github.GithubObject.NotSet
268         self._published_at = github.GithubObject.NotSet
269         self._tarball_url = github.GithubObject.NotSet
270         self._zipball_url = github.GithubObject.NotSet
271 
272     def _useAttributes(self, attributes):
273         if "id" in attributes:
274             self._id = self._makeIntAttribute(attributes["id"])
275         if "body" in attributes:
276             self._body = self._makeStringAttribute(attributes["body"])
277         if "name" in attributes:
278             self._title = self._makeStringAttribute(attributes["name"])
279         if "tag_name" in attributes:
280             self._tag_name = self._makeStringAttribute(attributes["tag_name"])
281         if "target_commitish" in attributes:
282             self._target_commitish = self._makeStringAttribute(attributes["target_commitish"])
283         if "draft" in attributes:
284             self._draft = self._makeBoolAttribute(attributes["draft"])
285         if "prerelease" in attributes:
286             self._prerelease = self._makeBoolAttribute(attributes["prerelease"])
287         if "author" in attributes:
288             self._author = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["author"])
289         if "url" in attributes:
290             self._url = self._makeStringAttribute(attributes["url"])
291         if "upload_url" in attributes:
292             self._upload_url = self._makeStringAttribute(attributes["upload_url"])
293         if "html_url" in attributes:
294             self._html_url = self._makeStringAttribute(attributes["html_url"])
295         if "created_at" in attributes:
296             self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
297         if "published_at" in attributes:
298             self._published_at = self._makeDatetimeAttribute(attributes["published_at"])
299         if "tarball_url" in attributes:
300             self._tarball_url = self._makeStringAttribute(attributes["tarball_url"])
301         if "zipball_url" in attributes:
302             self._zipball_url = self._makeStringAttribute(attributes["zipball_url"])
303
```
--- 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/github/GitRelease.py b/github/GitRelease.py
--- a/github/GitRelease.py
+++ b/github/GitRelease.py
@@ -216,20 +216,24 @@
         )
         return github.GitRelease.GitRelease(self._requester, headers, data, completed=True)
 
-    def upload_asset(self, path, label="", content_type=""):
+    def upload_asset(self, path, label="", content_type=github.GithubObject.NotSet, name=github.GithubObject.NotSet):
         """
-        :calls: `POST https://<upload_url>/repos/:owner/:repo/releases/:release_id/assets?name=foo.zip <https://developer.github.com/v3/repos/releases/#upload-a-release-asset>`_
+        :calls: `POST https://<upload_url>/repos/:owner/:repo/releases/:release_id/assets <https://developer.github.com/v3/repos/releases/#upload-a-release-asset>`_
         :rtype: :class:`github.GitReleaseAsset.GitReleaseAsset`
         """
         assert isinstance(path, (str, unicode)), path
         assert isinstance(label, (str, unicode)), label
+        assert name is github.GithubObject.NotSet or isinstance(name, (str, unicode)), name
 
         post_parameters = {
-            "name": basename(path),
             "label": label
         }
+        if name is github.GithubObject.NotSet:
+            post_parameters["name"] = basename(path)
+        else:
+            post_parameters["name"] = name
         headers = {}
-        if len(content_type) > 0:
+        if content_type is not github.GithubObject.NotSet:
             headers["Content-Type"] = content_type
         resp_headers, data = self._requester.requestBlobAndCheck(
             "POST",

{"golden_diff": "diff --git a/github/GitRelease.py b/github/GitRelease.py\n--- a/github/GitRelease.py\n+++ b/github/GitRelease.py\n@@ -216,20 +216,24 @@\n         )\n         return github.GitRelease.GitRelease(self._requester, headers, data, completed=True)\n \n-    def upload_asset(self, path, label=\"\", content_type=\"\"):\n+    def upload_asset(self, path, label=\"\", content_type=github.GithubObject.NotSet, name=github.GithubObject.NotSet):\n         \"\"\"\n-        :calls: `POST https://<upload_url>/repos/:owner/:repo/releases/:release_id/assets?name=foo.zip <https://developer.github.com/v3/repos/releases/#upload-a-release-asset>`_\n+        :calls: `POST https://<upload_url>/repos/:owner/:repo/releases/:release_id/assets <https://developer.github.com/v3/repos/releases/#upload-a-release-asset>`_\n         :rtype: :class:`github.GitReleaseAsset.GitReleaseAsset`\n         \"\"\"\n         assert isinstance(path, (str, unicode)), path\n         assert isinstance(label, (str, unicode)), label\n+        assert name is github.GithubObject.NotSet or isinstance(name, (str, unicode)), name\n \n         post_parameters = {\n-            \"name\": basename(path),\n             \"label\": label\n         }\n+        if name is github.GithubObject.NotSet:\n+            post_parameters[\"name\"] = basename(path)\n+        else:\n+            post_parameters[\"name\"] = name\n         headers = {}\n-        if len(content_type) > 0:\n+        if content_type is not github.GithubObject.NotSet:\n             headers[\"Content-Type\"] = content_type\n         resp_headers, data = self._requester.requestBlobAndCheck(\n             \"POST\",\n", "issue": "Allow setting `name` for upload_asset\nCurrently, PyGithub uses `path.basename` for the `name` of the file assets -- could it be added that I can choose my own name? I can of course rename the file before upload, but it would be easier if I could just specify the name.\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\n############################ Copyrights and license ############################\n#                                                                              #\n# Copyright 2015 Ed Holland <eholland@alertlogic.com>                          #\n# Copyright 2016 Benjamin Whitney <benjamin.whitney@ironnetcybersecurity.com>  #\n# Copyright 2016 Jannis Gebauer <ja.geb@me.com>                                #\n# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com>          #\n# Copyright 2017 Chris McBride <thehighlander@users.noreply.github.com>        #\n# Copyright 2017 Simon <spam@esemi.ru>                                         #\n# Copyright 2018 Daniel Kesler <kesler.daniel@gmail.com>                       #\n# Copyright 2018 Kuba <jakub.glapa@adspired.com>                               #\n# Copyright 2018 Maarten Fonville <mfonville@users.noreply.github.com>         #\n# Copyright 2018 Shinichi TAMURA <shnch.tmr@gmail.com>                         #\n# Copyright 2018 Wan Liuyang <tsfdye@gmail.com>                                #\n# Copyright 2018 edquist <edquist@users.noreply.github.com>                    #\n# Copyright 2018 nurupo <nurupo.contributions@gmail.com>                       #\n# Copyright 2018 sfdye <tsfdye@gmail.com>                                      #\n#                                                                              #\n# This file is part of PyGithub.                                               #\n# http://pygithub.readthedocs.io/                                              #\n#                                                                              #\n# PyGithub is free software: you can redistribute it and/or modify it under    #\n# the terms of the GNU Lesser General Public License as published by the Free  #\n# Software Foundation, either version 3 of the License, or (at your option)    #\n# any later version.                                                           #\n#                                                                              #\n# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY  #\n# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS    #\n# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #\n# details.                                                                     #\n#                                                                              #\n# You should have received a copy of the GNU Lesser General Public License     #\n# along with PyGithub. If not, see <http://www.gnu.org/licenses/>.             #\n#                                                                              #\n################################################################################\n\nfrom os.path import basename\nimport github.GithubObject\nimport github.NamedUser\nimport github.GitReleaseAsset\n\n\nclass GitRelease(github.GithubObject.CompletableGithubObject):\n    \"\"\"\n    This class represents GitReleases. The reference can be found here https://developer.github.com/v3/repos/releases\n    \"\"\"\n\n    def __repr__(self):\n        return self.get__repr__({\"title\": self._title.value})\n\n    @property\n    def id(self):\n        \"\"\"\n        :type: integer\n        \"\"\"\n        self._completeIfNotSet(self._id)\n        return self._id.value\n\n    @property\n    def body(self):\n        \"\"\"\n        :type: string\n        \"\"\"\n        self._completeIfNotSet(self._body)\n        return self._body.value\n\n    @property\n    def title(self):\n        \"\"\"\n        :type: string\n        \"\"\"\n        self._completeIfNotSet(self._title)\n        return self._title.value\n\n    @property\n    def tag_name(self):\n        \"\"\"\n        :type: string\n        \"\"\"\n        self._completeIfNotSet(self._tag_name)\n        return self._tag_name.value\n\n    @property\n    def target_commitish(self):\n        \"\"\"\n        :type: string\n        \"\"\"\n        self._completeIfNotSet(self._target_commitish)\n        return self._target_commitish.value\n\n    @property\n    def draft(self):\n        \"\"\"\n        :type: bool\n        \"\"\"\n        self._completeIfNotSet(self._draft)\n        return self._draft.value\n\n    @property\n    def prerelease(self):\n        \"\"\"\n        :type: bool\n        \"\"\"\n        self._completeIfNotSet(self._prerelease)\n        return self._prerelease.value\n\n    @property\n    def author(self):\n        \"\"\"\n        :type: :class:`github.NamedUser.NamedUser`\n        \"\"\"\n        self._completeIfNotSet(self._author)\n        return self._author.value\n\n    @property\n    def created_at(self):\n        \"\"\"\n        :type: datetime.datetime\n        \"\"\"\n        self._completeIfNotSet(self._created_at)\n        return self._created_at.value\n\n    @property\n    def published_at(self):\n        \"\"\"\n        :type: datetime.datetime\n        \"\"\"\n        self._completeIfNotSet(self._published_at)\n        return self._published_at.value\n\n    @property\n    def url(self):\n        \"\"\"\n        :type: string\n        \"\"\"\n        self._completeIfNotSet(self._url)\n        return self._url.value\n\n    @property\n    def upload_url(self):\n        \"\"\"\n        :type: string\n        \"\"\"\n        self._completeIfNotSet(self._upload_url)\n        return self._upload_url.value\n\n    @property\n    def html_url(self):\n        \"\"\"\n        :type: string\n        \"\"\"\n        self._completeIfNotSet(self._html_url)\n        return self._html_url.value\n\n    @property\n    def tarball_url(self):\n        \"\"\"\n        :type: string\n        \"\"\"\n        self._completeIfNotSet(self._tarball_url)\n        return self._tarball_url.value\n\n    @property\n    def zipball_url(self):\n        \"\"\"\n        :type: string\n        \"\"\"\n        self._completeIfNotSet(self._zipball_url)\n        return self._zipball_url.value\n\n    def delete_release(self):\n        \"\"\"\n        :calls: `DELETE /repos/:owner/:repo/releases/:release_id <https://developer.github.com/v3/repos/releases/#delete-a-release>`_\n        :rtype: None\n        \"\"\"\n        headers, data = self._requester.requestJsonAndCheck(\n            \"DELETE\",\n            self.url\n        )\n\n    def update_release(self, name, message, draft=False, prerelease=False,\n                       tag_name=github.GithubObject.NotSet,\n                       target_commitish=github.GithubObject.NotSet):\n        \"\"\"\n        :calls: `PATCH /repos/:owner/:repo/releases/:release_id <https://developer.github.com/v3/repos/releases/#edit-a-release>`_\n        :rtype: :class:`github.GitRelease.GitRelease`\n        \"\"\"\n        assert tag_name is github.GithubObject.NotSet              \\\n            or isinstance(tag_name, (str, unicode)),               \\\n            'tag_name must be a str/unicode object'\n        assert target_commitish is github.GithubObject.NotSet      \\\n            or isinstance(target_commitish, (str, unicode)),       \\\n            'target_commitish must be a str/unicode object'\n        assert isinstance(name, (str, unicode)), name\n        assert isinstance(message, (str, unicode)), message\n        assert isinstance(draft, bool), draft\n        assert isinstance(prerelease, bool), prerelease\n        if tag_name is github.GithubObject.NotSet:\n            tag_name = self.tag_name\n        post_parameters = {\n            \"tag_name\": tag_name,\n            \"name\": name,\n            \"body\": message,\n            \"draft\": draft,\n            \"prerelease\": prerelease,\n        }\n        # Do not set target_commitish to self.target_commitish when ommited, just don't send it\n        # alltogether in that case, in order to match the Github API behaviour. Only send it when set.\n        if target_commitish is not github.GithubObject.NotSet:\n            post_parameters['target_commitish'] = target_commitish\n        headers, data = self._requester.requestJsonAndCheck(\n            \"PATCH\",\n            self.url,\n            input=post_parameters\n        )\n        return github.GitRelease.GitRelease(self._requester, headers, data, completed=True)\n\n    def upload_asset(self, path, label=\"\", content_type=\"\"):\n        \"\"\"\n        :calls: `POST https://<upload_url>/repos/:owner/:repo/releases/:release_id/assets?name=foo.zip <https://developer.github.com/v3/repos/releases/#upload-a-release-asset>`_\n        :rtype: :class:`github.GitReleaseAsset.GitReleaseAsset`\n        \"\"\"\n        assert isinstance(path, (str, unicode)), path\n        assert isinstance(label, (str, unicode)), label\n\n        post_parameters = {\n            \"name\": basename(path),\n            \"label\": label\n        }\n        headers = {}\n        if len(content_type) > 0:\n            headers[\"Content-Type\"] = content_type\n        resp_headers, data = self._requester.requestBlobAndCheck(\n            \"POST\",\n            self.upload_url.split(\"{?\")[0],\n            parameters=post_parameters,\n            headers=headers,\n            input=path\n        )\n        return github.GitReleaseAsset.GitReleaseAsset(self._requester, resp_headers, data, completed=True)\n\n    def get_assets(self):\n        \"\"\"\n        :calls: `GET /repos/:owner/:repo/releases/:release_id/assets <https://developer.github.com/v3/repos/releases/#list-assets-for-a-release>`_\n        :rtype: :class:`github.PaginatedList.PaginatedList`\n        \"\"\"\n        return github.PaginatedList.PaginatedList(\n            github.GitReleaseAsset.GitReleaseAsset,\n            self._requester,\n            self.url + \"/assets\",\n            None\n        )\n\n    def _initAttributes(self):\n        self._id = github.GithubObject.NotSet\n        self._body = github.GithubObject.NotSet\n        self._title = github.GithubObject.NotSet\n        self._tag_name = github.GithubObject.NotSet\n        self._target_commitish = github.GithubObject.NotSet\n        self._draft = github.GithubObject.NotSet\n        self._prerelease = github.GithubObject.NotSet\n        self._author = github.GithubObject.NotSet\n        self._url = github.GithubObject.NotSet\n        self._upload_url = github.GithubObject.NotSet\n        self._html_url = github.GithubObject.NotSet\n        self._created_at = github.GithubObject.NotSet\n        self._published_at = github.GithubObject.NotSet\n        self._tarball_url = github.GithubObject.NotSet\n        self._zipball_url = github.GithubObject.NotSet\n\n    def _useAttributes(self, attributes):\n        if \"id\" in attributes:\n            self._id = self._makeIntAttribute(attributes[\"id\"])\n        if \"body\" in attributes:\n            self._body = self._makeStringAttribute(attributes[\"body\"])\n        if \"name\" in attributes:\n            self._title = self._makeStringAttribute(attributes[\"name\"])\n        if \"tag_name\" in attributes:\n            self._tag_name = self._makeStringAttribute(attributes[\"tag_name\"])\n        if \"target_commitish\" in attributes:\n            self._target_commitish = self._makeStringAttribute(attributes[\"target_commitish\"])\n        if \"draft\" in attributes:\n            self._draft = self._makeBoolAttribute(attributes[\"draft\"])\n        if \"prerelease\" in attributes:\n            self._prerelease = self._makeBoolAttribute(attributes[\"prerelease\"])\n        if \"author\" in attributes:\n            self._author = self._makeClassAttribute(github.NamedUser.NamedUser, attributes[\"author\"])\n        if \"url\" in attributes:\n            self._url = self._makeStringAttribute(attributes[\"url\"])\n        if \"upload_url\" in attributes:\n            self._upload_url = self._makeStringAttribute(attributes[\"upload_url\"])\n        if \"html_url\" in attributes:\n            self._html_url = self._makeStringAttribute(attributes[\"html_url\"])\n        if \"created_at\" in attributes:\n            self._created_at = self._makeDatetimeAttribute(attributes[\"created_at\"])\n        if \"published_at\" in attributes:\n            self._published_at = self._makeDatetimeAttribute(attributes[\"published_at\"])\n        if \"tarball_url\" in attributes:\n            self._tarball_url = self._makeStringAttribute(attributes[\"tarball_url\"])\n        if \"zipball_url\" in attributes:\n            self._zipball_url = self._makeStringAttribute(attributes[\"zipball_url\"])\n", "path": "github/GitRelease.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\n############################ Copyrights and license ############################\n#                                                                              #\n# Copyright 2015 Ed Holland <eholland@alertlogic.com>                          #\n# Copyright 2016 Benjamin Whitney <benjamin.whitney@ironnetcybersecurity.com>  #\n# Copyright 2016 Jannis Gebauer <ja.geb@me.com>                                #\n# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com>          #\n# Copyright 2017 Chris McBride <thehighlander@users.noreply.github.com>        #\n# Copyright 2017 Simon <spam@esemi.ru>                                         #\n# Copyright 2018 Daniel Kesler <kesler.daniel@gmail.com>                       #\n# Copyright 2018 Kuba <jakub.glapa@adspired.com>                               #\n# Copyright 2018 Maarten Fonville <mfonville@users.noreply.github.com>         #\n# Copyright 2018 Shinichi TAMURA <shnch.tmr@gmail.com>                         #\n# Copyright 2018 Wan Liuyang <tsfdye@gmail.com>                                #\n# Copyright 2018 edquist <edquist@users.noreply.github.com>                    #\n# Copyright 2018 nurupo <nurupo.contributions@gmail.com>                       #\n# Copyright 2018 sfdye <tsfdye@gmail.com>                                      #\n#                                                                              #\n# This file is part of PyGithub.                                               #\n# http://pygithub.readthedocs.io/                                              #\n#                                                                              #\n# PyGithub is free software: you can redistribute it and/or modify it under    #\n# the terms of the GNU Lesser General Public License as published by the Free  #\n# Software Foundation, either version 3 of the License, or (at your option)    #\n# any later version.                                                           #\n#                                                                              #\n# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY  #\n# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS    #\n# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #\n# details.                                                                     #\n#                                                                              #\n# You should have received a copy of the GNU Lesser General Public License     #\n# along with PyGithub. If not, see <http://www.gnu.org/licenses/>.             #\n#                                                                              #\n################################################################################\n\nfrom os.path import basename\nimport github.GithubObject\nimport github.NamedUser\nimport github.GitReleaseAsset\n\n\nclass GitRelease(github.GithubObject.CompletableGithubObject):\n    \"\"\"\n    This class represents GitReleases. The reference can be found here https://developer.github.com/v3/repos/releases\n    \"\"\"\n\n    def __repr__(self):\n        return self.get__repr__({\"title\": self._title.value})\n\n    @property\n    def id(self):\n        \"\"\"\n        :type: integer\n        \"\"\"\n        self._completeIfNotSet(self._id)\n        return self._id.value\n\n    @property\n    def body(self):\n        \"\"\"\n        :type: string\n        \"\"\"\n        self._completeIfNotSet(self._body)\n        return self._body.value\n\n    @property\n    def title(self):\n        \"\"\"\n        :type: string\n        \"\"\"\n        self._completeIfNotSet(self._title)\n        return self._title.value\n\n    @property\n    def tag_name(self):\n        \"\"\"\n        :type: string\n        \"\"\"\n        self._completeIfNotSet(self._tag_name)\n        return self._tag_name.value\n\n    @property\n    def target_commitish(self):\n        \"\"\"\n        :type: string\n        \"\"\"\n        self._completeIfNotSet(self._target_commitish)\n        return self._target_commitish.value\n\n    @property\n    def draft(self):\n        \"\"\"\n        :type: bool\n        \"\"\"\n        self._completeIfNotSet(self._draft)\n        return self._draft.value\n\n    @property\n    def prerelease(self):\n        \"\"\"\n        :type: bool\n        \"\"\"\n        self._completeIfNotSet(self._prerelease)\n        return self._prerelease.value\n\n    @property\n    def author(self):\n        \"\"\"\n        :type: :class:`github.NamedUser.NamedUser`\n        \"\"\"\n        self._completeIfNotSet(self._author)\n        return self._author.value\n\n    @property\n    def created_at(self):\n        \"\"\"\n        :type: datetime.datetime\n        \"\"\"\n        self._completeIfNotSet(self._created_at)\n        return self._created_at.value\n\n    @property\n    def published_at(self):\n        \"\"\"\n        :type: datetime.datetime\n        \"\"\"\n        self._completeIfNotSet(self._published_at)\n        return self._published_at.value\n\n    @property\n    def url(self):\n        \"\"\"\n        :type: string\n        \"\"\"\n        self._completeIfNotSet(self._url)\n        return self._url.value\n\n    @property\n    def upload_url(self):\n        \"\"\"\n        :type: string\n        \"\"\"\n        self._completeIfNotSet(self._upload_url)\n        return self._upload_url.value\n\n    @property\n    def html_url(self):\n        \"\"\"\n        :type: string\n        \"\"\"\n        self._completeIfNotSet(self._html_url)\n        return self._html_url.value\n\n    @property\n    def tarball_url(self):\n        \"\"\"\n        :type: string\n        \"\"\"\n        self._completeIfNotSet(self._tarball_url)\n        return self._tarball_url.value\n\n    @property\n    def zipball_url(self):\n        \"\"\"\n        :type: string\n        \"\"\"\n        self._completeIfNotSet(self._zipball_url)\n        return self._zipball_url.value\n\n    def delete_release(self):\n        \"\"\"\n        :calls: `DELETE /repos/:owner/:repo/releases/:release_id <https://developer.github.com/v3/repos/releases/#delete-a-release>`_\n        :rtype: None\n        \"\"\"\n        headers, data = self._requester.requestJsonAndCheck(\n            \"DELETE\",\n            self.url\n        )\n\n    def update_release(self, name, message, draft=False, prerelease=False,\n                       tag_name=github.GithubObject.NotSet,\n                       target_commitish=github.GithubObject.NotSet):\n        \"\"\"\n        :calls: `PATCH /repos/:owner/:repo/releases/:release_id <https://developer.github.com/v3/repos/releases/#edit-a-release>`_\n        :rtype: :class:`github.GitRelease.GitRelease`\n        \"\"\"\n        assert tag_name is github.GithubObject.NotSet              \\\n            or isinstance(tag_name, (str, unicode)),               \\\n            'tag_name must be a str/unicode object'\n        assert target_commitish is github.GithubObject.NotSet      \\\n            or isinstance(target_commitish, (str, unicode)),       \\\n            'target_commitish must be a str/unicode object'\n        assert isinstance(name, (str, unicode)), name\n        assert isinstance(message, (str, unicode)), message\n        assert isinstance(draft, bool), draft\n        assert isinstance(prerelease, bool), prerelease\n        if tag_name is github.GithubObject.NotSet:\n            tag_name = self.tag_name\n        post_parameters = {\n            \"tag_name\": tag_name,\n            \"name\": name,\n            \"body\": message,\n            \"draft\": draft,\n            \"prerelease\": prerelease,\n        }\n        # Do not set target_commitish to self.target_commitish when ommited, just don't send it\n        # alltogether in that case, in order to match the Github API behaviour. Only send it when set.\n        if target_commitish is not github.GithubObject.NotSet:\n            post_parameters['target_commitish'] = target_commitish\n        headers, data = self._requester.requestJsonAndCheck(\n            \"PATCH\",\n            self.url,\n            input=post_parameters\n        )\n        return github.GitRelease.GitRelease(self._requester, headers, data, completed=True)\n\n    def upload_asset(self, path, label=\"\", content_type=github.GithubObject.NotSet, name=github.GithubObject.NotSet):\n        \"\"\"\n        :calls: `POST https://<upload_url>/repos/:owner/:repo/releases/:release_id/assets <https://developer.github.com/v3/repos/releases/#upload-a-release-asset>`_\n        :rtype: :class:`github.GitReleaseAsset.GitReleaseAsset`\n        \"\"\"\n        assert isinstance(path, (str, unicode)), path\n        assert isinstance(label, (str, unicode)), label\n        assert name is github.GithubObject.NotSet or isinstance(name, (str, unicode)), name\n\n        post_parameters = {\n            \"label\": label\n        }\n        if name is github.GithubObject.NotSet:\n            post_parameters[\"name\"] = basename(path)\n        else:\n            post_parameters[\"name\"] = name\n        headers = {}\n        if content_type is not github.GithubObject.NotSet:\n            headers[\"Content-Type\"] = content_type\n        resp_headers, data = self._requester.requestBlobAndCheck(\n            \"POST\",\n            self.upload_url.split(\"{?\")[0],\n            parameters=post_parameters,\n            headers=headers,\n            input=path\n        )\n        return github.GitReleaseAsset.GitReleaseAsset(self._requester, resp_headers, data, completed=True)\n\n    def get_assets(self):\n        \"\"\"\n        :calls: `GET /repos/:owner/:repo/releases/:release_id/assets <https://developer.github.com/v3/repos/releases/#list-assets-for-a-release>`_\n        :rtype: :class:`github.PaginatedList.PaginatedList`\n        \"\"\"\n        return github.PaginatedList.PaginatedList(\n            github.GitReleaseAsset.GitReleaseAsset,\n            self._requester,\n            self.url + \"/assets\",\n            None\n        )\n\n    def _initAttributes(self):\n        self._id = github.GithubObject.NotSet\n        self._body = github.GithubObject.NotSet\n        self._title = github.GithubObject.NotSet\n        self._tag_name = github.GithubObject.NotSet\n        self._target_commitish = github.GithubObject.NotSet\n        self._draft = github.GithubObject.NotSet\n        self._prerelease = github.GithubObject.NotSet\n        self._author = github.GithubObject.NotSet\n        self._url = github.GithubObject.NotSet\n        self._upload_url = github.GithubObject.NotSet\n        self._html_url = github.GithubObject.NotSet\n        self._created_at = github.GithubObject.NotSet\n        self._published_at = github.GithubObject.NotSet\n        self._tarball_url = github.GithubObject.NotSet\n        self._zipball_url = github.GithubObject.NotSet\n\n    def _useAttributes(self, attributes):\n        if \"id\" in attributes:\n            self._id = self._makeIntAttribute(attributes[\"id\"])\n        if \"body\" in attributes:\n            self._body = self._makeStringAttribute(attributes[\"body\"])\n        if \"name\" in attributes:\n            self._title = self._makeStringAttribute(attributes[\"name\"])\n        if \"tag_name\" in attributes:\n            self._tag_name = self._makeStringAttribute(attributes[\"tag_name\"])\n        if \"target_commitish\" in attributes:\n            self._target_commitish = self._makeStringAttribute(attributes[\"target_commitish\"])\n        if \"draft\" in attributes:\n            self._draft = self._makeBoolAttribute(attributes[\"draft\"])\n        if \"prerelease\" in attributes:\n            self._prerelease = self._makeBoolAttribute(attributes[\"prerelease\"])\n        if \"author\" in attributes:\n            self._author = self._makeClassAttribute(github.NamedUser.NamedUser, attributes[\"author\"])\n        if \"url\" in attributes:\n            self._url = self._makeStringAttribute(attributes[\"url\"])\n        if \"upload_url\" in attributes:\n            self._upload_url = self._makeStringAttribute(attributes[\"upload_url\"])\n        if \"html_url\" in attributes:\n            self._html_url = self._makeStringAttribute(attributes[\"html_url\"])\n        if \"created_at\" in attributes:\n            self._created_at = self._makeDatetimeAttribute(attributes[\"created_at\"])\n        if \"published_at\" in attributes:\n            self._published_at = self._makeDatetimeAttribute(attributes[\"published_at\"])\n        if \"tarball_url\" in attributes:\n            self._tarball_url = self._makeStringAttribute(attributes[\"tarball_url\"])\n        if \"zipball_url\" in attributes:\n            self._zipball_url = self._makeStringAttribute(attributes[\"zipball_url\"])\n", "path": "github/GitRelease.py"}]}