From 9a03610f7bd9143c1ec738afcbcf072274cf0324 Mon Sep 17 00:00:00 2001 From: Vincent Jacques Date: Wed, 21 Nov 2012 20:13:12 +0100 Subject: [PATCH] Use absolute imports. May help with Python 3 --- github/AuthenticatedUser.py | 277 ++++++++--------- github/Authorization.py | 48 +-- github/AuthorizationApplication.py | 8 +- github/Branch.py | 12 +- github/Commit.py | 81 +++-- github/CommitComment.py | 30 +- github/CommitStats.py | 10 +- github/CommitStatus.py | 22 +- github/Comparison.py | 38 +-- github/ContentFile.py | 18 +- github/Download.py | 44 +-- github/Event.py | 32 +- github/File.py | 22 +- github/Gist.py | 70 ++--- github/GistComment.py | 20 +- github/GistFile.py | 14 +- github/GistHistoryState.py | 22 +- github/GitAuthor.py | 10 +- github/GitBlob.py | 14 +- github/GitCommit.py | 29 +- github/GitObject.py | 10 +- github/GitRef.py | 20 +- github/GitTag.py | 24 +- github/GitTree.py | 14 +- github/GitTreeElement.py | 16 +- github/Github.py | 38 +-- github/Hook.py | 44 +-- github/HookDescription.py | 12 +- github/HookResponse.py | 10 +- github/InputGitTreeElement.py | 8 +- github/Issue.py | 118 +++---- github/IssueComment.py | 20 +- github/IssueEvent.py | 26 +- github/IssuePullRequest.py | 10 +- github/Label.py | 10 +- github/Legacy.py | 6 +- github/Milestone.py | 52 ++-- github/NamedUser.py | 135 ++++---- github/Organization.py | 188 +++++------ github/PaginatedList.py | 2 +- github/Permissions.py | 10 +- github/Plan.py | 12 +- github/PullRequest.py | 132 ++++---- github/PullRequestComment.py | 30 +- github/PullRequestMergeStatus.py | 10 +- github/PullRequestPart.py | 22 +- github/Repository.py | 484 ++++++++++++++--------------- github/RepositoryKey.py | 26 +- github/Tag.py | 16 +- github/Team.py | 48 +-- github/UserKey.py | 24 +- 51 files changed, 1195 insertions(+), 1203 deletions(-) diff --git a/github/AuthenticatedUser.py b/github/AuthenticatedUser.py index e450d5bc..81b14754 100644 --- a/github/AuthenticatedUser.py +++ b/github/AuthenticatedUser.py @@ -13,22 +13,21 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject -import PaginatedList +import github.GithubObject +import github.PaginatedList -import InputFileContent -import Gist -import Repository -import NamedUser -import Plan -import Organization -import UserKey -import Issue -import Event -import Authorization +import github.Gist +import github.Repository +import github.NamedUser +import github.Plan +import github.Organization +import github.UserKey +import github.Issue +import github.Event +import github.Authorization -class AuthenticatedUser(GithubObject.GithubObject): +class AuthenticatedUser(github.GithubObject.GithubObject): @property def avatar_url(self): self._completeIfNotSet(self._avatar_url) @@ -165,7 +164,7 @@ class AuthenticatedUser(GithubObject.GithubObject): ) def add_to_following(self, following): - assert isinstance(following, NamedUser.NamedUser), following + assert isinstance(following, github.NamedUser.NamedUser), following headers, data = self._requester.requestAndCheck( "PUT", "/user/following/" + following._identity, @@ -174,7 +173,7 @@ class AuthenticatedUser(GithubObject.GithubObject): ) def add_to_starred(self, starred): - assert isinstance(starred, Repository.Repository), starred + assert isinstance(starred, github.Repository.Repository), starred headers, data = self._requester.requestAndCheck( "PUT", "/user/starred/" + starred._identity, @@ -183,7 +182,7 @@ class AuthenticatedUser(GithubObject.GithubObject): ) def add_to_subscriptions(self, subscription): - assert isinstance(subscription, Repository.Repository), subscription + assert isinstance(subscription, github.Repository.Repository), subscription headers, data = self._requester.requestAndCheck( "PUT", "/user/subscriptions/" + subscription._identity, @@ -192,7 +191,7 @@ class AuthenticatedUser(GithubObject.GithubObject): ) def add_to_watched(self, watched): - assert isinstance(watched, Repository.Repository), watched + assert isinstance(watched, github.Repository.Repository), watched headers, data = self._requester.requestAndCheck( "PUT", "/user/watched/" + watched._identity, @@ -200,16 +199,16 @@ class AuthenticatedUser(GithubObject.GithubObject): None ) - def create_authorization(self, scopes=GithubObject.NotSet, note=GithubObject.NotSet, note_url=GithubObject.NotSet): - assert scopes is GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in scopes), scopes - assert note is GithubObject.NotSet or isinstance(note, (str, unicode)), note - assert note_url is GithubObject.NotSet or isinstance(note_url, (str, unicode)), note_url + def create_authorization(self, scopes=github.GithubObject.NotSet, note=github.GithubObject.NotSet, note_url=github.GithubObject.NotSet): + assert scopes is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in scopes), scopes + assert note is github.GithubObject.NotSet or isinstance(note, (str, unicode)), note + assert note_url is github.GithubObject.NotSet or isinstance(note_url, (str, unicode)), note_url post_parameters = dict() - if scopes is not GithubObject.NotSet: + if scopes is not github.GithubObject.NotSet: post_parameters["scopes"] = scopes - if note is not GithubObject.NotSet: + if note is not github.GithubObject.NotSet: post_parameters["note"] = note - if note_url is not GithubObject.NotSet: + if note_url is not github.GithubObject.NotSet: post_parameters["note_url"] = note_url headers, data = self._requester.requestAndCheck( "POST", @@ -217,27 +216,27 @@ class AuthenticatedUser(GithubObject.GithubObject): None, post_parameters ) - return Authorization.Authorization(self._requester, data, completed=True) + return github.Authorization.Authorization(self._requester, data, completed=True) def create_fork(self, repo): - assert isinstance(repo, Repository.Repository), repo + assert isinstance(repo, github.Repository.Repository), repo headers, data = self._requester.requestAndCheck( "POST", "/repos/" + repo.owner.login + "/" + repo.name + "/forks", None, None ) - return Repository.Repository(self._requester, data, completed=True) + return github.Repository.Repository(self._requester, data, completed=True) - def create_gist(self, public, files, description=GithubObject.NotSet): + def create_gist(self, public, files, description=github.GithubObject.NotSet): assert isinstance(public, bool), public - assert all(isinstance(element, InputFileContent.InputFileContent) for element in files.itervalues()), files - assert description is GithubObject.NotSet or isinstance(description, (str, unicode)), description + assert all(isinstance(element, github.InputFileContent) for element in files.itervalues()), files + assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description post_parameters = { "public": public, "files": dict((key, value._identity) for key, value in files.iteritems()), } - if description is not GithubObject.NotSet: + if description is not github.GithubObject.NotSet: post_parameters["description"] = description headers, data = self._requester.requestAndCheck( "POST", @@ -245,7 +244,7 @@ class AuthenticatedUser(GithubObject.GithubObject): None, post_parameters ) - return Gist.Gist(self._requester, data, completed=True) + return github.Gist.Gist(self._requester, data, completed=True) def create_key(self, title, key): assert isinstance(title, (str, unicode)), title @@ -260,36 +259,36 @@ class AuthenticatedUser(GithubObject.GithubObject): None, post_parameters ) - return UserKey.UserKey(self._requester, data, completed=True) + return github.UserKey.UserKey(self._requester, data, completed=True) - def create_repo(self, name, description=GithubObject.NotSet, homepage=GithubObject.NotSet, private=GithubObject.NotSet, has_issues=GithubObject.NotSet, has_wiki=GithubObject.NotSet, has_downloads=GithubObject.NotSet, auto_init=GithubObject.NotSet, gitignore_template=GithubObject.NotSet): + def create_repo(self, name, description=github.GithubObject.NotSet, homepage=github.GithubObject.NotSet, private=github.GithubObject.NotSet, has_issues=github.GithubObject.NotSet, has_wiki=github.GithubObject.NotSet, has_downloads=github.GithubObject.NotSet, auto_init=github.GithubObject.NotSet, gitignore_template=github.GithubObject.NotSet): assert isinstance(name, (str, unicode)), name - assert description is GithubObject.NotSet or isinstance(description, (str, unicode)), description - assert homepage is GithubObject.NotSet or isinstance(homepage, (str, unicode)), homepage - assert private is GithubObject.NotSet or isinstance(private, bool), private - assert has_issues is GithubObject.NotSet or isinstance(has_issues, bool), has_issues - assert has_wiki is GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki - assert has_downloads is GithubObject.NotSet or isinstance(has_downloads, bool), has_downloads - assert auto_init is GithubObject.NotSet or isinstance(auto_init, bool), auto_init - assert gitignore_template is GithubObject.NotSet or isinstance(gitignore_template, (str, unicode)), gitignore_template + assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description + assert homepage is github.GithubObject.NotSet or isinstance(homepage, (str, unicode)), homepage + assert private is github.GithubObject.NotSet or isinstance(private, bool), private + assert has_issues is github.GithubObject.NotSet or isinstance(has_issues, bool), has_issues + assert has_wiki is github.GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki + assert has_downloads is github.GithubObject.NotSet or isinstance(has_downloads, bool), has_downloads + assert auto_init is github.GithubObject.NotSet or isinstance(auto_init, bool), auto_init + assert gitignore_template is github.GithubObject.NotSet or isinstance(gitignore_template, (str, unicode)), gitignore_template post_parameters = { "name": name, } - if description is not GithubObject.NotSet: + if description is not github.GithubObject.NotSet: post_parameters["description"] = description - if homepage is not GithubObject.NotSet: + if homepage is not github.GithubObject.NotSet: post_parameters["homepage"] = homepage - if private is not GithubObject.NotSet: + if private is not github.GithubObject.NotSet: post_parameters["private"] = private - if has_issues is not GithubObject.NotSet: + if has_issues is not github.GithubObject.NotSet: post_parameters["has_issues"] = has_issues - if has_wiki is not GithubObject.NotSet: + if has_wiki is not github.GithubObject.NotSet: post_parameters["has_wiki"] = has_wiki - if has_downloads is not GithubObject.NotSet: + if has_downloads is not github.GithubObject.NotSet: post_parameters["has_downloads"] = has_downloads - if auto_init is not GithubObject.NotSet: + if auto_init is not github.GithubObject.NotSet: post_parameters["auto_init"] = auto_init - if gitignore_template is not GithubObject.NotSet: + if gitignore_template is not github.GithubObject.NotSet: post_parameters["gitignore_template"] = gitignore_template headers, data = self._requester.requestAndCheck( "POST", @@ -297,30 +296,30 @@ class AuthenticatedUser(GithubObject.GithubObject): None, post_parameters ) - return Repository.Repository(self._requester, data, completed=True) + return github.Repository.Repository(self._requester, data, completed=True) - def edit(self, name=GithubObject.NotSet, email=GithubObject.NotSet, blog=GithubObject.NotSet, company=GithubObject.NotSet, location=GithubObject.NotSet, hireable=GithubObject.NotSet, bio=GithubObject.NotSet): - assert name is GithubObject.NotSet or isinstance(name, (str, unicode)), name - assert email is GithubObject.NotSet or isinstance(email, (str, unicode)), email - assert blog is GithubObject.NotSet or isinstance(blog, (str, unicode)), blog - assert company is GithubObject.NotSet or isinstance(company, (str, unicode)), company - assert location is GithubObject.NotSet or isinstance(location, (str, unicode)), location - assert hireable is GithubObject.NotSet or isinstance(hireable, bool), hireable - assert bio is GithubObject.NotSet or isinstance(bio, (str, unicode)), bio + def edit(self, name=github.GithubObject.NotSet, email=github.GithubObject.NotSet, blog=github.GithubObject.NotSet, company=github.GithubObject.NotSet, location=github.GithubObject.NotSet, hireable=github.GithubObject.NotSet, bio=github.GithubObject.NotSet): + assert name is github.GithubObject.NotSet or isinstance(name, (str, unicode)), name + assert email is github.GithubObject.NotSet or isinstance(email, (str, unicode)), email + assert blog is github.GithubObject.NotSet or isinstance(blog, (str, unicode)), blog + assert company is github.GithubObject.NotSet or isinstance(company, (str, unicode)), company + assert location is github.GithubObject.NotSet or isinstance(location, (str, unicode)), location + assert hireable is github.GithubObject.NotSet or isinstance(hireable, bool), hireable + assert bio is github.GithubObject.NotSet or isinstance(bio, (str, unicode)), bio post_parameters = dict() - if name is not GithubObject.NotSet: + if name is not github.GithubObject.NotSet: post_parameters["name"] = name - if email is not GithubObject.NotSet: + if email is not github.GithubObject.NotSet: post_parameters["email"] = email - if blog is not GithubObject.NotSet: + if blog is not github.GithubObject.NotSet: post_parameters["blog"] = blog - if company is not GithubObject.NotSet: + if company is not github.GithubObject.NotSet: post_parameters["company"] = company - if location is not GithubObject.NotSet: + if location is not github.GithubObject.NotSet: post_parameters["location"] = location - if hireable is not GithubObject.NotSet: + if hireable is not github.GithubObject.NotSet: post_parameters["hireable"] = hireable - if bio is not GithubObject.NotSet: + if bio is not github.GithubObject.NotSet: post_parameters["bio"] = bio headers, data = self._requester.requestAndCheck( "PATCH", @@ -338,11 +337,11 @@ class AuthenticatedUser(GithubObject.GithubObject): None, None ) - return Authorization.Authorization(self._requester, data, completed=True) + return github.Authorization.Authorization(self._requester, data, completed=True) def get_authorizations(self): - return PaginatedList.PaginatedList( - Authorization.Authorization, + return github.PaginatedList.PaginatedList( + github.Authorization.Authorization, self._requester, "/authorizations", None @@ -358,40 +357,40 @@ class AuthenticatedUser(GithubObject.GithubObject): return data def get_events(self): - return PaginatedList.PaginatedList( - Event.Event, + return github.PaginatedList.PaginatedList( + github.Event.Event, self._requester, "/events", None ) def get_followers(self): - return PaginatedList.PaginatedList( - NamedUser.NamedUser, + return github.PaginatedList.PaginatedList( + github.NamedUser.NamedUser, self._requester, "/user/followers", None ) def get_following(self): - return PaginatedList.PaginatedList( - NamedUser.NamedUser, + return github.PaginatedList.PaginatedList( + github.NamedUser.NamedUser, self._requester, "/user/following", None ) def get_gists(self): - return PaginatedList.PaginatedList( - Gist.Gist, + return github.PaginatedList.PaginatedList( + github.Gist.Gist, self._requester, "/gists", None ) def get_issues(self): - return PaginatedList.PaginatedList( - Issue.Issue, + return github.PaginatedList.PaginatedList( + github.Issue.Issue, self._requester, "/issues", None @@ -405,28 +404,28 @@ class AuthenticatedUser(GithubObject.GithubObject): None, None ) - return UserKey.UserKey(self._requester, data, completed=True) + return github.UserKey.UserKey(self._requester, data, completed=True) def get_keys(self): - return PaginatedList.PaginatedList( - UserKey.UserKey, + return github.PaginatedList.PaginatedList( + github.UserKey.UserKey, self._requester, "/user/keys", None ) def get_organization_events(self, org): - assert isinstance(org, Organization.Organization), org - return PaginatedList.PaginatedList( - Event.Event, + assert isinstance(org, github.Organization.Organization), org + return github.PaginatedList.PaginatedList( + github.Event.Event, self._requester, "/users/" + self.login + "/events/orgs/" + org.login, None ) def get_orgs(self): - return PaginatedList.PaginatedList( - Organization.Organization, + return github.PaginatedList.PaginatedList( + github.Organization.Organization, self._requester, "/user/orgs", None @@ -440,60 +439,60 @@ class AuthenticatedUser(GithubObject.GithubObject): None, None ) - return Repository.Repository(self._requester, data, completed=True) + return github.Repository.Repository(self._requester, data, completed=True) - def get_repos(self, type=GithubObject.NotSet, sort=GithubObject.NotSet, direction=GithubObject.NotSet): - assert type is GithubObject.NotSet or isinstance(type, (str, unicode)), type - assert sort is GithubObject.NotSet or isinstance(sort, (str, unicode)), sort - assert direction is GithubObject.NotSet or isinstance(direction, (str, unicode)), direction + def get_repos(self, type=github.GithubObject.NotSet, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet): + assert type is github.GithubObject.NotSet or isinstance(type, (str, unicode)), type + assert sort is github.GithubObject.NotSet or isinstance(sort, (str, unicode)), sort + assert direction is github.GithubObject.NotSet or isinstance(direction, (str, unicode)), direction url_parameters = dict() - if type is not GithubObject.NotSet: + if type is not github.GithubObject.NotSet: url_parameters["type"] = type - if sort is not GithubObject.NotSet: + if sort is not github.GithubObject.NotSet: url_parameters["sort"] = sort - if direction is not GithubObject.NotSet: + if direction is not github.GithubObject.NotSet: url_parameters["direction"] = direction - return PaginatedList.PaginatedList( - Repository.Repository, + return github.PaginatedList.PaginatedList( + github.Repository.Repository, self._requester, "/user/repos", url_parameters ) def get_starred(self): - return PaginatedList.PaginatedList( - Repository.Repository, + return github.PaginatedList.PaginatedList( + github.Repository.Repository, self._requester, "/user/starred", None ) def get_starred_gists(self): - return PaginatedList.PaginatedList( - Gist.Gist, + return github.PaginatedList.PaginatedList( + github.Gist.Gist, self._requester, "/gists/starred", None ) def get_subscriptions(self): - return PaginatedList.PaginatedList( - Repository.Repository, + return github.PaginatedList.PaginatedList( + github.Repository.Repository, self._requester, "/user/subscriptions", None ) def get_watched(self): - return PaginatedList.PaginatedList( - Repository.Repository, + return github.PaginatedList.PaginatedList( + github.Repository.Repository, self._requester, "/user/watched", None ) def has_in_following(self, following): - assert isinstance(following, NamedUser.NamedUser), following + assert isinstance(following, github.NamedUser.NamedUser), following status, headers, data = self._requester.requestRaw( "GET", "/user/following/" + following._identity, @@ -503,7 +502,7 @@ class AuthenticatedUser(GithubObject.GithubObject): return status == 204 def has_in_starred(self, starred): - assert isinstance(starred, Repository.Repository), starred + assert isinstance(starred, github.Repository.Repository), starred status, headers, data = self._requester.requestRaw( "GET", "/user/starred/" + starred._identity, @@ -513,7 +512,7 @@ class AuthenticatedUser(GithubObject.GithubObject): return status == 204 def has_in_subscriptions(self, subscription): - assert isinstance(subscription, Repository.Repository), subscription + assert isinstance(subscription, github.Repository.Repository), subscription status, headers, data = self._requester.requestRaw( "GET", "/user/subscriptions/" + subscription._identity, @@ -523,7 +522,7 @@ class AuthenticatedUser(GithubObject.GithubObject): return status == 204 def has_in_watched(self, watched): - assert isinstance(watched, Repository.Repository), watched + assert isinstance(watched, github.Repository.Repository), watched status, headers, data = self._requester.requestRaw( "GET", "/user/watched/" + watched._identity, @@ -543,7 +542,7 @@ class AuthenticatedUser(GithubObject.GithubObject): ) def remove_from_following(self, following): - assert isinstance(following, NamedUser.NamedUser), following + assert isinstance(following, github.NamedUser.NamedUser), following headers, data = self._requester.requestAndCheck( "DELETE", "/user/following/" + following._identity, @@ -552,7 +551,7 @@ class AuthenticatedUser(GithubObject.GithubObject): ) def remove_from_starred(self, starred): - assert isinstance(starred, Repository.Repository), starred + assert isinstance(starred, github.Repository.Repository), starred headers, data = self._requester.requestAndCheck( "DELETE", "/user/starred/" + starred._identity, @@ -561,7 +560,7 @@ class AuthenticatedUser(GithubObject.GithubObject): ) def remove_from_subscriptions(self, subscription): - assert isinstance(subscription, Repository.Repository), subscription + assert isinstance(subscription, github.Repository.Repository), subscription headers, data = self._requester.requestAndCheck( "DELETE", "/user/subscriptions/" + subscription._identity, @@ -570,7 +569,7 @@ class AuthenticatedUser(GithubObject.GithubObject): ) def remove_from_watched(self, watched): - assert isinstance(watched, Repository.Repository), watched + assert isinstance(watched, github.Repository.Repository), watched headers, data = self._requester.requestAndCheck( "DELETE", "/user/watched/" + watched._identity, @@ -579,31 +578,31 @@ class AuthenticatedUser(GithubObject.GithubObject): ) def _initAttributes(self): - self._avatar_url = GithubObject.NotSet - self._bio = GithubObject.NotSet - self._blog = GithubObject.NotSet - self._collaborators = GithubObject.NotSet - self._company = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._disk_usage = GithubObject.NotSet - self._email = GithubObject.NotSet - self._followers = GithubObject.NotSet - self._following = GithubObject.NotSet - self._gravatar_id = GithubObject.NotSet - self._hireable = GithubObject.NotSet - self._html_url = GithubObject.NotSet - self._id = GithubObject.NotSet - self._location = GithubObject.NotSet - self._login = GithubObject.NotSet - self._name = GithubObject.NotSet - self._owned_private_repos = GithubObject.NotSet - self._plan = GithubObject.NotSet - self._private_gists = GithubObject.NotSet - self._public_gists = GithubObject.NotSet - self._public_repos = GithubObject.NotSet - self._total_private_repos = GithubObject.NotSet - self._type = GithubObject.NotSet - self._url = GithubObject.NotSet + self._avatar_url = github.GithubObject.NotSet + self._bio = github.GithubObject.NotSet + self._blog = github.GithubObject.NotSet + self._collaborators = github.GithubObject.NotSet + self._company = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._disk_usage = github.GithubObject.NotSet + self._email = github.GithubObject.NotSet + self._followers = github.GithubObject.NotSet + self._following = github.GithubObject.NotSet + self._gravatar_id = github.GithubObject.NotSet + self._hireable = github.GithubObject.NotSet + self._html_url = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._location = github.GithubObject.NotSet + self._login = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._owned_private_repos = github.GithubObject.NotSet + self._plan = github.GithubObject.NotSet + self._private_gists = github.GithubObject.NotSet + self._public_gists = github.GithubObject.NotSet + self._public_repos = github.GithubObject.NotSet + self._total_private_repos = github.GithubObject.NotSet + self._type = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet def _useAttributes(self, attributes): if "avatar_url" in attributes: # pragma no branch @@ -662,7 +661,7 @@ class AuthenticatedUser(GithubObject.GithubObject): self._owned_private_repos = attributes["owned_private_repos"] if "plan" in attributes: # pragma no branch assert attributes["plan"] is None or isinstance(attributes["plan"], dict), attributes["plan"] - self._plan = None if attributes["plan"] is None else Plan.Plan(self._requester, attributes["plan"], completed=False) + self._plan = None if attributes["plan"] is None else github.Plan.Plan(self._requester, attributes["plan"], completed=False) if "private_gists" in attributes: # pragma no branch assert attributes["private_gists"] is None or isinstance(attributes["private_gists"], (int, long)), attributes["private_gists"] self._private_gists = attributes["private_gists"] diff --git a/github/Authorization.py b/github/Authorization.py index 4ee1a008..e6876565 100644 --- a/github/Authorization.py +++ b/github/Authorization.py @@ -13,12 +13,12 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import AuthorizationApplication +import github.AuthorizationApplication -class Authorization(GithubObject.GithubObject): +class Authorization(github.GithubObject.GithubObject): @property def app(self): self._completeIfNotSet(self._app) @@ -72,22 +72,22 @@ class Authorization(GithubObject.GithubObject): None ) - def edit(self, scopes=GithubObject.NotSet, add_scopes=GithubObject.NotSet, remove_scopes=GithubObject.NotSet, note=GithubObject.NotSet, note_url=GithubObject.NotSet): - assert scopes is GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in scopes), scopes - assert add_scopes is GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in add_scopes), add_scopes - assert remove_scopes is GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in remove_scopes), remove_scopes - assert note is GithubObject.NotSet or isinstance(note, (str, unicode)), note - assert note_url is GithubObject.NotSet or isinstance(note_url, (str, unicode)), note_url + def edit(self, scopes=github.GithubObject.NotSet, add_scopes=github.GithubObject.NotSet, remove_scopes=github.GithubObject.NotSet, note=github.GithubObject.NotSet, note_url=github.GithubObject.NotSet): + assert scopes is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in scopes), scopes + assert add_scopes is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in add_scopes), add_scopes + assert remove_scopes is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in remove_scopes), remove_scopes + assert note is github.GithubObject.NotSet or isinstance(note, (str, unicode)), note + assert note_url is github.GithubObject.NotSet or isinstance(note_url, (str, unicode)), note_url post_parameters = dict() - if scopes is not GithubObject.NotSet: + if scopes is not github.GithubObject.NotSet: post_parameters["scopes"] = scopes - if add_scopes is not GithubObject.NotSet: + if add_scopes is not github.GithubObject.NotSet: post_parameters["add_scopes"] = add_scopes - if remove_scopes is not GithubObject.NotSet: + if remove_scopes is not github.GithubObject.NotSet: post_parameters["remove_scopes"] = remove_scopes - if note is not GithubObject.NotSet: + if note is not github.GithubObject.NotSet: post_parameters["note"] = note - if note_url is not GithubObject.NotSet: + if note_url is not github.GithubObject.NotSet: post_parameters["note_url"] = note_url headers, data = self._requester.requestAndCheck( "PATCH", @@ -98,20 +98,20 @@ class Authorization(GithubObject.GithubObject): self._useAttributes(data) def _initAttributes(self): - self._app = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._id = GithubObject.NotSet - self._note = GithubObject.NotSet - self._note_url = GithubObject.NotSet - self._scopes = GithubObject.NotSet - self._token = GithubObject.NotSet - self._updated_at = GithubObject.NotSet - self._url = GithubObject.NotSet + self._app = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._note = github.GithubObject.NotSet + self._note_url = github.GithubObject.NotSet + self._scopes = github.GithubObject.NotSet + self._token = github.GithubObject.NotSet + self._updated_at = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet def _useAttributes(self, attributes): if "app" in attributes: # pragma no branch assert attributes["app"] is None or isinstance(attributes["app"], dict), attributes["app"] - self._app = None if attributes["app"] is None else AuthorizationApplication.AuthorizationApplication(self._requester, attributes["app"], completed=False) + self._app = None if attributes["app"] is None else github.AuthorizationApplication.AuthorizationApplication(self._requester, attributes["app"], completed=False) if "created_at" in attributes: # pragma no branch assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"] self._created_at = self._parseDatetime(attributes["created_at"]) diff --git a/github/AuthorizationApplication.py b/github/AuthorizationApplication.py index e99844dc..15326561 100644 --- a/github/AuthorizationApplication.py +++ b/github/AuthorizationApplication.py @@ -13,10 +13,10 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class AuthorizationApplication(GithubObject.GithubObject): +class AuthorizationApplication(github.GithubObject.GithubObject): @property def name(self): self._completeIfNotSet(self._name) @@ -28,8 +28,8 @@ class AuthorizationApplication(GithubObject.GithubObject): return self._NoneIfNotSet(self._url) def _initAttributes(self): - self._name = GithubObject.NotSet - self._url = GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet def _useAttributes(self, attributes): if "name" in attributes: # pragma no branch diff --git a/github/Branch.py b/github/Branch.py index a49e9a7a..c843d54e 100644 --- a/github/Branch.py +++ b/github/Branch.py @@ -13,12 +13,12 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import Commit +import github.Commit -class Branch(GithubObject.BasicGithubObject): +class Branch(github.GithubObject.BasicGithubObject): @property def commit(self): return self._NoneIfNotSet(self._commit) @@ -28,13 +28,13 @@ class Branch(GithubObject.BasicGithubObject): return self._NoneIfNotSet(self._name) def _initAttributes(self): - self._commit = GithubObject.NotSet - self._name = GithubObject.NotSet + self._commit = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet def _useAttributes(self, attributes): if "commit" in attributes: # pragma no branch assert attributes["commit"] is None or isinstance(attributes["commit"], dict), attributes["commit"] - self._commit = None if attributes["commit"] is None else Commit.Commit(self._requester, attributes["commit"], completed=False) + self._commit = None if attributes["commit"] is None else github.Commit.Commit(self._requester, attributes["commit"], completed=False) if "name" in attributes: # pragma no branch assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] self._name = attributes["name"] diff --git a/github/Commit.py b/github/Commit.py index 88610b1a..6998596e 100644 --- a/github/Commit.py +++ b/github/Commit.py @@ -13,19 +13,18 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject -import PaginatedList +import github.GithubObject +import github.PaginatedList -import GitCommit -import NamedUser -import CommitStatus -import File -import CommitStats -import Commit -import CommitComment +import github.GitCommit +import github.NamedUser +import github.CommitStatus +import github.File +import github.CommitStats +import github.CommitComment -class Commit(GithubObject.GithubObject): +class Commit(github.GithubObject.GithubObject): @property def author(self): self._completeIfNotSet(self._author) @@ -66,19 +65,19 @@ class Commit(GithubObject.GithubObject): self._completeIfNotSet(self._url) return self._NoneIfNotSet(self._url) - def create_comment(self, body, line=GithubObject.NotSet, path=GithubObject.NotSet, position=GithubObject.NotSet): + def create_comment(self, body, line=github.GithubObject.NotSet, path=github.GithubObject.NotSet, position=github.GithubObject.NotSet): assert isinstance(body, (str, unicode)), body - assert line is GithubObject.NotSet or isinstance(line, (int, long)), line - assert path is GithubObject.NotSet or isinstance(path, (str, unicode)), path - assert position is GithubObject.NotSet or isinstance(position, (int, long)), position + assert line is github.GithubObject.NotSet or isinstance(line, (int, long)), line + assert path is github.GithubObject.NotSet or isinstance(path, (str, unicode)), path + assert position is github.GithubObject.NotSet or isinstance(position, (int, long)), position post_parameters = { "body": body, } - if line is not GithubObject.NotSet: + if line is not github.GithubObject.NotSet: post_parameters["line"] = line - if path is not GithubObject.NotSet: + if path is not github.GithubObject.NotSet: post_parameters["path"] = path - if position is not GithubObject.NotSet: + if position is not github.GithubObject.NotSet: post_parameters["position"] = position headers, data = self._requester.requestAndCheck( "POST", @@ -86,18 +85,18 @@ class Commit(GithubObject.GithubObject): None, post_parameters ) - return CommitComment.CommitComment(self._requester, data, completed=True) + return github.CommitComment.CommitComment(self._requester, data, completed=True) - def create_status(self, state, target_url=GithubObject.NotSet, description=GithubObject.NotSet): + def create_status(self, state, target_url=github.GithubObject.NotSet, description=github.GithubObject.NotSet): assert isinstance(state, (str, unicode)), state - assert target_url is GithubObject.NotSet or isinstance(target_url, (str, unicode)), target_url - assert description is GithubObject.NotSet or isinstance(description, (str, unicode)), description + assert target_url is github.GithubObject.NotSet or isinstance(target_url, (str, unicode)), target_url + assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description post_parameters = { "state": state, } - if target_url is not GithubObject.NotSet: + if target_url is not github.GithubObject.NotSet: post_parameters["target_url"] = target_url - if description is not GithubObject.NotSet: + if description is not github.GithubObject.NotSet: post_parameters["description"] = description headers, data = self._requester.requestAndCheck( "POST", @@ -105,19 +104,19 @@ class Commit(GithubObject.GithubObject): None, post_parameters ) - return CommitStatus.CommitStatus(self._requester, data, completed=True) + return github.CommitStatus.CommitStatus(self._requester, data, completed=True) def get_comments(self): - return PaginatedList.PaginatedList( - CommitComment.CommitComment, + return github.PaginatedList.PaginatedList( + github.CommitComment.CommitComment, self._requester, self.url + "/comments", None ) def get_statuses(self): - return PaginatedList.PaginatedList( - CommitStatus.CommitStatus, + return github.PaginatedList.PaginatedList( + github.CommitStatus.CommitStatus, self._requester, self._parentUrl(self._parentUrl(self.url)) + "/statuses/" + self.sha, None @@ -128,29 +127,29 @@ class Commit(GithubObject.GithubObject): return self.sha def _initAttributes(self): - self._author = GithubObject.NotSet - self._commit = GithubObject.NotSet - self._committer = GithubObject.NotSet - self._files = GithubObject.NotSet - self._parents = GithubObject.NotSet - self._sha = GithubObject.NotSet - self._stats = GithubObject.NotSet - self._url = GithubObject.NotSet + self._author = github.GithubObject.NotSet + self._commit = github.GithubObject.NotSet + self._committer = github.GithubObject.NotSet + self._files = github.GithubObject.NotSet + self._parents = github.GithubObject.NotSet + self._sha = github.GithubObject.NotSet + self._stats = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet def _useAttributes(self, attributes): if "author" in attributes: # pragma no branch assert attributes["author"] is None or isinstance(attributes["author"], dict), attributes["author"] - self._author = None if attributes["author"] is None else NamedUser.NamedUser(self._requester, attributes["author"], completed=False) + self._author = None if attributes["author"] is None else github.NamedUser.NamedUser(self._requester, attributes["author"], completed=False) if "commit" in attributes: # pragma no branch assert attributes["commit"] is None or isinstance(attributes["commit"], dict), attributes["commit"] - self._commit = None if attributes["commit"] is None else GitCommit.GitCommit(self._requester, attributes["commit"], completed=False) + self._commit = None if attributes["commit"] is None else github.GitCommit.GitCommit(self._requester, attributes["commit"], completed=False) if "committer" in attributes: # pragma no branch assert attributes["committer"] is None or isinstance(attributes["committer"], dict), attributes["committer"] - self._committer = None if attributes["committer"] is None else NamedUser.NamedUser(self._requester, attributes["committer"], completed=False) + self._committer = None if attributes["committer"] is None else github.NamedUser.NamedUser(self._requester, attributes["committer"], completed=False) if "files" in attributes: # pragma no branch assert attributes["files"] is None or all(isinstance(element, dict) for element in attributes["files"]), attributes["files"] self._files = None if attributes["files"] is None else [ - File.File(self._requester, element, completed=False) + github.File.File(self._requester, element, completed=False) for element in attributes["files"] ] if "parents" in attributes: # pragma no branch @@ -164,7 +163,7 @@ class Commit(GithubObject.GithubObject): self._sha = attributes["sha"] if "stats" in attributes: # pragma no branch assert attributes["stats"] is None or isinstance(attributes["stats"], dict), attributes["stats"] - self._stats = None if attributes["stats"] is None else CommitStats.CommitStats(self._requester, attributes["stats"], completed=False) + self._stats = None if attributes["stats"] is None else github.CommitStats.CommitStats(self._requester, attributes["stats"], completed=False) if "url" in attributes: # pragma no branch assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] self._url = attributes["url"] diff --git a/github/CommitComment.py b/github/CommitComment.py index 335285de..f5d93c72 100644 --- a/github/CommitComment.py +++ b/github/CommitComment.py @@ -13,12 +13,12 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import NamedUser +import github.NamedUser -class CommitComment(GithubObject.GithubObject): +class CommitComment(github.GithubObject.GithubObject): @property def body(self): self._completeIfNotSet(self._body) @@ -96,17 +96,17 @@ class CommitComment(GithubObject.GithubObject): self._useAttributes(data) def _initAttributes(self): - self._body = GithubObject.NotSet - self._commit_id = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._html_url = GithubObject.NotSet - self._id = GithubObject.NotSet - self._line = GithubObject.NotSet - self._path = GithubObject.NotSet - self._position = GithubObject.NotSet - self._updated_at = GithubObject.NotSet - self._url = GithubObject.NotSet - self._user = GithubObject.NotSet + self._body = github.GithubObject.NotSet + self._commit_id = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._html_url = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._line = github.GithubObject.NotSet + self._path = github.GithubObject.NotSet + self._position = github.GithubObject.NotSet + self._updated_at = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + self._user = github.GithubObject.NotSet def _useAttributes(self, attributes): if "body" in attributes: # pragma no branch @@ -141,4 +141,4 @@ class CommitComment(GithubObject.GithubObject): self._url = attributes["url"] if "user" in attributes: # pragma no branch assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"] - self._user = None if attributes["user"] is None else NamedUser.NamedUser(self._requester, attributes["user"], completed=False) + self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False) diff --git a/github/CommitStats.py b/github/CommitStats.py index 0fed5814..7740614b 100644 --- a/github/CommitStats.py +++ b/github/CommitStats.py @@ -13,10 +13,10 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class CommitStats(GithubObject.BasicGithubObject): +class CommitStats(github.GithubObject.BasicGithubObject): @property def additions(self): return self._NoneIfNotSet(self._additions) @@ -30,9 +30,9 @@ class CommitStats(GithubObject.BasicGithubObject): return self._NoneIfNotSet(self._total) def _initAttributes(self): - self._additions = GithubObject.NotSet - self._deletions = GithubObject.NotSet - self._total = GithubObject.NotSet + self._additions = github.GithubObject.NotSet + self._deletions = github.GithubObject.NotSet + self._total = github.GithubObject.NotSet def _useAttributes(self, attributes): if "additions" in attributes: # pragma no branch diff --git a/github/CommitStatus.py b/github/CommitStatus.py index 62e367d4..29b7e43b 100644 --- a/github/CommitStatus.py +++ b/github/CommitStatus.py @@ -13,12 +13,12 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import NamedUser +import github.NamedUser -class CommitStatus(GithubObject.BasicGithubObject): +class CommitStatus(github.GithubObject.BasicGithubObject): @property def created_at(self): return self._NoneIfNotSet(self._created_at) @@ -48,13 +48,13 @@ class CommitStatus(GithubObject.BasicGithubObject): return self._NoneIfNotSet(self._updated_at) def _initAttributes(self): - self._created_at = GithubObject.NotSet - self._creator = GithubObject.NotSet - self._description = GithubObject.NotSet - self._id = GithubObject.NotSet - self._state = GithubObject.NotSet - self._target_url = GithubObject.NotSet - self._updated_at = GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._creator = github.GithubObject.NotSet + self._description = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._state = github.GithubObject.NotSet + self._target_url = github.GithubObject.NotSet + self._updated_at = github.GithubObject.NotSet def _useAttributes(self, attributes): if "created_at" in attributes: # pragma no branch @@ -62,7 +62,7 @@ class CommitStatus(GithubObject.BasicGithubObject): self._created_at = self._parseDatetime(attributes["created_at"]) if "creator" in attributes: # pragma no branch assert attributes["creator"] is None or isinstance(attributes["creator"], dict), attributes["creator"] - self._creator = None if attributes["creator"] is None else NamedUser.NamedUser(self._requester, attributes["creator"], completed=False) + self._creator = None if attributes["creator"] is None else github.NamedUser.NamedUser(self._requester, attributes["creator"], completed=False) if "description" in attributes: # pragma no branch assert attributes["description"] is None or isinstance(attributes["description"], (str, unicode)), attributes["description"] self._description = attributes["description"] diff --git a/github/Comparison.py b/github/Comparison.py index c4007f5e..8fe9771e 100644 --- a/github/Comparison.py +++ b/github/Comparison.py @@ -13,13 +13,13 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import Commit -import File +import github.Commit +import github.File -class Comparison(GithubObject.GithubObject): +class Comparison(github.GithubObject.GithubObject): @property def ahead_by(self): self._completeIfNotSet(self._ahead_by) @@ -81,18 +81,18 @@ class Comparison(GithubObject.GithubObject): return self._NoneIfNotSet(self._url) def _initAttributes(self): - self._ahead_by = GithubObject.NotSet - self._base_commit = GithubObject.NotSet - self._behind_by = GithubObject.NotSet - self._commits = GithubObject.NotSet - self._diff_url = GithubObject.NotSet - self._files = GithubObject.NotSet - self._html_url = GithubObject.NotSet - self._patch_url = GithubObject.NotSet - self._permalink_url = GithubObject.NotSet - self._status = GithubObject.NotSet - self._total_commits = GithubObject.NotSet - self._url = GithubObject.NotSet + self._ahead_by = github.GithubObject.NotSet + self._base_commit = github.GithubObject.NotSet + self._behind_by = github.GithubObject.NotSet + self._commits = github.GithubObject.NotSet + self._diff_url = github.GithubObject.NotSet + self._files = github.GithubObject.NotSet + self._html_url = github.GithubObject.NotSet + self._patch_url = github.GithubObject.NotSet + self._permalink_url = github.GithubObject.NotSet + self._status = github.GithubObject.NotSet + self._total_commits = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet def _useAttributes(self, attributes): if "ahead_by" in attributes: # pragma no branch @@ -100,14 +100,14 @@ class Comparison(GithubObject.GithubObject): self._ahead_by = attributes["ahead_by"] if "base_commit" in attributes: # pragma no branch assert attributes["base_commit"] is None or isinstance(attributes["base_commit"], dict), attributes["base_commit"] - self._base_commit = None if attributes["base_commit"] is None else Commit.Commit(self._requester, attributes["base_commit"], completed=False) + self._base_commit = None if attributes["base_commit"] is None else github.Commit.Commit(self._requester, attributes["base_commit"], completed=False) if "behind_by" in attributes: # pragma no branch assert attributes["behind_by"] is None or isinstance(attributes["behind_by"], (int, long)), attributes["behind_by"] self._behind_by = attributes["behind_by"] if "commits" in attributes: # pragma no branch assert attributes["commits"] is None or all(isinstance(element, dict) for element in attributes["commits"]), attributes["commits"] self._commits = None if attributes["commits"] is None else [ - Commit.Commit(self._requester, element, completed=False) + github.Commit.Commit(self._requester, element, completed=False) for element in attributes["commits"] ] if "diff_url" in attributes: # pragma no branch @@ -116,7 +116,7 @@ class Comparison(GithubObject.GithubObject): if "files" in attributes: # pragma no branch assert attributes["files"] is None or all(isinstance(element, dict) for element in attributes["files"]), attributes["files"] self._files = None if attributes["files"] is None else [ - File.File(self._requester, element, completed=False) + github.File.File(self._requester, element, completed=False) for element in attributes["files"] ] if "html_url" in attributes: # pragma no branch diff --git a/github/ContentFile.py b/github/ContentFile.py index 9c8ceca7..4f43188c 100644 --- a/github/ContentFile.py +++ b/github/ContentFile.py @@ -13,10 +13,10 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class ContentFile(GithubObject.BasicGithubObject): +class ContentFile(github.GithubObject.BasicGithubObject): @property def content(self): return self._NoneIfNotSet(self._content) @@ -46,13 +46,13 @@ class ContentFile(GithubObject.BasicGithubObject): return self._NoneIfNotSet(self._type) def _initAttributes(self): - self._content = GithubObject.NotSet - self._encoding = GithubObject.NotSet - self._name = GithubObject.NotSet - self._path = GithubObject.NotSet - self._sha = GithubObject.NotSet - self._size = GithubObject.NotSet - self._type = GithubObject.NotSet + self._content = github.GithubObject.NotSet + self._encoding = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._path = github.GithubObject.NotSet + self._sha = github.GithubObject.NotSet + self._size = github.GithubObject.NotSet + self._type = github.GithubObject.NotSet def _useAttributes(self, attributes): if "content" in attributes: # pragma no branch diff --git a/github/Download.py b/github/Download.py index 52ecc86f..6e172a1e 100644 --- a/github/Download.py +++ b/github/Download.py @@ -13,10 +13,10 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class Download(GithubObject.GithubObject): +class Download(github.GithubObject.GithubObject): @property def accesskeyid(self): self._completeIfNotSet(self._accesskeyid) @@ -126,26 +126,26 @@ class Download(GithubObject.GithubObject): ) def _initAttributes(self): - self._accesskeyid = GithubObject.NotSet - self._acl = GithubObject.NotSet - self._bucket = GithubObject.NotSet - self._content_type = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._description = GithubObject.NotSet - self._download_count = GithubObject.NotSet - self._expirationdate = GithubObject.NotSet - self._html_url = GithubObject.NotSet - self._id = GithubObject.NotSet - self._mime_type = GithubObject.NotSet - self._name = GithubObject.NotSet - self._path = GithubObject.NotSet - self._policy = GithubObject.NotSet - self._prefix = GithubObject.NotSet - self._redirect = GithubObject.NotSet - self._s3_url = GithubObject.NotSet - self._signature = GithubObject.NotSet - self._size = GithubObject.NotSet - self._url = GithubObject.NotSet + self._accesskeyid = github.GithubObject.NotSet + self._acl = github.GithubObject.NotSet + self._bucket = github.GithubObject.NotSet + self._content_type = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._description = github.GithubObject.NotSet + self._download_count = github.GithubObject.NotSet + self._expirationdate = github.GithubObject.NotSet + self._html_url = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._mime_type = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._path = github.GithubObject.NotSet + self._policy = github.GithubObject.NotSet + self._prefix = github.GithubObject.NotSet + self._redirect = github.GithubObject.NotSet + self._s3_url = github.GithubObject.NotSet + self._signature = github.GithubObject.NotSet + self._size = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet def _useAttributes(self, attributes): if "accesskeyid" in attributes: # pragma no branch diff --git a/github/Event.py b/github/Event.py index 4c8b3b3b..238907d2 100644 --- a/github/Event.py +++ b/github/Event.py @@ -13,14 +13,14 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import Organization -import Repository -import NamedUser +import github.Organization +import github.Repository +import github.NamedUser -class Event(GithubObject.BasicGithubObject): +class Event(github.GithubObject.BasicGithubObject): @property def actor(self): return self._NoneIfNotSet(self._actor) @@ -54,19 +54,19 @@ class Event(GithubObject.BasicGithubObject): return self._NoneIfNotSet(self._type) def _initAttributes(self): - self._actor = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._id = GithubObject.NotSet - self._org = GithubObject.NotSet - self._payload = GithubObject.NotSet - self._public = GithubObject.NotSet - self._repo = GithubObject.NotSet - self._type = GithubObject.NotSet + self._actor = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._org = github.GithubObject.NotSet + self._payload = github.GithubObject.NotSet + self._public = github.GithubObject.NotSet + self._repo = github.GithubObject.NotSet + self._type = github.GithubObject.NotSet def _useAttributes(self, attributes): if "actor" in attributes: # pragma no branch assert attributes["actor"] is None or isinstance(attributes["actor"], dict), attributes["actor"] - self._actor = None if attributes["actor"] is None else NamedUser.NamedUser(self._requester, attributes["actor"], completed=False) + self._actor = None if attributes["actor"] is None else github.NamedUser.NamedUser(self._requester, attributes["actor"], completed=False) if "created_at" in attributes: # pragma no branch assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"] self._created_at = self._parseDatetime(attributes["created_at"]) @@ -75,7 +75,7 @@ class Event(GithubObject.BasicGithubObject): self._id = attributes["id"] if "org" in attributes: # pragma no branch assert attributes["org"] is None or isinstance(attributes["org"], dict), attributes["org"] - self._org = None if attributes["org"] is None else Organization.Organization(self._requester, attributes["org"], completed=False) + self._org = None if attributes["org"] is None else github.Organization.Organization(self._requester, attributes["org"], completed=False) if "payload" in attributes: # pragma no branch assert attributes["payload"] is None or isinstance(attributes["payload"], dict), attributes["payload"] self._payload = attributes["payload"] @@ -84,7 +84,7 @@ class Event(GithubObject.BasicGithubObject): self._public = attributes["public"] if "repo" in attributes: # pragma no branch assert attributes["repo"] is None or isinstance(attributes["repo"], dict), attributes["repo"] - self._repo = None if attributes["repo"] is None else Repository.Repository(self._requester, attributes["repo"], completed=False) + self._repo = None if attributes["repo"] is None else github.Repository.Repository(self._requester, attributes["repo"], completed=False) if "type" in attributes: # pragma no branch assert attributes["type"] is None or isinstance(attributes["type"], (str, unicode)), attributes["type"] self._type = attributes["type"] diff --git a/github/File.py b/github/File.py index 9a6a9d16..f01f0183 100644 --- a/github/File.py +++ b/github/File.py @@ -13,10 +13,10 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class File(GithubObject.BasicGithubObject): +class File(github.GithubObject.BasicGithubObject): @property def additions(self): return self._NoneIfNotSet(self._additions) @@ -54,15 +54,15 @@ class File(GithubObject.BasicGithubObject): return self._NoneIfNotSet(self._status) def _initAttributes(self): - self._additions = GithubObject.NotSet - self._blob_url = GithubObject.NotSet - self._changes = GithubObject.NotSet - self._deletions = GithubObject.NotSet - self._filename = GithubObject.NotSet - self._patch = GithubObject.NotSet - self._raw_url = GithubObject.NotSet - self._sha = GithubObject.NotSet - self._status = GithubObject.NotSet + self._additions = github.GithubObject.NotSet + self._blob_url = github.GithubObject.NotSet + self._changes = github.GithubObject.NotSet + self._deletions = github.GithubObject.NotSet + self._filename = github.GithubObject.NotSet + self._patch = github.GithubObject.NotSet + self._raw_url = github.GithubObject.NotSet + self._sha = github.GithubObject.NotSet + self._status = github.GithubObject.NotSet def _useAttributes(self, attributes): if "additions" in attributes: # pragma no branch diff --git a/github/Gist.py b/github/Gist.py index aa5256d5..cdf7339a 100644 --- a/github/Gist.py +++ b/github/Gist.py @@ -13,18 +13,16 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject -import PaginatedList +import github.GithubObject +import github.PaginatedList -import Gist -import GistComment -import NamedUser -import GistFile -import InputFileContent -import GistHistoryState +import github.GistComment +import github.NamedUser +import github.GistFile +import github.GistHistoryState -class Gist(GithubObject.GithubObject): +class Gist(github.GithubObject.GithubObject): @property def comments(self): self._completeIfNotSet(self._comments) @@ -111,7 +109,7 @@ class Gist(GithubObject.GithubObject): None, post_parameters ) - return GistComment.GistComment(self._requester, data, completed=True) + return github.GistComment.GistComment(self._requester, data, completed=True) def create_fork(self): headers, data = self._requester.requestAndCheck( @@ -130,13 +128,13 @@ class Gist(GithubObject.GithubObject): None ) - def edit(self, description=GithubObject.NotSet, files=GithubObject.NotSet): - assert description is GithubObject.NotSet or isinstance(description, (str, unicode)), description - assert files is GithubObject.NotSet or all(isinstance(element, InputFileContent.InputFileContent) for element in files.itervalues()), files + def edit(self, description=github.GithubObject.NotSet, files=github.GithubObject.NotSet): + assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description + assert files is github.GithubObject.NotSet or all(isinstance(element, github.InputFileContent) for element in files.itervalues()), files post_parameters = dict() - if description is not GithubObject.NotSet: + if description is not github.GithubObject.NotSet: post_parameters["description"] = description - if files is not GithubObject.NotSet: + if files is not github.GithubObject.NotSet: post_parameters["files"] = dict((key, value._identity) for key, value in files.iteritems()) headers, data = self._requester.requestAndCheck( "PATCH", @@ -154,11 +152,11 @@ class Gist(GithubObject.GithubObject): None, None ) - return GistComment.GistComment(self._requester, data, completed=True) + return github.GistComment.GistComment(self._requester, data, completed=True) def get_comments(self): - return PaginatedList.PaginatedList( - GistComment.GistComment, + return github.PaginatedList.PaginatedList( + github.GistComment.GistComment, self._requester, self.url + "/comments", None @@ -190,21 +188,21 @@ class Gist(GithubObject.GithubObject): ) def _initAttributes(self): - self._comments = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._description = GithubObject.NotSet - self._files = GithubObject.NotSet - self._fork_of = GithubObject.NotSet - self._forks = GithubObject.NotSet - self._git_pull_url = GithubObject.NotSet - self._git_push_url = GithubObject.NotSet - self._history = GithubObject.NotSet - self._html_url = GithubObject.NotSet - self._id = GithubObject.NotSet - self._public = GithubObject.NotSet - self._updated_at = GithubObject.NotSet - self._url = GithubObject.NotSet - self._user = GithubObject.NotSet + self._comments = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._description = github.GithubObject.NotSet + self._files = github.GithubObject.NotSet + self._fork_of = github.GithubObject.NotSet + self._forks = github.GithubObject.NotSet + self._git_pull_url = github.GithubObject.NotSet + self._git_push_url = github.GithubObject.NotSet + self._history = github.GithubObject.NotSet + self._html_url = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._public = github.GithubObject.NotSet + self._updated_at = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + self._user = github.GithubObject.NotSet def _useAttributes(self, attributes): if "comments" in attributes: # pragma no branch @@ -219,7 +217,7 @@ class Gist(GithubObject.GithubObject): if "files" in attributes: # pragma no branch assert attributes["files"] is None or all(isinstance(element, dict) for element in attributes["files"].itervalues()), attributes["files"] self._files = None if attributes["files"] is None else dict( - (key, GistFile.GistFile(self._requester, element, completed=False)) + (key, github.GistFile.GistFile(self._requester, element, completed=False)) for key, element in attributes["files"].iteritems() ) if "fork_of" in attributes: # pragma no branch @@ -240,7 +238,7 @@ class Gist(GithubObject.GithubObject): if "history" in attributes: # pragma no branch assert attributes["history"] is None or all(isinstance(element, dict) for element in attributes["history"]), attributes["history"] self._history = None if attributes["history"] is None else [ - GistHistoryState.GistHistoryState(self._requester, element, completed=False) + github.GistHistoryState.GistHistoryState(self._requester, element, completed=False) for element in attributes["history"] ] if "html_url" in attributes: # pragma no branch @@ -260,4 +258,4 @@ class Gist(GithubObject.GithubObject): self._url = attributes["url"] if "user" in attributes: # pragma no branch assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"] - self._user = None if attributes["user"] is None else NamedUser.NamedUser(self._requester, attributes["user"], completed=False) + self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False) diff --git a/github/GistComment.py b/github/GistComment.py index 6cd36d49..1d0a573c 100644 --- a/github/GistComment.py +++ b/github/GistComment.py @@ -13,12 +13,12 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import NamedUser +import github.NamedUser -class GistComment(GithubObject.GithubObject): +class GistComment(github.GithubObject.GithubObject): @property def body(self): self._completeIfNotSet(self._body) @@ -71,12 +71,12 @@ class GistComment(GithubObject.GithubObject): self._useAttributes(data) def _initAttributes(self): - self._body = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._id = GithubObject.NotSet - self._updated_at = GithubObject.NotSet - self._url = GithubObject.NotSet - self._user = GithubObject.NotSet + self._body = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._updated_at = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + self._user = github.GithubObject.NotSet def _useAttributes(self, attributes): if "body" in attributes: # pragma no branch @@ -96,4 +96,4 @@ class GistComment(GithubObject.GithubObject): self._url = attributes["url"] if "user" in attributes: # pragma no branch assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"] - self._user = None if attributes["user"] is None else NamedUser.NamedUser(self._requester, attributes["user"], completed=False) + self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False) diff --git a/github/GistFile.py b/github/GistFile.py index c5011dca..4e2fb323 100644 --- a/github/GistFile.py +++ b/github/GistFile.py @@ -13,10 +13,10 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class GistFile(GithubObject.BasicGithubObject): +class GistFile(github.GithubObject.BasicGithubObject): @property def content(self): return self._NoneIfNotSet(self._content) @@ -38,11 +38,11 @@ class GistFile(GithubObject.BasicGithubObject): return self._NoneIfNotSet(self._size) def _initAttributes(self): - self._content = GithubObject.NotSet - self._filename = GithubObject.NotSet - self._language = GithubObject.NotSet - self._raw_url = GithubObject.NotSet - self._size = GithubObject.NotSet + self._content = github.GithubObject.NotSet + self._filename = github.GithubObject.NotSet + self._language = github.GithubObject.NotSet + self._raw_url = github.GithubObject.NotSet + self._size = github.GithubObject.NotSet def _useAttributes(self, attributes): if "content" in attributes: # pragma no branch diff --git a/github/GistHistoryState.py b/github/GistHistoryState.py index 0c214fff..89c8349e 100644 --- a/github/GistHistoryState.py +++ b/github/GistHistoryState.py @@ -13,13 +13,13 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import NamedUser -import CommitStats +import github.NamedUser +import github.CommitStats -class GistHistoryState(GithubObject.GithubObject): +class GistHistoryState(github.GithubObject.GithubObject): @property def change_status(self): self._completeIfNotSet(self._change_status) @@ -46,16 +46,16 @@ class GistHistoryState(GithubObject.GithubObject): return self._NoneIfNotSet(self._version) def _initAttributes(self): - self._change_status = GithubObject.NotSet - self._committed_at = GithubObject.NotSet - self._url = GithubObject.NotSet - self._user = GithubObject.NotSet - self._version = GithubObject.NotSet + self._change_status = github.GithubObject.NotSet + self._committed_at = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + self._user = github.GithubObject.NotSet + self._version = github.GithubObject.NotSet def _useAttributes(self, attributes): if "change_status" in attributes: # pragma no branch assert attributes["change_status"] is None or isinstance(attributes["change_status"], dict), attributes["change_status"] - self._change_status = None if attributes["change_status"] is None else CommitStats.CommitStats(self._requester, attributes["change_status"], completed=False) + self._change_status = None if attributes["change_status"] is None else github.CommitStats.CommitStats(self._requester, attributes["change_status"], completed=False) if "committed_at" in attributes: # pragma no branch assert attributes["committed_at"] is None or isinstance(attributes["committed_at"], (str, unicode)), attributes["committed_at"] self._committed_at = self._parseDatetime(attributes["committed_at"]) @@ -64,7 +64,7 @@ class GistHistoryState(GithubObject.GithubObject): self._url = attributes["url"] if "user" in attributes: # pragma no branch assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"] - self._user = None if attributes["user"] is None else NamedUser.NamedUser(self._requester, attributes["user"], completed=False) + self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False) if "version" in attributes: # pragma no branch assert attributes["version"] is None or isinstance(attributes["version"], (str, unicode)), attributes["version"] self._version = attributes["version"] diff --git a/github/GitAuthor.py b/github/GitAuthor.py index a14f31c9..fe378303 100644 --- a/github/GitAuthor.py +++ b/github/GitAuthor.py @@ -13,10 +13,10 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class GitAuthor(GithubObject.BasicGithubObject): +class GitAuthor(github.GithubObject.BasicGithubObject): @property def date(self): return self._NoneIfNotSet(self._date) @@ -30,9 +30,9 @@ class GitAuthor(GithubObject.BasicGithubObject): return self._NoneIfNotSet(self._name) def _initAttributes(self): - self._date = GithubObject.NotSet - self._email = GithubObject.NotSet - self._name = GithubObject.NotSet + self._date = github.GithubObject.NotSet + self._email = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet def _useAttributes(self, attributes): if "date" in attributes: # pragma no branch diff --git a/github/GitBlob.py b/github/GitBlob.py index 9ab38b92..bd5a304f 100644 --- a/github/GitBlob.py +++ b/github/GitBlob.py @@ -13,10 +13,10 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class GitBlob(GithubObject.GithubObject): +class GitBlob(github.GithubObject.GithubObject): @property def content(self): self._completeIfNotSet(self._content) @@ -43,11 +43,11 @@ class GitBlob(GithubObject.GithubObject): return self._NoneIfNotSet(self._url) def _initAttributes(self): - self._content = GithubObject.NotSet - self._encoding = GithubObject.NotSet - self._sha = GithubObject.NotSet - self._size = GithubObject.NotSet - self._url = GithubObject.NotSet + self._content = github.GithubObject.NotSet + self._encoding = github.GithubObject.NotSet + self._sha = github.GithubObject.NotSet + self._size = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet def _useAttributes(self, attributes): if "content" in attributes: # pragma no branch diff --git a/github/GitCommit.py b/github/GitCommit.py index 0dcf1de5..3e3afe88 100644 --- a/github/GitCommit.py +++ b/github/GitCommit.py @@ -13,14 +13,13 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import GitAuthor -import GitCommit -import GitTree +import github.GitAuthor +import github.GitTree -class GitCommit(GithubObject.GithubObject): +class GitCommit(github.GithubObject.GithubObject): @property def author(self): self._completeIfNotSet(self._author) @@ -61,21 +60,21 @@ class GitCommit(GithubObject.GithubObject): return self.sha def _initAttributes(self): - self._author = GithubObject.NotSet - self._committer = GithubObject.NotSet - self._message = GithubObject.NotSet - self._parents = GithubObject.NotSet - self._sha = GithubObject.NotSet - self._tree = GithubObject.NotSet - self._url = GithubObject.NotSet + self._author = github.GithubObject.NotSet + self._committer = github.GithubObject.NotSet + self._message = github.GithubObject.NotSet + self._parents = github.GithubObject.NotSet + self._sha = github.GithubObject.NotSet + self._tree = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet def _useAttributes(self, attributes): if "author" in attributes: # pragma no branch assert attributes["author"] is None or isinstance(attributes["author"], dict), attributes["author"] - self._author = None if attributes["author"] is None else GitAuthor.GitAuthor(self._requester, attributes["author"], completed=False) + self._author = None if attributes["author"] is None else github.GitAuthor.GitAuthor(self._requester, attributes["author"], completed=False) if "committer" in attributes: # pragma no branch assert attributes["committer"] is None or isinstance(attributes["committer"], dict), attributes["committer"] - self._committer = None if attributes["committer"] is None else GitAuthor.GitAuthor(self._requester, attributes["committer"], completed=False) + self._committer = None if attributes["committer"] is None else github.GitAuthor.GitAuthor(self._requester, attributes["committer"], completed=False) if "message" in attributes: # pragma no branch assert attributes["message"] is None or isinstance(attributes["message"], (str, unicode)), attributes["message"] self._message = attributes["message"] @@ -90,7 +89,7 @@ class GitCommit(GithubObject.GithubObject): self._sha = attributes["sha"] if "tree" in attributes: # pragma no branch assert attributes["tree"] is None or isinstance(attributes["tree"], dict), attributes["tree"] - self._tree = None if attributes["tree"] is None else GitTree.GitTree(self._requester, attributes["tree"], completed=False) + self._tree = None if attributes["tree"] is None else github.GitTree.GitTree(self._requester, attributes["tree"], completed=False) if "url" in attributes: # pragma no branch assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] self._url = attributes["url"] diff --git a/github/GitObject.py b/github/GitObject.py index 5b6b308b..e5a2db27 100644 --- a/github/GitObject.py +++ b/github/GitObject.py @@ -13,10 +13,10 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class GitObject(GithubObject.BasicGithubObject): +class GitObject(github.GithubObject.BasicGithubObject): @property def sha(self): return self._NoneIfNotSet(self._sha) @@ -30,9 +30,9 @@ class GitObject(GithubObject.BasicGithubObject): return self._NoneIfNotSet(self._url) def _initAttributes(self): - self._sha = GithubObject.NotSet - self._type = GithubObject.NotSet - self._url = GithubObject.NotSet + self._sha = github.GithubObject.NotSet + self._type = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet def _useAttributes(self, attributes): if "sha" in attributes: # pragma no branch diff --git a/github/GitRef.py b/github/GitRef.py index 58b2426f..ce6a0904 100644 --- a/github/GitRef.py +++ b/github/GitRef.py @@ -13,12 +13,12 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import GitObject +import github.GitObject -class GitRef(GithubObject.GithubObject): +class GitRef(github.GithubObject.GithubObject): @property def object(self): self._completeIfNotSet(self._object) @@ -42,13 +42,13 @@ class GitRef(GithubObject.GithubObject): None ) - def edit(self, sha, force=GithubObject.NotSet): + def edit(self, sha, force=github.GithubObject.NotSet): assert isinstance(sha, (str, unicode)), sha - assert force is GithubObject.NotSet or isinstance(force, bool), force + assert force is github.GithubObject.NotSet or isinstance(force, bool), force post_parameters = { "sha": sha, } - if force is not GithubObject.NotSet: + if force is not github.GithubObject.NotSet: post_parameters["force"] = force headers, data = self._requester.requestAndCheck( "PATCH", @@ -59,14 +59,14 @@ class GitRef(GithubObject.GithubObject): self._useAttributes(data) def _initAttributes(self): - self._object = GithubObject.NotSet - self._ref = GithubObject.NotSet - self._url = GithubObject.NotSet + self._object = github.GithubObject.NotSet + self._ref = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet def _useAttributes(self, attributes): if "object" in attributes: # pragma no branch assert attributes["object"] is None or isinstance(attributes["object"], dict), attributes["object"] - self._object = None if attributes["object"] is None else GitObject.GitObject(self._requester, attributes["object"], completed=False) + self._object = None if attributes["object"] is None else github.GitObject.GitObject(self._requester, attributes["object"], completed=False) if "ref" in attributes: # pragma no branch assert attributes["ref"] is None or isinstance(attributes["ref"], (str, unicode)), attributes["ref"] self._ref = attributes["ref"] diff --git a/github/GitTag.py b/github/GitTag.py index 664bc8aa..fa16597e 100644 --- a/github/GitTag.py +++ b/github/GitTag.py @@ -13,13 +13,13 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import GitAuthor -import GitObject +import github.GitAuthor +import github.GitObject -class GitTag(GithubObject.GithubObject): +class GitTag(github.GithubObject.GithubObject): @property def message(self): self._completeIfNotSet(self._message) @@ -51,12 +51,12 @@ class GitTag(GithubObject.GithubObject): return self._NoneIfNotSet(self._url) def _initAttributes(self): - self._message = GithubObject.NotSet - self._object = GithubObject.NotSet - self._sha = GithubObject.NotSet - self._tag = GithubObject.NotSet - self._tagger = GithubObject.NotSet - self._url = GithubObject.NotSet + self._message = github.GithubObject.NotSet + self._object = github.GithubObject.NotSet + self._sha = github.GithubObject.NotSet + self._tag = github.GithubObject.NotSet + self._tagger = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet def _useAttributes(self, attributes): if "message" in attributes: # pragma no branch @@ -64,7 +64,7 @@ class GitTag(GithubObject.GithubObject): self._message = attributes["message"] if "object" in attributes: # pragma no branch assert attributes["object"] is None or isinstance(attributes["object"], dict), attributes["object"] - self._object = None if attributes["object"] is None else GitObject.GitObject(self._requester, attributes["object"], completed=False) + self._object = None if attributes["object"] is None else github.GitObject.GitObject(self._requester, attributes["object"], completed=False) if "sha" in attributes: # pragma no branch assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"] self._sha = attributes["sha"] @@ -73,7 +73,7 @@ class GitTag(GithubObject.GithubObject): self._tag = attributes["tag"] if "tagger" in attributes: # pragma no branch assert attributes["tagger"] is None or isinstance(attributes["tagger"], dict), attributes["tagger"] - self._tagger = None if attributes["tagger"] is None else GitAuthor.GitAuthor(self._requester, attributes["tagger"], completed=False) + self._tagger = None if attributes["tagger"] is None else github.GitAuthor.GitAuthor(self._requester, attributes["tagger"], completed=False) if "url" in attributes: # pragma no branch assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] self._url = attributes["url"] diff --git a/github/GitTree.py b/github/GitTree.py index 3af066ab..926776f9 100644 --- a/github/GitTree.py +++ b/github/GitTree.py @@ -13,12 +13,12 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import GitTreeElement +import github.GitTreeElement -class GitTree(GithubObject.GithubObject): +class GitTree(github.GithubObject.GithubObject): @property def sha(self): self._completeIfNotSet(self._sha) @@ -39,9 +39,9 @@ class GitTree(GithubObject.GithubObject): return self.sha def _initAttributes(self): - self._sha = GithubObject.NotSet - self._tree = GithubObject.NotSet - self._url = GithubObject.NotSet + self._sha = github.GithubObject.NotSet + self._tree = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet def _useAttributes(self, attributes): if "sha" in attributes: # pragma no branch @@ -50,7 +50,7 @@ class GitTree(GithubObject.GithubObject): if "tree" in attributes: # pragma no branch assert attributes["tree"] is None or all(isinstance(element, dict) for element in attributes["tree"]), attributes["tree"] self._tree = None if attributes["tree"] is None else [ - GitTreeElement.GitTreeElement(self._requester, element, completed=False) + github.GitTreeElement.GitTreeElement(self._requester, element, completed=False) for element in attributes["tree"] ] if "url" in attributes: # pragma no branch diff --git a/github/GitTreeElement.py b/github/GitTreeElement.py index 6d0aa9ae..d2ec2027 100644 --- a/github/GitTreeElement.py +++ b/github/GitTreeElement.py @@ -13,10 +13,10 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class GitTreeElement(GithubObject.BasicGithubObject): +class GitTreeElement(github.GithubObject.BasicGithubObject): @property def mode(self): return self._NoneIfNotSet(self._mode) @@ -42,12 +42,12 @@ class GitTreeElement(GithubObject.BasicGithubObject): return self._NoneIfNotSet(self._url) def _initAttributes(self): - self._mode = GithubObject.NotSet - self._path = GithubObject.NotSet - self._sha = GithubObject.NotSet - self._size = GithubObject.NotSet - self._type = GithubObject.NotSet - self._url = GithubObject.NotSet + self._mode = github.GithubObject.NotSet + self._path = github.GithubObject.NotSet + self._sha = github.GithubObject.NotSet + self._size = github.GithubObject.NotSet + self._type = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet def _useAttributes(self, attributes): if "mode" in attributes: # pragma no branch diff --git a/github/Github.py b/github/Github.py index 32d69c91..e4e548f6 100644 --- a/github/Github.py +++ b/github/Github.py @@ -20,10 +20,10 @@ import AuthenticatedUser import NamedUser import Organization import Gist -import PaginatedList +import github.PaginatedList import Repository import Legacy -import GithubObject +import github.GithubObject import HookDescription @@ -47,9 +47,9 @@ class Github(object): def rate_limiting(self): return self.__requester.rate_limiting - def get_user(self, login=GithubObject.NotSet): - assert login is GithubObject.NotSet or isinstance(login, (str, unicode)), login - if login is GithubObject.NotSet: + def get_user(self, login=github.GithubObject.NotSet): + assert login is github.GithubObject.NotSet or isinstance(login, (str, unicode)), login + if login is github.GithubObject.NotSet: return AuthenticatedUser.AuthenticatedUser(self.__requester, {"url": "/user"}, completed=False) else: headers, data = self.__requester.requestAndCheck( @@ -58,7 +58,7 @@ class Github(object): None, None ) - return NamedUser.NamedUser(self.__requester, data, completed=True) + return github.NamedUser.NamedUser(self.__requester, data, completed=True) def get_organization(self, login): assert isinstance(login, (str, unicode)), login @@ -68,7 +68,7 @@ class Github(object): None, None ) - return Organization.Organization(self.__requester, data, completed=True) + return github.Organization.Organization(self.__requester, data, completed=True) def get_gist(self, id): assert isinstance(id, (str, unicode)), id @@ -78,27 +78,27 @@ class Github(object): None, None ) - return Gist.Gist(self.__requester, data, completed=True) + return github.Gist.Gist(self.__requester, data, completed=True) def get_gists(self): - return PaginatedList.PaginatedList( - Gist.Gist, + return github.PaginatedList.PaginatedList( + github.Gist.Gist, self.__requester, "/gists/public", None ) - def legacy_search_repos(self, keyword, language=GithubObject.NotSet): + def legacy_search_repos(self, keyword, language=github.GithubObject.NotSet): assert isinstance(keyword, (str, unicode)), keyword - assert language is GithubObject.NotSet or isinstance(language, (str, unicode)), language - args = {} if language is GithubObject.NotSet else {"language": language} + assert language is github.GithubObject.NotSet or isinstance(language, (str, unicode)), language + args = {} if language is github.GithubObject.NotSet else {"language": language} return Legacy.PaginatedList( "/legacy/repos/search/" + urllib.quote(keyword), args, self.__requester, "repositories", Legacy.convertRepo, - Repository.Repository, + github.Repository.Repository, ) def legacy_search_users(self, keyword): @@ -109,7 +109,7 @@ class Github(object): self.__requester, "users", Legacy.convertUser, - NamedUser.NamedUser, + github.NamedUser.NamedUser, ) def legacy_search_user_by_email(self, email): @@ -120,15 +120,15 @@ class Github(object): None, None ) - return NamedUser.NamedUser(self.__requester, Legacy.convertUser(data["user"]), completed=False) + return github.NamedUser.NamedUser(self.__requester, Legacy.convertUser(data["user"]), completed=False) - def render_markdown(self, text, context=GithubObject.NotSet): + def render_markdown(self, text, context=github.GithubObject.NotSet): assert isinstance(text, (str, unicode)), text - assert context is GithubObject.NotSet or isinstance(context, Repository.Repository), context + assert context is github.GithubObject.NotSet or isinstance(context, github.Repository.Repository), context post_parameters = { "text": text } - if context is not GithubObject.NotSet: + if context is not github.GithubObject.NotSet: post_parameters["mode"] = "gfm" post_parameters["context"] = context._identity status, headers, data = self.__requester.requestRaw( diff --git a/github/Hook.py b/github/Hook.py index 86fc0918..a1faccb1 100644 --- a/github/Hook.py +++ b/github/Hook.py @@ -13,12 +13,12 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import HookResponse +import github.HookResponse -class Hook(GithubObject.GithubObject): +class Hook(github.GithubObject.GithubObject): @property def active(self): self._completeIfNotSet(self._active) @@ -72,24 +72,24 @@ class Hook(GithubObject.GithubObject): None ) - def edit(self, name, config, events=GithubObject.NotSet, add_events=GithubObject.NotSet, remove_events=GithubObject.NotSet, active=GithubObject.NotSet): + def edit(self, name, config, events=github.GithubObject.NotSet, add_events=github.GithubObject.NotSet, remove_events=github.GithubObject.NotSet, active=github.GithubObject.NotSet): assert isinstance(name, (str, unicode)), name assert isinstance(config, dict), config - assert events is GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in events), events - assert add_events is GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in add_events), add_events - assert remove_events is GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in remove_events), remove_events - assert active is GithubObject.NotSet or isinstance(active, bool), active + assert events is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in events), events + assert add_events is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in add_events), add_events + assert remove_events is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in remove_events), remove_events + assert active is github.GithubObject.NotSet or isinstance(active, bool), active post_parameters = { "name": name, "config": config, } - if events is not GithubObject.NotSet: + if events is not github.GithubObject.NotSet: post_parameters["events"] = events - if add_events is not GithubObject.NotSet: + if add_events is not github.GithubObject.NotSet: post_parameters["add_events"] = add_events - if remove_events is not GithubObject.NotSet: + if remove_events is not github.GithubObject.NotSet: post_parameters["remove_events"] = remove_events - if active is not GithubObject.NotSet: + if active is not github.GithubObject.NotSet: post_parameters["active"] = active headers, data = self._requester.requestAndCheck( "PATCH", @@ -108,15 +108,15 @@ class Hook(GithubObject.GithubObject): ) def _initAttributes(self): - self._active = GithubObject.NotSet - self._config = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._events = GithubObject.NotSet - self._id = GithubObject.NotSet - self._last_response = GithubObject.NotSet - self._name = GithubObject.NotSet - self._updated_at = GithubObject.NotSet - self._url = GithubObject.NotSet + self._active = github.GithubObject.NotSet + self._config = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._events = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._last_response = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._updated_at = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet def _useAttributes(self, attributes): if "active" in attributes: # pragma no branch @@ -136,7 +136,7 @@ class Hook(GithubObject.GithubObject): self._id = attributes["id"] if "last_response" in attributes: # pragma no branch assert attributes["last_response"] is None or isinstance(attributes["last_response"], dict), attributes["last_response"] - self._last_response = None if attributes["last_response"] is None else HookResponse.HookResponse(self._requester, attributes["last_response"], completed=False) + self._last_response = None if attributes["last_response"] is None else github.HookResponse.HookResponse(self._requester, attributes["last_response"], completed=False) if "name" in attributes: # pragma no branch assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] self._name = attributes["name"] diff --git a/github/HookDescription.py b/github/HookDescription.py index 28e4e654..68fd4269 100644 --- a/github/HookDescription.py +++ b/github/HookDescription.py @@ -13,10 +13,10 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class HookDescription(GithubObject.BasicGithubObject): +class HookDescription(github.GithubObject.BasicGithubObject): @property def events(self): return self._NoneIfNotSet(self._events) @@ -34,10 +34,10 @@ class HookDescription(GithubObject.BasicGithubObject): return self._NoneIfNotSet(self._supported_events) def _initAttributes(self): - self._events = GithubObject.NotSet - self._name = GithubObject.NotSet - self._schema = GithubObject.NotSet - self._supported_events = GithubObject.NotSet + self._events = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._schema = github.GithubObject.NotSet + self._supported_events = github.GithubObject.NotSet def _useAttributes(self, attributes): if "events" in attributes: # pragma no branch diff --git a/github/HookResponse.py b/github/HookResponse.py index a280c785..3554c481 100644 --- a/github/HookResponse.py +++ b/github/HookResponse.py @@ -13,10 +13,10 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class HookResponse(GithubObject.BasicGithubObject): +class HookResponse(github.GithubObject.BasicGithubObject): @property def code(self): return self._NoneIfNotSet(self._code) @@ -30,9 +30,9 @@ class HookResponse(GithubObject.BasicGithubObject): return self._NoneIfNotSet(self._status) def _initAttributes(self): - self._code = GithubObject.NotSet - self._message = GithubObject.NotSet - self._status = GithubObject.NotSet + self._code = github.GithubObject.NotSet + self._message = github.GithubObject.NotSet + self._status = github.GithubObject.NotSet def _useAttributes(self, attributes): if "code" in attributes: # pragma no branch diff --git a/github/InputGitTreeElement.py b/github/InputGitTreeElement.py index edf56150..5211fa99 100644 --- a/github/InputGitTreeElement.py +++ b/github/InputGitTreeElement.py @@ -13,11 +13,11 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject class InputGitTreeElement(object): - def __init__(self, path, mode, type, content=GithubObject.NotSet, sha=GithubObject.NotSet): + def __init__(self, path, mode, type, content=github.GithubObject.NotSet, sha=github.GithubObject.NotSet): self.__path = path self.__mode = mode self.__type = type @@ -31,8 +31,8 @@ class InputGitTreeElement(object): "mode": self.__mode, "type": self.__type, } - if self.__sha is not GithubObject.NotSet: + if self.__sha is not github.GithubObject.NotSet: identity["sha"] = self.__sha - if self.__content is not GithubObject.NotSet: + if self.__content is not github.GithubObject.NotSet: identity["content"] = self.__content return identity diff --git a/github/Issue.py b/github/Issue.py index fa50729b..c502f30e 100644 --- a/github/Issue.py +++ b/github/Issue.py @@ -13,19 +13,19 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject -import PaginatedList +import github.GithubObject +import github.PaginatedList -import Repository -import IssueEvent -import Label -import NamedUser -import Milestone -import IssueComment -import IssuePullRequest +import github.Repository +import github.IssueEvent +import github.Label +import github.NamedUser +import github.Milestone +import github.IssueComment +import github.IssuePullRequest -class Issue(GithubObject.GithubObject): +class Issue(github.GithubObject.GithubObject): @property def assignee(self): self._completeIfNotSet(self._assignee) @@ -117,7 +117,7 @@ class Issue(GithubObject.GithubObject): return self._NoneIfNotSet(self._user) def add_to_labels(self, *labels): - assert all(isinstance(element, Label.Label) for element in labels), labels + assert all(isinstance(element, github.Label.Label) for element in labels), labels post_parameters = [label.name for label in labels] headers, data = self._requester.requestAndCheck( "POST", @@ -137,7 +137,7 @@ class Issue(GithubObject.GithubObject): None, post_parameters ) - return IssueComment.IssueComment(self._requester, data, completed=True) + return github.IssueComment.IssueComment(self._requester, data, completed=True) def delete_labels(self): headers, data = self._requester.requestAndCheck( @@ -147,25 +147,25 @@ class Issue(GithubObject.GithubObject): None ) - def edit(self, title=GithubObject.NotSet, body=GithubObject.NotSet, assignee=GithubObject.NotSet, state=GithubObject.NotSet, milestone=GithubObject.NotSet, labels=GithubObject.NotSet): - assert title is GithubObject.NotSet or isinstance(title, (str, unicode)), title - assert body is GithubObject.NotSet or isinstance(body, (str, unicode)), body - assert assignee is GithubObject.NotSet or assignee is None or isinstance(assignee, NamedUser.NamedUser), assignee - assert state is GithubObject.NotSet or isinstance(state, (str, unicode)), state - assert milestone is GithubObject.NotSet or milestone is None or isinstance(milestone, Milestone.Milestone), milestone - assert labels is GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in labels), labels + def edit(self, title=github.GithubObject.NotSet, body=github.GithubObject.NotSet, assignee=github.GithubObject.NotSet, state=github.GithubObject.NotSet, milestone=github.GithubObject.NotSet, labels=github.GithubObject.NotSet): + assert title is github.GithubObject.NotSet or isinstance(title, (str, unicode)), title + assert body is github.GithubObject.NotSet or isinstance(body, (str, unicode)), body + assert assignee is github.GithubObject.NotSet or assignee is None or isinstance(assignee, github.NamedUser.NamedUser), assignee + assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state + assert milestone is github.GithubObject.NotSet or milestone is None or isinstance(milestone, github.Milestone.Milestone), milestone + assert labels is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in labels), labels post_parameters = dict() - if title is not GithubObject.NotSet: + if title is not github.GithubObject.NotSet: post_parameters["title"] = title - if body is not GithubObject.NotSet: + if body is not github.GithubObject.NotSet: post_parameters["body"] = body - if assignee is not GithubObject.NotSet: + if assignee is not github.GithubObject.NotSet: post_parameters["assignee"] = assignee._identity if assignee else '' - if state is not GithubObject.NotSet: + if state is not github.GithubObject.NotSet: post_parameters["state"] = state - if milestone is not GithubObject.NotSet: + if milestone is not github.GithubObject.NotSet: post_parameters["milestone"] = milestone._identity if milestone else '' - if labels is not GithubObject.NotSet: + if labels is not github.GithubObject.NotSet: post_parameters["labels"] = labels headers, data = self._requester.requestAndCheck( "PATCH", @@ -183,34 +183,34 @@ class Issue(GithubObject.GithubObject): None, None ) - return IssueComment.IssueComment(self._requester, data, completed=True) + return github.IssueComment.IssueComment(self._requester, data, completed=True) def get_comments(self): - return PaginatedList.PaginatedList( - IssueComment.IssueComment, + return github.PaginatedList.PaginatedList( + github.IssueComment.IssueComment, self._requester, self.url + "/comments", None ) def get_events(self): - return PaginatedList.PaginatedList( - IssueEvent.IssueEvent, + return github.PaginatedList.PaginatedList( + github.IssueEvent.IssueEvent, self._requester, self.url + "/events", None ) def get_labels(self): - return PaginatedList.PaginatedList( - Label.Label, + return github.PaginatedList.PaginatedList( + github.Label.Label, self._requester, self.url + "/labels", None ) def remove_from_labels(self, label): - assert isinstance(label, Label.Label), label + assert isinstance(label, github.Label.Label), label headers, data = self._requester.requestAndCheck( "DELETE", self.url + "/labels/" + label._identity, @@ -219,7 +219,7 @@ class Issue(GithubObject.GithubObject): ) def set_labels(self, *labels): - assert all(isinstance(element, Label.Label) for element in labels), labels + assert all(isinstance(element, github.Label.Label) for element in labels), labels post_parameters = [label.name for label in labels] headers, data = self._requester.requestAndCheck( "PUT", @@ -233,29 +233,29 @@ class Issue(GithubObject.GithubObject): return self.number def _initAttributes(self): - self._assignee = GithubObject.NotSet - self._body = GithubObject.NotSet - self._closed_at = GithubObject.NotSet - self._closed_by = GithubObject.NotSet - self._comments = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._html_url = GithubObject.NotSet - self._id = GithubObject.NotSet - self._labels = GithubObject.NotSet - self._milestone = GithubObject.NotSet - self._number = GithubObject.NotSet - self._pull_request = GithubObject.NotSet - self._repository = GithubObject.NotSet - self._state = GithubObject.NotSet - self._title = GithubObject.NotSet - self._updated_at = GithubObject.NotSet - self._url = GithubObject.NotSet - self._user = GithubObject.NotSet + self._assignee = github.GithubObject.NotSet + self._body = github.GithubObject.NotSet + self._closed_at = github.GithubObject.NotSet + self._closed_by = github.GithubObject.NotSet + self._comments = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._html_url = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._labels = github.GithubObject.NotSet + self._milestone = github.GithubObject.NotSet + self._number = github.GithubObject.NotSet + self._pull_request = github.GithubObject.NotSet + self._repository = github.GithubObject.NotSet + self._state = github.GithubObject.NotSet + self._title = github.GithubObject.NotSet + self._updated_at = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + self._user = github.GithubObject.NotSet def _useAttributes(self, attributes): if "assignee" in attributes: # pragma no branch assert attributes["assignee"] is None or isinstance(attributes["assignee"], dict), attributes["assignee"] - self._assignee = None if attributes["assignee"] is None else NamedUser.NamedUser(self._requester, attributes["assignee"], completed=False) + self._assignee = None if attributes["assignee"] is None else github.NamedUser.NamedUser(self._requester, attributes["assignee"], completed=False) if "body" in attributes: # pragma no branch assert attributes["body"] is None or isinstance(attributes["body"], (str, unicode)), attributes["body"] self._body = attributes["body"] @@ -264,7 +264,7 @@ class Issue(GithubObject.GithubObject): self._closed_at = self._parseDatetime(attributes["closed_at"]) if "closed_by" in attributes: # pragma no branch assert attributes["closed_by"] is None or isinstance(attributes["closed_by"], dict), attributes["closed_by"] - self._closed_by = None if attributes["closed_by"] is None else NamedUser.NamedUser(self._requester, attributes["closed_by"], completed=False) + self._closed_by = None if attributes["closed_by"] is None else github.NamedUser.NamedUser(self._requester, attributes["closed_by"], completed=False) if "comments" in attributes: # pragma no branch assert attributes["comments"] is None or isinstance(attributes["comments"], (int, long)), attributes["comments"] self._comments = attributes["comments"] @@ -280,21 +280,21 @@ class Issue(GithubObject.GithubObject): if "labels" in attributes: # pragma no branch assert attributes["labels"] is None or all(isinstance(element, dict) for element in attributes["labels"]), attributes["labels"] self._labels = None if attributes["labels"] is None else [ - Label.Label(self._requester, element, completed=False) + github.Label.Label(self._requester, element, completed=False) for element in attributes["labels"] ] if "milestone" in attributes: # pragma no branch assert attributes["milestone"] is None or isinstance(attributes["milestone"], dict), attributes["milestone"] - self._milestone = None if attributes["milestone"] is None else Milestone.Milestone(self._requester, attributes["milestone"], completed=False) + self._milestone = None if attributes["milestone"] is None else github.Milestone.Milestone(self._requester, attributes["milestone"], completed=False) if "number" in attributes: # pragma no branch assert attributes["number"] is None or isinstance(attributes["number"], (int, long)), attributes["number"] self._number = attributes["number"] if "pull_request" in attributes: # pragma no branch assert attributes["pull_request"] is None or isinstance(attributes["pull_request"], dict), attributes["pull_request"] - self._pull_request = None if attributes["pull_request"] is None else IssuePullRequest.IssuePullRequest(self._requester, attributes["pull_request"], completed=False) + self._pull_request = None if attributes["pull_request"] is None else github.IssuePullRequest.IssuePullRequest(self._requester, attributes["pull_request"], completed=False) if "repository" in attributes: # pragma no branch assert attributes["repository"] is None or isinstance(attributes["repository"], dict), attributes["repository"] - self._repository = None if attributes["repository"] is None else Repository.Repository(self._requester, attributes["repository"], completed=False) + self._repository = None if attributes["repository"] is None else github.Repository.Repository(self._requester, attributes["repository"], completed=False) if "state" in attributes: # pragma no branch assert attributes["state"] is None or isinstance(attributes["state"], (str, unicode)), attributes["state"] self._state = attributes["state"] @@ -309,4 +309,4 @@ class Issue(GithubObject.GithubObject): self._url = attributes["url"] if "user" in attributes: # pragma no branch assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"] - self._user = None if attributes["user"] is None else NamedUser.NamedUser(self._requester, attributes["user"], completed=False) + self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False) diff --git a/github/IssueComment.py b/github/IssueComment.py index e8f779c4..aab643a4 100644 --- a/github/IssueComment.py +++ b/github/IssueComment.py @@ -13,12 +13,12 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import NamedUser +import github.NamedUser -class IssueComment(GithubObject.GithubObject): +class IssueComment(github.GithubObject.GithubObject): @property def body(self): self._completeIfNotSet(self._body) @@ -71,12 +71,12 @@ class IssueComment(GithubObject.GithubObject): self._useAttributes(data) def _initAttributes(self): - self._body = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._id = GithubObject.NotSet - self._updated_at = GithubObject.NotSet - self._url = GithubObject.NotSet - self._user = GithubObject.NotSet + self._body = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._updated_at = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + self._user = github.GithubObject.NotSet def _useAttributes(self, attributes): if "body" in attributes: # pragma no branch @@ -96,4 +96,4 @@ class IssueComment(GithubObject.GithubObject): self._url = attributes["url"] if "user" in attributes: # pragma no branch assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"] - self._user = None if attributes["user"] is None else NamedUser.NamedUser(self._requester, attributes["user"], completed=False) + self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False) diff --git a/github/IssueEvent.py b/github/IssueEvent.py index 7dd49336..08992044 100644 --- a/github/IssueEvent.py +++ b/github/IssueEvent.py @@ -13,13 +13,13 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import Issue -import NamedUser +import github.Issue +import github.NamedUser -class IssueEvent(GithubObject.GithubObject): +class IssueEvent(github.GithubObject.GithubObject): @property def actor(self): self._completeIfNotSet(self._actor) @@ -56,18 +56,18 @@ class IssueEvent(GithubObject.GithubObject): return self._NoneIfNotSet(self._url) def _initAttributes(self): - self._actor = GithubObject.NotSet - self._commit_id = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._event = GithubObject.NotSet - self._id = GithubObject.NotSet - self._issue = GithubObject.NotSet - self._url = GithubObject.NotSet + self._actor = github.GithubObject.NotSet + self._commit_id = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._event = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._issue = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet def _useAttributes(self, attributes): if "actor" in attributes: # pragma no branch assert attributes["actor"] is None or isinstance(attributes["actor"], dict), attributes["actor"] - self._actor = None if attributes["actor"] is None else NamedUser.NamedUser(self._requester, attributes["actor"], completed=False) + self._actor = None if attributes["actor"] is None else github.NamedUser.NamedUser(self._requester, attributes["actor"], completed=False) if "commit_id" in attributes: # pragma no branch assert attributes["commit_id"] is None or isinstance(attributes["commit_id"], (str, unicode)), attributes["commit_id"] self._commit_id = attributes["commit_id"] @@ -82,7 +82,7 @@ class IssueEvent(GithubObject.GithubObject): self._id = attributes["id"] if "issue" in attributes: # pragma no branch assert attributes["issue"] is None or isinstance(attributes["issue"], dict), attributes["issue"] - self._issue = None if attributes["issue"] is None else Issue.Issue(self._requester, attributes["issue"], completed=False) + self._issue = None if attributes["issue"] is None else github.Issue.Issue(self._requester, attributes["issue"], completed=False) if "url" in attributes: # pragma no branch assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] self._url = attributes["url"] diff --git a/github/IssuePullRequest.py b/github/IssuePullRequest.py index e5b94375..3ca15e69 100644 --- a/github/IssuePullRequest.py +++ b/github/IssuePullRequest.py @@ -13,10 +13,10 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class IssuePullRequest(GithubObject.BasicGithubObject): +class IssuePullRequest(github.GithubObject.BasicGithubObject): @property def diff_url(self): return self._NoneIfNotSet(self._diff_url) @@ -30,9 +30,9 @@ class IssuePullRequest(GithubObject.BasicGithubObject): return self._NoneIfNotSet(self._patch_url) def _initAttributes(self): - self._diff_url = GithubObject.NotSet - self._html_url = GithubObject.NotSet - self._patch_url = GithubObject.NotSet + self._diff_url = github.GithubObject.NotSet + self._html_url = github.GithubObject.NotSet + self._patch_url = github.GithubObject.NotSet def _useAttributes(self, attributes): if "diff_url" in attributes: # pragma no branch diff --git a/github/Label.py b/github/Label.py index 1d8e7dd8..5e5410ee 100644 --- a/github/Label.py +++ b/github/Label.py @@ -15,10 +15,10 @@ import urllib -import GithubObject +import github.GithubObject -class Label(GithubObject.GithubObject): +class Label(github.GithubObject.GithubObject): @property def color(self): self._completeIfNotSet(self._color) @@ -62,9 +62,9 @@ class Label(GithubObject.GithubObject): return urllib.quote(self.name) def _initAttributes(self): - self._color = GithubObject.NotSet - self._name = GithubObject.NotSet - self._url = GithubObject.NotSet + self._color = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet def _useAttributes(self, attributes): if "color" in attributes: # pragma no branch diff --git a/github/Legacy.py b/github/Legacy.py index 264a0796..f9567610 100644 --- a/github/Legacy.py +++ b/github/Legacy.py @@ -15,12 +15,12 @@ import urlparse -from PaginatedList import PaginatedListBase +import github.PaginatedList -class PaginatedList(PaginatedListBase): +class PaginatedList(github.PaginatedList.PaginatedListBase): def __init__(self, url, args, requester, key, convert, contentClass): - PaginatedListBase.__init__(self) + github.PaginatedList.PaginatedListBase.__init__(self) self.__url = url self.__args = args self.__requester = requester diff --git a/github/Milestone.py b/github/Milestone.py index 18e01865..e646a225 100644 --- a/github/Milestone.py +++ b/github/Milestone.py @@ -15,14 +15,14 @@ import datetime -import GithubObject -import PaginatedList +import github.GithubObject +import github.PaginatedList -import NamedUser -import Label +import github.NamedUser +import github.Label -class Milestone(GithubObject.GithubObject): +class Milestone(github.GithubObject.GithubObject): @property def closed_issues(self): self._completeIfNotSet(self._closed_issues) @@ -86,19 +86,19 @@ class Milestone(GithubObject.GithubObject): None ) - def edit(self, title, state=GithubObject.NotSet, description=GithubObject.NotSet, due_on=GithubObject.NotSet): + def edit(self, title, state=github.GithubObject.NotSet, description=github.GithubObject.NotSet, due_on=github.GithubObject.NotSet): assert isinstance(title, (str, unicode)), title - assert state is GithubObject.NotSet or isinstance(state, (str, unicode)), state - assert description is GithubObject.NotSet or isinstance(description, (str, unicode)), description - assert due_on is GithubObject.NotSet or isinstance(due_on, datetime.date), due_on + assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state + assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description + assert due_on is github.GithubObject.NotSet or isinstance(due_on, datetime.date), due_on post_parameters = { "title": title, } - if state is not GithubObject.NotSet: + if state is not github.GithubObject.NotSet: post_parameters["state"] = state - if description is not GithubObject.NotSet: + if description is not github.GithubObject.NotSet: post_parameters["description"] = description - if due_on is not GithubObject.NotSet: + if due_on is not github.GithubObject.NotSet: post_parameters["due_on"] = due_on.strftime("%Y-%m-%d") headers, data = self._requester.requestAndCheck( "PATCH", @@ -109,8 +109,8 @@ class Milestone(GithubObject.GithubObject): self._useAttributes(data) def get_labels(self): - return PaginatedList.PaginatedList( - Label.Label, + return github.PaginatedList.PaginatedList( + github.Label.Label, self._requester, self.url + "/labels", None @@ -121,17 +121,17 @@ class Milestone(GithubObject.GithubObject): return self.number def _initAttributes(self): - self._closed_issues = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._creator = GithubObject.NotSet - self._description = GithubObject.NotSet - self._due_on = GithubObject.NotSet - self._id = GithubObject.NotSet - self._number = GithubObject.NotSet - self._open_issues = GithubObject.NotSet - self._state = GithubObject.NotSet - self._title = GithubObject.NotSet - self._url = GithubObject.NotSet + self._closed_issues = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._creator = github.GithubObject.NotSet + self._description = github.GithubObject.NotSet + self._due_on = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._number = github.GithubObject.NotSet + self._open_issues = github.GithubObject.NotSet + self._state = github.GithubObject.NotSet + self._title = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet def _useAttributes(self, attributes): if "closed_issues" in attributes: # pragma no branch @@ -142,7 +142,7 @@ class Milestone(GithubObject.GithubObject): self._created_at = self._parseDatetime(attributes["created_at"]) if "creator" in attributes: # pragma no branch assert attributes["creator"] is None or isinstance(attributes["creator"], dict), attributes["creator"] - self._creator = None if attributes["creator"] is None else NamedUser.NamedUser(self._requester, attributes["creator"], completed=False) + self._creator = None if attributes["creator"] is None else github.NamedUser.NamedUser(self._requester, attributes["creator"], completed=False) if "description" in attributes: # pragma no branch assert attributes["description"] is None or isinstance(attributes["description"], (str, unicode)), attributes["description"] self._description = attributes["description"] diff --git a/github/NamedUser.py b/github/NamedUser.py index 8269e2a5..15df5907 100644 --- a/github/NamedUser.py +++ b/github/NamedUser.py @@ -13,19 +13,18 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject -import PaginatedList +import github.GithubObject +import github.PaginatedList -import Gist -import Repository -import NamedUser -import Plan -import Organization -import InputFileContent -import Event +import github.Gist +import github.Repository +import github.NamedUser +import github.Plan +import github.Organization +import github.Event -class NamedUser(GithubObject.GithubObject): +class NamedUser(github.GithubObject.GithubObject): @property def avatar_url(self): self._completeIfNotSet(self._avatar_url) @@ -156,15 +155,15 @@ class NamedUser(GithubObject.GithubObject): self._completeIfNotSet(self._url) return self._NoneIfNotSet(self._url) - def create_gist(self, public, files, description=GithubObject.NotSet): + def create_gist(self, public, files, description=github.GithubObject.NotSet): assert isinstance(public, bool), public - assert all(isinstance(element, InputFileContent.InputFileContent) for element in files.itervalues()), files - assert description is GithubObject.NotSet or isinstance(description, (str, unicode)), description + assert all(isinstance(element, github.InputFileContent) for element in files.itervalues()), files + assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description post_parameters = { "public": public, "files": dict((key, value._identity) for key, value in files.iteritems()), } - if description is not GithubObject.NotSet: + if description is not github.GithubObject.NotSet: post_parameters["description"] = description headers, data = self._requester.requestAndCheck( "POST", @@ -172,18 +171,18 @@ class NamedUser(GithubObject.GithubObject): None, post_parameters ) - return Gist.Gist(self._requester, data, completed=True) + return github.Gist.Gist(self._requester, data, completed=True) def get_events(self): - return PaginatedList.PaginatedList( - Event.Event, + return github.PaginatedList.PaginatedList( + github.Event.Event, self._requester, self.url + "/events", None ) def get_followers(self): - return PaginatedList.PaginatedList( + return github.PaginatedList.PaginatedList( NamedUser, self._requester, self.url + "/followers", @@ -191,7 +190,7 @@ class NamedUser(GithubObject.GithubObject): ) def get_following(self): - return PaginatedList.PaginatedList( + return github.PaginatedList.PaginatedList( NamedUser, self._requester, self.url + "/following", @@ -199,40 +198,40 @@ class NamedUser(GithubObject.GithubObject): ) def get_gists(self): - return PaginatedList.PaginatedList( - Gist.Gist, + return github.PaginatedList.PaginatedList( + github.Gist.Gist, self._requester, self.url + "/gists", None ) def get_orgs(self): - return PaginatedList.PaginatedList( - Organization.Organization, + return github.PaginatedList.PaginatedList( + github.Organization.Organization, self._requester, self.url + "/orgs", None ) def get_public_events(self): - return PaginatedList.PaginatedList( - Event.Event, + return github.PaginatedList.PaginatedList( + github.Event.Event, self._requester, self.url + "/events/public", None ) def get_public_received_events(self): - return PaginatedList.PaginatedList( - Event.Event, + return github.PaginatedList.PaginatedList( + github.Event.Event, self._requester, self.url + "/received_events/public", None ) def get_received_events(self): - return PaginatedList.PaginatedList( - Event.Event, + return github.PaginatedList.PaginatedList( + github.Event.Event, self._requester, self.url + "/received_events", None @@ -246,39 +245,39 @@ class NamedUser(GithubObject.GithubObject): None, None ) - return Repository.Repository(self._requester, data, completed=True) + return github.Repository.Repository(self._requester, data, completed=True) - def get_repos(self, type=GithubObject.NotSet): - assert type is GithubObject.NotSet or isinstance(type, (str, unicode)), type + def get_repos(self, type=github.GithubObject.NotSet): + assert type is github.GithubObject.NotSet or isinstance(type, (str, unicode)), type url_parameters = dict() - if type is not GithubObject.NotSet: + if type is not github.GithubObject.NotSet: url_parameters["type"] = type - return PaginatedList.PaginatedList( - Repository.Repository, + return github.PaginatedList.PaginatedList( + github.Repository.Repository, self._requester, self.url + "/repos", url_parameters ) def get_starred(self): - return PaginatedList.PaginatedList( - Repository.Repository, + return github.PaginatedList.PaginatedList( + github.Repository.Repository, self._requester, self.url + "/starred", None ) def get_subscriptions(self): - return PaginatedList.PaginatedList( - Repository.Repository, + return github.PaginatedList.PaginatedList( + github.Repository.Repository, self._requester, self.url + "/subscriptions", None ) def get_watched(self): - return PaginatedList.PaginatedList( - Repository.Repository, + return github.PaginatedList.PaginatedList( + github.Repository.Repository, self._requester, self.url + "/watched", None @@ -289,32 +288,32 @@ class NamedUser(GithubObject.GithubObject): return self.login def _initAttributes(self): - self._avatar_url = GithubObject.NotSet - self._bio = GithubObject.NotSet - self._blog = GithubObject.NotSet - self._collaborators = GithubObject.NotSet - self._company = GithubObject.NotSet - self._contributions = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._disk_usage = GithubObject.NotSet - self._email = GithubObject.NotSet - self._followers = GithubObject.NotSet - self._following = GithubObject.NotSet - self._gravatar_id = GithubObject.NotSet - self._hireable = GithubObject.NotSet - self._html_url = GithubObject.NotSet - self._id = GithubObject.NotSet - self._location = GithubObject.NotSet - self._login = GithubObject.NotSet - self._name = GithubObject.NotSet - self._owned_private_repos = GithubObject.NotSet - self._plan = GithubObject.NotSet - self._private_gists = GithubObject.NotSet - self._public_gists = GithubObject.NotSet - self._public_repos = GithubObject.NotSet - self._total_private_repos = GithubObject.NotSet - self._type = GithubObject.NotSet - self._url = GithubObject.NotSet + self._avatar_url = github.GithubObject.NotSet + self._bio = github.GithubObject.NotSet + self._blog = github.GithubObject.NotSet + self._collaborators = github.GithubObject.NotSet + self._company = github.GithubObject.NotSet + self._contributions = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._disk_usage = github.GithubObject.NotSet + self._email = github.GithubObject.NotSet + self._followers = github.GithubObject.NotSet + self._following = github.GithubObject.NotSet + self._gravatar_id = github.GithubObject.NotSet + self._hireable = github.GithubObject.NotSet + self._html_url = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._location = github.GithubObject.NotSet + self._login = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._owned_private_repos = github.GithubObject.NotSet + self._plan = github.GithubObject.NotSet + self._private_gists = github.GithubObject.NotSet + self._public_gists = github.GithubObject.NotSet + self._public_repos = github.GithubObject.NotSet + self._total_private_repos = github.GithubObject.NotSet + self._type = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet def _useAttributes(self, attributes): if "avatar_url" in attributes: # pragma no branch @@ -376,7 +375,7 @@ class NamedUser(GithubObject.GithubObject): self._owned_private_repos = attributes["owned_private_repos"] if "plan" in attributes: # pragma no branch assert attributes["plan"] is None or isinstance(attributes["plan"], dict), attributes["plan"] - self._plan = None if attributes["plan"] is None else Plan.Plan(self._requester, attributes["plan"], completed=False) + self._plan = None if attributes["plan"] is None else github.Plan.Plan(self._requester, attributes["plan"], completed=False) if "private_gists" in attributes: # pragma no branch assert attributes["private_gists"] is None or isinstance(attributes["private_gists"], (int, long)), attributes["private_gists"] self._private_gists = attributes["private_gists"] diff --git a/github/Organization.py b/github/Organization.py index af39d730..c6aadb54 100644 --- a/github/Organization.py +++ b/github/Organization.py @@ -13,17 +13,17 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject -import PaginatedList +import github.GithubObject +import github.PaginatedList -import Plan -import Team -import Event -import Repository -import NamedUser +import github.Plan +import github.Team +import github.Event +import github.Repository +import github.NamedUser -class Organization(GithubObject.GithubObject): +class Organization(github.GithubObject.GithubObject): @property def avatar_url(self): self._completeIfNotSet(self._avatar_url) @@ -145,7 +145,7 @@ class Organization(GithubObject.GithubObject): return self._NoneIfNotSet(self._url) def add_to_public_members(self, public_member): - assert isinstance(public_member, NamedUser.NamedUser), public_member + assert isinstance(public_member, github.NamedUser.NamedUser), public_member headers, data = self._requester.requestAndCheck( "PUT", self.url + "/public_members/" + public_member._identity, @@ -154,7 +154,7 @@ class Organization(GithubObject.GithubObject): ) def create_fork(self, repo): - assert isinstance(repo, Repository.Repository), repo + assert isinstance(repo, github.Repository.Repository), repo url_parameters = { "org": self.login, } @@ -164,39 +164,39 @@ class Organization(GithubObject.GithubObject): url_parameters, None ) - return Repository.Repository(self._requester, data, completed=True) + return github.Repository.Repository(self._requester, data, completed=True) - def create_repo(self, name, description=GithubObject.NotSet, homepage=GithubObject.NotSet, private=GithubObject.NotSet, has_issues=GithubObject.NotSet, has_wiki=GithubObject.NotSet, has_downloads=GithubObject.NotSet, team_id=GithubObject.NotSet, auto_init=GithubObject.NotSet, gitignore_template=GithubObject.NotSet): + def create_repo(self, name, description=github.GithubObject.NotSet, homepage=github.GithubObject.NotSet, private=github.GithubObject.NotSet, has_issues=github.GithubObject.NotSet, has_wiki=github.GithubObject.NotSet, has_downloads=github.GithubObject.NotSet, team_id=github.GithubObject.NotSet, auto_init=github.GithubObject.NotSet, gitignore_template=github.GithubObject.NotSet): assert isinstance(name, (str, unicode)), name - assert description is GithubObject.NotSet or isinstance(description, (str, unicode)), description - assert homepage is GithubObject.NotSet or isinstance(homepage, (str, unicode)), homepage - assert private is GithubObject.NotSet or isinstance(private, bool), private - assert has_issues is GithubObject.NotSet or isinstance(has_issues, bool), has_issues - assert has_wiki is GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki - assert has_downloads is GithubObject.NotSet or isinstance(has_downloads, bool), has_downloads - assert team_id is GithubObject.NotSet or isinstance(team_id, Team.Team), team_id - assert auto_init is GithubObject.NotSet or isinstance(auto_init, bool), auto_init - assert gitignore_template is GithubObject.NotSet or isinstance(gitignore_template, (str, unicode)), gitignore_template + assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description + assert homepage is github.GithubObject.NotSet or isinstance(homepage, (str, unicode)), homepage + assert private is github.GithubObject.NotSet or isinstance(private, bool), private + assert has_issues is github.GithubObject.NotSet or isinstance(has_issues, bool), has_issues + assert has_wiki is github.GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki + assert has_downloads is github.GithubObject.NotSet or isinstance(has_downloads, bool), has_downloads + assert team_id is github.GithubObject.NotSet or isinstance(team_id, github.Team.Team), team_id + assert auto_init is github.GithubObject.NotSet or isinstance(auto_init, bool), auto_init + assert gitignore_template is github.GithubObject.NotSet or isinstance(gitignore_template, (str, unicode)), gitignore_template post_parameters = { "name": name, } - if description is not GithubObject.NotSet: + if description is not github.GithubObject.NotSet: post_parameters["description"] = description - if homepage is not GithubObject.NotSet: + if homepage is not github.GithubObject.NotSet: post_parameters["homepage"] = homepage - if private is not GithubObject.NotSet: + if private is not github.GithubObject.NotSet: post_parameters["private"] = private - if has_issues is not GithubObject.NotSet: + if has_issues is not github.GithubObject.NotSet: post_parameters["has_issues"] = has_issues - if has_wiki is not GithubObject.NotSet: + if has_wiki is not github.GithubObject.NotSet: post_parameters["has_wiki"] = has_wiki - if has_downloads is not GithubObject.NotSet: + if has_downloads is not github.GithubObject.NotSet: post_parameters["has_downloads"] = has_downloads - if team_id is not GithubObject.NotSet: + if team_id is not github.GithubObject.NotSet: post_parameters["team_id"] = team_id._identity - if auto_init is not GithubObject.NotSet: + if auto_init is not github.GithubObject.NotSet: post_parameters["auto_init"] = auto_init - if gitignore_template is not GithubObject.NotSet: + if gitignore_template is not github.GithubObject.NotSet: post_parameters["gitignore_template"] = gitignore_template headers, data = self._requester.requestAndCheck( "POST", @@ -204,18 +204,18 @@ class Organization(GithubObject.GithubObject): None, post_parameters ) - return Repository.Repository(self._requester, data, completed=True) + return github.Repository.Repository(self._requester, data, completed=True) - def create_team(self, name, repo_names=GithubObject.NotSet, permission=GithubObject.NotSet): + def create_team(self, name, repo_names=github.GithubObject.NotSet, permission=github.GithubObject.NotSet): assert isinstance(name, (str, unicode)), name - assert repo_names is GithubObject.NotSet or all(isinstance(element, Repository.Repository) for element in repo_names), repo_names - assert permission is GithubObject.NotSet or isinstance(permission, (str, unicode)), permission + assert repo_names is github.GithubObject.NotSet or all(isinstance(element, github.Repository.Repository) for element in repo_names), repo_names + assert permission is github.GithubObject.NotSet or isinstance(permission, (str, unicode)), permission post_parameters = { "name": name, } - if repo_names is not GithubObject.NotSet: + if repo_names is not github.GithubObject.NotSet: post_parameters["repo_names"] = [element._identity for element in repo_names] - if permission is not GithubObject.NotSet: + if permission is not github.GithubObject.NotSet: post_parameters["permission"] = permission headers, data = self._requester.requestAndCheck( "POST", @@ -223,27 +223,27 @@ class Organization(GithubObject.GithubObject): None, post_parameters ) - return Team.Team(self._requester, data, completed=True) + return github.Team.Team(self._requester, data, completed=True) - def edit(self, billing_email=GithubObject.NotSet, blog=GithubObject.NotSet, company=GithubObject.NotSet, email=GithubObject.NotSet, location=GithubObject.NotSet, name=GithubObject.NotSet): - assert billing_email is GithubObject.NotSet or isinstance(billing_email, (str, unicode)), billing_email - assert blog is GithubObject.NotSet or isinstance(blog, (str, unicode)), blog - assert company is GithubObject.NotSet or isinstance(company, (str, unicode)), company - assert email is GithubObject.NotSet or isinstance(email, (str, unicode)), email - assert location is GithubObject.NotSet or isinstance(location, (str, unicode)), location - assert name is GithubObject.NotSet or isinstance(name, (str, unicode)), name + def edit(self, billing_email=github.GithubObject.NotSet, blog=github.GithubObject.NotSet, company=github.GithubObject.NotSet, email=github.GithubObject.NotSet, location=github.GithubObject.NotSet, name=github.GithubObject.NotSet): + assert billing_email is github.GithubObject.NotSet or isinstance(billing_email, (str, unicode)), billing_email + assert blog is github.GithubObject.NotSet or isinstance(blog, (str, unicode)), blog + assert company is github.GithubObject.NotSet or isinstance(company, (str, unicode)), company + assert email is github.GithubObject.NotSet or isinstance(email, (str, unicode)), email + assert location is github.GithubObject.NotSet or isinstance(location, (str, unicode)), location + assert name is github.GithubObject.NotSet or isinstance(name, (str, unicode)), name post_parameters = dict() - if billing_email is not GithubObject.NotSet: + if billing_email is not github.GithubObject.NotSet: post_parameters["billing_email"] = billing_email - if blog is not GithubObject.NotSet: + if blog is not github.GithubObject.NotSet: post_parameters["blog"] = blog - if company is not GithubObject.NotSet: + if company is not github.GithubObject.NotSet: post_parameters["company"] = company - if email is not GithubObject.NotSet: + if email is not github.GithubObject.NotSet: post_parameters["email"] = email - if location is not GithubObject.NotSet: + if location is not github.GithubObject.NotSet: post_parameters["location"] = location - if name is not GithubObject.NotSet: + if name is not github.GithubObject.NotSet: post_parameters["name"] = name headers, data = self._requester.requestAndCheck( "PATCH", @@ -254,24 +254,24 @@ class Organization(GithubObject.GithubObject): self._useAttributes(data) def get_events(self): - return PaginatedList.PaginatedList( - Event.Event, + return github.PaginatedList.PaginatedList( + github.Event.Event, self._requester, self.url + "/events", None ) def get_members(self): - return PaginatedList.PaginatedList( - NamedUser.NamedUser, + return github.PaginatedList.PaginatedList( + github.NamedUser.NamedUser, self._requester, self.url + "/members", None ) def get_public_members(self): - return PaginatedList.PaginatedList( - NamedUser.NamedUser, + return github.PaginatedList.PaginatedList( + github.NamedUser.NamedUser, self._requester, self.url + "/public_members", None @@ -285,15 +285,15 @@ class Organization(GithubObject.GithubObject): None, None ) - return Repository.Repository(self._requester, data, completed=True) + return github.Repository.Repository(self._requester, data, completed=True) - def get_repos(self, type=GithubObject.NotSet): - assert type is GithubObject.NotSet or isinstance(type, (str, unicode)), type + def get_repos(self, type=github.GithubObject.NotSet): + assert type is github.GithubObject.NotSet or isinstance(type, (str, unicode)), type url_parameters = dict() - if type is not GithubObject.NotSet: + if type is not github.GithubObject.NotSet: url_parameters["type"] = type - return PaginatedList.PaginatedList( - Repository.Repository, + return github.PaginatedList.PaginatedList( + github.Repository.Repository, self._requester, self.url + "/repos", url_parameters @@ -307,18 +307,18 @@ class Organization(GithubObject.GithubObject): None, None ) - return Team.Team(self._requester, data, completed=True) + return github.Team.Team(self._requester, data, completed=True) def get_teams(self): - return PaginatedList.PaginatedList( - Team.Team, + return github.PaginatedList.PaginatedList( + github.Team.Team, self._requester, self.url + "/teams", None ) def has_in_members(self, member): - assert isinstance(member, NamedUser.NamedUser), member + assert isinstance(member, github.NamedUser.NamedUser), member status, headers, data = self._requester.requestRaw( "GET", self.url + "/members/" + member._identity, @@ -328,7 +328,7 @@ class Organization(GithubObject.GithubObject): return status == 204 def has_in_public_members(self, public_member): - assert isinstance(public_member, NamedUser.NamedUser), public_member + assert isinstance(public_member, github.NamedUser.NamedUser), public_member status, headers, data = self._requester.requestRaw( "GET", self.url + "/public_members/" + public_member._identity, @@ -338,7 +338,7 @@ class Organization(GithubObject.GithubObject): return status == 204 def remove_from_members(self, member): - assert isinstance(member, NamedUser.NamedUser), member + assert isinstance(member, github.NamedUser.NamedUser), member headers, data = self._requester.requestAndCheck( "DELETE", self.url + "/members/" + member._identity, @@ -347,7 +347,7 @@ class Organization(GithubObject.GithubObject): ) def remove_from_public_members(self, public_member): - assert isinstance(public_member, NamedUser.NamedUser), public_member + assert isinstance(public_member, github.NamedUser.NamedUser), public_member headers, data = self._requester.requestAndCheck( "DELETE", self.url + "/public_members/" + public_member._identity, @@ -356,30 +356,30 @@ class Organization(GithubObject.GithubObject): ) def _initAttributes(self): - self._avatar_url = GithubObject.NotSet - self._billing_email = GithubObject.NotSet - self._blog = GithubObject.NotSet - self._collaborators = GithubObject.NotSet - self._company = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._disk_usage = GithubObject.NotSet - self._email = GithubObject.NotSet - self._followers = GithubObject.NotSet - self._following = GithubObject.NotSet - self._gravatar_id = GithubObject.NotSet - self._html_url = GithubObject.NotSet - self._id = GithubObject.NotSet - self._location = GithubObject.NotSet - self._login = GithubObject.NotSet - self._name = GithubObject.NotSet - self._owned_private_repos = GithubObject.NotSet - self._plan = GithubObject.NotSet - self._private_gists = GithubObject.NotSet - self._public_gists = GithubObject.NotSet - self._public_repos = GithubObject.NotSet - self._total_private_repos = GithubObject.NotSet - self._type = GithubObject.NotSet - self._url = GithubObject.NotSet + self._avatar_url = github.GithubObject.NotSet + self._billing_email = github.GithubObject.NotSet + self._blog = github.GithubObject.NotSet + self._collaborators = github.GithubObject.NotSet + self._company = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._disk_usage = github.GithubObject.NotSet + self._email = github.GithubObject.NotSet + self._followers = github.GithubObject.NotSet + self._following = github.GithubObject.NotSet + self._gravatar_id = github.GithubObject.NotSet + self._html_url = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._location = github.GithubObject.NotSet + self._login = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._owned_private_repos = github.GithubObject.NotSet + self._plan = github.GithubObject.NotSet + self._private_gists = github.GithubObject.NotSet + self._public_gists = github.GithubObject.NotSet + self._public_repos = github.GithubObject.NotSet + self._total_private_repos = github.GithubObject.NotSet + self._type = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet def _useAttributes(self, attributes): if "avatar_url" in attributes: # pragma no branch @@ -435,7 +435,7 @@ class Organization(GithubObject.GithubObject): self._owned_private_repos = attributes["owned_private_repos"] if "plan" in attributes: # pragma no branch assert attributes["plan"] is None or isinstance(attributes["plan"], dict), attributes["plan"] - self._plan = None if attributes["plan"] is None else Plan.Plan(self._requester, attributes["plan"], completed=False) + self._plan = None if attributes["plan"] is None else github.Plan.Plan(self._requester, attributes["plan"], completed=False) if "private_gists" in attributes: # pragma no branch assert attributes["private_gists"] is None or isinstance(attributes["private_gists"], (int, long)), attributes["private_gists"] self._private_gists = attributes["private_gists"] diff --git a/github/PaginatedList.py b/github/PaginatedList.py index dc876ff2..8f7addd1 100644 --- a/github/PaginatedList.py +++ b/github/PaginatedList.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject class PaginatedListBase: diff --git a/github/Permissions.py b/github/Permissions.py index 91d65ecf..32df3015 100644 --- a/github/Permissions.py +++ b/github/Permissions.py @@ -13,10 +13,10 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class Permissions(GithubObject.BasicGithubObject): +class Permissions(github.GithubObject.BasicGithubObject): @property def admin(self): return self._NoneIfNotSet(self._admin) @@ -30,9 +30,9 @@ class Permissions(GithubObject.BasicGithubObject): return self._NoneIfNotSet(self._push) def _initAttributes(self): - self._admin = GithubObject.NotSet - self._pull = GithubObject.NotSet - self._push = GithubObject.NotSet + self._admin = github.GithubObject.NotSet + self._pull = github.GithubObject.NotSet + self._push = github.GithubObject.NotSet def _useAttributes(self, attributes): if "admin" in attributes: # pragma no branch diff --git a/github/Plan.py b/github/Plan.py index a7b23ffe..4d4764a2 100644 --- a/github/Plan.py +++ b/github/Plan.py @@ -13,10 +13,10 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class Plan(GithubObject.BasicGithubObject): +class Plan(github.GithubObject.BasicGithubObject): @property def collaborators(self): return self._NoneIfNotSet(self._collaborators) @@ -34,10 +34,10 @@ class Plan(GithubObject.BasicGithubObject): return self._NoneIfNotSet(self._space) def _initAttributes(self): - self._collaborators = GithubObject.NotSet - self._name = GithubObject.NotSet - self._private_repos = GithubObject.NotSet - self._space = GithubObject.NotSet + self._collaborators = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._private_repos = github.GithubObject.NotSet + self._space = github.GithubObject.NotSet def _useAttributes(self, attributes): if "collaborators" in attributes: # pragma no branch diff --git a/github/PullRequest.py b/github/PullRequest.py index 0304fcfc..0799aa64 100644 --- a/github/PullRequest.py +++ b/github/PullRequest.py @@ -13,19 +13,19 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject -import PaginatedList +import github.GithubObject +import github.PaginatedList -import PullRequestMergeStatus -import NamedUser -import PullRequestPart -import PullRequestComment -import File -import IssueComment -import Commit +import github.PullRequestMergeStatus +import github.NamedUser +import github.PullRequestPart +import github.PullRequestComment +import github.File +import github.IssueComment +import github.Commit -class PullRequest(GithubObject.GithubObject): +class PullRequest(github.GithubObject.GithubObject): @property def additions(self): self._completeIfNotSet(self._additions) @@ -166,7 +166,7 @@ class PullRequest(GithubObject.GithubObject): def create_review_comment(self, body, commit_id, path, position): assert isinstance(body, (str, unicode)), body - assert isinstance(commit_id, Commit.Commit), commit_id + assert isinstance(commit_id, github.Commit.Commit), commit_id assert isinstance(path, (str, unicode)), path assert isinstance(position, (int, long)), position post_parameters = { @@ -181,7 +181,7 @@ class PullRequest(GithubObject.GithubObject): None, post_parameters ) - return PullRequestComment.PullRequestComment(self._requester, data, completed=True) + return github.PullRequestComment.PullRequestComment(self._requester, data, completed=True) def create_issue_comment(self, body): assert isinstance(body, (str, unicode)), body @@ -194,18 +194,18 @@ class PullRequest(GithubObject.GithubObject): None, post_parameters ) - return IssueComment.IssueComment(self._requester, data, completed=True) + return github.IssueComment.IssueComment(self._requester, data, completed=True) - def edit(self, title=GithubObject.NotSet, body=GithubObject.NotSet, state=GithubObject.NotSet): - assert title is GithubObject.NotSet or isinstance(title, (str, unicode)), title - assert body is GithubObject.NotSet or isinstance(body, (str, unicode)), body - assert state is GithubObject.NotSet or isinstance(state, (str, unicode)), state + def edit(self, title=github.GithubObject.NotSet, body=github.GithubObject.NotSet, state=github.GithubObject.NotSet): + assert title is github.GithubObject.NotSet or isinstance(title, (str, unicode)), title + assert body is github.GithubObject.NotSet or isinstance(body, (str, unicode)), body + assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state post_parameters = dict() - if title is not GithubObject.NotSet: + if title is not github.GithubObject.NotSet: post_parameters["title"] = title - if body is not GithubObject.NotSet: + if body is not github.GithubObject.NotSet: post_parameters["body"] = body - if state is not GithubObject.NotSet: + if state is not github.GithubObject.NotSet: post_parameters["state"] = state headers, data = self._requester.requestAndCheck( "PATCH", @@ -226,30 +226,30 @@ class PullRequest(GithubObject.GithubObject): None, None ) - return PullRequestComment.PullRequestComment(self._requester, data, completed=True) + return github.PullRequestComment.PullRequestComment(self._requester, data, completed=True) def get_comments(self): return self.get_review_comments() def get_review_comments(self): - return PaginatedList.PaginatedList( - PullRequestComment.PullRequestComment, + return github.PaginatedList.PaginatedList( + github.PullRequestComment.PullRequestComment, self._requester, self.url + "/comments", None ) def get_commits(self): - return PaginatedList.PaginatedList( - Commit.Commit, + return github.PaginatedList.PaginatedList( + github.Commit.Commit, self._requester, self.url + "/commits", None ) def get_files(self): - return PaginatedList.PaginatedList( - File.File, + return github.PaginatedList.PaginatedList( + github.File.File, self._requester, self.url + "/files", None @@ -263,11 +263,11 @@ class PullRequest(GithubObject.GithubObject): None, None ) - return IssueComment.IssueComment(self._requester, data, completed=True) + return github.IssueComment.IssueComment(self._requester, data, completed=True) def get_issue_comments(self): - return PaginatedList.PaginatedList( - IssueComment.IssueComment, + return github.PaginatedList.PaginatedList( + github.IssueComment.IssueComment, self._requester, self._parentUrl(self._parentUrl(self.url)) + "/issues/" + str(self.number) + "/comments", None @@ -282,10 +282,10 @@ class PullRequest(GithubObject.GithubObject): ) return status == 204 - def merge(self, commit_message=GithubObject.NotSet): - assert commit_message is GithubObject.NotSet or isinstance(commit_message, (str, unicode)), commit_message + def merge(self, commit_message=github.GithubObject.NotSet): + assert commit_message is github.GithubObject.NotSet or isinstance(commit_message, (str, unicode)), commit_message post_parameters = dict() - if commit_message is not GithubObject.NotSet: + if commit_message is not github.GithubObject.NotSet: post_parameters["commit_message"] = commit_message headers, data = self._requester.requestAndCheck( "PUT", @@ -293,36 +293,36 @@ class PullRequest(GithubObject.GithubObject): None, post_parameters ) - return PullRequestMergeStatus.PullRequestMergeStatus(self._requester, data, completed=True) + return github.PullRequestMergeStatus.PullRequestMergeStatus(self._requester, data, completed=True) def _initAttributes(self): - self._additions = GithubObject.NotSet - self._assignee = GithubObject.NotSet - self._base = GithubObject.NotSet - self._body = GithubObject.NotSet - self._changed_files = GithubObject.NotSet - self._closed_at = GithubObject.NotSet - self._comments = GithubObject.NotSet - self._commits = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._deletions = GithubObject.NotSet - self._diff_url = GithubObject.NotSet - self._head = GithubObject.NotSet - self._html_url = GithubObject.NotSet - self._id = GithubObject.NotSet - self._issue_url = GithubObject.NotSet - self._mergeable = GithubObject.NotSet - self._merged = GithubObject.NotSet - self._merged_at = GithubObject.NotSet - self._merged_by = GithubObject.NotSet - self._number = GithubObject.NotSet - self._patch_url = GithubObject.NotSet - self._review_comments = GithubObject.NotSet - self._state = GithubObject.NotSet - self._title = GithubObject.NotSet - self._updated_at = GithubObject.NotSet - self._url = GithubObject.NotSet - self._user = GithubObject.NotSet + self._additions = github.GithubObject.NotSet + self._assignee = github.GithubObject.NotSet + self._base = github.GithubObject.NotSet + self._body = github.GithubObject.NotSet + self._changed_files = github.GithubObject.NotSet + self._closed_at = github.GithubObject.NotSet + self._comments = github.GithubObject.NotSet + self._commits = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._deletions = github.GithubObject.NotSet + self._diff_url = github.GithubObject.NotSet + self._head = github.GithubObject.NotSet + self._html_url = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._issue_url = github.GithubObject.NotSet + self._mergeable = github.GithubObject.NotSet + self._merged = github.GithubObject.NotSet + self._merged_at = github.GithubObject.NotSet + self._merged_by = github.GithubObject.NotSet + self._number = github.GithubObject.NotSet + self._patch_url = github.GithubObject.NotSet + self._review_comments = github.GithubObject.NotSet + self._state = github.GithubObject.NotSet + self._title = github.GithubObject.NotSet + self._updated_at = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + self._user = github.GithubObject.NotSet def _useAttributes(self, attributes): if "additions" in attributes: # pragma no branch @@ -330,10 +330,10 @@ class PullRequest(GithubObject.GithubObject): self._additions = attributes["additions"] if "assignee" in attributes: # pragma no branch assert attributes["assignee"] is None or isinstance(attributes["assignee"], dict), attributes["assignee"] - self._assignee = None if attributes["assignee"] is None else NamedUser.NamedUser(self._requester, attributes["assignee"], completed=False) + self._assignee = None if attributes["assignee"] is None else github.NamedUser.NamedUser(self._requester, attributes["assignee"], completed=False) if "base" in attributes: # pragma no branch assert attributes["base"] is None or isinstance(attributes["base"], dict), attributes["base"] - self._base = None if attributes["base"] is None else PullRequestPart.PullRequestPart(self._requester, attributes["base"], completed=False) + self._base = None if attributes["base"] is None else github.PullRequestPart.PullRequestPart(self._requester, attributes["base"], completed=False) if "body" in attributes: # pragma no branch assert attributes["body"] is None or isinstance(attributes["body"], (str, unicode)), attributes["body"] self._body = attributes["body"] @@ -360,7 +360,7 @@ class PullRequest(GithubObject.GithubObject): self._diff_url = attributes["diff_url"] if "head" in attributes: # pragma no branch assert attributes["head"] is None or isinstance(attributes["head"], dict), attributes["head"] - self._head = None if attributes["head"] is None else PullRequestPart.PullRequestPart(self._requester, attributes["head"], completed=False) + self._head = None if attributes["head"] is None else github.PullRequestPart.PullRequestPart(self._requester, attributes["head"], completed=False) if "html_url" in attributes: # pragma no branch assert attributes["html_url"] is None or isinstance(attributes["html_url"], (str, unicode)), attributes["html_url"] self._html_url = attributes["html_url"] @@ -381,7 +381,7 @@ class PullRequest(GithubObject.GithubObject): self._merged_at = self._parseDatetime(attributes["merged_at"]) if "merged_by" in attributes: # pragma no branch assert attributes["merged_by"] is None or isinstance(attributes["merged_by"], dict), attributes["merged_by"] - self._merged_by = None if attributes["merged_by"] is None else NamedUser.NamedUser(self._requester, attributes["merged_by"], completed=False) + self._merged_by = None if attributes["merged_by"] is None else github.NamedUser.NamedUser(self._requester, attributes["merged_by"], completed=False) if "number" in attributes: # pragma no branch assert attributes["number"] is None or isinstance(attributes["number"], (int, long)), attributes["number"] self._number = attributes["number"] @@ -405,4 +405,4 @@ class PullRequest(GithubObject.GithubObject): self._url = attributes["url"] if "user" in attributes: # pragma no branch assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"] - self._user = None if attributes["user"] is None else NamedUser.NamedUser(self._requester, attributes["user"], completed=False) + self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False) diff --git a/github/PullRequestComment.py b/github/PullRequestComment.py index d9768a0d..dbbb95b7 100644 --- a/github/PullRequestComment.py +++ b/github/PullRequestComment.py @@ -13,12 +13,12 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import NamedUser +import github.NamedUser -class PullRequestComment(GithubObject.GithubObject): +class PullRequestComment(github.GithubObject.GithubObject): @property def body(self): self._completeIfNotSet(self._body) @@ -96,17 +96,17 @@ class PullRequestComment(GithubObject.GithubObject): self._useAttributes(data) def _initAttributes(self): - self._body = GithubObject.NotSet - self._commit_id = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._id = GithubObject.NotSet - self._original_commit_id = GithubObject.NotSet - self._original_position = GithubObject.NotSet - self._path = GithubObject.NotSet - self._position = GithubObject.NotSet - self._updated_at = GithubObject.NotSet - self._url = GithubObject.NotSet - self._user = GithubObject.NotSet + self._body = github.GithubObject.NotSet + self._commit_id = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._original_commit_id = github.GithubObject.NotSet + self._original_position = github.GithubObject.NotSet + self._path = github.GithubObject.NotSet + self._position = github.GithubObject.NotSet + self._updated_at = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + self._user = github.GithubObject.NotSet def _useAttributes(self, attributes): if "body" in attributes: # pragma no branch @@ -141,4 +141,4 @@ class PullRequestComment(GithubObject.GithubObject): self._url = attributes["url"] if "user" in attributes: # pragma no branch assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"] - self._user = None if attributes["user"] is None else NamedUser.NamedUser(self._requester, attributes["user"], completed=False) + self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False) diff --git a/github/PullRequestMergeStatus.py b/github/PullRequestMergeStatus.py index ce96afac..4e2a6eb8 100644 --- a/github/PullRequestMergeStatus.py +++ b/github/PullRequestMergeStatus.py @@ -13,10 +13,10 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class PullRequestMergeStatus(GithubObject.BasicGithubObject): +class PullRequestMergeStatus(github.GithubObject.BasicGithubObject): @property def merged(self): return self._NoneIfNotSet(self._merged) @@ -30,9 +30,9 @@ class PullRequestMergeStatus(GithubObject.BasicGithubObject): return self._NoneIfNotSet(self._sha) def _initAttributes(self): - self._merged = GithubObject.NotSet - self._message = GithubObject.NotSet - self._sha = GithubObject.NotSet + self._merged = github.GithubObject.NotSet + self._message = github.GithubObject.NotSet + self._sha = github.GithubObject.NotSet def _useAttributes(self, attributes): if "merged" in attributes: # pragma no branch diff --git a/github/PullRequestPart.py b/github/PullRequestPart.py index 0507133e..10d1be55 100644 --- a/github/PullRequestPart.py +++ b/github/PullRequestPart.py @@ -13,13 +13,13 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import Repository -import NamedUser +import github.Repository +import github.NamedUser -class PullRequestPart(GithubObject.BasicGithubObject): +class PullRequestPart(github.GithubObject.BasicGithubObject): @property def label(self): return self._NoneIfNotSet(self._label) @@ -41,11 +41,11 @@ class PullRequestPart(GithubObject.BasicGithubObject): return self._NoneIfNotSet(self._user) def _initAttributes(self): - self._label = GithubObject.NotSet - self._ref = GithubObject.NotSet - self._repo = GithubObject.NotSet - self._sha = GithubObject.NotSet - self._user = GithubObject.NotSet + self._label = github.GithubObject.NotSet + self._ref = github.GithubObject.NotSet + self._repo = github.GithubObject.NotSet + self._sha = github.GithubObject.NotSet + self._user = github.GithubObject.NotSet def _useAttributes(self, attributes): if "label" in attributes: # pragma no branch @@ -56,10 +56,10 @@ class PullRequestPart(GithubObject.BasicGithubObject): self._ref = attributes["ref"] if "repo" in attributes: # pragma no branch assert attributes["repo"] is None or isinstance(attributes["repo"], dict), attributes["repo"] - self._repo = None if attributes["repo"] is None else Repository.Repository(self._requester, attributes["repo"], completed=False) + self._repo = None if attributes["repo"] is None else github.Repository.Repository(self._requester, attributes["repo"], completed=False) if "sha" in attributes: # pragma no branch assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"] self._sha = attributes["sha"] if "user" in attributes: # pragma no branch assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"] - self._user = None if attributes["user"] is None else NamedUser.NamedUser(self._requester, attributes["user"], completed=False) + self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False) diff --git a/github/Repository.py b/github/Repository.py index c4413a79..a92870a4 100644 --- a/github/Repository.py +++ b/github/Repository.py @@ -16,40 +16,38 @@ import urllib import datetime -import GithubObject -import PaginatedList +import github.GithubObject +import github.PaginatedList -import Branch -import IssueEvent -import ContentFile -import Label -import InputGitAuthor -import GitBlob -import Organization -import GitRef -import Issue -import Repository -import PullRequest -import RepositoryKey -import NamedUser -import Milestone -import InputGitTreeElement -import Comparison -import CommitComment -import GitCommit -import Team -import Commit -import GitTree -import Hook -import Tag -import GitTag -import Download -import Permissions -import Event -import Legacy +import github.Branch +import github.IssueEvent +import github.ContentFile +import github.Label +import github.GitBlob +import github.Organization +import github.GitRef +import github.Issue +import github.Repository +import github.PullRequest +import github.RepositoryKey +import github.NamedUser +import github.Milestone +import github.Comparison +import github.CommitComment +import github.GitCommit +import github.Team +import github.Commit +import github.GitTree +import github.Hook +import github.Tag +import github.GitTag +import github.Download +import github.Permissions +import github.Event +import github.Legacy -class Repository(GithubObject.GithubObject): +class Repository(github.GithubObject.GithubObject): @property def clone_url(self): self._completeIfNotSet(self._clone_url) @@ -201,7 +199,7 @@ class Repository(GithubObject.GithubObject): return self._NoneIfNotSet(self._watchers) def add_to_collaborators(self, collaborator): - assert isinstance(collaborator, NamedUser.NamedUser), collaborator + assert isinstance(collaborator, github.NamedUser.NamedUser), collaborator headers, data = self._requester.requestAndCheck( "PUT", self.url + "/collaborators/" + collaborator._identity, @@ -218,20 +216,20 @@ class Repository(GithubObject.GithubObject): None, None ) - return Comparison.Comparison(self._requester, data, completed=True) + return github.Comparison.Comparison(self._requester, data, completed=True) - def create_download(self, name, size, description=GithubObject.NotSet, content_type=GithubObject.NotSet): + def create_download(self, name, size, description=github.GithubObject.NotSet, content_type=github.GithubObject.NotSet): assert isinstance(name, (str, unicode)), name assert isinstance(size, (int, long)), size - assert description is GithubObject.NotSet or isinstance(description, (str, unicode)), description - assert content_type is GithubObject.NotSet or isinstance(content_type, (str, unicode)), content_type + assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description + assert content_type is github.GithubObject.NotSet or isinstance(content_type, (str, unicode)), content_type post_parameters = { "name": name, "size": size, } - if description is not GithubObject.NotSet: + if description is not github.GithubObject.NotSet: post_parameters["description"] = description - if content_type is not GithubObject.NotSet: + if content_type is not github.GithubObject.NotSet: post_parameters["content_type"] = content_type headers, data = self._requester.requestAndCheck( "POST", @@ -239,7 +237,7 @@ class Repository(GithubObject.GithubObject): None, post_parameters ) - return Download.Download(self._requester, data, completed=True) + return github.Download.Download(self._requester, data, completed=True) def create_git_blob(self, content, encoding): assert isinstance(content, (str, unicode)), content @@ -254,22 +252,22 @@ class Repository(GithubObject.GithubObject): None, post_parameters ) - return GitBlob.GitBlob(self._requester, data, completed=True) + return github.GitBlob.GitBlob(self._requester, data, completed=True) - def create_git_commit(self, message, tree, parents, author=GithubObject.NotSet, committer=GithubObject.NotSet): + def create_git_commit(self, message, tree, parents, author=github.GithubObject.NotSet, committer=github.GithubObject.NotSet): assert isinstance(message, (str, unicode)), message - assert isinstance(tree, GitTree.GitTree), tree - assert all(isinstance(element, GitCommit.GitCommit) for element in parents), parents - assert author is GithubObject.NotSet or isinstance(author, InputGitAuthor.InputGitAuthor), author - assert committer is GithubObject.NotSet or isinstance(committer, InputGitAuthor.InputGitAuthor), committer + assert isinstance(tree, github.GitTree.GitTree), tree + assert all(isinstance(element, github.GitCommit.GitCommit) for element in parents), parents + assert author is github.GithubObject.NotSet or isinstance(author, github.InputGitAuthor), author + assert committer is github.GithubObject.NotSet or isinstance(committer, github.InputGitAuthor), committer post_parameters = { "message": message, "tree": tree._identity, "parents": [element._identity for element in parents], } - if author is not GithubObject.NotSet: + if author is not github.GithubObject.NotSet: post_parameters["author"] = author._identity - if committer is not GithubObject.NotSet: + if committer is not github.GithubObject.NotSet: post_parameters["committer"] = committer._identity headers, data = self._requester.requestAndCheck( "POST", @@ -277,7 +275,7 @@ class Repository(GithubObject.GithubObject): None, post_parameters ) - return GitCommit.GitCommit(self._requester, data, completed=True) + return github.GitCommit.GitCommit(self._requester, data, completed=True) def create_git_ref(self, ref, sha): assert isinstance(ref, (str, unicode)), ref @@ -292,21 +290,21 @@ class Repository(GithubObject.GithubObject): None, post_parameters ) - return GitRef.GitRef(self._requester, data, completed=True) + return github.GitRef.GitRef(self._requester, data, completed=True) - def create_git_tag(self, tag, message, object, type, tagger=GithubObject.NotSet): + def create_git_tag(self, tag, message, object, type, tagger=github.GithubObject.NotSet): assert isinstance(tag, (str, unicode)), tag assert isinstance(message, (str, unicode)), message assert isinstance(object, (str, unicode)), object assert isinstance(type, (str, unicode)), type - assert tagger is GithubObject.NotSet or isinstance(tagger, InputGitAuthor.InputGitAuthor), tagger + assert tagger is github.GithubObject.NotSet or isinstance(tagger, github.InputGitAuthor), tagger post_parameters = { "tag": tag, "message": message, "object": object, "type": type, } - if tagger is not GithubObject.NotSet: + if tagger is not github.GithubObject.NotSet: post_parameters["tagger"] = tagger._identity headers, data = self._requester.requestAndCheck( "POST", @@ -314,15 +312,15 @@ class Repository(GithubObject.GithubObject): None, post_parameters ) - return GitTag.GitTag(self._requester, data, completed=True) + return github.GitTag.GitTag(self._requester, data, completed=True) - def create_git_tree(self, tree, base_tree=GithubObject.NotSet): - assert all(isinstance(element, InputGitTreeElement.InputGitTreeElement) for element in tree), tree - assert base_tree is GithubObject.NotSet or isinstance(base_tree, GitTree.GitTree), base_tree + def create_git_tree(self, tree, base_tree=github.GithubObject.NotSet): + assert all(isinstance(element, github.InputGitTreeElement) for element in tree), tree + assert base_tree is github.GithubObject.NotSet or isinstance(base_tree, github.GitTree.GitTree), base_tree post_parameters = { "tree": [element._identity for element in tree], } - if base_tree is not GithubObject.NotSet: + if base_tree is not github.GithubObject.NotSet: post_parameters["base_tree"] = base_tree._identity headers, data = self._requester.requestAndCheck( "POST", @@ -330,20 +328,20 @@ class Repository(GithubObject.GithubObject): None, post_parameters ) - return GitTree.GitTree(self._requester, data, completed=True) + return github.GitTree.GitTree(self._requester, data, completed=True) - def create_hook(self, name, config, events=GithubObject.NotSet, active=GithubObject.NotSet): + def create_hook(self, name, config, events=github.GithubObject.NotSet, active=github.GithubObject.NotSet): assert isinstance(name, (str, unicode)), name assert isinstance(config, dict), config - assert events is GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in events), events - assert active is GithubObject.NotSet or isinstance(active, bool), active + assert events is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in events), events + assert active is github.GithubObject.NotSet or isinstance(active, bool), active post_parameters = { "name": name, "config": config, } - if events is not GithubObject.NotSet: + if events is not github.GithubObject.NotSet: post_parameters["events"] = events - if active is not GithubObject.NotSet: + if active is not github.GithubObject.NotSet: post_parameters["active"] = active headers, data = self._requester.requestAndCheck( "POST", @@ -351,24 +349,24 @@ class Repository(GithubObject.GithubObject): None, post_parameters ) - return Hook.Hook(self._requester, data, completed=True) + return github.Hook.Hook(self._requester, data, completed=True) - def create_issue(self, title, body=GithubObject.NotSet, assignee=GithubObject.NotSet, milestone=GithubObject.NotSet, labels=GithubObject.NotSet): + def create_issue(self, title, body=github.GithubObject.NotSet, assignee=github.GithubObject.NotSet, milestone=github.GithubObject.NotSet, labels=github.GithubObject.NotSet): assert isinstance(title, (str, unicode)), title - assert body is GithubObject.NotSet or isinstance(body, (str, unicode)), body - assert assignee is GithubObject.NotSet or isinstance(assignee, NamedUser.NamedUser), assignee - assert milestone is GithubObject.NotSet or isinstance(milestone, Milestone.Milestone), milestone - assert labels is GithubObject.NotSet or all(isinstance(element, Label.Label) for element in labels), labels + assert body is github.GithubObject.NotSet or isinstance(body, (str, unicode)), body + assert assignee is github.GithubObject.NotSet or isinstance(assignee, github.NamedUser.NamedUser), assignee + assert milestone is github.GithubObject.NotSet or isinstance(milestone, github.Milestone.Milestone), milestone + assert labels is github.GithubObject.NotSet or all(isinstance(element, github.Label.Label) for element in labels), labels post_parameters = { "title": title, } - if body is not GithubObject.NotSet: + if body is not github.GithubObject.NotSet: post_parameters["body"] = body - if assignee is not GithubObject.NotSet: + if assignee is not github.GithubObject.NotSet: post_parameters["assignee"] = assignee._identity - if milestone is not GithubObject.NotSet: + if milestone is not github.GithubObject.NotSet: post_parameters["milestone"] = milestone._identity - if labels is not GithubObject.NotSet: + if labels is not github.GithubObject.NotSet: post_parameters["labels"] = [element.name for element in labels] headers, data = self._requester.requestAndCheck( "POST", @@ -376,7 +374,7 @@ class Repository(GithubObject.GithubObject): None, post_parameters ) - return Issue.Issue(self._requester, data, completed=True) + return github.Issue.Issue(self._requester, data, completed=True) def create_key(self, title, key): assert isinstance(title, (str, unicode)), title @@ -391,7 +389,7 @@ class Repository(GithubObject.GithubObject): None, post_parameters ) - return RepositoryKey.RepositoryKey(self._requester, data, completed=True, repoUrl=self._url) + return github.RepositoryKey.RepositoryKey(self._requester, data, completed=True, repoUrl=self._url) def create_label(self, name, color): assert isinstance(name, (str, unicode)), name @@ -406,21 +404,21 @@ class Repository(GithubObject.GithubObject): None, post_parameters ) - return Label.Label(self._requester, data, completed=True) + return github.Label.Label(self._requester, data, completed=True) - def create_milestone(self, title, state=GithubObject.NotSet, description=GithubObject.NotSet, due_on=GithubObject.NotSet): + def create_milestone(self, title, state=github.GithubObject.NotSet, description=github.GithubObject.NotSet, due_on=github.GithubObject.NotSet): assert isinstance(title, (str, unicode)), title - assert state is GithubObject.NotSet or isinstance(state, (str, unicode)), state - assert description is GithubObject.NotSet or isinstance(description, (str, unicode)), description - assert due_on is GithubObject.NotSet or isinstance(due_on, datetime.date), due_on + assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state + assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description + assert due_on is github.GithubObject.NotSet or isinstance(due_on, datetime.date), due_on post_parameters = { "title": title, } - if state is not GithubObject.NotSet: + if state is not github.GithubObject.NotSet: post_parameters["state"] = state - if description is not GithubObject.NotSet: + if description is not github.GithubObject.NotSet: post_parameters["description"] = description - if due_on is not GithubObject.NotSet: + if due_on is not github.GithubObject.NotSet: post_parameters["due_on"] = due_on.strftime("%Y-%m-%d") headers, data = self._requester.requestAndCheck( "POST", @@ -428,7 +426,7 @@ class Repository(GithubObject.GithubObject): None, post_parameters ) - return Milestone.Milestone(self._requester, data, completed=True) + return github.Milestone.Milestone(self._requester, data, completed=True) def create_pull(self, *args, **kwds): if len(args) + len(kwds) == 4: @@ -444,7 +442,7 @@ class Repository(GithubObject.GithubObject): return self.__create_pull(title=title, body=body, base=base, head=head) def __create_pull_2(self, issue, base, head): - assert isinstance(issue, Issue.Issue), issue + assert isinstance(issue, github.Issue.Issue), issue assert isinstance(base, (str, unicode)), base assert isinstance(head, (str, unicode)), head return self.__create_pull(issue=issue._identity, base=base, head=head) @@ -457,7 +455,7 @@ class Repository(GithubObject.GithubObject): None, post_parameters ) - return PullRequest.PullRequest(self._requester, data, completed=True) + return github.PullRequest.PullRequest(self._requester, data, completed=True) def delete(self): headers, data = self._requester.requestAndCheck( @@ -467,31 +465,31 @@ class Repository(GithubObject.GithubObject): None ) - def edit(self, name, description=GithubObject.NotSet, homepage=GithubObject.NotSet, public=GithubObject.NotSet, has_issues=GithubObject.NotSet, has_wiki=GithubObject.NotSet, has_downloads=GithubObject.NotSet, default_branch=GithubObject.NotSet): + def edit(self, name, description=github.GithubObject.NotSet, homepage=github.GithubObject.NotSet, public=github.GithubObject.NotSet, has_issues=github.GithubObject.NotSet, has_wiki=github.GithubObject.NotSet, has_downloads=github.GithubObject.NotSet, default_branch=github.GithubObject.NotSet): assert isinstance(name, (str, unicode)), name - assert description is GithubObject.NotSet or isinstance(description, (str, unicode)), description - assert homepage is GithubObject.NotSet or isinstance(homepage, (str, unicode)), homepage - assert public is GithubObject.NotSet or isinstance(public, bool), public - assert has_issues is GithubObject.NotSet or isinstance(has_issues, bool), has_issues - assert has_wiki is GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki - assert has_downloads is GithubObject.NotSet or isinstance(has_downloads, bool), has_downloads - assert default_branch is GithubObject.NotSet or isinstance(default_branch, (str, unicode)), default_branch + assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description + assert homepage is github.GithubObject.NotSet or isinstance(homepage, (str, unicode)), homepage + assert public is github.GithubObject.NotSet or isinstance(public, bool), public + assert has_issues is github.GithubObject.NotSet or isinstance(has_issues, bool), has_issues + assert has_wiki is github.GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki + assert has_downloads is github.GithubObject.NotSet or isinstance(has_downloads, bool), has_downloads + assert default_branch is github.GithubObject.NotSet or isinstance(default_branch, (str, unicode)), default_branch post_parameters = { "name": name, } - if description is not GithubObject.NotSet: + if description is not github.GithubObject.NotSet: post_parameters["description"] = description - if homepage is not GithubObject.NotSet: + if homepage is not github.GithubObject.NotSet: post_parameters["homepage"] = homepage - if public is not GithubObject.NotSet: + if public is not github.GithubObject.NotSet: post_parameters["public"] = public - if has_issues is not GithubObject.NotSet: + if has_issues is not github.GithubObject.NotSet: post_parameters["has_issues"] = has_issues - if has_wiki is not GithubObject.NotSet: + if has_wiki is not github.GithubObject.NotSet: post_parameters["has_wiki"] = has_wiki - if has_downloads is not GithubObject.NotSet: + if has_downloads is not github.GithubObject.NotSet: post_parameters["has_downloads"] = has_downloads - if default_branch is not GithubObject.NotSet: + if default_branch is not github.GithubObject.NotSet: post_parameters["default_branch"] = default_branch headers, data = self._requester.requestAndCheck( "PATCH", @@ -501,11 +499,11 @@ class Repository(GithubObject.GithubObject): ) self._useAttributes(data) - def get_archive_link(self, archive_format, ref=GithubObject.NotSet): + def get_archive_link(self, archive_format, ref=github.GithubObject.NotSet): assert isinstance(archive_format, (str, unicode)), archive_format - assert ref is GithubObject.NotSet or isinstance(ref, (str, unicode)), ref + assert ref is github.GithubObject.NotSet or isinstance(ref, (str, unicode)), ref url = self.url + "/" + archive_format - if ref is not GithubObject.NotSet: + if ref is not github.GithubObject.NotSet: url += "/" + ref headers, data = self._requester.requestAndCheck( "GET", @@ -516,8 +514,8 @@ class Repository(GithubObject.GithubObject): return headers["location"] def get_assignees(self): - return PaginatedList.PaginatedList( - NamedUser.NamedUser, + return github.PaginatedList.PaginatedList( + github.NamedUser.NamedUser, self._requester, self.url + "/assignees", None @@ -531,19 +529,19 @@ class Repository(GithubObject.GithubObject): None, None ) - return Branch.Branch(self._requester, data, completed=True) + return github.Branch.Branch(self._requester, data, completed=True) def get_branches(self): - return PaginatedList.PaginatedList( - Branch.Branch, + return github.PaginatedList.PaginatedList( + github.Branch.Branch, self._requester, self.url + "/branches", None ) def get_collaborators(self): - return PaginatedList.PaginatedList( - NamedUser.NamedUser, + return github.PaginatedList.PaginatedList( + github.NamedUser.NamedUser, self._requester, self.url + "/collaborators", None @@ -557,11 +555,11 @@ class Repository(GithubObject.GithubObject): None, None ) - return CommitComment.CommitComment(self._requester, data, completed=True) + return github.CommitComment.CommitComment(self._requester, data, completed=True) def get_comments(self): - return PaginatedList.PaginatedList( - CommitComment.CommitComment, + return github.PaginatedList.PaginatedList( + github.CommitComment.CommitComment, self._requester, self.url + "/comments", None @@ -575,18 +573,18 @@ class Repository(GithubObject.GithubObject): None, None ) - return Commit.Commit(self._requester, data, completed=True) + return github.Commit.Commit(self._requester, data, completed=True) - def get_commits(self, sha=GithubObject.NotSet, path=GithubObject.NotSet): - assert sha is GithubObject.NotSet or isinstance(sha, (str, unicode)), sha - assert path is GithubObject.NotSet or isinstance(path, (str, unicode)), path + def get_commits(self, sha=github.GithubObject.NotSet, path=github.GithubObject.NotSet): + assert sha is github.GithubObject.NotSet or isinstance(sha, (str, unicode)), sha + assert path is github.GithubObject.NotSet or isinstance(path, (str, unicode)), path url_parameters = dict() - if sha is not GithubObject.NotSet: + if sha is not github.GithubObject.NotSet: url_parameters["sha"] = sha - if path is not GithubObject.NotSet: + if path is not github.GithubObject.NotSet: url_parameters["path"] = path - return PaginatedList.PaginatedList( - Commit.Commit, + return github.PaginatedList.PaginatedList( + github.Commit.Commit, self._requester, self.url + "/commits", url_parameters @@ -600,11 +598,11 @@ class Repository(GithubObject.GithubObject): None, None ) - return ContentFile.ContentFile(self._requester, data, completed=True) + return github.ContentFile.ContentFile(self._requester, data, completed=True) def get_contributors(self): - return PaginatedList.PaginatedList( - NamedUser.NamedUser, + return github.PaginatedList.PaginatedList( + github.NamedUser.NamedUser, self._requester, self.url + "/contributors", None @@ -618,26 +616,26 @@ class Repository(GithubObject.GithubObject): None, None ) - return Download.Download(self._requester, data, completed=True) + return github.Download.Download(self._requester, data, completed=True) def get_downloads(self): - return PaginatedList.PaginatedList( - Download.Download, + return github.PaginatedList.PaginatedList( + github.Download.Download, self._requester, self.url + "/downloads", None ) def get_events(self): - return PaginatedList.PaginatedList( - Event.Event, + return github.PaginatedList.PaginatedList( + github.Event.Event, self._requester, self.url + "/events", None ) def get_forks(self): - return PaginatedList.PaginatedList( + return github.PaginatedList.PaginatedList( Repository, self._requester, self.url + "/forks", @@ -652,7 +650,7 @@ class Repository(GithubObject.GithubObject): None, None ) - return GitBlob.GitBlob(self._requester, data, completed=True) + return github.GitBlob.GitBlob(self._requester, data, completed=True) def get_git_commit(self, sha): assert isinstance(sha, (str, unicode)), sha @@ -662,7 +660,7 @@ class Repository(GithubObject.GithubObject): None, None ) - return GitCommit.GitCommit(self._requester, data, completed=True) + return github.GitCommit.GitCommit(self._requester, data, completed=True) def get_git_ref(self, ref): prefix = "/git/refs/" @@ -675,11 +673,11 @@ class Repository(GithubObject.GithubObject): None, None ) - return GitRef.GitRef(self._requester, data, completed=True) + return github.GitRef.GitRef(self._requester, data, completed=True) def get_git_refs(self): - return PaginatedList.PaginatedList( - GitRef.GitRef, + return github.PaginatedList.PaginatedList( + github.GitRef.GitRef, self._requester, self.url + "/git/refs", None @@ -693,13 +691,13 @@ class Repository(GithubObject.GithubObject): None, None ) - return GitTag.GitTag(self._requester, data, completed=True) + return github.GitTag.GitTag(self._requester, data, completed=True) - def get_git_tree(self, sha, recursive=GithubObject.NotSet): + def get_git_tree(self, sha, recursive=github.GithubObject.NotSet): assert isinstance(sha, (str, unicode)), sha - assert recursive is GithubObject.NotSet or isinstance(recursive, bool), recursive + assert recursive is github.GithubObject.NotSet or isinstance(recursive, bool), recursive url_parameters = dict() - if recursive is not GithubObject.NotSet: + if recursive is not github.GithubObject.NotSet: url_parameters["recursive"] = recursive headers, data = self._requester.requestAndCheck( "GET", @@ -707,7 +705,7 @@ class Repository(GithubObject.GithubObject): url_parameters, None ) - return GitTree.GitTree(self._requester, data, completed=True) + return github.GitTree.GitTree(self._requester, data, completed=True) def get_hook(self, id): assert isinstance(id, (int, long)), id @@ -717,11 +715,11 @@ class Repository(GithubObject.GithubObject): None, None ) - return Hook.Hook(self._requester, data, completed=True) + return github.Hook.Hook(self._requester, data, completed=True) def get_hooks(self): - return PaginatedList.PaginatedList( - Hook.Hook, + return github.PaginatedList.PaginatedList( + github.Hook.Hook, self._requester, self.url + "/hooks", None @@ -735,42 +733,42 @@ class Repository(GithubObject.GithubObject): None, None ) - return Issue.Issue(self._requester, data, completed=True) + return github.Issue.Issue(self._requester, data, completed=True) - def get_issues(self, milestone=GithubObject.NotSet, state=GithubObject.NotSet, assignee=GithubObject.NotSet, mentioned=GithubObject.NotSet, labels=GithubObject.NotSet, sort=GithubObject.NotSet, direction=GithubObject.NotSet, since=GithubObject.NotSet): - assert milestone is GithubObject.NotSet or milestone == "*" or milestone == "none" or isinstance(milestone, Milestone.Milestone), milestone - assert state is GithubObject.NotSet or isinstance(state, (str, unicode)), state - assert assignee is GithubObject.NotSet or assignee == "*" or assignee == "none" or isinstance(assignee, NamedUser.NamedUser), assignee - assert mentioned is GithubObject.NotSet or isinstance(mentioned, NamedUser.NamedUser), mentioned - assert labels is GithubObject.NotSet or all(isinstance(element, Label.Label) for element in labels), labels - assert sort is GithubObject.NotSet or isinstance(sort, (str, unicode)), sort - assert direction is GithubObject.NotSet or isinstance(direction, (str, unicode)), direction - assert since is GithubObject.NotSet or isinstance(since, datetime.datetime), since + def get_issues(self, milestone=github.GithubObject.NotSet, state=github.GithubObject.NotSet, assignee=github.GithubObject.NotSet, mentioned=github.GithubObject.NotSet, labels=github.GithubObject.NotSet, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet, since=github.GithubObject.NotSet): + assert milestone is github.GithubObject.NotSet or milestone == "*" or milestone == "none" or isinstance(milestone, github.Milestone.Milestone), milestone + assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state + assert assignee is github.GithubObject.NotSet or assignee == "*" or assignee == "none" or isinstance(assignee, github.NamedUser.NamedUser), assignee + assert mentioned is github.GithubObject.NotSet or isinstance(mentioned, github.NamedUser.NamedUser), mentioned + assert labels is github.GithubObject.NotSet or all(isinstance(element, github.Label.Label) for element in labels), labels + assert sort is github.GithubObject.NotSet or isinstance(sort, (str, unicode)), sort + assert direction is github.GithubObject.NotSet or isinstance(direction, (str, unicode)), direction + assert since is github.GithubObject.NotSet or isinstance(since, datetime.datetime), since url_parameters = dict() - if milestone is not GithubObject.NotSet: + if milestone is not github.GithubObject.NotSet: if isinstance(milestone, str): url_parameters["milestone"] = milestone else: url_parameters["milestone"] = milestone._identity - if state is not GithubObject.NotSet: + if state is not github.GithubObject.NotSet: url_parameters["state"] = state - if assignee is not GithubObject.NotSet: + if assignee is not github.GithubObject.NotSet: if isinstance(assignee, str): url_parameters["assignee"] = assignee else: url_parameters["assignee"] = assignee._identity - if mentioned is not GithubObject.NotSet: + if mentioned is not github.GithubObject.NotSet: url_parameters["mentioned"] = mentioned._identity - if labels is not GithubObject.NotSet: + if labels is not github.GithubObject.NotSet: url_parameters["labels"] = ",".join(label.name for label in labels) - if sort is not GithubObject.NotSet: + if sort is not github.GithubObject.NotSet: url_parameters["sort"] = sort - if direction is not GithubObject.NotSet: + if direction is not github.GithubObject.NotSet: url_parameters["direction"] = direction - if since is not GithubObject.NotSet: + if since is not github.GithubObject.NotSet: url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ") - return PaginatedList.PaginatedList( - Issue.Issue, + return github.PaginatedList.PaginatedList( + github.Issue.Issue, self._requester, self.url + "/issues", url_parameters @@ -784,11 +782,11 @@ class Repository(GithubObject.GithubObject): None, None ) - return IssueEvent.IssueEvent(self._requester, data, completed=True) + return github.IssueEvent.IssueEvent(self._requester, data, completed=True) def get_issues_events(self): - return PaginatedList.PaginatedList( - IssueEvent.IssueEvent, + return github.PaginatedList.PaginatedList( + github.IssueEvent.IssueEvent, self._requester, self.url + "/issues/events", None @@ -802,11 +800,11 @@ class Repository(GithubObject.GithubObject): None, None ) - return RepositoryKey.RepositoryKey(self._requester, data, completed=True, repoUrl=self._url) + return github.RepositoryKey.RepositoryKey(self._requester, data, completed=True, repoUrl=self._url) def get_keys(self): - return PaginatedList.PaginatedList( - lambda requester, data, completed: RepositoryKey.RepositoryKey(requester, data, completed, repoUrl=self._url), + return github.PaginatedList.PaginatedList( + lambda requester, data, completed: github.RepositoryKey.RepositoryKey(requester, data, completed, repoUrl=self._url), self._requester, self.url + "/keys", None @@ -820,11 +818,11 @@ class Repository(GithubObject.GithubObject): None, None ) - return Label.Label(self._requester, data, completed=True) + return github.Label.Label(self._requester, data, completed=True) def get_labels(self): - return PaginatedList.PaginatedList( - Label.Label, + return github.PaginatedList.PaginatedList( + github.Label.Label, self._requester, self.url + "/labels", None @@ -847,29 +845,29 @@ class Repository(GithubObject.GithubObject): None, None ) - return Milestone.Milestone(self._requester, data, completed=True) + return github.Milestone.Milestone(self._requester, data, completed=True) - def get_milestones(self, state=GithubObject.NotSet, sort=GithubObject.NotSet, direction=GithubObject.NotSet): - assert state is GithubObject.NotSet or isinstance(state, (str, unicode)), state - assert sort is GithubObject.NotSet or isinstance(sort, (str, unicode)), sort - assert direction is GithubObject.NotSet or isinstance(direction, (str, unicode)), direction + def get_milestones(self, state=github.GithubObject.NotSet, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet): + assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state + assert sort is github.GithubObject.NotSet or isinstance(sort, (str, unicode)), sort + assert direction is github.GithubObject.NotSet or isinstance(direction, (str, unicode)), direction url_parameters = dict() - if state is not GithubObject.NotSet: + if state is not github.GithubObject.NotSet: url_parameters["state"] = state - if sort is not GithubObject.NotSet: + if sort is not github.GithubObject.NotSet: url_parameters["sort"] = sort - if direction is not GithubObject.NotSet: + if direction is not github.GithubObject.NotSet: url_parameters["direction"] = direction - return PaginatedList.PaginatedList( - Milestone.Milestone, + return github.PaginatedList.PaginatedList( + github.Milestone.Milestone, self._requester, self.url + "/milestones", url_parameters ) def get_network_events(self): - return PaginatedList.PaginatedList( - Event.Event, + return github.PaginatedList.PaginatedList( + github.Event.Event, self._requester, "/networks/" + self.owner.login + "/" + self.name + "/events", None @@ -883,15 +881,15 @@ class Repository(GithubObject.GithubObject): None, None ) - return PullRequest.PullRequest(self._requester, data, completed=True) + return github.PullRequest.PullRequest(self._requester, data, completed=True) - def get_pulls(self, state=GithubObject.NotSet): - assert state is GithubObject.NotSet or isinstance(state, (str, unicode)), state + def get_pulls(self, state=github.GithubObject.NotSet): + assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state url_parameters = dict() - if state is not GithubObject.NotSet: + if state is not github.GithubObject.NotSet: url_parameters["state"] = state - return PaginatedList.PaginatedList( - PullRequest.PullRequest, + return github.PaginatedList.PaginatedList( + github.PullRequest.PullRequest, self._requester, self.url + "/pulls", url_parameters @@ -904,50 +902,50 @@ class Repository(GithubObject.GithubObject): None, None ) - return ContentFile.ContentFile(self._requester, data, completed=True) + return github.ContentFile.ContentFile(self._requester, data, completed=True) def get_stargazers(self): - return PaginatedList.PaginatedList( - NamedUser.NamedUser, + return github.PaginatedList.PaginatedList( + github.NamedUser.NamedUser, self._requester, self.url + "/stargazers", None ) def get_subscribers(self): - return PaginatedList.PaginatedList( - NamedUser.NamedUser, + return github.PaginatedList.PaginatedList( + github.NamedUser.NamedUser, self._requester, self.url + "/subscribers", None ) def get_tags(self): - return PaginatedList.PaginatedList( - Tag.Tag, + return github.PaginatedList.PaginatedList( + github.Tag.Tag, self._requester, self.url + "/tags", None ) def get_teams(self): - return PaginatedList.PaginatedList( - Team.Team, + return github.PaginatedList.PaginatedList( + github.Team.Team, self._requester, self.url + "/teams", None ) def get_watchers(self): - return PaginatedList.PaginatedList( - NamedUser.NamedUser, + return github.PaginatedList.PaginatedList( + github.NamedUser.NamedUser, self._requester, self.url + "/watchers", None ) def has_in_assignees(self, assignee): - assert isinstance(assignee, NamedUser.NamedUser), assignee + assert isinstance(assignee, github.NamedUser.NamedUser), assignee status, headers, data = self._requester.requestRaw( "GET", self.url + "/assignees/" + assignee._identity, @@ -957,7 +955,7 @@ class Repository(GithubObject.GithubObject): return status == 204 def has_in_collaborators(self, collaborator): - assert isinstance(collaborator, NamedUser.NamedUser), collaborator + assert isinstance(collaborator, github.NamedUser.NamedUser), collaborator status, headers, data = self._requester.requestRaw( "GET", self.url + "/collaborators/" + collaborator._identity, @@ -976,19 +974,19 @@ class Repository(GithubObject.GithubObject): None ) return [ - Issue.Issue(self._requester, Legacy.convertIssue(element), completed=False) + github.Issue.Issue(self._requester, github.Legacy.convertIssue(element), completed=False) for element in data["issues"] ] - def merge(self, base, head, commit_message=GithubObject.NotSet): + def merge(self, base, head, commit_message=github.GithubObject.NotSet): assert isinstance(base, (str, unicode)), base assert isinstance(head, (str, unicode)), head - assert commit_message is GithubObject.NotSet or isinstance(commit_message, (str, unicode)), commit_message + assert commit_message is github.GithubObject.NotSet or isinstance(commit_message, (str, unicode)), commit_message post_parameters = { "base": base, "head": head, } - if commit_message is not GithubObject.NotSet: + if commit_message is not github.GithubObject.NotSet: post_parameters["commit_message"] = commit_message headers, data = self._requester.requestAndCheck( "POST", @@ -999,10 +997,10 @@ class Repository(GithubObject.GithubObject): if data is None: return None else: - return Commit.Commit(self._requester, data, completed=True) + return github.Commit.Commit(self._requester, data, completed=True) def remove_from_collaborators(self, collaborator): - assert isinstance(collaborator, NamedUser.NamedUser), collaborator + assert isinstance(collaborator, github.NamedUser.NamedUser), collaborator headers, data = self._requester.requestAndCheck( "DELETE", self.url + "/collaborators/" + collaborator._identity, @@ -1015,36 +1013,36 @@ class Repository(GithubObject.GithubObject): return self.owner.login + "/" + self.name def _initAttributes(self): - self._clone_url = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._description = GithubObject.NotSet - self._fork = GithubObject.NotSet - self._forks = GithubObject.NotSet - self._full_name = GithubObject.NotSet - self._git_url = GithubObject.NotSet - self._has_downloads = GithubObject.NotSet - self._has_issues = GithubObject.NotSet - self._has_wiki = GithubObject.NotSet - self._homepage = GithubObject.NotSet - self._html_url = GithubObject.NotSet - self._id = GithubObject.NotSet - self._language = GithubObject.NotSet - self._master_branch = GithubObject.NotSet - self._name = GithubObject.NotSet - self._open_issues = GithubObject.NotSet - self._organization = GithubObject.NotSet - self._owner = GithubObject.NotSet - self._parent = GithubObject.NotSet - self._permissions = GithubObject.NotSet - self._private = GithubObject.NotSet - self._pushed_at = GithubObject.NotSet - self._size = GithubObject.NotSet - self._source = GithubObject.NotSet - self._ssh_url = GithubObject.NotSet - self._svn_url = GithubObject.NotSet - self._updated_at = GithubObject.NotSet - self._url = GithubObject.NotSet - self._watchers = GithubObject.NotSet + self._clone_url = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._description = github.GithubObject.NotSet + self._fork = github.GithubObject.NotSet + self._forks = github.GithubObject.NotSet + self._full_name = github.GithubObject.NotSet + self._git_url = github.GithubObject.NotSet + self._has_downloads = github.GithubObject.NotSet + self._has_issues = github.GithubObject.NotSet + self._has_wiki = github.GithubObject.NotSet + self._homepage = github.GithubObject.NotSet + self._html_url = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._language = github.GithubObject.NotSet + self._master_branch = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._open_issues = github.GithubObject.NotSet + self._organization = github.GithubObject.NotSet + self._owner = github.GithubObject.NotSet + self._parent = github.GithubObject.NotSet + self._permissions = github.GithubObject.NotSet + self._private = github.GithubObject.NotSet + self._pushed_at = github.GithubObject.NotSet + self._size = github.GithubObject.NotSet + self._source = github.GithubObject.NotSet + self._ssh_url = github.GithubObject.NotSet + self._svn_url = github.GithubObject.NotSet + self._updated_at = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + self._watchers = github.GithubObject.NotSet def _useAttributes(self, attributes): if "clone_url" in attributes: # pragma no branch @@ -1100,16 +1098,16 @@ class Repository(GithubObject.GithubObject): self._open_issues = attributes["open_issues"] if "organization" in attributes: # pragma no branch assert attributes["organization"] is None or isinstance(attributes["organization"], dict), attributes["organization"] - self._organization = None if attributes["organization"] is None else Organization.Organization(self._requester, attributes["organization"], completed=False) + self._organization = None if attributes["organization"] is None else github.Organization.Organization(self._requester, attributes["organization"], completed=False) if "owner" in attributes: # pragma no branch assert attributes["owner"] is None or isinstance(attributes["owner"], dict), attributes["owner"] - self._owner = None if attributes["owner"] is None else NamedUser.NamedUser(self._requester, attributes["owner"], completed=False) + self._owner = None if attributes["owner"] is None else github.NamedUser.NamedUser(self._requester, attributes["owner"], completed=False) if "parent" in attributes: # pragma no branch assert attributes["parent"] is None or isinstance(attributes["parent"], dict), attributes["parent"] self._parent = None if attributes["parent"] is None else Repository(self._requester, attributes["parent"], completed=False) if "permissions" in attributes: # pragma no branch assert attributes["permissions"] is None or isinstance(attributes["permissions"], dict), attributes["permissions"] - self._permissions = None if attributes["permissions"] is None else Permissions.Permissions(self._requester, attributes["permissions"], completed=False) + self._permissions = None if attributes["permissions"] is None else github.Permissions.Permissions(self._requester, attributes["permissions"], completed=False) if "private" in attributes: # pragma no branch assert attributes["private"] is None or isinstance(attributes["private"], bool), attributes["private"] self._private = attributes["private"] diff --git a/github/RepositoryKey.py b/github/RepositoryKey.py index dc759180..028dc3ce 100644 --- a/github/RepositoryKey.py +++ b/github/RepositoryKey.py @@ -13,12 +13,12 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class RepositoryKey(GithubObject.GithubObject): +class RepositoryKey(github.GithubObject.GithubObject): def __init__(self, requester, attributes, completed, repoUrl): - GithubObject.GithubObject.__init__(self, requester, attributes, completed) + github.GithubObject.GithubObject.__init__(self, requester, attributes, completed) self.__repoUrl = repoUrl @property @@ -58,13 +58,13 @@ class RepositoryKey(GithubObject.GithubObject): None ) - def edit(self, title=GithubObject.NotSet, key=GithubObject.NotSet): - assert title is GithubObject.NotSet or isinstance(title, (str, unicode)), title - assert key is GithubObject.NotSet or isinstance(key, (str, unicode)), key + def edit(self, title=github.GithubObject.NotSet, key=github.GithubObject.NotSet): + assert title is github.GithubObject.NotSet or isinstance(title, (str, unicode)), title + assert key is github.GithubObject.NotSet or isinstance(key, (str, unicode)), key post_parameters = dict() - if title is not GithubObject.NotSet: + if title is not github.GithubObject.NotSet: post_parameters["title"] = title - if key is not GithubObject.NotSet: + if key is not github.GithubObject.NotSet: post_parameters["key"] = key headers, data = self._requester.requestAndCheck( "PATCH", @@ -75,11 +75,11 @@ class RepositoryKey(GithubObject.GithubObject): self._useAttributes(data) def _initAttributes(self): - self._id = GithubObject.NotSet - self._key = GithubObject.NotSet - self._title = GithubObject.NotSet - self._url = GithubObject.NotSet - self._verified = GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._key = github.GithubObject.NotSet + self._title = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + self._verified = github.GithubObject.NotSet def _useAttributes(self, attributes): if "id" in attributes: # pragma no branch diff --git a/github/Tag.py b/github/Tag.py index b38ff6ae..96c87022 100644 --- a/github/Tag.py +++ b/github/Tag.py @@ -13,12 +13,12 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import Commit +import github.Commit -class Tag(GithubObject.BasicGithubObject): +class Tag(github.GithubObject.BasicGithubObject): @property def commit(self): return self._NoneIfNotSet(self._commit) @@ -36,15 +36,15 @@ class Tag(GithubObject.BasicGithubObject): return self._NoneIfNotSet(self._zipball_url) def _initAttributes(self): - self._commit = GithubObject.NotSet - self._name = GithubObject.NotSet - self._tarball_url = GithubObject.NotSet - self._zipball_url = GithubObject.NotSet + self._commit = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._tarball_url = github.GithubObject.NotSet + self._zipball_url = github.GithubObject.NotSet def _useAttributes(self, attributes): if "commit" in attributes: # pragma no branch assert attributes["commit"] is None or isinstance(attributes["commit"], dict), attributes["commit"] - self._commit = None if attributes["commit"] is None else Commit.Commit(self._requester, attributes["commit"], completed=False) + self._commit = None if attributes["commit"] is None else github.Commit.Commit(self._requester, attributes["commit"], completed=False) if "name" in attributes: # pragma no branch assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] self._name = attributes["name"] diff --git a/github/Team.py b/github/Team.py index 9dea6f09..684e5df9 100644 --- a/github/Team.py +++ b/github/Team.py @@ -13,14 +13,14 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject -import PaginatedList +import github.GithubObject +import github.PaginatedList -import Repository -import NamedUser +import github.Repository +import github.NamedUser -class Team(GithubObject.GithubObject): +class Team(github.GithubObject.GithubObject): @property def id(self): self._completeIfNotSet(self._id) @@ -52,7 +52,7 @@ class Team(GithubObject.GithubObject): return self._NoneIfNotSet(self._url) def add_to_members(self, member): - assert isinstance(member, NamedUser.NamedUser), member + assert isinstance(member, github.NamedUser.NamedUser), member headers, data = self._requester.requestAndCheck( "PUT", self.url + "/members/" + member._identity, @@ -61,7 +61,7 @@ class Team(GithubObject.GithubObject): ) def add_to_repos(self, repo): - assert isinstance(repo, Repository.Repository), repo + assert isinstance(repo, github.Repository.Repository), repo headers, data = self._requester.requestAndCheck( "PUT", self.url + "/repos/" + repo._identity, @@ -77,13 +77,13 @@ class Team(GithubObject.GithubObject): None ) - def edit(self, name, permission=GithubObject.NotSet): + def edit(self, name, permission=github.GithubObject.NotSet): assert isinstance(name, (str, unicode)), name - assert permission is GithubObject.NotSet or isinstance(permission, (str, unicode)), permission + assert permission is github.GithubObject.NotSet or isinstance(permission, (str, unicode)), permission post_parameters = { "name": name, } - if permission is not GithubObject.NotSet: + if permission is not github.GithubObject.NotSet: post_parameters["permission"] = permission headers, data = self._requester.requestAndCheck( "PATCH", @@ -94,23 +94,23 @@ class Team(GithubObject.GithubObject): self._useAttributes(data) def get_members(self): - return PaginatedList.PaginatedList( - NamedUser.NamedUser, + return github.PaginatedList.PaginatedList( + github.NamedUser.NamedUser, self._requester, self.url + "/members", None ) def get_repos(self): - return PaginatedList.PaginatedList( - Repository.Repository, + return github.PaginatedList.PaginatedList( + github.Repository.Repository, self._requester, self.url + "/repos", None ) def has_in_members(self, member): - assert isinstance(member, NamedUser.NamedUser), member + assert isinstance(member, github.NamedUser.NamedUser), member status, headers, data = self._requester.requestRaw( "GET", self.url + "/members/" + member._identity, @@ -120,7 +120,7 @@ class Team(GithubObject.GithubObject): return status == 204 def has_in_repos(self, repo): - assert isinstance(repo, Repository.Repository), repo + assert isinstance(repo, github.Repository.Repository), repo status, headers, data = self._requester.requestRaw( "GET", self.url + "/repos/" + repo._identity, @@ -130,7 +130,7 @@ class Team(GithubObject.GithubObject): return status == 204 def remove_from_members(self, member): - assert isinstance(member, NamedUser.NamedUser), member + assert isinstance(member, github.NamedUser.NamedUser), member headers, data = self._requester.requestAndCheck( "DELETE", self.url + "/members/" + member._identity, @@ -139,7 +139,7 @@ class Team(GithubObject.GithubObject): ) def remove_from_repos(self, repo): - assert isinstance(repo, Repository.Repository), repo + assert isinstance(repo, github.Repository.Repository), repo headers, data = self._requester.requestAndCheck( "DELETE", self.url + "/repos/" + repo._identity, @@ -152,12 +152,12 @@ class Team(GithubObject.GithubObject): return self.id def _initAttributes(self): - self._id = GithubObject.NotSet - self._members_count = GithubObject.NotSet - self._name = GithubObject.NotSet - self._permission = GithubObject.NotSet - self._repos_count = GithubObject.NotSet - self._url = GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._members_count = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._permission = github.GithubObject.NotSet + self._repos_count = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet def _useAttributes(self, attributes): if "id" in attributes: # pragma no branch diff --git a/github/UserKey.py b/github/UserKey.py index 53ca3841..4fe342ce 100644 --- a/github/UserKey.py +++ b/github/UserKey.py @@ -13,10 +13,10 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class UserKey(GithubObject.GithubObject): +class UserKey(github.GithubObject.GithubObject): @property def id(self): self._completeIfNotSet(self._id) @@ -50,13 +50,13 @@ class UserKey(GithubObject.GithubObject): None ) - def edit(self, title=GithubObject.NotSet, key=GithubObject.NotSet): - assert title is GithubObject.NotSet or isinstance(title, (str, unicode)), title - assert key is GithubObject.NotSet or isinstance(key, (str, unicode)), key + def edit(self, title=github.GithubObject.NotSet, key=github.GithubObject.NotSet): + assert title is github.GithubObject.NotSet or isinstance(title, (str, unicode)), title + assert key is github.GithubObject.NotSet or isinstance(key, (str, unicode)), key post_parameters = dict() - if title is not GithubObject.NotSet: + if title is not github.GithubObject.NotSet: post_parameters["title"] = title - if key is not GithubObject.NotSet: + if key is not github.GithubObject.NotSet: post_parameters["key"] = key headers, data = self._requester.requestAndCheck( "PATCH", @@ -67,11 +67,11 @@ class UserKey(GithubObject.GithubObject): self._useAttributes(data) def _initAttributes(self): - self._id = GithubObject.NotSet - self._key = GithubObject.NotSet - self._title = GithubObject.NotSet - self._url = GithubObject.NotSet - self._verified = GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._key = github.GithubObject.NotSet + self._title = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + self._verified = github.GithubObject.NotSet def _useAttributes(self, attributes): if "id" in attributes: # pragma no branch