diff --git a/CodeGenerator/templates/GithubObject.MethodBody.DoRequest.py b/CodeGenerator/templates/GithubObject.MethodBody.DoRequest.py index a4bbe073..59fb0235 100644 --- a/CodeGenerator/templates/GithubObject.MethodBody.DoRequest.py +++ b/CodeGenerator/templates/GithubObject.MethodBody.DoRequest.py @@ -5,7 +5,7 @@ {% endfor %} } {% for parameter in method.optional_parameters %} - if {{ parameter.name }} is not None: + if {{ parameter.name }} is not DefaultValueForOptionalParameters: post_parameters[ "{{ parameter.name }}" ] = {{ parameter.name }} {% endfor %} {% endif %} diff --git a/CodeGenerator/templates/GithubObject.Parameters.py b/CodeGenerator/templates/GithubObject.Parameters.py index 247eb246..6979049c 100644 --- a/CodeGenerator/templates/GithubObject.Parameters.py +++ b/CodeGenerator/templates/GithubObject.Parameters.py @@ -1 +1 @@ -self{% for parameter in function.mandatory_parameters %}, {{ parameter.name }}{% endfor %}{% for parameter in function.optional_parameters %}, {{ parameter.name }} = None{% endfor %}{% if function.variadic_parameter %}, *{{ function.variadic_parameter.name }}s{% endif %} \ No newline at end of file +self{% for parameter in function.mandatory_parameters %}, {{ parameter.name }}{% endfor %}{% for parameter in function.optional_parameters %}, {{ parameter.name }} = DefaultValueForOptionalParameters{% endfor %}{% if function.variadic_parameter %}, *{{ function.variadic_parameter.name }}s{% endif %} \ No newline at end of file diff --git a/CodeGenerator/templates/GithubObject.py b/CodeGenerator/templates/GithubObject.py index 6ec60aa1..e9ed55d2 100644 --- a/CodeGenerator/templates/GithubObject.py +++ b/CodeGenerator/templates/GithubObject.py @@ -2,6 +2,11 @@ import {{ dependency }} {% endfor %} +# This allows None as a valid value for an optional parameter +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() + class {{ class.name }}( object ): def __init__( self, requester, attributes, lazy ): self.__requester = requester diff --git a/IntegrationTest.py b/IntegrationTest.py index b44effb7..4c442bc2 100644 --- a/IntegrationTest.py +++ b/IntegrationTest.py @@ -278,14 +278,14 @@ class IntegrationTest: u.edit( name = originalName ) print u.name - # def testEditOrganization( self ): - # o = self.g.get_organization( self.cobayeOrganization ) - # originalName = o.name - # print o.name - # o.edit( name = str( o.name ) + " (edited by PyGithub)" ) - # print o.name - # o.edit( name = originalName ) - # print o.name + def testEditOrganization( self ): + o = self.g.get_organization( self.cobayeOrganization ) + originalName = o.name + print o.name + o.edit( name = str( o.name ) + " (edited by PyGithub)" ) + print o.name + o.edit( name = originalName ) + print o.name # def testEditOrganizationTeamAndMembers( self ): # o = self.g.get_organization( self.cobayeOrganization ) diff --git a/github/GithubObjects/AuthenticatedUser.py b/github/GithubObjects/AuthenticatedUser.py index ea2d20dc..00db7eed 100644 --- a/github/GithubObjects/AuthenticatedUser.py +++ b/github/GithubObjects/AuthenticatedUser.py @@ -9,6 +9,11 @@ import UserKey import Issue import Event import Authorization +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class AuthenticatedUser( object ): def __init__( self, requester, attributes, lazy ): @@ -163,14 +168,14 @@ class AuthenticatedUser( object ): None ) - def create_authorization( self, scopes = None, note = None, note_url = None ): + def create_authorization( self, scopes = DefaultValueForOptionalParameters, note = DefaultValueForOptionalParameters, note_url = DefaultValueForOptionalParameters ): post_parameters = { } - if scopes is not None: + if scopes is not DefaultValueForOptionalParameters: post_parameters[ "scopes" ] = scopes - if note is not None: + if note is not DefaultValueForOptionalParameters: post_parameters[ "note" ] = note - if note_url is not None: + if note_url is not DefaultValueForOptionalParameters: post_parameters[ "note_url" ] = note_url status, headers, data = self.__requester.request( "POST", @@ -189,12 +194,12 @@ class AuthenticatedUser( object ): ) return Repository.Repository( self.__requester, data, lazy = True ) - def create_gist( self, public, files, description = None ): + def create_gist( self, public, files, description = DefaultValueForOptionalParameters ): post_parameters = { "public": public, "files": files, } - if description is not None: + if description is not DefaultValueForOptionalParameters: post_parameters[ "description" ] = description status, headers, data = self.__requester.request( "POST", @@ -217,23 +222,23 @@ class AuthenticatedUser( object ): ) return UserKey.UserKey( self.__requester, data, lazy = True ) - def create_repo( self, name, description = None, homepage = None, private = None, has_issues = None, has_wiki = None, has_downloads = None, team_id = None ): + def create_repo( self, name, description = DefaultValueForOptionalParameters, homepage = DefaultValueForOptionalParameters, private = DefaultValueForOptionalParameters, has_issues = DefaultValueForOptionalParameters, has_wiki = DefaultValueForOptionalParameters, has_downloads = DefaultValueForOptionalParameters, team_id = DefaultValueForOptionalParameters ): post_parameters = { "name": name, } - if description is not None: + if description is not DefaultValueForOptionalParameters: post_parameters[ "description" ] = description - if homepage is not None: + if homepage is not DefaultValueForOptionalParameters: post_parameters[ "homepage" ] = homepage - if private is not None: + if private is not DefaultValueForOptionalParameters: post_parameters[ "private" ] = private - if has_issues is not None: + if has_issues is not DefaultValueForOptionalParameters: post_parameters[ "has_issues" ] = has_issues - if has_wiki is not None: + if has_wiki is not DefaultValueForOptionalParameters: post_parameters[ "has_wiki" ] = has_wiki - if has_downloads is not None: + if has_downloads is not DefaultValueForOptionalParameters: post_parameters[ "has_downloads" ] = has_downloads - if team_id is not None: + if team_id is not DefaultValueForOptionalParameters: post_parameters[ "team_id" ] = team_id status, headers, data = self.__requester.request( "POST", @@ -243,22 +248,22 @@ class AuthenticatedUser( object ): ) return Repository.Repository( self.__requester, data, lazy = True ) - def edit( self, name = None, email = None, blog = None, company = None, location = None, hireable = None, bio = None ): + def edit( self, name = DefaultValueForOptionalParameters, email = DefaultValueForOptionalParameters, blog = DefaultValueForOptionalParameters, company = DefaultValueForOptionalParameters, location = DefaultValueForOptionalParameters, hireable = DefaultValueForOptionalParameters, bio = DefaultValueForOptionalParameters ): post_parameters = { } - if name is not None: + if name is not DefaultValueForOptionalParameters: post_parameters[ "name" ] = name - if email is not None: + if email is not DefaultValueForOptionalParameters: post_parameters[ "email" ] = email - if blog is not None: + if blog is not DefaultValueForOptionalParameters: post_parameters[ "blog" ] = blog - if company is not None: + if company is not DefaultValueForOptionalParameters: post_parameters[ "company" ] = company - if location is not None: + if location is not DefaultValueForOptionalParameters: post_parameters[ "location" ] = location - if hireable is not None: + if hireable is not DefaultValueForOptionalParameters: post_parameters[ "hireable" ] = hireable - if bio is not None: + if bio is not DefaultValueForOptionalParameters: post_parameters[ "bio" ] = bio status, headers, data = self.__requester.request( "PATCH", @@ -402,7 +407,7 @@ class AuthenticatedUser( object ): ) return Repository.Repository( self.__requester, data, lazy = True ) - def get_repos( self, type = None ): + def get_repos( self, type = DefaultValueForOptionalParameters ): status, headers, data = self.__requester.request( "GET", str( self.url ) + "/repos", diff --git a/github/GithubObjects/Authorization.py b/github/GithubObjects/Authorization.py index 00a60945..26f29bd8 100644 --- a/github/GithubObjects/Authorization.py +++ b/github/GithubObjects/Authorization.py @@ -1,6 +1,11 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class Authorization( object ): def __init__( self, requester, attributes, lazy ): @@ -64,18 +69,18 @@ class Authorization( object ): None ) - def edit( self, scopes = None, add_scopes = None, remove_scopes = None, note = None, note_url = None ): + def edit( self, scopes = DefaultValueForOptionalParameters, add_scopes = DefaultValueForOptionalParameters, remove_scopes = DefaultValueForOptionalParameters, note = DefaultValueForOptionalParameters, note_url = DefaultValueForOptionalParameters ): post_parameters = { } - if scopes is not None: + if scopes is not DefaultValueForOptionalParameters: post_parameters[ "scopes" ] = scopes - if add_scopes is not None: + if add_scopes is not DefaultValueForOptionalParameters: post_parameters[ "add_scopes" ] = add_scopes - if remove_scopes is not None: + if remove_scopes is not DefaultValueForOptionalParameters: post_parameters[ "remove_scopes" ] = remove_scopes - if note is not None: + if note is not DefaultValueForOptionalParameters: post_parameters[ "note" ] = note - if note_url is not None: + if note_url is not DefaultValueForOptionalParameters: post_parameters[ "note_url" ] = note_url status, headers, data = self.__requester.request( "PATCH", diff --git a/github/GithubObjects/Branch.py b/github/GithubObjects/Branch.py index b97fbfde..296546a7 100644 --- a/github/GithubObjects/Branch.py +++ b/github/GithubObjects/Branch.py @@ -2,6 +2,11 @@ # Do not modify it manually, your work would be lost. import Commit +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class Branch( object ): def __init__( self, requester, attributes, lazy ): diff --git a/github/GithubObjects/Commit.py b/github/GithubObjects/Commit.py index ac76032d..c333a8ba 100644 --- a/github/GithubObjects/Commit.py +++ b/github/GithubObjects/Commit.py @@ -4,6 +4,11 @@ import NamedUser import GitCommit import CommitComment +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class Commit( object ): def __init__( self, requester, attributes, lazy ): @@ -54,17 +59,17 @@ class Commit( object ): self.__completeIfNeeded( self.__url ) return self.__url - def create_comment( self, body, commit_id = None, line = None, path = None, position = None ): + def create_comment( self, body, commit_id = DefaultValueForOptionalParameters, line = DefaultValueForOptionalParameters, path = DefaultValueForOptionalParameters, position = DefaultValueForOptionalParameters ): post_parameters = { "body": body, } - if commit_id is not None: + if commit_id is not DefaultValueForOptionalParameters: post_parameters[ "commit_id" ] = commit_id - if line is not None: + if line is not DefaultValueForOptionalParameters: post_parameters[ "line" ] = line - if path is not None: + if path is not DefaultValueForOptionalParameters: post_parameters[ "path" ] = path - if position is not None: + if position is not DefaultValueForOptionalParameters: post_parameters[ "position" ] = position status, headers, data = self.__requester.request( "POST", diff --git a/github/GithubObjects/CommitComment.py b/github/GithubObjects/CommitComment.py index a025f8f6..45a0f891 100644 --- a/github/GithubObjects/CommitComment.py +++ b/github/GithubObjects/CommitComment.py @@ -2,6 +2,11 @@ # Do not modify it manually, your work would be lost. import NamedUser +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class CommitComment( object ): def __init__( self, requester, attributes, lazy ): diff --git a/github/GithubObjects/Download.py b/github/GithubObjects/Download.py index a19440b6..ad68d8b4 100644 --- a/github/GithubObjects/Download.py +++ b/github/GithubObjects/Download.py @@ -1,6 +1,11 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class Download( object ): def __init__( self, requester, attributes, lazy ): diff --git a/github/GithubObjects/Event.py b/github/GithubObjects/Event.py index 0e7694a8..20ff2526 100644 --- a/github/GithubObjects/Event.py +++ b/github/GithubObjects/Event.py @@ -4,6 +4,11 @@ import Organization import Repository import NamedUser +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class Event( object ): def __init__( self, requester, attributes, lazy ): diff --git a/github/GithubObjects/Gist.py b/github/GithubObjects/Gist.py index 9a36d69f..41c66dde 100644 --- a/github/GithubObjects/Gist.py +++ b/github/GithubObjects/Gist.py @@ -4,6 +4,11 @@ import NamedUser import Gist import GistComment +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class Gist( object ): def __init__( self, requester, attributes, lazy ): @@ -107,12 +112,12 @@ class Gist( object ): None ) - def edit( self, description = None, files = None ): + def edit( self, description = DefaultValueForOptionalParameters, files = DefaultValueForOptionalParameters ): post_parameters = { } - if description is not None: + if description is not DefaultValueForOptionalParameters: post_parameters[ "description" ] = description - if files is not None: + if files is not DefaultValueForOptionalParameters: post_parameters[ "files" ] = files status, headers, data = self.__requester.request( "PATCH", diff --git a/github/GithubObjects/GistComment.py b/github/GithubObjects/GistComment.py index 858161e3..0a2b8f33 100644 --- a/github/GithubObjects/GistComment.py +++ b/github/GithubObjects/GistComment.py @@ -2,6 +2,11 @@ # Do not modify it manually, your work would be lost. import NamedUser +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class GistComment( object ): def __init__( self, requester, attributes, lazy ): diff --git a/github/GithubObjects/GitBlob.py b/github/GithubObjects/GitBlob.py index bcf9e438..5b5cf483 100644 --- a/github/GithubObjects/GitBlob.py +++ b/github/GithubObjects/GitBlob.py @@ -1,6 +1,11 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class GitBlob( object ): def __init__( self, requester, attributes, lazy ): diff --git a/github/GithubObjects/GitCommit.py b/github/GithubObjects/GitCommit.py index b183ede9..7ae49011 100644 --- a/github/GithubObjects/GitCommit.py +++ b/github/GithubObjects/GitCommit.py @@ -2,6 +2,11 @@ # Do not modify it manually, your work would be lost. import GitTree +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class GitCommit( object ): def __init__( self, requester, attributes, lazy ): diff --git a/github/GithubObjects/GitRef.py b/github/GithubObjects/GitRef.py index e1078a4d..19bb7002 100644 --- a/github/GithubObjects/GitRef.py +++ b/github/GithubObjects/GitRef.py @@ -1,6 +1,11 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class GitRef( object ): def __init__( self, requester, attributes, lazy ): @@ -34,11 +39,11 @@ class GitRef( object ): None ) - def edit( self, sha, force = None ): + def edit( self, sha, force = DefaultValueForOptionalParameters ): post_parameters = { "sha": sha, } - if force is not None: + if force is not DefaultValueForOptionalParameters: post_parameters[ "force" ] = force status, headers, data = self.__requester.request( "PATCH", diff --git a/github/GithubObjects/GitTag.py b/github/GithubObjects/GitTag.py index b5e50cb3..0b781117 100644 --- a/github/GithubObjects/GitTag.py +++ b/github/GithubObjects/GitTag.py @@ -1,6 +1,11 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class GitTag( object ): def __init__( self, requester, attributes, lazy ): diff --git a/github/GithubObjects/GitTree.py b/github/GithubObjects/GitTree.py index ba5d1053..3fafcc75 100644 --- a/github/GithubObjects/GitTree.py +++ b/github/GithubObjects/GitTree.py @@ -1,6 +1,11 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class GitTree( object ): def __init__( self, requester, attributes, lazy ): diff --git a/github/GithubObjects/Hook.py b/github/GithubObjects/Hook.py index 0c8f440d..7f93b1be 100644 --- a/github/GithubObjects/Hook.py +++ b/github/GithubObjects/Hook.py @@ -1,6 +1,11 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class Hook( object ): def __init__( self, requester, attributes, lazy ): @@ -64,18 +69,18 @@ class Hook( object ): None ) - def edit( self, name, config, events = None, add_events = None, remove_events = None, active = None ): + def edit( self, name, config, events = DefaultValueForOptionalParameters, add_events = DefaultValueForOptionalParameters, remove_events = DefaultValueForOptionalParameters, active = DefaultValueForOptionalParameters ): post_parameters = { "name": name, "config": config, } - if events is not None: + if events is not DefaultValueForOptionalParameters: post_parameters[ "events" ] = events - if add_events is not None: + if add_events is not DefaultValueForOptionalParameters: post_parameters[ "add_events" ] = add_events - if remove_events is not None: + if remove_events is not DefaultValueForOptionalParameters: post_parameters[ "remove_events" ] = remove_events - if active is not None: + if active is not DefaultValueForOptionalParameters: post_parameters[ "active" ] = active status, headers, data = self.__requester.request( "PATCH", diff --git a/github/GithubObjects/Issue.py b/github/GithubObjects/Issue.py index 1512a04d..c288e1f7 100644 --- a/github/GithubObjects/Issue.py +++ b/github/GithubObjects/Issue.py @@ -6,6 +6,11 @@ import IssueEvent import NamedUser import Milestone import Label +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class Issue( object ): def __init__( self, requester, attributes, lazy ): @@ -119,20 +124,20 @@ class Issue( object ): def delete_labels( self ): pass - def edit( self, title = None, body = None, assignee = None, state = None, milestone = None, labels = None ): + def edit( self, title = DefaultValueForOptionalParameters, body = DefaultValueForOptionalParameters, assignee = DefaultValueForOptionalParameters, state = DefaultValueForOptionalParameters, milestone = DefaultValueForOptionalParameters, labels = DefaultValueForOptionalParameters ): post_parameters = { } - if title is not None: + if title is not DefaultValueForOptionalParameters: post_parameters[ "title" ] = title - if body is not None: + if body is not DefaultValueForOptionalParameters: post_parameters[ "body" ] = body - if assignee is not None: + if assignee is not DefaultValueForOptionalParameters: post_parameters[ "assignee" ] = assignee - if state is not None: + if state is not DefaultValueForOptionalParameters: post_parameters[ "state" ] = state - if milestone is not None: + if milestone is not DefaultValueForOptionalParameters: post_parameters[ "milestone" ] = milestone - if labels is not None: + if labels is not DefaultValueForOptionalParameters: post_parameters[ "labels" ] = labels status, headers, data = self.__requester.request( "PATCH", diff --git a/github/GithubObjects/IssueComment.py b/github/GithubObjects/IssueComment.py index 3c557b1c..2819386c 100644 --- a/github/GithubObjects/IssueComment.py +++ b/github/GithubObjects/IssueComment.py @@ -2,6 +2,11 @@ # Do not modify it manually, your work would be lost. import NamedUser +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class IssueComment( object ): def __init__( self, requester, attributes, lazy ): diff --git a/github/GithubObjects/IssueEvent.py b/github/GithubObjects/IssueEvent.py index f458b816..e84c42d8 100644 --- a/github/GithubObjects/IssueEvent.py +++ b/github/GithubObjects/IssueEvent.py @@ -2,6 +2,11 @@ # Do not modify it manually, your work would be lost. import NamedUser +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class IssueEvent( object ): def __init__( self, requester, attributes, lazy ): diff --git a/github/GithubObjects/Label.py b/github/GithubObjects/Label.py index b95fce77..7dbe6f3c 100644 --- a/github/GithubObjects/Label.py +++ b/github/GithubObjects/Label.py @@ -1,6 +1,11 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class Label( object ): def __init__( self, requester, attributes, lazy ): diff --git a/github/GithubObjects/Milestone.py b/github/GithubObjects/Milestone.py index b4f2427c..d55cbd0f 100644 --- a/github/GithubObjects/Milestone.py +++ b/github/GithubObjects/Milestone.py @@ -3,6 +3,11 @@ import NamedUser import Label +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class Milestone( object ): def __init__( self, requester, attributes, lazy ): @@ -71,15 +76,15 @@ class Milestone( object ): None ) - def edit( self, title, state = None, description = None, due_on = None ): + def edit( self, title, state = DefaultValueForOptionalParameters, description = DefaultValueForOptionalParameters, due_on = DefaultValueForOptionalParameters ): post_parameters = { "title": title, } - if state is not None: + if state is not DefaultValueForOptionalParameters: post_parameters[ "state" ] = state - if description is not None: + if description is not DefaultValueForOptionalParameters: post_parameters[ "description" ] = description - if due_on is not None: + if due_on is not DefaultValueForOptionalParameters: post_parameters[ "due_on" ] = due_on status, headers, data = self.__requester.request( "PATCH", diff --git a/github/GithubObjects/NamedUser.py b/github/GithubObjects/NamedUser.py index ca778589..cdf3ecad 100644 --- a/github/GithubObjects/NamedUser.py +++ b/github/GithubObjects/NamedUser.py @@ -6,6 +6,11 @@ import Gist import Event import Repository import NamedUser +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class NamedUser( object ): def __init__( self, requester, attributes, lazy ): @@ -146,12 +151,12 @@ class NamedUser( object ): self.__completeIfNeeded( self.__url ) return self.__url - def create_gist( self, public, files, description = None ): + def create_gist( self, public, files, description = DefaultValueForOptionalParameters ): post_parameters = { "public": public, "files": files, } - if description is not None: + if description is not DefaultValueForOptionalParameters: post_parameters[ "description" ] = description status, headers, data = self.__requester.request( "POST", @@ -239,7 +244,7 @@ class NamedUser( object ): ) return Repository.Repository( self.__requester, data, lazy = True ) - def get_repos( self, type = None ): + def get_repos( self, type = DefaultValueForOptionalParameters ): status, headers, data = self.__requester.request( "GET", str( self.url ) + "/repos", diff --git a/github/GithubObjects/Organization.py b/github/GithubObjects/Organization.py index f562043f..da3059b8 100644 --- a/github/GithubObjects/Organization.py +++ b/github/GithubObjects/Organization.py @@ -5,6 +5,11 @@ import Team import Event import Repository import NamedUser +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class Organization( object ): def __init__( self, requester, attributes, lazy ): @@ -152,23 +157,23 @@ class Organization( object ): ) return Repository.Repository( self.__requester, data, lazy = True ) - def create_repo( self, name, description = None, homepage = None, private = None, has_issues = None, has_wiki = None, has_downloads = None, team_id = None ): + def create_repo( self, name, description = DefaultValueForOptionalParameters, homepage = DefaultValueForOptionalParameters, private = DefaultValueForOptionalParameters, has_issues = DefaultValueForOptionalParameters, has_wiki = DefaultValueForOptionalParameters, has_downloads = DefaultValueForOptionalParameters, team_id = DefaultValueForOptionalParameters ): post_parameters = { "name": name, } - if description is not None: + if description is not DefaultValueForOptionalParameters: post_parameters[ "description" ] = description - if homepage is not None: + if homepage is not DefaultValueForOptionalParameters: post_parameters[ "homepage" ] = homepage - if private is not None: + if private is not DefaultValueForOptionalParameters: post_parameters[ "private" ] = private - if has_issues is not None: + if has_issues is not DefaultValueForOptionalParameters: post_parameters[ "has_issues" ] = has_issues - if has_wiki is not None: + if has_wiki is not DefaultValueForOptionalParameters: post_parameters[ "has_wiki" ] = has_wiki - if has_downloads is not None: + if has_downloads is not DefaultValueForOptionalParameters: post_parameters[ "has_downloads" ] = has_downloads - if team_id is not None: + if team_id is not DefaultValueForOptionalParameters: post_parameters[ "team_id" ] = team_id status, headers, data = self.__requester.request( "POST", @@ -178,13 +183,13 @@ class Organization( object ): ) return Repository.Repository( self.__requester, data, lazy = True ) - def create_team( self, name, repo_names = None, permission = None ): + def create_team( self, name, repo_names = DefaultValueForOptionalParameters, permission = DefaultValueForOptionalParameters ): post_parameters = { "name": name, } - if repo_names is not None: + if repo_names is not DefaultValueForOptionalParameters: post_parameters[ "repo_names" ] = repo_names - if permission is not None: + if permission is not DefaultValueForOptionalParameters: post_parameters[ "permission" ] = permission status, headers, data = self.__requester.request( "POST", @@ -194,20 +199,20 @@ class Organization( object ): ) return Team.Team( self.__requester, data, lazy = True ) - def edit( self, billing_email = None, blog = None, company = None, email = None, location = None, name = None ): + def edit( self, billing_email = DefaultValueForOptionalParameters, blog = DefaultValueForOptionalParameters, company = DefaultValueForOptionalParameters, email = DefaultValueForOptionalParameters, location = DefaultValueForOptionalParameters, name = DefaultValueForOptionalParameters ): post_parameters = { } - if billing_email is not None: + if billing_email is not DefaultValueForOptionalParameters: post_parameters[ "billing_email" ] = billing_email - if blog is not None: + if blog is not DefaultValueForOptionalParameters: post_parameters[ "blog" ] = blog - if company is not None: + if company is not DefaultValueForOptionalParameters: post_parameters[ "company" ] = company - if email is not None: + if email is not DefaultValueForOptionalParameters: post_parameters[ "email" ] = email - if location is not None: + if location is not DefaultValueForOptionalParameters: post_parameters[ "location" ] = location - if name is not None: + if name is not DefaultValueForOptionalParameters: post_parameters[ "name" ] = name status, headers, data = self.__requester.request( "PATCH", @@ -262,7 +267,7 @@ class Organization( object ): ) return Repository.Repository( self.__requester, data, lazy = True ) - def get_repos( self, type = None ): + def get_repos( self, type = DefaultValueForOptionalParameters ): status, headers, data = self.__requester.request( "GET", str( self.url ) + "/repos", diff --git a/github/GithubObjects/PullRequest.py b/github/GithubObjects/PullRequest.py index 9a759495..2ffad59f 100644 --- a/github/GithubObjects/PullRequest.py +++ b/github/GithubObjects/PullRequest.py @@ -5,6 +5,11 @@ import Commit import NamedUser import PullRequestComment import PullRequestFile +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class PullRequest( object ): def __init__( self, requester, attributes, lazy ): @@ -145,14 +150,14 @@ class PullRequest( object ): self.__completeIfNeeded( self.__user ) return self.__user - def edit( self, title = None, body = None, state = None ): + def edit( self, title = DefaultValueForOptionalParameters, body = DefaultValueForOptionalParameters, state = DefaultValueForOptionalParameters ): post_parameters = { } - if title is not None: + if title is not DefaultValueForOptionalParameters: post_parameters[ "title" ] = title - if body is not None: + if body is not DefaultValueForOptionalParameters: post_parameters[ "body" ] = body - if state is not None: + if state is not DefaultValueForOptionalParameters: post_parameters[ "state" ] = state status, headers, data = self.__requester.request( "PATCH", @@ -210,7 +215,7 @@ class PullRequest( object ): def is_merged( self ): pass - def merge( self, commit_message = None ): + def merge( self, commit_message = DefaultValueForOptionalParameters ): pass def __initAttributes( self ): diff --git a/github/GithubObjects/PullRequestComment.py b/github/GithubObjects/PullRequestComment.py index 52eb0d62..f4603fd9 100644 --- a/github/GithubObjects/PullRequestComment.py +++ b/github/GithubObjects/PullRequestComment.py @@ -2,6 +2,11 @@ # Do not modify it manually, your work would be lost. import NamedUser +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class PullRequestComment( object ): def __init__( self, requester, attributes, lazy ): diff --git a/github/GithubObjects/PullRequestFile.py b/github/GithubObjects/PullRequestFile.py index 48c7da8f..d6ea9e20 100644 --- a/github/GithubObjects/PullRequestFile.py +++ b/github/GithubObjects/PullRequestFile.py @@ -1,6 +1,11 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class PullRequestFile( object ): def __init__( self, requester, attributes, lazy ): diff --git a/github/GithubObjects/Repository.py b/github/GithubObjects/Repository.py index e3402791..d6a8a345 100644 --- a/github/GithubObjects/Repository.py +++ b/github/GithubObjects/Repository.py @@ -22,6 +22,11 @@ import Issue import Event import GitTree import Label +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class Repository( object ): def __init__( self, requester, attributes, lazy ): @@ -193,14 +198,14 @@ class Repository( object ): def compare( self, base, head ): pass - def create_download( self, name, size, description = None, content_type = None ): + def create_download( self, name, size, description = DefaultValueForOptionalParameters, content_type = DefaultValueForOptionalParameters ): post_parameters = { "name": name, "size": size, } - if description is not None: + if description is not DefaultValueForOptionalParameters: post_parameters[ "description" ] = description - if content_type is not None: + if content_type is not DefaultValueForOptionalParameters: post_parameters[ "content_type" ] = content_type status, headers, data = self.__requester.request( "POST", @@ -223,15 +228,15 @@ class Repository( object ): ) return GitBlob.GitBlob( self.__requester, data, lazy = True ) - def create_git_commit( self, message, tree, parents, author = None, committer = None ): + def create_git_commit( self, message, tree, parents, author = DefaultValueForOptionalParameters, committer = DefaultValueForOptionalParameters ): post_parameters = { "message": message, "tree": tree, "parents": parents, } - if author is not None: + if author is not DefaultValueForOptionalParameters: post_parameters[ "author" ] = author - if committer is not None: + if committer is not DefaultValueForOptionalParameters: post_parameters[ "committer" ] = committer status, headers, data = self.__requester.request( "POST", @@ -254,14 +259,14 @@ class Repository( object ): ) return GitRef.GitRef( self.__requester, data, lazy = True ) - def create_git_tag( self, tag, message, object, type, tagger = None ): + def create_git_tag( self, tag, message, object, type, tagger = DefaultValueForOptionalParameters ): post_parameters = { "tag": tag, "message": message, "object": object, "type": type, } - if tagger is not None: + if tagger is not DefaultValueForOptionalParameters: post_parameters[ "tagger" ] = tagger status, headers, data = self.__requester.request( "POST", @@ -271,11 +276,11 @@ class Repository( object ): ) return GitTag.GitTag( self.__requester, data, lazy = True ) - def create_git_tree( self, tree, base_tree = None ): + def create_git_tree( self, tree, base_tree = DefaultValueForOptionalParameters ): post_parameters = { "tree": tree, } - if base_tree is not None: + if base_tree is not DefaultValueForOptionalParameters: post_parameters[ "base_tree" ] = base_tree status, headers, data = self.__requester.request( "POST", @@ -285,14 +290,14 @@ class Repository( object ): ) return GitTree.GitTree( self.__requester, data, lazy = True ) - def create_hook( self, name, config, events = None, active = None ): + def create_hook( self, name, config, events = DefaultValueForOptionalParameters, active = DefaultValueForOptionalParameters ): post_parameters = { "name": name, "config": config, } - if events is not None: + if events is not DefaultValueForOptionalParameters: post_parameters[ "events" ] = events - if active is not None: + if active is not DefaultValueForOptionalParameters: post_parameters[ "active" ] = active status, headers, data = self.__requester.request( "POST", @@ -302,17 +307,17 @@ class Repository( object ): ) return Hook.Hook( self.__requester, data, lazy = True ) - def create_issue( self, title, body = None, assignee = None, milestone = None, labels = None ): + def create_issue( self, title, body = DefaultValueForOptionalParameters, assignee = DefaultValueForOptionalParameters, milestone = DefaultValueForOptionalParameters, labels = DefaultValueForOptionalParameters ): post_parameters = { "title": title, } - if body is not None: + if body is not DefaultValueForOptionalParameters: post_parameters[ "body" ] = body - if assignee is not None: + if assignee is not DefaultValueForOptionalParameters: post_parameters[ "assignee" ] = assignee - if milestone is not None: + if milestone is not DefaultValueForOptionalParameters: post_parameters[ "milestone" ] = milestone - if labels is not None: + if labels is not DefaultValueForOptionalParameters: post_parameters[ "labels" ] = labels status, headers, data = self.__requester.request( "POST", @@ -348,15 +353,15 @@ class Repository( object ): ) return Label.Label( self.__requester, data, lazy = True ) - def create_milestone( self, title, state = None, description = None, due_on = None ): + def create_milestone( self, title, state = DefaultValueForOptionalParameters, description = DefaultValueForOptionalParameters, due_on = DefaultValueForOptionalParameters ): post_parameters = { "title": title, } - if state is not None: + if state is not DefaultValueForOptionalParameters: post_parameters[ "state" ] = state - if description is not None: + if description is not DefaultValueForOptionalParameters: post_parameters[ "description" ] = description - if due_on is not None: + if due_on is not DefaultValueForOptionalParameters: post_parameters[ "due_on" ] = due_on status, headers, data = self.__requester.request( "POST", @@ -366,21 +371,21 @@ class Repository( object ): ) return Milestone.Milestone( self.__requester, data, lazy = True ) - def edit( self, name, description = None, homepage = None, public = None, has_issues = None, has_wiki = None, has_downloads = None ): + def edit( self, name, description = DefaultValueForOptionalParameters, homepage = DefaultValueForOptionalParameters, public = DefaultValueForOptionalParameters, has_issues = DefaultValueForOptionalParameters, has_wiki = DefaultValueForOptionalParameters, has_downloads = DefaultValueForOptionalParameters ): post_parameters = { "name": name, } - if description is not None: + if description is not DefaultValueForOptionalParameters: post_parameters[ "description" ] = description - if homepage is not None: + if homepage is not DefaultValueForOptionalParameters: post_parameters[ "homepage" ] = homepage - if public is not None: + if public is not DefaultValueForOptionalParameters: post_parameters[ "public" ] = public - if has_issues is not None: + if has_issues is not DefaultValueForOptionalParameters: post_parameters[ "has_issues" ] = has_issues - if has_wiki is not None: + if has_wiki is not DefaultValueForOptionalParameters: post_parameters[ "has_wiki" ] = has_wiki - if has_downloads is not None: + if has_downloads is not DefaultValueForOptionalParameters: post_parameters[ "has_downloads" ] = has_downloads status, headers, data = self.__requester.request( "PATCH", @@ -444,7 +449,7 @@ class Repository( object ): ) return Commit.Commit( self.__requester, data, lazy = True ) - def get_commits( self, sha = None, path = None ): + def get_commits( self, sha = DefaultValueForOptionalParameters, path = DefaultValueForOptionalParameters ): status, headers, data = self.__requester.request( "GET", str( self.url ) + "/commits", @@ -561,7 +566,7 @@ class Repository( object ): ) return GitTag.GitTag( self.__requester, data, lazy = True ) - def get_git_tree( self, sha, recursive = None ): + def get_git_tree( self, sha, recursive = DefaultValueForOptionalParameters ): status, headers, data = self.__requester.request( "GET", str( self.url ) + "/git_trees/" + str( sha ), @@ -600,7 +605,7 @@ class Repository( object ): ) return Issue.Issue( self.__requester, data, lazy = True ) - def get_issues( self, milestone = None, state = None, assignee = None, mentioned = None, labels = None, sort = None, direction = None, since = None ): + def get_issues( self, milestone = DefaultValueForOptionalParameters, state = DefaultValueForOptionalParameters, assignee = DefaultValueForOptionalParameters, mentioned = DefaultValueForOptionalParameters, labels = DefaultValueForOptionalParameters, sort = DefaultValueForOptionalParameters, direction = DefaultValueForOptionalParameters, since = DefaultValueForOptionalParameters ): status, headers, data = self.__requester.request( "GET", str( self.url ) + "/issues", @@ -687,7 +692,7 @@ class Repository( object ): ) return Milestone.Milestone( self.__requester, data, lazy = True ) - def get_milestones( self, state = None, sort = None, direction = None ): + def get_milestones( self, state = DefaultValueForOptionalParameters, sort = DefaultValueForOptionalParameters, direction = DefaultValueForOptionalParameters ): status, headers, data = self.__requester.request( "GET", str( self.url ) + "/milestones", @@ -711,7 +716,7 @@ class Repository( object ): ) return PullRequest.PullRequest( self.__requester, data, lazy = True ) - def get_pulls( self, state = None ): + def get_pulls( self, state = DefaultValueForOptionalParameters ): status, headers, data = self.__requester.request( "GET", str( self.url ) + "/pulls", diff --git a/github/GithubObjects/RepositoryKey.py b/github/GithubObjects/RepositoryKey.py index d99fd921..056a7036 100644 --- a/github/GithubObjects/RepositoryKey.py +++ b/github/GithubObjects/RepositoryKey.py @@ -1,6 +1,11 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class RepositoryKey( object ): def __init__( self, requester, attributes, lazy ): diff --git a/github/GithubObjects/Tag.py b/github/GithubObjects/Tag.py index 6741f47e..50a21d4d 100644 --- a/github/GithubObjects/Tag.py +++ b/github/GithubObjects/Tag.py @@ -2,6 +2,11 @@ # Do not modify it manually, your work would be lost. import Commit +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class Tag( object ): def __init__( self, requester, attributes, lazy ): diff --git a/github/GithubObjects/Team.py b/github/GithubObjects/Team.py index f307163a..2953867e 100644 --- a/github/GithubObjects/Team.py +++ b/github/GithubObjects/Team.py @@ -3,6 +3,11 @@ import Repository import NamedUser +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class Team( object ): def __init__( self, requester, attributes, lazy ): @@ -67,11 +72,11 @@ class Team( object ): None ) - def edit( self, name, permission = None ): + def edit( self, name, permission = DefaultValueForOptionalParameters ): post_parameters = { "name": name, } - if permission is not None: + if permission is not DefaultValueForOptionalParameters: post_parameters[ "permission" ] = permission status, headers, data = self.__requester.request( "PATCH", diff --git a/github/GithubObjects/UserKey.py b/github/GithubObjects/UserKey.py index 68fc5d3b..9377a249 100644 --- a/github/GithubObjects/UserKey.py +++ b/github/GithubObjects/UserKey.py @@ -1,6 +1,11 @@ # WARNING: this file is generated automaticaly. # Do not modify it manually, your work would be lost. +# This allows None as a valid value for an optional parameter + +class DefaultValueForOptionalParametersType: + pass +DefaultValueForOptionalParameters = DefaultValueForOptionalParametersType() class UserKey( object ): def __init__( self, requester, attributes, lazy ): @@ -39,12 +44,12 @@ class UserKey( object ): None ) - def edit( self, title = None, key = None ): + def edit( self, title = DefaultValueForOptionalParameters, key = DefaultValueForOptionalParameters ): post_parameters = { } - if title is not None: + if title is not DefaultValueForOptionalParameters: post_parameters[ "title" ] = title - if key is not None: + if key is not DefaultValueForOptionalParameters: post_parameters[ "key" ] = key status, headers, data = self.__requester.request( "PATCH",