Put private methods after public ones

This commit is contained in:
Vincent Jacques
2012-05-04 12:55:24 +02:00
parent 07af042cf1
commit ce0aa9f34f
22 changed files with 547 additions and 547 deletions
+21 -21
View File
@@ -11,33 +11,13 @@ class {{ class.name }}( object ):
if not lazy:
self.__complete()
{% for attribute in class.attributes %}
{% for attribute in class.attributes|dictsort:"name" %}
@property
def {{ attribute.name }}( self ):
self.__completeIfNeeded( self.__{{ attribute.name }} )
return self.__{{ attribute.name }}
{% endfor %}
def __initAttributes( self ):
{% for attribute in class.attributes %}
self.__{{ attribute.name }} = None
{% endfor %}
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
# @todo Do not generate __complete if type has no url attribute
def __complete( self ):
result = self.__github._dataRequest(
"GET",
self.__url,
None,
None
)
self.__useAttributes( result )
self.__completed = True
{% for method in class.methods|dictsort:"name" %}
def {{ method.name|join:"_" }}( {% include "GithubObject.Parameters.py" with function=method only %} ):
{% if method.request %}
@@ -97,6 +77,26 @@ class {{ class.name }}( object ):
{% endif %}
{% endfor %}
def __initAttributes( self ):
{% for attribute in class.attributes %}
self.__{{ attribute.name }} = None
{% endfor %}
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
# @todo Do not generate __complete if type has no url attribute
def __complete( self ):
result = self.__github._dataRequest(
"GET",
self.__url,
None,
None
)
self.__useAttributes( result )
self.__completed = True
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
{% for attribute in class.attributes %}
+42 -42
View File
@@ -144,48 +144,6 @@ class AuthenticatedUser( object ):
self.__completeIfNeeded( self.__url )
return self.__url
def __initAttributes( self ):
self.__avatar_url = None
self.__bio = None
self.__blog = None
self.__collaborators = None
self.__company = None
self.__created_at = None
self.__disk_usage = None
self.__email = None
self.__followers = None
self.__following = None
self.__gravatar_id = None
self.__hireable = None
self.__html_url = None
self.__id = None
self.__location = None
self.__login = None
self.__name = None
self.__owned_private_repos = None
self.__plan = None
self.__private_gists = None
self.__public_gists = None
self.__public_repos = None
self.__total_private_repos = None
self.__type = None
self.__url = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
# @todo Do not generate __complete if type has no url attribute
def __complete( self ):
result = self.__github._dataRequest(
"GET",
self.__url,
None,
None
)
self.__useAttributes( result )
self.__completed = True
def add_to_emails( self, *emails ):
pass
@@ -437,6 +395,48 @@ class AuthenticatedUser( object ):
None
)
def __initAttributes( self ):
self.__avatar_url = None
self.__bio = None
self.__blog = None
self.__collaborators = None
self.__company = None
self.__created_at = None
self.__disk_usage = None
self.__email = None
self.__followers = None
self.__following = None
self.__gravatar_id = None
self.__hireable = None
self.__html_url = None
self.__id = None
self.__location = None
self.__login = None
self.__name = None
self.__owned_private_repos = None
self.__plan = None
self.__private_gists = None
self.__public_gists = None
self.__public_repos = None
self.__total_private_repos = None
self.__type = None
self.__url = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
# @todo Do not generate __complete if type has no url attribute
def __complete( self ):
result = self.__github._dataRequest(
"GET",
self.__url,
None,
None
)
self.__useAttributes( result )
self.__completed = True
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "avatar_url" in attributes:
+24 -24
View File
@@ -56,6 +56,30 @@ class Authorization( object ):
self.__completeIfNeeded( self.__url )
return self.__url
def delete( self ):
pass
def edit( self, scopes = None, add_scopes = None, remove_scopes = None, note = None, note_url = None ):
post_parameters = {
}
if scopes is not None:
post_parameters[ "scopes" ] = scopes
if add_scopes is not None:
post_parameters[ "add_scopes" ] = add_scopes
if remove_scopes is not None:
post_parameters[ "remove_scopes" ] = remove_scopes
if note is not None:
post_parameters[ "note" ] = note
if note_url is not None:
post_parameters[ "note_url" ] = note_url
result = self.__github._dataRequest(
"PATCH",
"https://api.github.com/user",
None,
post_parameters
)
self.__useAttributes( result )
def __initAttributes( self ):
self.__app = None
self.__created_at = None
@@ -82,30 +106,6 @@ class Authorization( object ):
self.__useAttributes( result )
self.__completed = True
def delete( self ):
pass
def edit( self, scopes = None, add_scopes = None, remove_scopes = None, note = None, note_url = None ):
post_parameters = {
}
if scopes is not None:
post_parameters[ "scopes" ] = scopes
if add_scopes is not None:
post_parameters[ "add_scopes" ] = add_scopes
if remove_scopes is not None:
post_parameters[ "remove_scopes" ] = remove_scopes
if note is not None:
post_parameters[ "note" ] = note
if note_url is not None:
post_parameters[ "note_url" ] = note_url
result = self.__github._dataRequest(
"PATCH",
"https://api.github.com/user",
None,
post_parameters
)
self.__useAttributes( result )
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "app" in attributes:
+15 -15
View File
@@ -54,6 +54,21 @@ class Commit( object ):
self.__completeIfNeeded( self.__url )
return self.__url
def create_comment( self, body, commit_id = None, line = None, path = None, position = None ):
pass
def get_comments( self ):
result = self.__github._dataRequest(
"GET",
self.url + "/comments",
None,
None
)
return [
CommitComment.CommitComment( self.__github, element, lazy = True )
for element in result
]
def __initAttributes( self ):
self.__author = None
self.__commit = None
@@ -79,21 +94,6 @@ class Commit( object ):
self.__useAttributes( result )
self.__completed = True
def create_comment( self, body, commit_id = None, line = None, path = None, position = None ):
pass
def get_comments( self ):
result = self.__github._dataRequest(
"GET",
self.url + "/comments",
None,
None
)
return [
CommitComment.CommitComment( self.__github, element, lazy = True )
for element in result
]
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "author" in attributes:
+15 -15
View File
@@ -67,6 +67,21 @@ class CommitComment( object ):
self.__completeIfNeeded( self.__user )
return self.__user
def delete( self ):
pass
def edit( self, body ):
post_parameters = {
"body": body,
}
result = self.__github._dataRequest(
"PATCH",
"https://api.github.com/user",
None,
post_parameters
)
self.__useAttributes( result )
def __initAttributes( self ):
self.__body = None
self.__commit_id = None
@@ -95,21 +110,6 @@ class CommitComment( object ):
self.__useAttributes( result )
self.__completed = True
def delete( self ):
pass
def edit( self, body ):
post_parameters = {
"body": body,
}
result = self.__github._dataRequest(
"PATCH",
"https://api.github.com/user",
None,
post_parameters
)
self.__useAttributes( result )
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "body" in attributes:
+3 -3
View File
@@ -111,6 +111,9 @@ class Download( object ):
self.__completeIfNeeded( self.__url )
return self.__url
def delete( self ):
pass
def __initAttributes( self ):
self.__accesskeyid = None
self.__acl = None
@@ -148,9 +151,6 @@ class Download( object ):
self.__useAttributes( result )
self.__completed = True
def delete( self ):
pass
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "accesskeyid" in attributes:
+31 -31
View File
@@ -84,37 +84,6 @@ class Gist( object ):
self.__completeIfNeeded( self.__user )
return self.__user
def __initAttributes( self ):
self.__comments = None
self.__created_at = None
self.__description = None
self.__files = None
self.__forks = None
self.__git_pull_url = None
self.__git_push_url = None
self.__history = None
self.__html_url = None
self.__id = None
self.__public = None
self.__updated_at = None
self.__url = None
self.__user = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
# @todo Do not generate __complete if type has no url attribute
def __complete( self ):
result = self.__github._dataRequest(
"GET",
self.__url,
None,
None
)
self.__useAttributes( result )
self.__completed = True
def create_comment( self, body ):
pass
@@ -163,6 +132,37 @@ class Gist( object ):
def set_starred( self ):
pass
def __initAttributes( self ):
self.__comments = None
self.__created_at = None
self.__description = None
self.__files = None
self.__forks = None
self.__git_pull_url = None
self.__git_push_url = None
self.__history = None
self.__html_url = None
self.__id = None
self.__public = None
self.__updated_at = None
self.__url = None
self.__user = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
# @todo Do not generate __complete if type has no url attribute
def __complete( self ):
result = self.__github._dataRequest(
"GET",
self.__url,
None,
None
)
self.__useAttributes( result )
self.__completed = True
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "comments" in attributes:
+15 -15
View File
@@ -42,6 +42,21 @@ class GistComment( object ):
self.__completeIfNeeded( self.__user )
return self.__user
def delete( self ):
pass
def edit( self, body ):
post_parameters = {
"body": body,
}
result = self.__github._dataRequest(
"PATCH",
"https://api.github.com/user",
None,
post_parameters
)
self.__useAttributes( result )
def __initAttributes( self ):
self.__body = None
self.__created_at = None
@@ -65,21 +80,6 @@ class GistComment( object ):
self.__useAttributes( result )
self.__completed = True
def delete( self ):
pass
def edit( self, body ):
post_parameters = {
"body": body,
}
result = self.__github._dataRequest(
"PATCH",
"https://api.github.com/user",
None,
post_parameters
)
self.__useAttributes( result )
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "body" in attributes:
+17 -17
View File
@@ -26,6 +26,23 @@ class GitRef( object ):
self.__completeIfNeeded( self.__url )
return self.__url
def delete( self ):
pass
def edit( self, sha, force = None ):
post_parameters = {
"sha": sha,
}
if force is not None:
post_parameters[ "force" ] = force
result = self.__github._dataRequest(
"PATCH",
"https://api.github.com/user",
None,
post_parameters
)
self.__useAttributes( result )
def __initAttributes( self ):
self.__object = None
self.__ref = None
@@ -46,23 +63,6 @@ class GitRef( object ):
self.__useAttributes( result )
self.__completed = True
def delete( self ):
pass
def edit( self, sha, force = None ):
post_parameters = {
"sha": sha,
}
if force is not None:
post_parameters[ "force" ] = force
result = self.__github._dataRequest(
"PATCH",
"https://api.github.com/user",
None,
post_parameters
)
self.__useAttributes( result )
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "object" in attributes:
+26 -26
View File
@@ -56,32 +56,6 @@ class Hook( object ):
self.__completeIfNeeded( self.__url )
return self.__url
def __initAttributes( self ):
self.__active = None
self.__config = None
self.__created_at = None
self.__events = None
self.__id = None
self.__last_response = None
self.__name = None
self.__updated_at = None
self.__url = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
# @todo Do not generate __complete if type has no url attribute
def __complete( self ):
result = self.__github._dataRequest(
"GET",
self.__url,
None,
None
)
self.__useAttributes( result )
self.__completed = True
def delete( self ):
pass
@@ -109,6 +83,32 @@ class Hook( object ):
def test( self ):
pass
def __initAttributes( self ):
self.__active = None
self.__config = None
self.__created_at = None
self.__events = None
self.__id = None
self.__last_response = None
self.__name = None
self.__updated_at = None
self.__url = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
# @todo Do not generate __complete if type has no url attribute
def __complete( self ):
result = self.__github._dataRequest(
"GET",
self.__url,
None,
None
)
self.__useAttributes( result )
self.__completed = True
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "active" in attributes:
+34 -34
View File
@@ -101,40 +101,6 @@ class Issue( object ):
self.__completeIfNeeded( self.__user )
return self.__user
def __initAttributes( self ):
self.__assignee = None
self.__body = None
self.__closed_at = None
self.__closed_by = None
self.__comments = None
self.__created_at = None
self.__html_url = None
self.__id = None
self.__labels = None
self.__milestone = None
self.__number = None
self.__pull_request = None
self.__state = None
self.__title = None
self.__updated_at = None
self.__url = None
self.__user = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
# @todo Do not generate __complete if type has no url attribute
def __complete( self ):
result = self.__github._dataRequest(
"GET",
self.__url,
None,
None
)
self.__useAttributes( result )
self.__completed = True
def add_to_labels( self, *labels ):
pass
@@ -217,6 +183,40 @@ class Issue( object ):
def set_labels( self, *labels ):
pass
def __initAttributes( self ):
self.__assignee = None
self.__body = None
self.__closed_at = None
self.__closed_by = None
self.__comments = None
self.__created_at = None
self.__html_url = None
self.__id = None
self.__labels = None
self.__milestone = None
self.__number = None
self.__pull_request = None
self.__state = None
self.__title = None
self.__updated_at = None
self.__url = None
self.__user = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
# @todo Do not generate __complete if type has no url attribute
def __complete( self ):
result = self.__github._dataRequest(
"GET",
self.__url,
None,
None
)
self.__useAttributes( result )
self.__completed = True
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "assignee" in attributes:
+15 -15
View File
@@ -42,6 +42,21 @@ class IssueComment( object ):
self.__completeIfNeeded( self.__user )
return self.__user
def delete( self ):
pass
def edit( self, body ):
post_parameters = {
"body": body,
}
result = self.__github._dataRequest(
"PATCH",
"https://api.github.com/user",
None,
post_parameters
)
self.__useAttributes( result )
def __initAttributes( self ):
self.__body = None
self.__created_at = None
@@ -65,21 +80,6 @@ class IssueComment( object ):
self.__useAttributes( result )
self.__completed = True
def delete( self ):
pass
def edit( self, body ):
post_parameters = {
"body": body,
}
result = self.__github._dataRequest(
"PATCH",
"https://api.github.com/user",
None,
post_parameters
)
self.__useAttributes( result )
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "body" in attributes:
+16 -16
View File
@@ -26,6 +26,22 @@ class Label( object ):
self.__completeIfNeeded( self.__url )
return self.__url
def delete( self ):
pass
def edit( self, name, color ):
post_parameters = {
"name": name,
"color": color,
}
result = self.__github._dataRequest(
"PATCH",
"https://api.github.com/user",
None,
post_parameters
)
self.__useAttributes( result )
def __initAttributes( self ):
self.__color = None
self.__name = None
@@ -46,22 +62,6 @@ class Label( object ):
self.__useAttributes( result )
self.__completed = True
def delete( self ):
pass
def edit( self, name, color ):
post_parameters = {
"name": name,
"color": color,
}
result = self.__github._dataRequest(
"PATCH",
"https://api.github.com/user",
None,
post_parameters
)
self.__useAttributes( result )
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "color" in attributes:
+27 -27
View File
@@ -63,33 +63,6 @@ class Milestone( object ):
self.__completeIfNeeded( self.__url )
return self.__url
def __initAttributes( self ):
self.__closed_issues = None
self.__created_at = None
self.__creator = None
self.__description = None
self.__due_on = None
self.__number = None
self.__open_issues = None
self.__state = None
self.__title = None
self.__url = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
# @todo Do not generate __complete if type has no url attribute
def __complete( self ):
result = self.__github._dataRequest(
"GET",
self.__url,
None,
None
)
self.__useAttributes( result )
self.__completed = True
def delete( self ):
pass
@@ -123,6 +96,33 @@ class Milestone( object ):
for element in result
]
def __initAttributes( self ):
self.__closed_issues = None
self.__created_at = None
self.__creator = None
self.__description = None
self.__due_on = None
self.__number = None
self.__open_issues = None
self.__state = None
self.__title = None
self.__url = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
# @todo Do not generate __complete if type has no url attribute
def __complete( self ):
result = self.__github._dataRequest(
"GET",
self.__url,
None,
None
)
self.__useAttributes( result )
self.__completed = True
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "closed_issues" in attributes:
+43 -43
View File
@@ -146,49 +146,6 @@ class NamedUser( object ):
self.__completeIfNeeded( self.__url )
return self.__url
def __initAttributes( self ):
self.__avatar_url = None
self.__bio = None
self.__blog = None
self.__collaborators = None
self.__company = None
self.__contributions = None
self.__created_at = None
self.__disk_usage = None
self.__email = None
self.__followers = None
self.__following = None
self.__gravatar_id = None
self.__hireable = None
self.__html_url = None
self.__id = None
self.__location = None
self.__login = None
self.__name = None
self.__owned_private_repos = None
self.__plan = None
self.__private_gists = None
self.__public_gists = None
self.__public_repos = None
self.__total_private_repos = None
self.__type = None
self.__url = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
# @todo Do not generate __complete if type has no url attribute
def __complete( self ):
result = self.__github._dataRequest(
"GET",
self.__url,
None,
None
)
self.__useAttributes( result )
self.__completed = True
def create_gist( self, public, files, description = None ):
pass
@@ -294,6 +251,49 @@ class NamedUser( object ):
for element in result
]
def __initAttributes( self ):
self.__avatar_url = None
self.__bio = None
self.__blog = None
self.__collaborators = None
self.__company = None
self.__contributions = None
self.__created_at = None
self.__disk_usage = None
self.__email = None
self.__followers = None
self.__following = None
self.__gravatar_id = None
self.__hireable = None
self.__html_url = None
self.__id = None
self.__location = None
self.__login = None
self.__name = None
self.__owned_private_repos = None
self.__plan = None
self.__private_gists = None
self.__public_gists = None
self.__public_repos = None
self.__total_private_repos = None
self.__type = None
self.__url = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
# @todo Do not generate __complete if type has no url attribute
def __complete( self ):
result = self.__github._dataRequest(
"GET",
self.__url,
None,
None
)
self.__useAttributes( result )
self.__completed = True
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "avatar_url" in attributes:
+41 -41
View File
@@ -135,47 +135,6 @@ class Organization( object ):
self.__completeIfNeeded( self.__url )
return self.__url
def __initAttributes( self ):
self.__avatar_url = None
self.__billing_email = None
self.__blog = None
self.__collaborators = None
self.__company = None
self.__created_at = None
self.__disk_usage = None
self.__email = None
self.__followers = None
self.__following = None
self.__gravatar_id = None
self.__html_url = None
self.__id = None
self.__location = None
self.__login = None
self.__name = None
self.__owned_private_repos = None
self.__plan = None
self.__private_gists = None
self.__public_gists = None
self.__public_repos = None
self.__total_private_repos = None
self.__type = None
self.__url = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
# @todo Do not generate __complete if type has no url attribute
def __complete( self ):
result = self.__github._dataRequest(
"GET",
self.__url,
None,
None
)
self.__useAttributes( result )
self.__completed = True
def add_to_public_members( self, public_member ):
result = self.__github._statusRequest(
"PUT",
@@ -319,6 +278,47 @@ class Organization( object ):
None
)
def __initAttributes( self ):
self.__avatar_url = None
self.__billing_email = None
self.__blog = None
self.__collaborators = None
self.__company = None
self.__created_at = None
self.__disk_usage = None
self.__email = None
self.__followers = None
self.__following = None
self.__gravatar_id = None
self.__html_url = None
self.__id = None
self.__location = None
self.__login = None
self.__name = None
self.__owned_private_repos = None
self.__plan = None
self.__private_gists = None
self.__public_gists = None
self.__public_repos = None
self.__total_private_repos = None
self.__type = None
self.__url = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
# @todo Do not generate __complete if type has no url attribute
def __complete( self ):
result = self.__github._dataRequest(
"GET",
self.__url,
None,
None
)
self.__useAttributes( result )
self.__completed = True
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "avatar_url" in attributes:
+43 -43
View File
@@ -145,49 +145,6 @@ class PullRequest( object ):
self.__completeIfNeeded( self.__user )
return self.__user
def __initAttributes( self ):
self.__additions = None
self.__base = None
self.__body = None
self.__changed_files = None
self.__closed_at = None
self.__comments = None
self.__commits = None
self.__created_at = None
self.__deletions = None
self.__diff_url = None
self.__head = None
self.__html_url = None
self.__id = None
self.__issue_url = None
self.__mergeable = None
self.__merged = None
self.__merged_at = None
self.__merged_by = None
self.__number = None
self.__patch_url = None
self.__review_comments = None
self.__state = None
self.__title = None
self.__updated_at = None
self.__url = None
self.__user = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
# @todo Do not generate __complete if type has no url attribute
def __complete( self ):
result = self.__github._dataRequest(
"GET",
self.__url,
None,
None
)
self.__useAttributes( result )
self.__completed = True
def edit( self, title = None, body = None, state = None ):
post_parameters = {
}
@@ -250,6 +207,49 @@ class PullRequest( object ):
def merge( self, commit_message = None ):
pass
def __initAttributes( self ):
self.__additions = None
self.__base = None
self.__body = None
self.__changed_files = None
self.__closed_at = None
self.__comments = None
self.__commits = None
self.__created_at = None
self.__deletions = None
self.__diff_url = None
self.__head = None
self.__html_url = None
self.__id = None
self.__issue_url = None
self.__mergeable = None
self.__merged = None
self.__merged_at = None
self.__merged_by = None
self.__number = None
self.__patch_url = None
self.__review_comments = None
self.__state = None
self.__title = None
self.__updated_at = None
self.__url = None
self.__user = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
# @todo Do not generate __complete if type has no url attribute
def __complete( self ):
result = self.__github._dataRequest(
"GET",
self.__url,
None,
None
)
self.__useAttributes( result )
self.__completed = True
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "additions" in attributes:
+15 -15
View File
@@ -67,6 +67,21 @@ class PullRequestComment( object ):
self.__completeIfNeeded( self.__user )
return self.__user
def delete( self ):
pass
def edit( self, body ):
post_parameters = {
"body": body,
}
result = self.__github._dataRequest(
"PATCH",
"https://api.github.com/user",
None,
post_parameters
)
self.__useAttributes( result )
def __initAttributes( self ):
self.__body = None
self.__commit_id = None
@@ -95,21 +110,6 @@ class PullRequestComment( object ):
self.__useAttributes( result )
self.__completed = True
def delete( self ):
pass
def edit( self, body ):
post_parameters = {
"body": body,
}
result = self.__github._dataRequest(
"PATCH",
"https://api.github.com/user",
None,
post_parameters
)
self.__useAttributes( result )
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "body" in attributes:
+47 -47
View File
@@ -182,53 +182,6 @@ class Repository( object ):
self.__completeIfNeeded( self.__watchers )
return self.__watchers
def __initAttributes( self ):
self.__clone_url = None
self.__created_at = None
self.__description = None
self.__fork = None
self.__forks = None
self.__git_url = None
self.__has_downloads = None
self.__has_issues = None
self.__has_wiki = None
self.__homepage = None
self.__html_url = None
self.__id = None
self.__language = None
self.__master_branch = None
self.__mirror_url = None
self.__name = None
self.__open_issues = None
self.__organization = None
self.__owner = None
self.__parent = None
self.__permissions = None
self.__private = None
self.__pushed_at = None
self.__size = None
self.__source = None
self.__ssh_url = None
self.__svn_url = None
self.__updated_at = None
self.__url = None
self.__watchers = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
# @todo Do not generate __complete if type has no url attribute
def __complete( self ):
result = self.__github._dataRequest(
"GET",
self.__url,
None,
None
)
self.__useAttributes( result )
self.__completed = True
def add_to_collaborators( self, collaborator ):
result = self.__github._statusRequest(
"PUT",
@@ -593,6 +546,53 @@ class Repository( object ):
None
)
def __initAttributes( self ):
self.__clone_url = None
self.__created_at = None
self.__description = None
self.__fork = None
self.__forks = None
self.__git_url = None
self.__has_downloads = None
self.__has_issues = None
self.__has_wiki = None
self.__homepage = None
self.__html_url = None
self.__id = None
self.__language = None
self.__master_branch = None
self.__mirror_url = None
self.__name = None
self.__open_issues = None
self.__organization = None
self.__owner = None
self.__parent = None
self.__permissions = None
self.__private = None
self.__pushed_at = None
self.__size = None
self.__source = None
self.__ssh_url = None
self.__svn_url = None
self.__updated_at = None
self.__url = None
self.__watchers = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
# @todo Do not generate __complete if type has no url attribute
def __complete( self ):
result = self.__github._dataRequest(
"GET",
self.__url,
None,
None
)
self.__useAttributes( result )
self.__completed = True
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "clone_url" in attributes:
+16 -16
View File
@@ -31,6 +31,22 @@ class RepositoryKey( object ):
self.__completeIfNeeded( self.__url )
return self.__url
def delete( self ):
pass
def edit( self, title, key ):
post_parameters = {
"title": title,
"key": key,
}
result = self.__github._dataRequest(
"PATCH",
"https://api.github.com/user",
None,
post_parameters
)
self.__useAttributes( result )
def __initAttributes( self ):
self.__id = None
self.__key = None
@@ -52,22 +68,6 @@ class RepositoryKey( object ):
self.__useAttributes( result )
self.__completed = True
def delete( self ):
pass
def edit( self, title, key ):
post_parameters = {
"title": title,
"key": key,
}
result = self.__github._dataRequest(
"PATCH",
"https://api.github.com/user",
None,
post_parameters
)
self.__useAttributes( result )
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "id" in attributes:
+23 -23
View File
@@ -43,29 +43,6 @@ class Team( object ):
self.__completeIfNeeded( self.__url )
return self.__url
def __initAttributes( self ):
self.__id = None
self.__members_count = None
self.__name = None
self.__permission = None
self.__repos_count = None
self.__url = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
# @todo Do not generate __complete if type has no url attribute
def __complete( self ):
result = self.__github._dataRequest(
"GET",
self.__url,
None,
None
)
self.__useAttributes( result )
self.__completed = True
def add_to_members( self, member ):
result = self.__github._statusRequest(
"PUT",
@@ -157,6 +134,29 @@ class Team( object ):
None
)
def __initAttributes( self ):
self.__id = None
self.__members_count = None
self.__name = None
self.__permission = None
self.__repos_count = None
self.__url = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
# @todo Do not generate __complete if type has no url attribute
def __complete( self ):
result = self.__github._dataRequest(
"GET",
self.__url,
None,
None
)
self.__useAttributes( result )
self.__completed = True
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "id" in attributes:
+18 -18
View File
@@ -31,6 +31,24 @@ class UserKey( object ):
self.__completeIfNeeded( self.__url )
return self.__url
def delete( self ):
pass
def edit( self, title = None, key = None ):
post_parameters = {
}
if title is not None:
post_parameters[ "title" ] = title
if key is not None:
post_parameters[ "key" ] = key
result = self.__github._dataRequest(
"PATCH",
"https://api.github.com/user",
None,
post_parameters
)
self.__useAttributes( result )
def __initAttributes( self ):
self.__id = None
self.__key = None
@@ -52,24 +70,6 @@ class UserKey( object ):
self.__useAttributes( result )
self.__completed = True
def delete( self ):
pass
def edit( self, title = None, key = None ):
post_parameters = {
}
if title is not None:
post_parameters[ "title" ] = title
if key is not None:
post_parameters[ "key" ] = key
result = self.__github._dataRequest(
"PATCH",
"https://api.github.com/user",
None,
post_parameters
)
self.__useAttributes( result )
def __useAttributes( self, attributes ):
#@todo No need to check if attribute is in attributes when attribute is mandatory
if "id" in attributes: