Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
s-t-e-v-e-n-k committed Oct 12, 2021
2 parents e12d559 + b10dbe3 commit 178e23d
Show file tree
Hide file tree
Showing 61 changed files with 422 additions and 348 deletions.
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Expand Up @@ -3,7 +3,6 @@ repos:
rev: 20.8b1
hooks:
- id: black
language_version: python3.6
- repo: https://github.com/asottile/seed-isort-config
rev: v1.9.4
hooks:
Expand Down
38 changes: 38 additions & 0 deletions doc/changes.rst
Expand Up @@ -4,6 +4,44 @@ Change log
Stable versions
~~~~~~~~~~~~~~~

Version 1.55 (April 26, 2021)
-----------------------------------
**Breaking Changes**

* Remove client_id/client_secret authentication (#1888) (901af8c8)
* Adjust to Github API changes regarding emails (#1890) (2c77cfad)
- This impacts what AuthenticatedUser.get_emails() returns
* PublicKey.key_id could be int on Github Enterprise (#1894) (ad124ef4)
* Export headers in GithubException (#1887) (ddd437a7)

**Bug Fixes & Improvements**

* Do not import from unpackaged paths in typing (#1926) (27ba7838)
* Implement hash for CompletableGithubObject (#1922) (4faff23c)
* Use property decorator to improve typing compatibility (#1925) (e4168109)
* Fix :rtype: directive (#1927) (54b6a97b)
* Update most URLs to docs.github.com (#1896) (babcbcd0)
* Tighten asserts for new Permission tests (#1893) (5aab6f5d)
* Adding attributes "maintain" and "triage" to class "Permissions" (#1810) (76879613)
* Add default arguments to Workflow method type annotations (#1857) (7d6bac9e)
* Re-raise the exception when failing to parse JSON (#1892) (916da53b)
* Allow adding attributes at the end of the list (#1807) (0245b758)
* Updating links to Github documentation for deploy keys (#1850) (c27fb919)
* Update PyJWT Version to 2.0+ (#1891) (a68577b7)
* Use right variable in both get_check_runs() (#1889) (3003e065)
* fix bad assertions in github.Project.edit (#1817) (6bae9e5c)
* Test repr() for PublicKey (#1879) (e0acd8f4)
* Add support for deleting repository secrets (#1868) (696793de)
* Switch repository secrets to using f-strings (#1867) (aa240304)
* Manually fixing paths for codecov.io to cover all project files (#1813) (b2232c89)
* Add missing links to project metadata (#1789) (64f532ae)
* No longer show username and password examples (#1866) (55d98373)
* Adding github actions secrets (#1681) (c90c050e)
* fix get_user_issues (#1842) (7db1b0c9)
* Switch all string addition to using f-strings (#1774) (290b6272)
* Enabling connection pool_size definition (a77d4f48)
* Always define the session adapter (aaec0a0f)

Version 1.54.1 (December 24, 2020)
-----------------------------------

Expand Down
2 changes: 1 addition & 1 deletion github/ApplicationOAuth.py
Expand Up @@ -29,7 +29,7 @@
class ApplicationOAuth(github.GithubObject.NonCompletableGithubObject):
"""
This class is used for identifying and authorizing users for Github Apps.
The reference can be found at https://docs.github.com/en/developers/apps/identifying-and-authorizing-users-for-github-apps
The reference can be found at https://docs.github.com/en/developers/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps
"""

def __repr__(self):
Expand Down
6 changes: 4 additions & 2 deletions github/AuthenticatedUser.py
Expand Up @@ -973,9 +973,11 @@ def get_notifications(

params = dict()
if all is not github.GithubObject.NotSet:
params["all"] = all
# convert True, False to true, false for api parameters
params["all"] = "true" if all else "false"
if participating is not github.GithubObject.NotSet:
params["participating"] = participating
# convert True, False to true, false for api parameters
params["participating"] = "true" if participating else "false"
if since is not github.GithubObject.NotSet:
params["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
if before is not github.GithubObject.NotSet:
Expand Down
2 changes: 1 addition & 1 deletion github/Branch.py
Expand Up @@ -123,7 +123,7 @@ def edit_protection(
team_push_restrictions=github.GithubObject.NotSet,
):
"""
:calls: `PUT /repos/{owner}/{repo}/branches/{branch}/protection <https://docs.github.com/en/rest/reference/repos#branches>`_
:calls: `PUT /repos/{owner}/{repo}/branches/{branch}/protection <https://docs.github.com/en/rest/reference/repos#get-branch-protection>`_
:strict: bool
:contexts: list of strings
:enforce_admins: bool
Expand Down
1 change: 0 additions & 1 deletion github/CheckRun.py
Expand Up @@ -276,7 +276,6 @@ def _initAttributes(self):
self._name = github.GithubObject.NotSet
self._node_id = github.GithubObject.NotSet
self._output = github.GithubObject.NotSet
self._output = github.GithubObject.NotSet
self._pull_requests = github.GithubObject.NotSet
self._started_at = github.GithubObject.NotSet
self._status = github.GithubObject.NotSet
Expand Down
10 changes: 5 additions & 5 deletions github/Commit.py
Expand Up @@ -45,7 +45,7 @@

class Commit(github.GithubObject.CompletableGithubObject):
"""
This class represents Commits. The reference can be found here http://docs.github.com/en/rest/reference/git#commits
This class represents Commits. The reference can be found here https://docs.github.com/en/rest/reference/git#commits
"""

def __repr__(self):
Expand Down Expand Up @@ -139,7 +139,7 @@ def create_comment(
position=github.GithubObject.NotSet,
):
"""
:calls: `POST /repos/{owner}/{repo}/commits/{sha}/comments <http://docs.github.com/en/rest/reference/repos#comments>`_
:calls: `POST /repos/{owner}/{repo}/commits/{sha}/comments <https://docs.github.com/en/rest/reference/repos#comments>`_
:param body: string
:param line: integer
:param path: string
Expand Down Expand Up @@ -176,7 +176,7 @@ def create_status(
context=github.GithubObject.NotSet,
):
"""
:calls: `POST /repos/{owner}/{repo}/statuses/{sha} <http://docs.github.com/en/rest/reference/repos#statuses>`_
:calls: `POST /repos/{owner}/{repo}/statuses/{sha} <https://docs.github.com/en/rest/reference/repos#statuses>`_
:param state: string
:param target_url: string
:param description: string
Expand Down Expand Up @@ -213,7 +213,7 @@ def create_status(

def get_comments(self):
"""
:calls: `GET /repos/{owner}/{repo}/commits/{sha}/comments <http://docs.github.com/en/rest/reference/repos#comments>`_
:calls: `GET /repos/{owner}/{repo}/commits/{sha}/comments <https://docs.github.com/en/rest/reference/repos#comments>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.CommitComment.CommitComment`
"""
return github.PaginatedList.PaginatedList(
Expand All @@ -225,7 +225,7 @@ def get_comments(self):

def get_statuses(self):
"""
:calls: `GET /repos/{owner}/{repo}/statuses/{ref} <http://docs.github.com/en/rest/reference/repos#statuses>`_
:calls: `GET /repos/{owner}/{repo}/statuses/{ref} <https://docs.github.com/en/rest/reference/repos#statuses>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.CommitStatus.CommitStatus`
"""
return github.PaginatedList.PaginatedList(
Expand Down
2 changes: 2 additions & 0 deletions github/Commit.pyi
Expand Up @@ -11,6 +11,7 @@ from github.GitCommit import GitCommit
from github.GithubObject import CompletableGithubObject, _NotSetType
from github.NamedUser import NamedUser
from github.PaginatedList import PaginatedList
from github.PullRequest import PullRequest

class Commit(CompletableGithubObject):
def __repr__(self) -> str: ...
Expand Down Expand Up @@ -50,6 +51,7 @@ class Commit(CompletableGithubObject):
def get_combined_status(self) -> CommitCombinedStatus: ...
def get_comments(self) -> PaginatedList[CommitComment]: ...
def get_statuses(self) -> PaginatedList[CommitStatus]: ...
def get_pulls(self) -> PaginatedList[PullRequest]: ...
def get_check_runs(
self,
check_name: Union[_NotSetType, str] = ...,
Expand Down
4 changes: 2 additions & 2 deletions github/CommitComment.py
Expand Up @@ -135,14 +135,14 @@ def user(self):

def delete(self):
"""
:calls: `DELETE /repos/{owner}/{repo}/comments/{id} <http://docs.github.com/en/rest/reference/repos#comments>`_
:calls: `DELETE /repos/{owner}/{repo}/comments/{id} <https://docs.github.com/en/rest/reference/repos#comments>`_
:rtype: None
"""
headers, data = self._requester.requestJsonAndCheck("DELETE", self.url)

def edit(self, body):
"""
:calls: `PATCH /repos/{owner}/{repo}/comments/{id} <http://docs.github.com/en/rest/reference/repos#comments>`_
:calls: `PATCH /repos/{owner}/{repo}/comments/{id} <https://docs.github.com/en/rest/reference/repos#comments>`_
:param body: string
:rtype: None
"""
Expand Down
18 changes: 9 additions & 9 deletions github/Gist.py
Expand Up @@ -201,7 +201,7 @@ def user(self):

def create_comment(self, body):
"""
:calls: `POST /gists/{gist_id}/comments <http://docs.github.com/en/rest/reference/gists#comments>`_
:calls: `POST /gists/{gist_id}/comments <https://docs.github.com/en/rest/reference/gists#comments>`_
:param body: string
:rtype: :class:`github.GistComment.GistComment`
"""
Expand All @@ -218,15 +218,15 @@ def create_comment(self, body):

def create_fork(self):
"""
:calls: `POST /gists/{id}/forks <http://docs.github.com/en/rest/reference/gists>`_
:calls: `POST /gists/{id}/forks <https://docs.github.com/en/rest/reference/gists>`_
:rtype: :class:`github.Gist.Gist`
"""
headers, data = self._requester.requestJsonAndCheck("POST", f"{self.url}/forks")
return Gist(self._requester, headers, data, completed=True)

def delete(self):
"""
:calls: `DELETE /gists/{id} <http://docs.github.com/en/rest/reference/gists>`_
:calls: `DELETE /gists/{id} <https://docs.github.com/en/rest/reference/gists>`_
:rtype: None
"""
headers, data = self._requester.requestJsonAndCheck("DELETE", self.url)
Expand All @@ -235,7 +235,7 @@ def edit(
self, description=github.GithubObject.NotSet, files=github.GithubObject.NotSet
):
"""
:calls: `PATCH /gists/{id} <http://docs.github.com/en/rest/reference/gists>`_
:calls: `PATCH /gists/{id} <https://docs.github.com/en/rest/reference/gists>`_
:param description: string
:param files: dict of string to :class:`github.InputFileContent.InputFileContent`
:rtype: None
Expand All @@ -262,7 +262,7 @@ def edit(

def get_comment(self, id):
"""
:calls: `GET /gists/{gist_id}/comments/{id} <http://docs.github.com/en/rest/reference/gists#comments>`_
:calls: `GET /gists/{gist_id}/comments/{id} <https://docs.github.com/en/rest/reference/gists#comments>`_
:param id: integer
:rtype: :class:`github.GistComment.GistComment`
"""
Expand All @@ -276,7 +276,7 @@ def get_comment(self, id):

def get_comments(self):
"""
:calls: `GET /gists/{gist_id}/comments <http://docs.github.com/en/rest/reference/gists#comments>`_
:calls: `GET /gists/{gist_id}/comments <https://docs.github.com/en/rest/reference/gists#comments>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.GistComment.GistComment`
"""
return github.PaginatedList.PaginatedList(
Expand All @@ -288,15 +288,15 @@ def get_comments(self):

def is_starred(self):
"""
:calls: `GET /gists/{id}/star <http://docs.github.com/en/rest/reference/gists>`_
:calls: `GET /gists/{id}/star <https://docs.github.com/en/rest/reference/gists>`_
:rtype: bool
"""
status, headers, data = self._requester.requestJson("GET", f"{self.url}/star")
return status == 204

def reset_starred(self):
"""
:calls: `DELETE /gists/{id}/star <http://docs.github.com/en/rest/reference/gists>`_
:calls: `DELETE /gists/{id}/star <https://docs.github.com/en/rest/reference/gists>`_
:rtype: None
"""
headers, data = self._requester.requestJsonAndCheck(
Expand All @@ -305,7 +305,7 @@ def reset_starred(self):

def set_starred(self):
"""
:calls: `PUT /gists/{id}/star <http://docs.github.com/en/rest/reference/gists>`_
:calls: `PUT /gists/{id}/star <https://docs.github.com/en/rest/reference/gists>`_
:rtype: None
"""
headers, data = self._requester.requestJsonAndCheck("PUT", f"{self.url}/star")
Expand Down
4 changes: 2 additions & 2 deletions github/GistComment.py
Expand Up @@ -90,14 +90,14 @@ def user(self):

def delete(self):
"""
:calls: `DELETE /gists/{gist_id}/comments/{id} <http://docs.github.com/en/rest/reference/gists#comments>`_
:calls: `DELETE /gists/{gist_id}/comments/{id} <https://docs.github.com/en/rest/reference/gists#comments>`_
:rtype: None
"""
headers, data = self._requester.requestJsonAndCheck("DELETE", self.url)

def edit(self, body):
"""
:calls: `PATCH /gists/{gist_id}/comments/{id} <http://docs.github.com/en/rest/reference/gists#comments>`_
:calls: `PATCH /gists/{gist_id}/comments/{id} <https://docs.github.com/en/rest/reference/gists#comments>`_
:param body: string
:rtype: None
"""
Expand Down
6 changes: 3 additions & 3 deletions github/GitRef.py
Expand Up @@ -34,7 +34,7 @@

class GitRef(github.GithubObject.CompletableGithubObject):
"""
This class represents GitRefs. The reference can be found here https://docs.github.com/en/rest/reference/git#refs
This class represents GitRefs. The reference can be found here https://docs.github.com/en/rest/reference/git#references
"""

def __repr__(self):
Expand Down Expand Up @@ -66,14 +66,14 @@ def url(self):

def delete(self):
"""
:calls: `DELETE /repos/{owner}/{repo}/git/refs/{ref} <http://docs.github.com/en/rest/reference/git#refs>`_
:calls: `DELETE /repos/{owner}/{repo}/git/refs/{ref} <https://docs.github.com/en/rest/reference/git#references>`_
:rtype: None
"""
headers, data = self._requester.requestJsonAndCheck("DELETE", self.url)

def edit(self, sha, force=github.GithubObject.NotSet):
"""
:calls: `PATCH /repos/{owner}/{repo}/git/refs/{ref} <http://docs.github.com/en/rest/reference/git#refs>`_
:calls: `PATCH /repos/{owner}/{repo}/git/refs/{ref} <https://docs.github.com/en/rest/reference/git#references>`_
:param sha: string
:param force: bool
:rtype: None
Expand Down
10 changes: 5 additions & 5 deletions github/GitRelease.py
Expand Up @@ -172,7 +172,7 @@ def zipball_url(self):

def delete_release(self):
"""
:calls: `DELETE /repos/{owner}/{repo}/releases/{release_id} <https://docs.github.com/en/rest/reference/repos/releases#delete-a-release>`_
:calls: `DELETE /repos/{owner}/{repo}/releases/{release_id} <https://docs.github.com/en/rest/reference/repos#delete-a-release>`_
:rtype: None
"""
headers, data = self._requester.requestJsonAndCheck("DELETE", self.url)
Expand All @@ -187,7 +187,7 @@ def update_release(
target_commitish=github.GithubObject.NotSet,
):
"""
:calls: `PATCH /repos/{owner}/{repo}/releases/{release_id} <https://docs.github.com/en/rest/reference/repos/releases#edit-a-release>`_
:calls: `PATCH /repos/{owner}/{repo}/releases/{release_id} <https://docs.github.com/en/rest/reference/repos#update-a-release>`_
:param name: string
:param message: string
:param draft: bool
Expand Down Expand Up @@ -234,7 +234,7 @@ def upload_asset(
name=github.GithubObject.NotSet,
):
"""
:calls: `POST https://<upload_url>/repos/{owner}/{repo}/releases/{release_id}/assets <https://docs.github.com/en/rest/reference/repos/releases#upload-a-release-asset>`_
:calls: `POST https://<upload_url>/repos/{owner}/{repo}/releases/{release_id}/assets <https://docs.github.com/en/rest/reference/repos#upload-a-release-asset>`_
:param path: string
:param label: string
:param content_type: string
Expand Down Expand Up @@ -274,7 +274,7 @@ def upload_asset_from_memory(
):
"""Uploads an asset. Unlike ``upload_asset()`` this method allows you to pass in a file-like object to upload.
Note that this method is more strict and requires you to specify the ``name``, since there's no file name to infer these from.
:calls: `POST https://<upload_url>/repos/{owner}/{repo}/releases/{release_id}/assets <https://docs.github.com/en/rest/reference/repos/releases#upload-a-release-asset>`_
:calls: `POST https://<upload_url>/repos/{owner}/{repo}/releases/{release_id}/assets <https://docs.github.com/en/rest/reference/repos#upload-a-release-asset>`_
:param file_like: binary file-like object, such as those returned by ``open("file_name", "rb")``. At the very minimum, this object must implement ``read()``.
:param file_size: int, size in bytes of ``file_like``
:param content_type: string
Expand Down Expand Up @@ -307,7 +307,7 @@ def upload_asset_from_memory(

def get_assets(self):
"""
:calls: `GET /repos/{owner}/{repo}/releases/{release_id}/assets <https://docs.github.com/en/rest/reference/repos/releases#list-assets-for-a-release>`_
:calls: `GET /repos/{owner}/{repo}/releases/{release_id}/assets <https://docs.github.com/en/rest/reference/repos#list-release-assets>`_
:rtype: :class:`github.PaginatedList.PaginatedList`
"""
return github.PaginatedList.PaginatedList(
Expand Down
3 changes: 3 additions & 0 deletions github/GithubObject.py
Expand Up @@ -286,6 +286,9 @@ def __init__(self, requester, headers, attributes, completed):
def __eq__(self, other):
return other.__class__ is self.__class__ and other._url.value == self._url.value

def __hash__(self):
return hash(self._url.value)

def __ne__(self, other):
return not self == other

Expand Down
10 changes: 5 additions & 5 deletions github/Hook.py
Expand Up @@ -35,7 +35,7 @@

class Hook(github.GithubObject.CompletableGithubObject):
"""
This class represents Hooks. The reference can be found here http://docs.github.com/en/rest/reference/repos#webhooks
This class represents Hooks. The reference can be found here https://docs.github.com/en/rest/reference/repos#webhooks
"""

def __repr__(self):
Expand Down Expand Up @@ -131,7 +131,7 @@ def ping_url(self):

def delete(self):
"""
:calls: `DELETE /repos/{owner}/{repo}/hooks/{id} <http://docs.github.com/en/rest/reference/repos#webhooks>`_
:calls: `DELETE /repos/{owner}/{repo}/hooks/{id} <https://docs.github.com/en/rest/reference/repos#webhooks>`_
:rtype: None
"""
headers, data = self._requester.requestJsonAndCheck("DELETE", self.url)
Expand All @@ -146,7 +146,7 @@ def edit(
active=github.GithubObject.NotSet,
):
"""
:calls: `PATCH /repos/{owner}/{repo}/hooks/{id} <http://docs.github.com/en/rest/reference/repos#webhooks>`_
:calls: `PATCH /repos/{owner}/{repo}/hooks/{id} <https://docs.github.com/en/rest/reference/repos#webhooks>`_
:param name: string
:param config: dict
:param events: list of string
Expand Down Expand Up @@ -186,14 +186,14 @@ def edit(

def test(self):
"""
:calls: `POST /repos/{owner}/{repo}/hooks/{id}/tests <http://docs.github.com/en/rest/reference/repos#webhooks>`_
:calls: `POST /repos/{owner}/{repo}/hooks/{id}/tests <https://docs.github.com/en/rest/reference/repos#webhooks>`_
:rtype: None
"""
headers, data = self._requester.requestJsonAndCheck("POST", f"{self.url}/tests")

def ping(self):
"""
:calls: `POST /repos/{owner}/{repo}/hooks/{id}/pings <http://docs.github.com/en/rest/reference/repos#webhooks>`_
:calls: `POST /repos/{owner}/{repo}/hooks/{id}/pings <https://docs.github.com/en/rest/reference/repos#webhooks>`_
:rtype: None
"""
headers, data = self._requester.requestJsonAndCheck("POST", f"{self.url}/pings")
Expand Down

0 comments on commit 178e23d

Please sign in to comment.