From 843e455fb69b68cfee538663ba3e2a5659dc33d8 Mon Sep 17 00:00:00 2001 From: Jirka Date: Fri, 7 Jul 2023 10:00:40 +0200 Subject: [PATCH 01/12] precommit: add docformatter --- .pre-commit-config.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 599bbf7f55..512a0b7f39 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ repos: - id: check-symlinks - id: destroyed-symlinks - id: mixed-line-ending - args: [ --fix=lf ] + args: ["--fix=lf"] - repo: https://github.com/asottile/pyupgrade rev: v3.1.0 @@ -33,3 +33,12 @@ repos: rev: 23.3.0 hooks: - id: black + + - repo: https://github.com/PyCQA/docformatter + rev: v1.6.3 + hooks: + - id: docformatter + args: + - "--in-place" + - "--wrap-summaries=120" + - "--wrap-descriptions=120" From b30ea575432c31b80c0a101926ac99a7c56486e7 Mon Sep 17 00:00:00 2001 From: Jirka B Date: Tue, 25 Jul 2023 09:47:59 -1000 Subject: [PATCH 02/12] conf in pyproject --- .pre-commit-config.yaml | 8 +++----- pyproject.toml | 6 ++++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 512a0b7f39..f82e383c46 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,10 +35,8 @@ repos: - id: black - repo: https://github.com/PyCQA/docformatter - rev: v1.6.3 + rev: v1.7.5 hooks: - id: docformatter - args: - - "--in-place" - - "--wrap-summaries=120" - - "--wrap-descriptions=120" + additional_dependencies: [tomli] + args: ["--in-place"] diff --git a/pyproject.toml b/pyproject.toml index 1b1c3a3d1e..137ed3b936 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,6 +14,12 @@ disallow_untyped_defs = true line-length = 120 target-version = ['py37'] +[tool.docformatter] +recursive = true +wrap-summaries = 120 +wrap-descriptions = 120 +blank = true + [tool.ruff] line-length = 120 From 5a53808e8556868a4e809a7ef57741381972adf2 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 14 Sep 2023 23:05:38 +0200 Subject: [PATCH 03/12] apply & fixing --- github/AccessToken.py | 4 +- github/ApplicationOAuth.py | 8 +- github/Artifact.py | 4 +- github/Auth.py | 58 +++++++------- github/Authorization.py | 7 +- github/AuthorizationApplication.py | 4 +- github/Autolink.py | 5 +- github/Branch.py | 6 +- github/BranchProtection.py | 6 +- github/CWE.py | 5 +- github/CheckRun.py | 5 +- github/CheckRunAnnotation.py | 5 +- github/CheckSuite.py | 6 +- github/Clones.py | 5 +- github/CodeScanAlert.py | 11 ++- github/CodeScanAlertInstance.py | 5 +- github/CodeScanAlertInstanceLocation.py | 5 +- github/CodeScanRule.py | 5 +- github/CodeScanTool.py | 5 +- github/Commit.py | 6 +- github/CommitCombinedStatus.py | 6 +- github/CommitComment.py | 6 +- github/CommitStats.py | 4 +- github/Comparison.py | 4 +- github/ContentFile.py | 6 +- github/Deployment.py | 6 +- github/DeploymentStatus.py | 6 +- github/Download.py | 6 +- github/Enterprise.py | 7 +- github/EnterpriseConsumedLicenses.py | 7 +- github/Environment.py | 6 +- github/EnvironmentDeploymentBranchPolicy.py | 10 +-- github/EnvironmentProtectionRule.py | 6 +- github/EnvironmentProtectionRuleReviewer.py | 10 +-- github/Event.py | 6 +- github/File.py | 4 +- github/Gist.py | 6 +- github/GistComment.py | 6 +- github/GistFile.py | 4 +- github/GistHistoryState.py | 4 +- github/GitAuthor.py | 4 +- github/GitBlob.py | 6 +- github/GitCommit.py | 6 +- github/GitObject.py | 4 +- github/GitRef.py | 6 +- github/GitRelease.py | 11 ++- github/GitReleaseAsset.py | 14 ++-- github/GitTag.py | 6 +- github/GitTree.py | 6 +- github/GitTreeElement.py | 4 +- github/GithubApp.py | 6 +- github/GithubException.py | 60 +++++---------- github/GithubIntegration.py | 23 +++--- github/GithubObject.py | 14 +--- github/GithubRetry.py | 4 +- github/GitignoreTemplate.py | 6 +- github/Hook.py | 6 +- github/HookDelivery.py | 16 +--- github/HookDescription.py | 4 +- github/HookResponse.py | 4 +- github/InputFileContent.py | 4 +- github/InputGitAuthor.py | 4 +- github/InputGitTreeElement.py | 4 +- github/Installation.py | 6 +- github/InstallationAuthorization.py | 4 +- github/Invitation.py | 6 +- github/Issue.py | 6 +- github/IssueComment.py | 6 +- github/IssueEvent.py | 6 +- github/IssuePullRequest.py | 4 +- github/Label.py | 6 +- github/License.py | 6 +- github/MainClass.py | 65 ++++++++++------ github/Membership.py | 6 +- github/Migration.py | 6 +- github/Milestone.py | 6 +- github/NamedEnterpriseUser.py | 7 +- github/NamedUser.py | 6 +- github/Notification.py | 6 +- github/NotificationSubject.py | 7 +- github/Organization.py | 18 ++--- github/OrganizationSecret.py | 6 +- github/OrganizationVariable.py | 6 +- github/Path.py | 5 +- github/Permissions.py | 4 +- github/Plan.py | 4 +- github/Project.py | 6 +- github/ProjectCard.py | 6 +- github/ProjectColumn.py | 6 +- github/PublicKey.py | 10 ++- github/PullRequest.py | 6 +- github/PullRequestComment.py | 6 +- github/PullRequestMergeStatus.py | 7 +- github/PullRequestPart.py | 4 +- github/PullRequestReview.py | 6 +- github/Rate.py | 6 +- github/RateLimit.py | 24 ++---- github/Reaction.py | 6 +- github/Referrer.py | 5 +- github/Repository.py | 76 ++++++++++--------- github/RepositoryAdvisory.py | 5 +- github/RepositoryAdvisoryCredit.py | 9 +-- github/RepositoryAdvisoryCreditDetailed.py | 5 +- github/RepositoryAdvisoryVulnerability.py | 13 ++-- .../RepositoryAdvisoryVulnerabilityPackage.py | 5 +- github/RepositoryKey.py | 6 +- github/RepositoryPreferences.py | 8 +- github/Requester.py | 25 ++---- github/RequiredPullRequestReviews.py | 7 +- github/RequiredStatusChecks.py | 6 +- github/Secret.py | 6 +- github/SelfHostedActionsRunner.py | 6 +- github/SourceImport.py | 6 +- github/Stargazer.py | 6 +- github/StatsCodeFrequency.py | 8 +- github/StatsCommitActivity.py | 7 +- github/StatsContributor.py | 11 +-- github/StatsParticipation.py | 6 +- github/StatsPunchCard.py | 9 ++- github/Tag.py | 6 +- github/Team.py | 6 +- github/TeamDiscussion.py | 6 +- github/TimelineEvent.py | 6 +- github/TimelineEventSource.py | 6 +- github/UserKey.py | 6 +- github/Variable.py | 6 +- github/View.py | 5 +- github/Workflow.py | 6 +- github/WorkflowJob.py | 6 +- github/WorkflowRun.py | 6 +- github/WorkflowStep.py | 6 +- github/__init__.py | 19 ++--- 132 files changed, 612 insertions(+), 515 deletions(-) diff --git a/github/AccessToken.py b/github/AccessToken.py index 86201f5eb7..221da27ff5 100644 --- a/github/AccessToken.py +++ b/github/AccessToken.py @@ -28,9 +28,7 @@ class AccessToken(NonCompletableGithubObject): - """ - This class represents access tokens. - """ + """This class represents access tokens.""" _created: datetime diff --git a/github/ApplicationOAuth.py b/github/ApplicationOAuth.py index 63cfa859de..4e6ceb8fa1 100644 --- a/github/ApplicationOAuth.py +++ b/github/ApplicationOAuth.py @@ -37,9 +37,11 @@ class ApplicationOAuth(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/building-github-apps/identifying-and-authorizing-users-for-github-apps + """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/building-github-apps/identifying-and-authorizing-users-for-github-apps + """ def _initAttributes(self) -> None: diff --git a/github/Artifact.py b/github/Artifact.py index 53c3d11bc8..135c1f635a 100644 --- a/github/Artifact.py +++ b/github/Artifact.py @@ -32,9 +32,7 @@ class Artifact(NonCompletableGithubObject): - """ - This class represents an Artifact of Github Run - """ + """This class represents an Artifact of Github Run.""" def _initAttributes(self) -> None: self._archive_download_url: Attribute[str] = NotSet diff --git a/github/Auth.py b/github/Auth.py index 41e5e42e17..97c68d0f1e 100644 --- a/github/Auth.py +++ b/github/Auth.py @@ -40,24 +40,24 @@ class Auth(abc.ABC): - """ - This class is the base class of all authentication methods for Requester. - """ + """This class is the base class of all authentication methods for Requester.""" @property @abc.abstractmethod def token_type(self) -> str: - """ - The type of the auth token as used in the HTTP Authorization header, e.g. Bearer or Basic. + """The type of the auth token as used in the HTTP Authorization header, e.g. Bearer or Basic. + :return: token type + """ @property @abc.abstractmethod def token(self) -> str: - """ - The auth token as used in the HTTP Authorization header. + """The auth token as used in the HTTP Authorization header. + :return: token + """ @@ -70,7 +70,7 @@ def username(self) -> str: @property @abc.abstractmethod def password(self) -> str: - """The password""" + """The password.""" @property def token_type(self) -> str: @@ -82,9 +82,7 @@ def token(self) -> str: class Login(HTTPBasicAuth): - """ - This class is used to authenticate Requester with login and password. - """ + """This class is used to authenticate Requester with login and password.""" def __init__(self, login: str, password: str): assert isinstance(login, str) @@ -109,9 +107,7 @@ def password(self) -> str: class Token(Auth): - """ - This class is used to authenticate Requester with a single constant token. - """ + """This class is used to authenticate Requester with a single constant token.""" def __init__(self, token: str): assert isinstance(token, str) @@ -128,9 +124,10 @@ def token(self) -> str: class JWT(Auth, ABC): - """ - This class is the base class to authenticate with a JSON Web Token (JWT). + """This class is the base class to authenticate with a JSON Web Token (JWT). + https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-json-web-token-jwt-for-a-github-app + """ @property @@ -139,9 +136,10 @@ def token_type(self) -> str: class AppAuth(JWT): - """ - This class is used to authenticate Requester as a GitHub App. + """This class is used to authenticate Requester as a GitHub App. + https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app + """ def __init__( @@ -184,12 +182,13 @@ def get_installation_auth( token_permissions: Optional[Dict[str, str]] = None, requester: Optional[Requester] = None, ) -> "AppInstallationAuth": - """ - Creates a github.Auth.AppInstallationAuth instance for an installation. + """Creates a github.Auth.AppInstallationAuth instance for an installation. + :param installation_id: installation id :param token_permissions: optional permissions :param requester: optional requester with app authentication :return: + """ return AppInstallationAuth(self, installation_id, token_permissions, requester) @@ -218,9 +217,10 @@ def create_jwt(self, expiration: Optional[int] = None) -> str: class AppAuthToken(JWT): - """ - This class is used to authenticate Requester as a GitHub App with a single constant JWT. + """This class is used to authenticate Requester as a GitHub App with a single constant JWT. + https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app + """ def __init__(self, token: str): @@ -234,9 +234,10 @@ def token(self) -> str: class AppInstallationAuth(Auth, WithRequester["AppInstallationAuth"]): - """ - This class is used to authenticate Requester as a GitHub App Installation. + """This class is used to authenticate Requester as a GitHub App Installation. + https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app-installation + """ # imported here to avoid circular import, needed for typing only @@ -316,9 +317,10 @@ def _get_installation_authorization(self) -> InstallationAuthorization: class AppUserAuth(Auth, WithRequester["AppUserAuth"]): - """ - This class is used to authenticate Requester as a GitHub App on behalf of a user. + """This class is used to authenticate Requester as a GitHub App on behalf of a user. + https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-with-a-github-app-on-behalf-of-a-user + """ _client_id: str @@ -444,9 +446,7 @@ def refresh_expires_at(self) -> Optional[datetime]: class NetrcAuth(HTTPBasicAuth, WithRequester["NetrcAuth"]): - """ - This class is used to authenticate Requester via .netrc. - """ + """This class is used to authenticate Requester via .netrc.""" def __init__(self) -> None: super().__init__() diff --git a/github/Authorization.py b/github/Authorization.py index 7738f559fe..d574f44422 100644 --- a/github/Authorization.py +++ b/github/Authorization.py @@ -41,8 +41,11 @@ class Authorization(github.GithubObject.CompletableGithubObject): - """ - This class represents Authorizations. The reference can be found here https://docs.github.com/en/enterprise-server@3.0/rest/reference/oauth-authorizations + """This class represents Authorizations. + + The reference can be found here + https://docs.github.com/en/enterprise-server@3.0/rest/reference/oauth-authorizations + """ def _initAttributes(self) -> None: diff --git a/github/AuthorizationApplication.py b/github/AuthorizationApplication.py index b97260be43..97b4ed6d22 100644 --- a/github/AuthorizationApplication.py +++ b/github/AuthorizationApplication.py @@ -34,9 +34,7 @@ class AuthorizationApplication(CompletableGithubObject): - """ - This class represents AuthorizationApplications - """ + """This class represents AuthorizationApplications.""" def _initAttributes(self) -> None: self._name: Attribute[str] = NotSet diff --git a/github/Autolink.py b/github/Autolink.py index 61d4de9da0..5acdef7a47 100644 --- a/github/Autolink.py +++ b/github/Autolink.py @@ -26,9 +26,10 @@ class Autolink(NonCompletableGithubObject): - """ - This class represents Repository autolinks. + """This class represents Repository autolinks. + The reference can be found here https://docs.github.com/en/rest/repos/autolinks?apiVersion=2022-11-28 + """ def _initAttributes(self) -> None: diff --git a/github/Branch.py b/github/Branch.py index e42fc6b52a..e1e5f65fc9 100644 --- a/github/Branch.py +++ b/github/Branch.py @@ -61,8 +61,10 @@ class Branch(NonCompletableGithubObject): - """ - This class represents Branches. The reference can be found here https://docs.github.com/en/rest/reference/repos#branches + """This class represents Branches. + + The reference can be found here https://docs.github.com/en/rest/reference/repos#branches + """ def __repr__(self) -> str: diff --git a/github/BranchProtection.py b/github/BranchProtection.py index 3b7d98378d..a7aa2d468c 100644 --- a/github/BranchProtection.py +++ b/github/BranchProtection.py @@ -40,8 +40,10 @@ class BranchProtection(github.GithubObject.CompletableGithubObject): - """ - This class represents Branch Protection. The reference can be found here https://docs.github.com/en/rest/reference/repos#get-branch-protection + """This class represents Branch Protection. + + The reference can be found here https://docs.github.com/en/rest/reference/repos#get-branch-protection + """ def __repr__(self) -> str: diff --git a/github/CWE.py b/github/CWE.py index 892960c15f..b689bab125 100644 --- a/github/CWE.py +++ b/github/CWE.py @@ -27,9 +27,10 @@ class CWE(CompletableGithubObject): - """ - This class represents a CWE. + """This class represents a CWE. + The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories + """ def _initAttributes(self) -> None: diff --git a/github/CheckRun.py b/github/CheckRun.py index 61eaf9981b..3e26bdd5ba 100644 --- a/github/CheckRun.py +++ b/github/CheckRun.py @@ -49,9 +49,10 @@ class CheckRun(CompletableGithubObject): - """ - This class represents check runs. + """This class represents check runs. + The reference can be found here https://docs.github.com/en/rest/reference/checks#check-runs + """ def _initAttributes(self) -> None: diff --git a/github/CheckRunAnnotation.py b/github/CheckRunAnnotation.py index 9aa4ccd320..7dc8508180 100644 --- a/github/CheckRunAnnotation.py +++ b/github/CheckRunAnnotation.py @@ -26,9 +26,10 @@ class CheckRunAnnotation(NonCompletableGithubObject): - """ - This class represents check run annotations. + """This class represents check run annotations. + The reference can be found here: https://docs.github.com/en/rest/reference/checks#list-check-run-annotations + """ def _initAttributes(self) -> None: diff --git a/github/CheckSuite.py b/github/CheckSuite.py index a6d2eec847..6ee5ba34b3 100644 --- a/github/CheckSuite.py +++ b/github/CheckSuite.py @@ -42,8 +42,10 @@ class CheckSuite(CompletableGithubObject): - """ - This class represents check suites. The reference can be found here https://docs.github.com/en/rest/reference/checks#check-suites + """This class represents check suites. + + The reference can be found here https://docs.github.com/en/rest/reference/checks#check-suites + """ def _initAttributes(self) -> None: diff --git a/github/Clones.py b/github/Clones.py index f5e2fcc6a6..d185363d0b 100644 --- a/github/Clones.py +++ b/github/Clones.py @@ -30,9 +30,10 @@ class Clones(NonCompletableGithubObject): - """ - This class represents a popular Path for a GitHub repository. + """This class represents a popular Path for a GitHub repository. + The reference can be found here https://docs.github.com/en/rest/reference/repos#get-repository-clones + """ def _initAttributes(self) -> None: diff --git a/github/CodeScanAlert.py b/github/CodeScanAlert.py index 1d675a7632..f9c9bcda06 100644 --- a/github/CodeScanAlert.py +++ b/github/CodeScanAlert.py @@ -34,9 +34,10 @@ class CodeScanAlert(NonCompletableGithubObject): - """ - This class represents alerts from code scanning. + """This class represents alerts from code scanning. + The reference can be found here https://docs.github.com/en/rest/reference/code-scanning. + """ def _initAttributes(self) -> None: @@ -105,8 +106,10 @@ def state(self) -> str: return self._state.value def get_instances(self) -> PaginatedList[github.CodeScanAlertInstance.CodeScanAlertInstance]: - """ - :calls: `GET` on the URL for instances as provided by Github + """Get instances. + + :calls: `GET` on the URL for instances as provided by Github. + """ return PaginatedList( github.CodeScanAlertInstance.CodeScanAlertInstance, diff --git a/github/CodeScanAlertInstance.py b/github/CodeScanAlertInstance.py index 75ee0f54a7..13bf09fec2 100644 --- a/github/CodeScanAlertInstance.py +++ b/github/CodeScanAlertInstance.py @@ -31,9 +31,10 @@ class CodeScanAlertInstance(NonCompletableGithubObject): - """ - This class represents code scanning alert instances. + """This class represents code scanning alert instances. + The reference can be found here https://docs.github.com/en/rest/reference/code-scanning. + """ def _initAttributes(self) -> None: diff --git a/github/CodeScanAlertInstanceLocation.py b/github/CodeScanAlertInstanceLocation.py index fad746651f..898f326d0a 100644 --- a/github/CodeScanAlertInstanceLocation.py +++ b/github/CodeScanAlertInstanceLocation.py @@ -25,9 +25,10 @@ class CodeScanAlertInstanceLocation(NonCompletableGithubObject): - """ - This class represents code scanning alert instance locations. + """This class represents code scanning alert instance locations. + The reference can be found here https://docs.github.com/en/rest/reference/code-scanning. + """ def _initAttributes(self) -> None: diff --git a/github/CodeScanRule.py b/github/CodeScanRule.py index 98eb0f7687..e561f2cbff 100644 --- a/github/CodeScanRule.py +++ b/github/CodeScanRule.py @@ -27,9 +27,10 @@ class CodeScanRule(NonCompletableGithubObject): - """ - This class represents Alerts from code scanning. + """This class represents Alerts from code scanning. + The reference can be found here https://docs.github.com/en/rest/reference/code-scanning. + """ def _initAttributes(self) -> None: diff --git a/github/CodeScanTool.py b/github/CodeScanTool.py index d944c8cbd3..83259d737d 100644 --- a/github/CodeScanTool.py +++ b/github/CodeScanTool.py @@ -26,9 +26,10 @@ class CodeScanTool(NonCompletableGithubObject): - """ - This class represents code scanning tools. + """This class represents code scanning tools. + The reference can be found here https://docs.github.com/en/rest/reference/code-scanning. + """ def _initAttributes(self) -> None: diff --git a/github/Commit.py b/github/Commit.py index 4f944e8bb5..8936032886 100644 --- a/github/Commit.py +++ b/github/Commit.py @@ -60,8 +60,10 @@ class Commit(CompletableGithubObject): - """ - This class represents Commits. The reference can be found here https://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 _initAttributes(self) -> None: diff --git a/github/CommitCombinedStatus.py b/github/CommitCombinedStatus.py index d9bfdb3074..3142d311f5 100644 --- a/github/CommitCombinedStatus.py +++ b/github/CommitCombinedStatus.py @@ -33,8 +33,10 @@ class CommitCombinedStatus(NonCompletableGithubObject): - """ - This class represents CommitCombinedStatuses. The reference can be found here https://docs.github.com/en/rest/reference/repos#statuses + """This class represents CommitCombinedStatuses. + + The reference can be found here https://docs.github.com/en/rest/reference/repos#statuses + """ def _initAttributes(self) -> None: diff --git a/github/CommitComment.py b/github/CommitComment.py index 403e9e0644..b0f74f43b6 100644 --- a/github/CommitComment.py +++ b/github/CommitComment.py @@ -46,8 +46,10 @@ class CommitComment(CompletableGithubObject): - """ - This class represents CommitComments. The reference can be found here https://docs.github.com/en/rest/reference/repos#comments + """This class represents CommitComments. + + The reference can be found here https://docs.github.com/en/rest/reference/repos#comments + """ def _initAttributes(self) -> None: diff --git a/github/CommitStats.py b/github/CommitStats.py index 929e263256..1fc63970a0 100644 --- a/github/CommitStats.py +++ b/github/CommitStats.py @@ -33,9 +33,7 @@ class CommitStats(NonCompletableGithubObject): - """ - This class represents CommitStats. - """ + """This class represents CommitStats.""" def _initAttributes(self) -> None: self._total: Attribute[int] = NotSet diff --git a/github/Comparison.py b/github/Comparison.py index f09e3ef2b9..e6ea82fb52 100644 --- a/github/Comparison.py +++ b/github/Comparison.py @@ -36,9 +36,7 @@ class Comparison(CompletableGithubObject): - """ - This class represents Comparisons - """ + """This class represents Comparisons.""" def _initAttributes(self) -> None: self._ahead_by: Attribute[int] = NotSet diff --git a/github/ContentFile.py b/github/ContentFile.py index b20e9f6381..f2137fec3c 100644 --- a/github/ContentFile.py +++ b/github/ContentFile.py @@ -43,8 +43,10 @@ class ContentFile(CompletableGithubObject): - """ - This class represents ContentFiles. The reference can be found here https://docs.github.com/en/rest/reference/repos#contents + """This class represents ContentFiles. + + The reference can be found here https://docs.github.com/en/rest/reference/repos#contents + """ def _initAttributes(self) -> None: diff --git a/github/Deployment.py b/github/Deployment.py index 1ae9d37f62..05efc5d21c 100644 --- a/github/Deployment.py +++ b/github/Deployment.py @@ -34,8 +34,10 @@ class Deployment(CompletableGithubObject): - """ - This class represents Deployments. The reference can be found here https://docs.github.com/en/rest/reference/repos#deployments + """This class represents Deployments. + + The reference can be found here https://docs.github.com/en/rest/reference/repos#deployments + """ def _initAttributes(self) -> None: diff --git a/github/DeploymentStatus.py b/github/DeploymentStatus.py index 528d00ee52..9c83f00f0b 100644 --- a/github/DeploymentStatus.py +++ b/github/DeploymentStatus.py @@ -30,8 +30,10 @@ class DeploymentStatus(CompletableGithubObject): - """ - This class represents Deployment Statuses. The reference can be found here https://docs.github.com/en/rest/reference/repos#deployments + """This class represents Deployment Statuses. + + The reference can be found here https://docs.github.com/en/rest/reference/repos#deployments + """ def _initAttributes(self) -> None: diff --git a/github/Download.py b/github/Download.py index 69d2ea8e1f..defad9787e 100644 --- a/github/Download.py +++ b/github/Download.py @@ -36,8 +36,10 @@ class Download(CompletableGithubObject): - """ - This class represents Downloads. The reference can be found here https://docs.github.com/en/rest/reference/repos + """This class represents Downloads. + + The reference can be found here https://docs.github.com/en/rest/reference/repos + """ def _initAttributes(self) -> None: diff --git a/github/Enterprise.py b/github/Enterprise.py index 5f662cde4a..6dbb95be22 100644 --- a/github/Enterprise.py +++ b/github/Enterprise.py @@ -27,9 +27,12 @@ class Enterprise(NonCompletableGithubObject): - """ - This class represents Enterprises. Such objects do not exist in the Github API, so this class merely collects all endpoints the start with /enterprises/{enterprise}/. See methods below for specific endpoints and docs. + """This class represents Enterprises. + + Such objects do not exist in the Github API, so this class merely collects all endpoints the start with + /enterprises/{enterprise}/. See methods below for specific endpoints and docs. https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin?apiVersion=2022-11-28 + """ def __init__( diff --git a/github/EnterpriseConsumedLicenses.py b/github/EnterpriseConsumedLicenses.py index 08bca61c7d..a9c59e54b5 100644 --- a/github/EnterpriseConsumedLicenses.py +++ b/github/EnterpriseConsumedLicenses.py @@ -27,8 +27,11 @@ class EnterpriseConsumedLicenses(CompletableGithubObject): - """ - This class represents license consumed by enterprises. The reference can be found here https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/license#list-enterprise-consumed-licenses + """This class represents license consumed by enterprises. + + The reference can be found here + https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/license#list-enterprise-consumed-licenses + """ def _initAttributes(self) -> None: diff --git a/github/Environment.py b/github/Environment.py index b611ba15ae..c1cf184bf7 100644 --- a/github/Environment.py +++ b/github/Environment.py @@ -34,8 +34,10 @@ class Environment(CompletableGithubObject): - """ - This class represents Environment. The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments + """This class represents Environment. + + The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments + """ def _initAttributes(self) -> None: diff --git a/github/EnvironmentDeploymentBranchPolicy.py b/github/EnvironmentDeploymentBranchPolicy.py index 5ec5df46f9..cb6e9c60bd 100644 --- a/github/EnvironmentDeploymentBranchPolicy.py +++ b/github/EnvironmentDeploymentBranchPolicy.py @@ -25,8 +25,10 @@ class EnvironmentDeploymentBranchPolicy(NonCompletableGithubObject): - """ - This class represents a deployment branch policy for an environment. The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments + """This class represents a deployment branch policy for an environment. + + The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments + """ def _initAttributes(self) -> None: @@ -52,9 +54,7 @@ def _useAttributes(self, attributes: Dict[str, Any]) -> None: class EnvironmentDeploymentBranchPolicyParams: - """ - This class presents the deployment branch policy parameters as can be configured for an Environment. - """ + """This class presents the deployment branch policy parameters as can be configured for an Environment.""" def __init__(self, protected_branches: bool = False, custom_branch_policies: bool = False): assert isinstance(protected_branches, bool) diff --git a/github/EnvironmentProtectionRule.py b/github/EnvironmentProtectionRule.py index 2cefe9def4..1ffe637061 100644 --- a/github/EnvironmentProtectionRule.py +++ b/github/EnvironmentProtectionRule.py @@ -31,8 +31,10 @@ class EnvironmentProtectionRule(NonCompletableGithubObject): - """ - This class represents a protection rule for an environment. The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments + """This class represents a protection rule for an environment. + + The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments + """ def _initAttributes(self) -> None: diff --git a/github/EnvironmentProtectionRuleReviewer.py b/github/EnvironmentProtectionRuleReviewer.py index 87cf7e8d83..b4ca63b432 100644 --- a/github/EnvironmentProtectionRuleReviewer.py +++ b/github/EnvironmentProtectionRuleReviewer.py @@ -30,8 +30,10 @@ class EnvironmentProtectionRuleReviewer(NonCompletableGithubObject): - """ - This class represents a reviewer for an EnvironmentProtectionRule. The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments + """This class represents a reviewer for an EnvironmentProtectionRule. + + The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments + """ def _initAttributes(self) -> None: @@ -61,9 +63,7 @@ def _useAttributes(self, attributes: dict[str, Any]) -> None: class ReviewerParams: - """ - This class presents reviewers as can be configured for an Environment. - """ + """This class presents reviewers as can be configured for an Environment.""" def __init__(self, type_: str, id_: int): assert isinstance(type_, str) and type_ in ("User", "Team") diff --git a/github/Event.py b/github/Event.py index c15ab83523..a08bf518d3 100644 --- a/github/Event.py +++ b/github/Event.py @@ -40,8 +40,10 @@ class Event(NonCompletableGithubObject): - """ - This class represents Events. The reference can be found here https://docs.github.com/en/rest/reference/activity#events + """This class represents Events. + + The reference can be found here https://docs.github.com/en/rest/reference/activity#events + """ def _initAttributes(self) -> None: diff --git a/github/File.py b/github/File.py index cf7c21c922..b06e71d60c 100644 --- a/github/File.py +++ b/github/File.py @@ -35,9 +35,7 @@ class File(NonCompletableGithubObject): - """ - This class represents Files - """ + """This class represents Files.""" def _initAttributes(self) -> None: self._additions: Attribute[int] = NotSet diff --git a/github/Gist.py b/github/Gist.py index f99660bf04..bf2458540d 100644 --- a/github/Gist.py +++ b/github/Gist.py @@ -51,8 +51,10 @@ class Gist(CompletableGithubObject): - """ - This class represents Gists. The reference can be found here https://docs.github.com/en/rest/reference/gists + """This class represents Gists. + + The reference can be found here https://docs.github.com/en/rest/reference/gists + """ def _initAttributes(self) -> None: diff --git a/github/GistComment.py b/github/GistComment.py index 35f53572f4..4e2337b763 100644 --- a/github/GistComment.py +++ b/github/GistComment.py @@ -38,8 +38,10 @@ class GistComment(CompletableGithubObject): - """ - This class represents GistComments. The reference can be found here https://docs.github.com/en/rest/reference/gists#comments + """This class represents GistComments. + + The reference can be found here https://docs.github.com/en/rest/reference/gists#comments + """ def _initAttributes(self) -> None: diff --git a/github/GistFile.py b/github/GistFile.py index 8d788cded8..b3752092cd 100644 --- a/github/GistFile.py +++ b/github/GistFile.py @@ -33,9 +33,7 @@ class GistFile(NonCompletableGithubObject): - """ - This class represents GistFiles - """ + """This class represents GistFiles.""" def _initAttributes(self) -> None: self._content: Attribute[str] = NotSet diff --git a/github/GistHistoryState.py b/github/GistHistoryState.py index 976d8f3442..182d204703 100644 --- a/github/GistHistoryState.py +++ b/github/GistHistoryState.py @@ -40,9 +40,7 @@ class GistHistoryState(CompletableGithubObject): - """ - This class represents GistHistoryStates - """ + """This class represents GistHistoryStates.""" def _initAttributes(self) -> None: self._change_status: Attribute[github.CommitStats.CommitStats] = NotSet diff --git a/github/GitAuthor.py b/github/GitAuthor.py index b5a847f37e..03b3d64c92 100644 --- a/github/GitAuthor.py +++ b/github/GitAuthor.py @@ -34,9 +34,7 @@ class GitAuthor(NonCompletableGithubObject): - """ - This class represents GitAuthors - """ + """This class represents GitAuthors.""" def _initAttributes(self) -> None: self._name: Attribute[str] = NotSet diff --git a/github/GitBlob.py b/github/GitBlob.py index 0558d05d3f..8678cdfe3a 100644 --- a/github/GitBlob.py +++ b/github/GitBlob.py @@ -34,8 +34,10 @@ class GitBlob(CompletableGithubObject): - """ - This class represents GitBlobs. The reference can be found here https://docs.github.com/en/rest/reference/git#blobs + """This class represents GitBlobs. + + The reference can be found here https://docs.github.com/en/rest/reference/git#blobs + """ def _initAttributes(self) -> None: diff --git a/github/GitCommit.py b/github/GitCommit.py index 734225267d..f00cfc4a98 100644 --- a/github/GitCommit.py +++ b/github/GitCommit.py @@ -38,8 +38,10 @@ class GitCommit(CompletableGithubObject): - """ - This class represents GitCommits. The reference can be found here https://docs.github.com/en/rest/reference/git#commits + """This class represents GitCommits. + + The reference can be found here https://docs.github.com/en/rest/reference/git#commits + """ def _initAttributes(self) -> None: diff --git a/github/GitObject.py b/github/GitObject.py index 66948acd81..9a539ac3b5 100644 --- a/github/GitObject.py +++ b/github/GitObject.py @@ -34,9 +34,7 @@ class GitObject(NonCompletableGithubObject): - """ - This class represents GitObjects - """ + """This class represents GitObjects.""" def _initAttributes(self) -> None: self._sha: Attribute[str] = NotSet diff --git a/github/GitRef.py b/github/GitRef.py index 043b094fc7..5708305fab 100644 --- a/github/GitRef.py +++ b/github/GitRef.py @@ -41,8 +41,10 @@ class GitRef(CompletableGithubObject): - """ - This class represents GitRefs. The reference can be found here https://docs.github.com/en/rest/reference/git#references + """This class represents GitRefs. + + The reference can be found here https://docs.github.com/en/rest/reference/git#references + """ def _initAttributes(self) -> None: diff --git a/github/GitRelease.py b/github/GitRelease.py index d0036585c2..91b08bb3cf 100644 --- a/github/GitRelease.py +++ b/github/GitRelease.py @@ -47,8 +47,10 @@ class GitRelease(CompletableGithubObject): - """ - This class represents GitReleases. The reference can be found here https://docs.github.com/en/rest/reference/repos#releases + """This class represents GitReleases. + + The reference can be found here https://docs.github.com/en/rest/reference/repos#releases + """ def _initAttributes(self) -> None: @@ -230,11 +232,14 @@ def upload_asset_from_memory( content_type: Opt[str] = NotSet, label: str = "", ) -> github.GitReleaseAsset.GitReleaseAsset: - """Uploads an asset. Unlike ``upload_asset()`` this method allows you to pass in a file-like object to upload. + """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:///repos/{owner}/{repo}/releases/{release_id}/assets `_ :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`` + """ assert isinstance(name, str), name assert isinstance(file_size, int), file_size diff --git a/github/GitReleaseAsset.py b/github/GitReleaseAsset.py index 919ce2deaf..eaf37b1548 100644 --- a/github/GitReleaseAsset.py +++ b/github/GitReleaseAsset.py @@ -32,8 +32,10 @@ class GitReleaseAsset(CompletableGithubObject): - """ - This class represents GitReleaseAssets. The reference can be found here https://docs.github.com/en/rest/reference/repos#releases + """This class represents GitReleaseAssets. + + The reference can be found here https://docs.github.com/en/rest/reference/repos#releases + """ def _initAttributes(self) -> None: @@ -114,16 +116,12 @@ def uploader(self) -> github.NamedUser.NamedUser: return self._uploader.value def delete_asset(self) -> bool: - """ - Delete asset from the release. - """ + """Delete asset from the release.""" headers, data = self._requester.requestJsonAndCheck("DELETE", self.url) return True def update_asset(self, name: str, label: str = "") -> GitReleaseAsset: - """ - Update asset metadata. - """ + """Update asset metadata.""" assert isinstance(name, str), name assert isinstance(label, str), label post_parameters = {"name": name, "label": label} diff --git a/github/GitTag.py b/github/GitTag.py index c576b1a226..c65990f0f0 100644 --- a/github/GitTag.py +++ b/github/GitTag.py @@ -44,8 +44,10 @@ class GitTag(CompletableGithubObject): - """ - This class represents GitTags. The reference can be found here https://docs.github.com/en/rest/reference/git#tags + """This class represents GitTags. + + The reference can be found here https://docs.github.com/en/rest/reference/git#tags + """ def _initAttributes(self) -> None: diff --git a/github/GitTree.py b/github/GitTree.py index ad26d25ae4..5b5a195496 100644 --- a/github/GitTree.py +++ b/github/GitTree.py @@ -40,8 +40,10 @@ class GitTree(CompletableGithubObject): - """ - This class represents GitTrees. The reference can be found here https://docs.github.com/en/rest/reference/git#trees + """This class represents GitTrees. + + The reference can be found here https://docs.github.com/en/rest/reference/git#trees + """ def _initAttributes(self) -> None: diff --git a/github/GitTreeElement.py b/github/GitTreeElement.py index bd0b4b39dc..41cf77ea6a 100644 --- a/github/GitTreeElement.py +++ b/github/GitTreeElement.py @@ -34,9 +34,7 @@ class GitTreeElement(NonCompletableGithubObject): - """ - This class represents GitTreeElements - """ + """This class represents GitTreeElements.""" def _initAttributes(self) -> None: self._mode: Attribute[str] = NotSet diff --git a/github/GithubApp.py b/github/GithubApp.py index eaab36e184..8d5ea7e0d8 100644 --- a/github/GithubApp.py +++ b/github/GithubApp.py @@ -30,8 +30,10 @@ class GithubApp(CompletableGithubObject): - """ - This class represents github apps. The reference can be found here https://docs.github.com/en/rest/reference/apps + """This class represents github apps. + + The reference can be found here https://docs.github.com/en/rest/reference/apps + """ def _initAttributes(self) -> None: diff --git a/github/GithubException.py b/github/GithubException.py index 42f50d2cab..36d5aa8350 100644 --- a/github/GithubException.py +++ b/github/GithubException.py @@ -32,10 +32,11 @@ class GithubException(Exception): - """ - Error handling in PyGithub is done with exceptions. This class is the base of all exceptions raised by PyGithub (but :class:`github.GithubException.BadAttributeException`). + """Error handling in PyGithub is done with exceptions. This class is the base of all exceptions raised by PyGithub + (but :class:`github.GithubException.BadAttributeException`). Some other types of exceptions might be raised by underlying libraries, for example for network-related issues. + """ def __init__( @@ -58,23 +59,17 @@ def message(self) -> Optional[str]: @property def status(self) -> int: - """ - The status returned by the Github API - """ + """The status returned by the Github API.""" return self.__status @property def data(self) -> Any: - """ - The (decoded) data returned by the Github API - """ + """The (decoded) data returned by the Github API.""" return self.__data @property def headers(self) -> Optional[Dict[str, str]]: - """ - The headers returned by the Github API - """ + """The headers returned by the Github API.""" return self.__headers def __repr__(self) -> str: @@ -93,33 +88,25 @@ def __str__(self) -> str: class BadCredentialsException(GithubException): - """ - Exception raised in case of bad credentials (when Github API replies with a 401 or 403 HTML status) - """ + """Exception raised in case of bad credentials (when Github API replies with a 401 or 403 HTML status)""" class UnknownObjectException(GithubException): - """ - Exception raised when a non-existing object is requested (when Github API replies with a 404 HTML status) - """ + """Exception raised when a non-existing object is requested (when Github API replies with a 404 HTML status)""" class BadUserAgentException(GithubException): - """ - Exception raised when request is sent with a bad user agent header (when Github API replies with a 403 bad user agent HTML status) - """ + """Exception raised when request is sent with a bad user agent header (when Github API replies with a 403 bad user + agent HTML status)""" class RateLimitExceededException(GithubException): - """ - Exception raised when the rate limit is exceeded (when Github API replies with a 403 rate limit exceeded HTML status) - """ + """Exception raised when the rate limit is exceeded (when Github API replies with a 403 rate limit exceeded HTML + status)""" class BadAttributeException(Exception): - """ - Exception raised when Github returns an attribute with the wrong type. - """ + """Exception raised when Github returns an attribute with the wrong type.""" def __init__( self, @@ -138,9 +125,7 @@ def __init__( @property def actual_value(self) -> Any: - """ - The value returned by Github - """ + """The value returned by Github.""" return self.__actualValue @property @@ -152,26 +137,19 @@ def expected_type( Dict[Tuple[Type[str], Type[str]], Type[dict]], List[Tuple[Type[str], Type[str]]], ]: - """ - The type PyGithub expected - """ + """The type PyGithub expected.""" return self.__expectedType @property def transformation_exception(self) -> Optional[Exception]: - """ - The exception raised when PyGithub tried to parse the value - """ + """The exception raised when PyGithub tried to parse the value.""" return self.__transformationException class TwoFactorException(GithubException): - """ - Exception raised when Github requires a onetime password for two-factor authentication - """ + """Exception raised when Github requires a onetime password for two-factor authentication.""" class IncompletableObject(GithubException): - """ - Exception raised when we can not request an object from Github because the data returned did not include a URL - """ + """Exception raised when we can not request an object from Github because the data returned did not include a + URL.""" diff --git a/github/GithubIntegration.py b/github/GithubIntegration.py index d74c5ef8d6..56b657d5f7 100644 --- a/github/GithubIntegration.py +++ b/github/GithubIntegration.py @@ -19,9 +19,7 @@ class GithubIntegration: - """ - Main class to obtain tokens for a GitHub integration. - """ + """Main class to obtain tokens for a GitHub integration.""" # keep non-deprecated arguments in-sync with Requester # v3: remove integration_id, private_key, jwt_expiry, jwt_issued_at and jwt_algorithm @@ -128,13 +126,13 @@ def __init__( ) def close(self) -> None: - """ - Close connections to the server. Alternatively, use the GithubIntegration object as a context manager: + """Close connections to the server. Alternatively, use the GithubIntegration object as a context manager: .. code-block:: python with github.GithubIntegration(...) as gi: # do something + """ self.__requester.close() @@ -152,17 +150,13 @@ def get_github_for_installation( return github.Github(**self.__requester.withAuth(auth).kwargs) def _get_headers(self) -> dict[str, str]: - """ - Get headers for the requests. - """ + """Get headers for the requests.""" return { "Accept": Consts.mediaTypeIntegrationPreview, } def _get_installed_app(self, url: str) -> Installation: - """ - Get installation for the given URL. - """ + """Get installation for the given URL.""" headers, response = self.__requester.requestJsonAndCheck("GET", url, headers=self._get_headers()) return Installation( @@ -211,10 +205,11 @@ def get_access_token( @deprecated.deprecated("Use get_repo_installation") def get_installation(self, owner: str, repo: str) -> Installation: - """ - Deprecated by get_repo_installation + """Deprecated by get_repo_installation. + + :calls: `GET /repos/{owner}/{repo}/installation + ` - :calls: `GET /repos/{owner}/{repo}/installation ` """ return self._get_installed_app(url=f"/repos/{owner}/{repo}/installation") diff --git a/github/GithubObject.py b/github/GithubObject.py index 1ad7475eeb..b5c265962c 100644 --- a/github/GithubObject.py +++ b/github/GithubObject.py @@ -121,9 +121,7 @@ def value(self) -> Any: # v3: add * to edit function of all GithubObject implementations, # this allows to rename attributes and maintain the order of attributes class GithubObject: - """ - Base class for all classes representing objects returned by the API. - """ + """Base class for all classes representing objects returned by the API.""" """ A global debug flag to enable header validation by requester for all objects @@ -303,9 +301,7 @@ def last_modified(self) -> Optional[str]: return self._headers.get(Consts.RES_LAST_MODIFIED) # type: ignore def get__repr__(self, params: Dict[str, Any]) -> str: - """ - Converts the object to a nicely printable string. - """ + """Converts the object to a nicely printable string.""" def format_params(params: Dict[str, Any]) -> typing.Generator[str, None, None]: items = list(params.items()) @@ -372,10 +368,8 @@ def __complete(self) -> None: self.__completed = True def update(self, additional_headers: Optional[Dict[str, Any]] = None) -> bool: - """ - Check and update the object with conditional request - :rtype: Boolean value indicating whether the object is changed - """ + """Check and update the object with conditional request :rtype: Boolean value indicating whether the object is + changed.""" conditionalRequestHeader = dict() if self.etag is not None: conditionalRequestHeader[Consts.REQ_IF_NONE_MATCH] = self.etag diff --git a/github/GithubRetry.py b/github/GithubRetry.py index 6cfe4056ae..5cea4958fd 100644 --- a/github/GithubRetry.py +++ b/github/GithubRetry.py @@ -42,8 +42,7 @@ class GithubRetry(Retry): - """ - A Github-specific implementation of `urllib3.Retry` + """A Github-specific implementation of `urllib3.Retry` This retries 403 responses if they are retry-able. Github requests are retry-able when the response provides a `"Retry-After"` header, or the content indicates a rate limit error. @@ -53,6 +52,7 @@ class GithubRetry(Retry): By default, all methods defined in `Retry.DEFAULT_ALLOWED_METHODS` are retried, plus GET and POST. This can be configured via the `allowed_methods` argument. + """ __logger: Optional[Logger] = None diff --git a/github/GitignoreTemplate.py b/github/GitignoreTemplate.py index 7f89a9c080..8a7a8a311e 100644 --- a/github/GitignoreTemplate.py +++ b/github/GitignoreTemplate.py @@ -33,8 +33,10 @@ class GitignoreTemplate(NonCompletableGithubObject): - """ - This class represents GitignoreTemplates. The reference can be found here https://docs.github.com/en/rest/reference/gitignore + """This class represents GitignoreTemplates. + + The reference can be found here https://docs.github.com/en/rest/reference/gitignore + """ def _initAttributes(self) -> None: diff --git a/github/Hook.py b/github/Hook.py index 91a6cd09fb..766a88eaf1 100644 --- a/github/Hook.py +++ b/github/Hook.py @@ -39,8 +39,10 @@ class Hook(CompletableGithubObject): - """ - This class represents Hooks. The reference can be found here https://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 _initAttributes(self) -> None: diff --git a/github/HookDelivery.py b/github/HookDelivery.py index 2ae7c330d9..4f3372bd9a 100644 --- a/github/HookDelivery.py +++ b/github/HookDelivery.py @@ -35,9 +35,7 @@ class HookDeliverySummary(github.GithubObject.NonCompletableGithubObject): - """ - This class represents a Summary of HookDeliveries - """ + """This class represents a Summary of HookDeliveries.""" def _initAttributes(self) -> None: self._id: Attribute[int] = NotSet @@ -132,9 +130,7 @@ def _useAttributes(self, attributes: Dict[str, Any]) -> None: class HookDeliveryRequest(github.GithubObject.NonCompletableGithubObject): - """ - This class represents a HookDeliveryRequest - """ + """This class represents a HookDeliveryRequest.""" def _initAttributes(self) -> None: self._request_headers: Attribute[Dict] = NotSet @@ -159,9 +155,7 @@ def _useAttributes(self, attributes: Dict[str, Any]) -> None: class HookDeliveryResponse(github.GithubObject.NonCompletableGithubObject): - """ - This class represents a HookDeliveryResponse - """ + """This class represents a HookDeliveryResponse.""" def __repr__(self) -> str: return self.get__repr__({"payload": self._payload.value}) @@ -186,9 +180,7 @@ def _useAttributes(self, attributes: Dict[str, Any]) -> None: class HookDelivery(HookDeliverySummary): - """ - This class represents a HookDelivery - """ + """This class represents a HookDelivery.""" def _initAttributes(self) -> None: super()._initAttributes() diff --git a/github/HookDescription.py b/github/HookDescription.py index 38e617ee25..29044735a0 100644 --- a/github/HookDescription.py +++ b/github/HookDescription.py @@ -35,9 +35,7 @@ class HookDescription(NonCompletableGithubObject): - """ - This class represents HookDescriptions - """ + """This class represents HookDescriptions.""" def _initAttributes(self) -> None: self._events: Attribute[list[str]] = NotSet diff --git a/github/HookResponse.py b/github/HookResponse.py index 90caa91a7c..7545cadc84 100644 --- a/github/HookResponse.py +++ b/github/HookResponse.py @@ -34,9 +34,7 @@ class HookResponse(NonCompletableGithubObject): - """ - This class represents HookResponses - """ + """This class represents HookResponses.""" def _initAttributes(self) -> None: self._code: Attribute[int] = NotSet diff --git a/github/InputFileContent.py b/github/InputFileContent.py index 1fd8e97b50..82f2d1c14f 100644 --- a/github/InputFileContent.py +++ b/github/InputFileContent.py @@ -35,9 +35,7 @@ class InputFileContent: - """ - This class represents InputFileContents - """ + """This class represents InputFileContents.""" def __init__(self, content: str, new_name: Opt[str] = NotSet): assert isinstance(content, str), content diff --git a/github/InputGitAuthor.py b/github/InputGitAuthor.py index dd6dcfb71a..e0bd694f37 100644 --- a/github/InputGitAuthor.py +++ b/github/InputGitAuthor.py @@ -36,9 +36,7 @@ class InputGitAuthor: - """ - This class represents InputGitAuthors - """ + """This class represents InputGitAuthors.""" def __init__(self, name: str, email: str, date: Opt[str] = NotSet): assert isinstance(name, str), name diff --git a/github/InputGitTreeElement.py b/github/InputGitTreeElement.py index a956194311..1daa749bb7 100644 --- a/github/InputGitTreeElement.py +++ b/github/InputGitTreeElement.py @@ -33,9 +33,7 @@ class InputGitTreeElement: - """ - This class represents InputGitTreeElements - """ + """This class represents InputGitTreeElements.""" def __init__( self, diff --git a/github/Installation.py b/github/Installation.py index a7c3f66a7f..45faddeeeb 100644 --- a/github/Installation.py +++ b/github/Installation.py @@ -51,8 +51,10 @@ class Installation(NonCompletableGithubObject): - """ - This class represents Installations. The reference can be found here https://docs.github.com/en/rest/reference/apps#installations + """This class represents Installations. + + The reference can be found here https://docs.github.com/en/rest/reference/apps#installations + """ def __init__( diff --git a/github/InstallationAuthorization.py b/github/InstallationAuthorization.py index 3e9a500f93..f251a8f569 100644 --- a/github/InstallationAuthorization.py +++ b/github/InstallationAuthorization.py @@ -36,9 +36,7 @@ class InstallationAuthorization(NonCompletableGithubObject): - """ - This class represents InstallationAuthorizations - """ + """This class represents InstallationAuthorizations.""" def _initAttributes(self) -> None: self._token: Attribute[str] = NotSet diff --git a/github/Invitation.py b/github/Invitation.py index 5ed6a36dc3..0c87f557cd 100644 --- a/github/Invitation.py +++ b/github/Invitation.py @@ -37,8 +37,10 @@ class Invitation(CompletableGithubObject): - """ - This class represents repository invitations. The reference can be found here https://docs.github.com/en/rest/reference/repos#invitations + """This class represents repository invitations. + + The reference can be found here https://docs.github.com/en/rest/reference/repos#invitations + """ def _initAttributes(self) -> None: diff --git a/github/Issue.py b/github/Issue.py index d3ea5b6926..7dd08507f5 100644 --- a/github/Issue.py +++ b/github/Issue.py @@ -85,8 +85,10 @@ class Issue(CompletableGithubObject): - """ - This class represents Issues. The reference can be found here https://docs.github.com/en/rest/reference/issues + """This class represents Issues. + + The reference can be found here https://docs.github.com/en/rest/reference/issues + """ def _initAttributes(self) -> None: diff --git a/github/IssueComment.py b/github/IssueComment.py index 4422658109..f5d5a7b872 100644 --- a/github/IssueComment.py +++ b/github/IssueComment.py @@ -47,8 +47,10 @@ class IssueComment(CompletableGithubObject): - """ - This class represents IssueComments. The reference can be found here https://docs.github.com/en/rest/reference/issues#comments + """This class represents IssueComments. + + The reference can be found here https://docs.github.com/en/rest/reference/issues#comments + """ def _initAttributes(self) -> None: diff --git a/github/IssueEvent.py b/github/IssueEvent.py index fa7ad19e7d..b92e5f8356 100644 --- a/github/IssueEvent.py +++ b/github/IssueEvent.py @@ -42,8 +42,10 @@ class IssueEvent(CompletableGithubObject): - """ - This class represents IssueEvents. The reference can be found here https://docs.github.com/en/rest/reference/issues#events + """This class represents IssueEvents. + + The reference can be found here https://docs.github.com/en/rest/reference/issues#events + """ def _initAttributes(self) -> None: diff --git a/github/IssuePullRequest.py b/github/IssuePullRequest.py index a2cc556797..a13728ca37 100644 --- a/github/IssuePullRequest.py +++ b/github/IssuePullRequest.py @@ -34,9 +34,7 @@ class IssuePullRequest(NonCompletableGithubObject): - """ - This class represents IssuePullRequests - """ + """This class represents IssuePullRequests.""" def _initAttributes(self) -> None: self._diff_url: Attribute[str] = NotSet diff --git a/github/Label.py b/github/Label.py index 9473a7968e..783e648bad 100644 --- a/github/Label.py +++ b/github/Label.py @@ -36,8 +36,10 @@ class Label(CompletableGithubObject): - """ - This class represents Labels. The reference can be found here https://docs.github.com/en/rest/reference/issues#labels + """This class represents Labels. + + The reference can be found here https://docs.github.com/en/rest/reference/issues#labels + """ def _initAttributes(self) -> None: diff --git a/github/License.py b/github/License.py index 8544633197..e4a4a1a02d 100644 --- a/github/License.py +++ b/github/License.py @@ -27,8 +27,10 @@ class License(CompletableGithubObject): - """ - This class represents Licenses. The reference can be found here https://docs.github.com/en/rest/reference/licenses + """This class represents Licenses. + + The reference can be found here https://docs.github.com/en/rest/reference/licenses + """ def _initAttributes(self) -> None: diff --git a/github/MainClass.py b/github/MainClass.py index 2cc9f240a5..2b266bf320 100644 --- a/github/MainClass.py +++ b/github/MainClass.py @@ -103,8 +103,10 @@ class Github: - """ - This is the main class you instantiate to access the Github API v3. Optional parameters allow different authentication methods. + """This is the main class you instantiate to access the Github API v3. + + Optional parameters allow different authentication methods. + """ __requester: Requester @@ -208,13 +210,13 @@ def __init__( ) def close(self) -> None: - """ - Close connections to the server. Alternatively, use the Github object as a context manager: + """Close connections to the server. Alternatively, use the Github object as a context manager: .. code-block:: python with github.Github(...) as gh: # do something + """ self.__requester.close() @@ -246,9 +248,7 @@ def per_page(self, value: int) -> None: # v3: Return an instance of a class: using a tuple did not allow to add a field "resettime" @property def rate_limiting(self) -> tuple[int, int]: - """ - First value is requests remaining, second value is request limit. - """ + """First value is requests remaining, second value is request limit.""" remaining, limit = self.__requester.rate_limiting if limit < 0: self.get_rate_limit() @@ -256,18 +256,16 @@ def rate_limiting(self) -> tuple[int, int]: @property def rate_limiting_resettime(self) -> int: - """ - Unix timestamp indicating when rate limiting will reset. - """ + """Unix timestamp indicating when rate limiting will reset.""" if self.__requester.rate_limiting_resettime == 0: self.get_rate_limit() return self.__requester.rate_limiting_resettime def get_rate_limit(self) -> RateLimit: - """ - Rate limit status for different resources (core/search/graphql). + """Rate limit status for different resources (core/search/graphql). :calls: `GET /rate_limit `_ + """ headers, data = self.__requester.requestJsonAndCheck("GET", "/rate_limit") return RateLimit(self.__requester, headers, data["resources"], True) @@ -757,14 +755,14 @@ def get_emojis(self) -> dict[str, str]: def create_from_raw_data( self, klass: type[TGithubObject], raw_data: dict[str, Any], headers: dict[str, str | int] | None = None ) -> TGithubObject: - """ - Creates an object from raw_data previously obtained by :attr:`GithubObject.raw_data`, - and optionally headers previously obtained by :attr:`GithubObject.raw_headers`. + """Creates an object from raw_data previously obtained by :attr:`GithubObject.raw_data`, and optionally headers + previously obtained by :attr:`GithubObject.raw_headers`. :param klass: the class of the object to create :param raw_data: dict :param headers: dict :rtype: instance of class ``klass`` + """ if headers is None: headers = {} @@ -772,23 +770,44 @@ def create_from_raw_data( return klass(self.__requester, headers, raw_data, completed=True) def dump(self, obj: GithubObject, file: BinaryIO, protocol: int = 0) -> None: - """ - Dumps (pickles) a PyGithub object to a file-like object. - Some effort is made to not pickle sensitive information like the Github credentials used in the :class:`Github` instance. - But NO EFFORT is made to remove sensitive information from the object's attributes. - + """Dumps (pickles) a PyGithub object to a file-like object. Some effort is made to not pickle sensitive + information like the Github credentials used in the :class:`Github` instance. But NO EFFORT is made to remove + sensitive information from the object's attributes. + + :param obj: the object to pickle :param file: the file-like object to pickle to :param protocol: the + `pickling protocol `_ + :param obj: the object to pickle :param file: the file-like object to pickle to :param protocol: the + `pickling protocol `_ :param obj: the object to pickle :param file: the file-like object to pickle to :param + protocol: the + `pickling protocol `_ + :param obj: the object to pickle + :param file: the file-like object to pickle to + :param protocol: the `pickling protocol `_ :param obj: the object to pickle :param file: the file-like object to pickle to - :param protocol: the `pickling protocol `_ + :param protocol: the `pickling protocol `_ + """ pickle.dump((obj.__class__, obj.raw_data, obj.raw_headers), file, protocol) def load(self, f: BinaryIO) -> Any: - """ - Loads (unpickles) a PyGithub object from a file-like object. + """Loads (unpickles) a PyGithub object from a file-like object. :param f: the file-like object to unpickle from :return: the unpickled object + """ return self.create_from_raw_data(*pickle.load(f)) diff --git a/github/Membership.py b/github/Membership.py index 3938a16e68..e73194d4c2 100644 --- a/github/Membership.py +++ b/github/Membership.py @@ -51,8 +51,10 @@ class Membership(CompletableGithubObject): - """ - This class represents Membership of an organization. The reference can be found here https://docs.github.com/en/rest/reference/orgs + """This class represents Membership of an organization. + + The reference can be found here https://docs.github.com/en/rest/reference/orgs + """ def _initAttributes(self) -> None: diff --git a/github/Migration.py b/github/Migration.py index 2d4f1b69ea..3a09b67626 100644 --- a/github/Migration.py +++ b/github/Migration.py @@ -43,8 +43,10 @@ class Migration(CompletableGithubObject): - """ - This class represents Migrations. The reference can be found here https://docs.github.com/en/rest/reference/migrations + """This class represents Migrations. + + The reference can be found here https://docs.github.com/en/rest/reference/migrations + """ def _initAttributes(self) -> None: diff --git a/github/Milestone.py b/github/Milestone.py index dc9e4be58e..fe906606f1 100644 --- a/github/Milestone.py +++ b/github/Milestone.py @@ -41,8 +41,10 @@ class Milestone(CompletableGithubObject): - """ - This class represents Milestones. The reference can be found here https://docs.github.com/en/rest/reference/issues#milestones + """This class represents Milestones. + + The reference can be found here https://docs.github.com/en/rest/reference/issues#milestones + """ def _initAttributes(self) -> None: diff --git a/github/NamedEnterpriseUser.py b/github/NamedEnterpriseUser.py index 7e1fdf2bda..86c8cdfbfc 100644 --- a/github/NamedEnterpriseUser.py +++ b/github/NamedEnterpriseUser.py @@ -25,8 +25,11 @@ class NamedEnterpriseUser(CompletableGithubObject): - """ - This class represents NamedEnterpriseUsers. The reference can be found here https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/license#list-enterprise-consumed-licenses + """This class represents NamedEnterpriseUsers. + + The reference can be found here + https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/license#list-enterprise-consumed-licenses + """ def _initAttributes(self) -> None: diff --git a/github/NamedUser.py b/github/NamedUser.py index e76e976d72..d78d39cbf2 100644 --- a/github/NamedUser.py +++ b/github/NamedUser.py @@ -64,8 +64,10 @@ class NamedUser(github.GithubObject.CompletableGithubObject): - """ - This class represents NamedUsers. The reference can be found here https://docs.github.com/en/rest/reference/users#get-a-user + """This class represents NamedUsers. + + The reference can be found here https://docs.github.com/en/rest/reference/users#get-a-user + """ def _initAttributes(self) -> None: diff --git a/github/Notification.py b/github/Notification.py index d35eadeee3..c46cde39e4 100644 --- a/github/Notification.py +++ b/github/Notification.py @@ -40,8 +40,10 @@ class Notification(CompletableGithubObject): - """ - This class represents Notifications. The reference can be found here https://docs.github.com/en/rest/reference/activity#notifications + """This class represents Notifications. + + The reference can be found here https://docs.github.com/en/rest/reference/activity#notifications + """ def _initAttributes(self) -> None: diff --git a/github/NotificationSubject.py b/github/NotificationSubject.py index 74d6b87b7b..a0db936dd4 100644 --- a/github/NotificationSubject.py +++ b/github/NotificationSubject.py @@ -33,8 +33,11 @@ class NotificationSubject(NonCompletableGithubObject): - """ - This class represents Subjects of Notifications. The reference can be found here https://docs.github.com/en/rest/reference/activity#list-notifications-for-the-authenticated-user + """This class represents Subjects of Notifications. + + The reference can be found here + https://docs.github.com/en/rest/reference/activity#list-notifications-for-the-authenticated-user + """ def _initAttributes(self) -> None: diff --git a/github/Organization.py b/github/Organization.py index a8d8b5e0f8..d13ea055e0 100644 --- a/github/Organization.py +++ b/github/Organization.py @@ -85,8 +85,10 @@ class Organization(CompletableGithubObject): - """ - This class represents Organizations. The reference can be found here https://docs.github.com/en/rest/reference/orgs + """This class represents Organizations. + + The reference can be found here https://docs.github.com/en/rest/reference/orgs + """ def _initAttributes(self) -> None: @@ -542,10 +544,8 @@ def create_secret( ) def get_secrets(self) -> PaginatedList[OrganizationSecret]: - """ - Gets all organization secrets - :rtype: :class:`PaginatedList` of :class:`github.OrganizationSecret.OrganizationSecret` - """ + """Gets all organization secrets :rtype: :class:`PaginatedList` of + :class:`github.OrganizationSecret.OrganizationSecret`""" return PaginatedList( github.OrganizationSecret.OrganizationSecret, self._requester, @@ -647,10 +647,8 @@ def create_variable( ) def get_variables(self) -> PaginatedList[OrganizationVariable]: - """ - Gets all organization variables - :rtype: :class:`PaginatedList` of :class:`github.OrganizationVariable.OrganizationVariable` - """ + """Gets all organization variables :rtype: :class:`PaginatedList` of + :class:`github.OrganizationVariable.OrganizationVariable`""" return PaginatedList( github.OrganizationVariable.OrganizationVariable, self._requester, diff --git a/github/OrganizationSecret.py b/github/OrganizationSecret.py index 5b606932f4..75056de1a1 100644 --- a/github/OrganizationSecret.py +++ b/github/OrganizationSecret.py @@ -30,8 +30,10 @@ class OrganizationSecret(Secret): - """ - This class represents a org level GitHub secret. The reference can be found here https://docs.github.com/en/rest/actions/secrets + """This class represents a org level GitHub secret. + + The reference can be found here https://docs.github.com/en/rest/actions/secrets + """ def _initAttributes(self) -> None: diff --git a/github/OrganizationVariable.py b/github/OrganizationVariable.py index 3d7f9c2ae2..9dda0a2473 100644 --- a/github/OrganizationVariable.py +++ b/github/OrganizationVariable.py @@ -30,8 +30,10 @@ class OrganizationVariable(Variable): - """ - This class represents a org level GitHub variable. The reference can be found here https://docs.github.com/en/rest/actions/variables + """This class represents a org level GitHub variable. + + The reference can be found here https://docs.github.com/en/rest/actions/variables + """ def _initAttributes(self) -> None: diff --git a/github/Path.py b/github/Path.py index f966392f55..b8c6335d98 100644 --- a/github/Path.py +++ b/github/Path.py @@ -29,9 +29,10 @@ class Path(NonCompletableGithubObject): - """ - This class represents a popular Path for a GitHub repository. + """This class represents a popular Path for a GitHub repository. + The reference can be found here https://docs.github.com/en/rest/reference/repos#traffic + """ def _initAttributes(self) -> None: diff --git a/github/Permissions.py b/github/Permissions.py index a136d901a6..e470ac3446 100644 --- a/github/Permissions.py +++ b/github/Permissions.py @@ -33,9 +33,7 @@ class Permissions(NonCompletableGithubObject): - """ - This class represents Permissions - """ + """This class represents Permissions.""" def _initAttributes(self) -> None: self._admin: Attribute[bool] = NotSet diff --git a/github/Plan.py b/github/Plan.py index 043d44098f..06b31d3b64 100644 --- a/github/Plan.py +++ b/github/Plan.py @@ -33,9 +33,7 @@ class Plan(NonCompletableGithubObject): - """ - This class represents Plans - """ + """This class represents Plans.""" def _initAttributes(self) -> None: self._collaborators: Attribute[int] = NotSet diff --git a/github/Project.py b/github/Project.py index 711fafec8e..8a30d9a72e 100644 --- a/github/Project.py +++ b/github/Project.py @@ -33,8 +33,10 @@ class Project(CompletableGithubObject): - """ - This class represents Projects. The reference can be found here https://docs.github.com/en/rest/reference/projects + """This class represents Projects. + + The reference can be found here https://docs.github.com/en/rest/reference/projects + """ def _initAttributes(self) -> None: diff --git a/github/ProjectCard.py b/github/ProjectCard.py index 28500a0fb2..fad83e4a04 100644 --- a/github/ProjectCard.py +++ b/github/ProjectCard.py @@ -39,8 +39,10 @@ class ProjectCard(CompletableGithubObject): - """ - This class represents Project Cards. The reference can be found here https://docs.github.com/en/rest/reference/projects#cards + """This class represents Project Cards. + + The reference can be found here https://docs.github.com/en/rest/reference/projects#cards + """ def _initAttributes(self) -> None: diff --git a/github/ProjectColumn.py b/github/ProjectColumn.py index 024fb7b0e9..f5adab3747 100644 --- a/github/ProjectColumn.py +++ b/github/ProjectColumn.py @@ -34,8 +34,10 @@ class ProjectColumn(CompletableGithubObject): - """ - This class represents Project Columns. The reference can be found here https://docs.github.com/en/rest/reference/projects#columns + """This class represents Project Columns. + + The reference can be found here https://docs.github.com/en/rest/reference/projects#columns + """ def _initAttributes(self) -> None: diff --git a/github/PublicKey.py b/github/PublicKey.py index 07b2accb80..98d7015f77 100644 --- a/github/PublicKey.py +++ b/github/PublicKey.py @@ -48,10 +48,12 @@ def encrypt(public_key: str, secret_value: str) -> str: class PublicKey(CompletableGithubObject): - """ - This class represents either an organization public key or a repository public key. - The reference can be found here https://docs.github.com/en/rest/reference/actions#get-an-organization-public-key - or here https://docs.github.com/en/rest/reference/actions#get-a-repository-public-key + """This class represents either an organization public key or a repository public key. + + The reference can be found here https://docs.github.com/en/rest/reference/actions#get-an-organization-public-key or + here + https://docs.github.com/en/rest/reference/actions#get-a-repository-public-key + """ def _initAttributes(self) -> None: diff --git a/github/PullRequest.py b/github/PullRequest.py index 75e72e902c..cea2aa4ba8 100644 --- a/github/PullRequest.py +++ b/github/PullRequest.py @@ -89,8 +89,10 @@ class ReviewComment(TypedDict): class PullRequest(CompletableGithubObject): - """ - This class represents PullRequests. The reference can be found here https://docs.github.com/en/rest/reference/pulls + """This class represents PullRequests. + + The reference can be found here https://docs.github.com/en/rest/reference/pulls + """ def _initAttributes(self) -> None: diff --git a/github/PullRequestComment.py b/github/PullRequestComment.py index f952fe4ad6..db00b61841 100644 --- a/github/PullRequestComment.py +++ b/github/PullRequestComment.py @@ -46,8 +46,10 @@ class PullRequestComment(CompletableGithubObject): - """ - This class represents PullRequestComments. The reference can be found here https://docs.github.com/en/rest/reference/pulls#review-comments + """This class represents PullRequestComments. + + The reference can be found here https://docs.github.com/en/rest/reference/pulls#review-comments + """ def _initAttributes(self) -> None: diff --git a/github/PullRequestMergeStatus.py b/github/PullRequestMergeStatus.py index 01a5d79f6d..93125e2e7d 100644 --- a/github/PullRequestMergeStatus.py +++ b/github/PullRequestMergeStatus.py @@ -34,8 +34,11 @@ class PullRequestMergeStatus(NonCompletableGithubObject): - """ - This class represents PullRequestMergeStatuses. The reference can be found here https://docs.github.com/en/rest/reference/pulls#check-if-a-pull-request-has-been-merged + """This class represents PullRequestMergeStatuses. + + The reference can be found here + https://docs.github.com/en/rest/reference/pulls#check-if-a-pull-request-has-been-merged + """ def _initAttributes(self) -> None: diff --git a/github/PullRequestPart.py b/github/PullRequestPart.py index 57fc8a80a8..fcc24d07e2 100644 --- a/github/PullRequestPart.py +++ b/github/PullRequestPart.py @@ -41,9 +41,7 @@ class PullRequestPart(NonCompletableGithubObject): - """ - This class represents PullRequestParts - """ + """This class represents PullRequestParts.""" def _initAttributes(self) -> None: self._label: Attribute[str] = NotSet diff --git a/github/PullRequestReview.py b/github/PullRequestReview.py index 1ac8ea30d5..ef1c94bb85 100644 --- a/github/PullRequestReview.py +++ b/github/PullRequestReview.py @@ -34,8 +34,10 @@ class PullRequestReview(NonCompletableGithubObject): - """ - This class represents PullRequestReviews. The reference can be found here https://docs.github.com/en/rest/reference/pulls#reviews + """This class represents PullRequestReviews. + + The reference can be found here https://docs.github.com/en/rest/reference/pulls#reviews + """ def _initAttributes(self) -> None: diff --git a/github/Rate.py b/github/Rate.py index 5c7b107ea3..bb8ef1cc29 100644 --- a/github/Rate.py +++ b/github/Rate.py @@ -33,8 +33,10 @@ class Rate(NonCompletableGithubObject): - """ - This class represents Rates. The reference can be found here https://docs.github.com/en/rest/reference/rate-limit + """This class represents Rates. + + The reference can be found here https://docs.github.com/en/rest/reference/rate-limit + """ def _initAttributes(self) -> None: diff --git a/github/RateLimit.py b/github/RateLimit.py index 8a52e763f8..5f09f02cd3 100644 --- a/github/RateLimit.py +++ b/github/RateLimit.py @@ -37,8 +37,10 @@ class RateLimit(NonCompletableGithubObject): - """ - This class represents RateLimits. The reference can be found here https://docs.github.com/en/rest/reference/rate-limit + """This class represents RateLimits. + + The reference can be found here https://docs.github.com/en/rest/reference/rate-limit + """ def _initAttributes(self) -> None: @@ -51,29 +53,17 @@ def __repr__(self) -> str: @property def core(self) -> Rate: - """ - Rate limit for the non-search-related API - - :type: class:`github.Rate.Rate` - """ + """Rate limit for the non-search-related API.""" return self._core.value @property def search(self) -> Rate: - """ - Rate limit for the Search API. - - :type: class:`github.Rate.Rate` - """ + """Rate limit for the Search API.""" return self._search.value @property def graphql(self) -> Rate: - """ - (Experimental) Rate limit for GraphQL API, use with caution. - - :type: class:`github.Rate.Rate` - """ + """(Experimental) Rate limit for GraphQL API, use with caution.""" return self._graphql.value def _useAttributes(self, attributes: dict[str, Any]) -> None: diff --git a/github/Reaction.py b/github/Reaction.py index 1daaccd6c7..bb545b5266 100644 --- a/github/Reaction.py +++ b/github/Reaction.py @@ -36,8 +36,10 @@ class Reaction(CompletableGithubObject): - """ - This class represents Reactions. The reference can be found here https://docs.github.com/en/rest/reference/reactions + """This class represents Reactions. + + The reference can be found here https://docs.github.com/en/rest/reference/reactions + """ def _initAttributes(self) -> None: diff --git a/github/Referrer.py b/github/Referrer.py index 76b202d630..e0c223c098 100644 --- a/github/Referrer.py +++ b/github/Referrer.py @@ -29,9 +29,10 @@ class Referrer(NonCompletableGithubObject): - """ - This class represents a popylar Referrer for a GitHub repository. + """This class represents a popylar Referrer for a GitHub repository. + The reference can be found here https://docs.github.com/en/rest/reference/repos#traffic + """ def _initAttributes(self) -> None: diff --git a/github/Repository.py b/github/Repository.py index 33d7629d5c..b12bd9a726 100644 --- a/github/Repository.py +++ b/github/Repository.py @@ -202,8 +202,10 @@ class Repository(github.GithubObject.CompletableGithubObject): - """ - This class represents Repositories. The reference can be found here https://docs.github.com/en/rest/reference/repos + """This class represents Repositories. + + The reference can be found here https://docs.github.com/en/rest/reference/repos + """ def __repr__(self) -> str: @@ -1136,9 +1138,8 @@ def create_git_tag_and_release( prerelease=False, generate_release_notes=False, ): - """ - Convenience function that calls :meth:`Repository.create_git_tag` and - :meth:`Repository.create_git_release`. + """Convenience function that calls :meth:`Repository.create_git_tag` and :meth:`Repository.create_git_release`. + :param tag: string :param tag_message: string :param release_name: string @@ -1150,6 +1151,7 @@ def create_git_tag_and_release( :param prerelease: bool :param generate_release_notes: bool :rtype: :class:`github.GitRelease.GitRelease` + """ self.create_git_tag(tag, tag_message, object, type, tagger) return self.create_git_release( @@ -1671,10 +1673,8 @@ def create_secret(self, secret_name, unencrypted_value): ) def get_secrets(self): - """ - Gets all repository secrets - :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Secret.Secret` - """ + """Gets all repository secrets :rtype: :class:`github.PaginatedList.PaginatedList` of + :class:`github.Secret.Secret`""" return github.PaginatedList.PaginatedList( github.Secret.Secret, self._requester, @@ -1723,10 +1723,8 @@ def create_variable(self, variable_name: str, value: str) -> bool: ) def get_variables(self): - """ - Gets all repository variables - :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Variable.Variable` - """ + """Gets all repository variables :rtype: :class:`github.PaginatedList.PaginatedList` of + :class:`github.Variable.Variable`""" return github.PaginatedList.PaginatedList( github.Variable.Variable, self._requester, @@ -2367,16 +2365,20 @@ def create_file( ): """Create a file in this repository. - :calls: `PUT /repos/{owner}/{repo}/contents/{path} `_ + :calls: `PUT /repos/{owner}/{repo}/contents/{path} `_ :param path: string, (required), path of the file in the repository :param message: string, (required), commit message :param content: string, (required), the actual data in the file - :param branch: string, (optional), branch to create the commit on. Defaults to the default branch of the repository - :param committer: InputGitAuthor, (optional), if no information is given the authenticated user's information will be used. You must specify both a name and email. - :param author: InputGitAuthor, (optional), if omitted this will be filled in with committer information. If passed, you must specify both a name and email. - :rtype: { - 'content': :class:`ContentFile `:, - 'commit': :class:`Commit `} + :param branch: string, (optional), branch to create the commit on. Defaults to the default branch of the + repository + :param committer: InputGitAuthor, (optional), if no information is given the authenticated user's information + will be used. You must specify both a name and email. + :param author: InputGitAuthor, (optional), if omitted this will be filled in with committer information. If + passed, you must specify both a name and email. + :rtype: { 'content': :class:`ContentFile `:, 'commit': :class:`Commit + `} + """ assert isinstance(path, str) assert isinstance(message, str) @@ -2441,19 +2443,22 @@ def update_file( committer=github.GithubObject.NotSet, author=github.GithubObject.NotSet, ): - """This method updates a file in a repository + """This method updates a file in a repository. - :calls: `PUT /repos/{owner}/{repo}/contents/{path} `_ + :calls: `PUT /repos/{owner}/{repo}/contents/{path} `_ :param path: string, Required. The content path. :param message: string, Required. The commit message. :param content: string, Required. The updated file content, either base64 encoded, or ready to be encoded. :param sha: string, Required. The blob SHA of the file being replaced. :param branch: string. The branch name. Default: the repository’s default branch (usually master) - :param committer: InputGitAuthor, (optional), if no information is given the authenticated user's information will be used. You must specify both a name and email. - :param author: InputGitAuthor, (optional), if omitted this will be filled in with committer information. If passed, you must specify both a name and email. - :rtype: { - 'content': :class:`ContentFile `:, - 'commit': :class:`Commit `} + :param committer: InputGitAuthor, (optional), if no information is given the authenticated user's information + will be used. You must specify both a name and email. + :param author: InputGitAuthor, (optional), if omitted this will be filled in with committer information. If + passed, you must specify both a name and email. + :rtype: { 'content': :class:`ContentFile `:, 'commit': :class:`Commit + `} + """ assert isinstance(path, str) assert isinstance(message, str) @@ -2496,18 +2501,21 @@ def delete_file( committer=github.GithubObject.NotSet, author=github.GithubObject.NotSet, ): - """This method deletes a file in a repository + """This method deletes a file in a repository. - :calls: `DELETE /repos/{owner}/{repo}/contents/{path} `_ + :calls: `DELETE /repos/{owner}/{repo}/contents/{path} `_ :param path: string, Required. The content path. :param message: string, Required. The commit message. :param sha: string, Required. The blob SHA of the file being replaced. :param branch: string. The branch name. Default: the repository’s default branch (usually master) - :param committer: InputGitAuthor, (optional), if no information is given the authenticated user's information will be used. You must specify both a name and email. - :param author: InputGitAuthor, (optional), if omitted this will be filled in with committer information. If passed, you must specify both a name and email. - :rtype: { - 'content': :class:`null `:, - 'commit': :class:`Commit `} + :param committer: InputGitAuthor, (optional), if no information is given the authenticated user's information + will be used. You must specify both a name and email. + :param author: InputGitAuthor, (optional), if omitted this will be filled in with committer information. If + passed, you must specify both a name and email. + :rtype: { 'content': :class:`null `:, 'commit': :class:`Commit + `} + """ assert isinstance(path, str), "path must be str/unicode object" assert isinstance(message, str), "message must be str/unicode object" diff --git a/github/RepositoryAdvisory.py b/github/RepositoryAdvisory.py index 8df4e1445a..357b99015d 100644 --- a/github/RepositoryAdvisory.py +++ b/github/RepositoryAdvisory.py @@ -36,9 +36,10 @@ class RepositoryAdvisory(NonCompletableGithubObject): - """ - This class represents a RepositoryAdvisory. + """This class represents a RepositoryAdvisory. + The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories + """ def _initAttributes(self) -> None: diff --git a/github/RepositoryAdvisoryCredit.py b/github/RepositoryAdvisoryCredit.py index e02953665f..6a40dd643f 100644 --- a/github/RepositoryAdvisoryCredit.py +++ b/github/RepositoryAdvisoryCredit.py @@ -30,9 +30,7 @@ class SimpleCredit(TypedDict): - """ - A simple credit for a security advisory. - """ + """A simple credit for a security advisory.""" login: str | github.NamedUser.NamedUser type: str @@ -42,9 +40,10 @@ class SimpleCredit(TypedDict): class RepositoryAdvisoryCredit(NonCompletableGithubObject): - """ - This class represents a credit that is assigned to a SecurityAdvisory. + """This class represents a credit that is assigned to a SecurityAdvisory. + The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories + """ @property diff --git a/github/RepositoryAdvisoryCreditDetailed.py b/github/RepositoryAdvisoryCreditDetailed.py index 90a18c89d0..a9e3db8886 100644 --- a/github/RepositoryAdvisoryCreditDetailed.py +++ b/github/RepositoryAdvisoryCreditDetailed.py @@ -28,9 +28,10 @@ class RepositoryAdvisoryCreditDetailed(NonCompletableGithubObject): - """ - This class represents a credit that is assigned to a SecurityAdvisory. + """This class represents a credit that is assigned to a SecurityAdvisory. + The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories + """ @property diff --git a/github/RepositoryAdvisoryVulnerability.py b/github/RepositoryAdvisoryVulnerability.py index 46f85689b2..bd7419e009 100644 --- a/github/RepositoryAdvisoryVulnerability.py +++ b/github/RepositoryAdvisoryVulnerability.py @@ -33,18 +33,14 @@ class SimpleAdvisoryVulnerabilityPackage(TypedDict): - """ - A simple package in an advisory. - """ + """A simple package in an advisory.""" ecosystem: str name: str | None class SimpleAdvisoryVulnerability(TypedDict): - """ - A simple vulnerability in a security advisory. - """ + """A simple vulnerability in a security advisory.""" package: SimpleAdvisoryVulnerabilityPackage patched_versions: str | None @@ -56,9 +52,10 @@ class SimpleAdvisoryVulnerability(TypedDict): class RepositoryAdvisoryVulnerability(NonCompletableGithubObject): - """ - This class represents a package that is vulnerable to a parent SecurityAdvisory. + """This class represents a package that is vulnerable to a parent SecurityAdvisory. + The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories + """ @property diff --git a/github/RepositoryAdvisoryVulnerabilityPackage.py b/github/RepositoryAdvisoryVulnerabilityPackage.py index b8632833eb..f4ea7c4157 100644 --- a/github/RepositoryAdvisoryVulnerabilityPackage.py +++ b/github/RepositoryAdvisoryVulnerabilityPackage.py @@ -27,9 +27,10 @@ class RepositoryAdvisoryVulnerabilityPackage(NonCompletableGithubObject): - """ - This class represents an identifier for a package that is vulnerable tao parent SecurityAdvisory. + """This class represents an identifier for a package that is vulnerable tao parent SecurityAdvisory. + The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories + """ def _initAttributes(self) -> None: diff --git a/github/RepositoryKey.py b/github/RepositoryKey.py index 6a02312b64..31ae6caed7 100644 --- a/github/RepositoryKey.py +++ b/github/RepositoryKey.py @@ -39,8 +39,10 @@ class RepositoryKey(CompletableGithubObject): - """ - This class represents RepositoryKeys. The reference can be found here https://docs.github.com/en/rest/reference/repos#deploy-keys + """This class represents RepositoryKeys. + + The reference can be found here https://docs.github.com/en/rest/reference/repos#deploy-keys + """ def _initAttributes(self) -> None: diff --git a/github/RepositoryPreferences.py b/github/RepositoryPreferences.py index a6adbeed3b..6e11d21a9d 100644 --- a/github/RepositoryPreferences.py +++ b/github/RepositoryPreferences.py @@ -32,9 +32,11 @@ class RepositoryPreferences(NonCompletableGithubObject): - """ - This class represents repository preferences. - The reference can be found here https://docs.github.com/en/free-pro-team@latest/rest/reference/checks#update-repository-preferences-for-check-suites + """This class represents repository preferences. + + The reference can be found here + https://docs.github.com/en/free-pro-team@latest/rest/reference/checks#update-repository-preferences-for-check-suites + """ def _initAttributes(self) -> None: diff --git a/github/Requester.py b/github/Requester.py index fe3cb0e0fe..d5f3e7a6f9 100644 --- a/github/Requester.py +++ b/github/Requester.py @@ -322,10 +322,7 @@ def NEW_DEBUG_FRAME(self, requestHeader: Dict[str, str]) -> None: self._frameCount = len(self._frameBuffer) - 1 def DEBUG_ON_RESPONSE(self, statusCode: int, responseHeader: Dict[str, Union[str, int]], data: str) -> None: - """ - Update current frame with response - Current frame index will be attached to responseHeader - """ + """Update current frame with response Current frame index will be attached to responseHeader.""" if self.DEBUG_FLAG: # pragma no branch (Flag always set in tests) self._frameBuffer[self._frameCount][1:4] = [ statusCode, @@ -431,9 +428,7 @@ def __setstate__(self, state: Dict[str, Any]) -> None: self.__custom_connections = deque() def close(self) -> None: - """ - Close the connection to the server. - """ + """Close the connection to the server.""" with self.__connection_lock: if self.__connection is not None: self.__connection.close() @@ -443,11 +438,8 @@ def close(self) -> None: @property def kwargs(self) -> Dict[str, Any]: - """ - Returns arguments required to recreate this Requester with Requester.__init__, as well as - with MainClass.__init__ and GithubIntegration.__init__. - :return: - """ + """Returns arguments required to recreate this Requester with Requester.__init__, as well as with + MainClass.__init__ and GithubIntegration.__init__.""" return dict( auth=self.__auth, base_url=self.__base_url, @@ -474,10 +466,11 @@ def auth(self) -> Optional["Auth"]: return self.__auth def withAuth(self, auth: Optional["Auth"]) -> "Requester": - """ - Create a new requester instance with identical configuration but the given authentication method. + """Create a new requester instance with identical configuration but the given authentication method. + :param auth: authentication method :return: new Requester implementation + """ kwargs = self.kwargs kwargs.update(auth=auth) @@ -927,9 +920,7 @@ def __log( class WithRequester(Generic[T]): - """ - Mixin class that allows to set a requester. - """ + """Mixin class that allows to set a requester.""" __requester: Requester diff --git a/github/RequiredPullRequestReviews.py b/github/RequiredPullRequestReviews.py index 252824da1e..a96dcf9aac 100644 --- a/github/RequiredPullRequestReviews.py +++ b/github/RequiredPullRequestReviews.py @@ -34,8 +34,11 @@ class RequiredPullRequestReviews(CompletableGithubObject): - """ - This class represents Required Pull Request Reviews. The reference can be found here https://docs.github.com/en/rest/reference/repos#get-pull-request-review-protection + """This class represents Required Pull Request Reviews. + + The reference can be found here + https://docs.github.com/en/rest/reference/repos#get-pull-request-review-protection + """ def _initAttributes(self) -> None: diff --git a/github/RequiredStatusChecks.py b/github/RequiredStatusChecks.py index e12420d6b4..197a020c22 100644 --- a/github/RequiredStatusChecks.py +++ b/github/RequiredStatusChecks.py @@ -27,8 +27,10 @@ class RequiredStatusChecks(CompletableGithubObject): - """ - This class represents Required Status Checks. The reference can be found here https://docs.github.com/en/rest/reference/repos#get-status-checks-protection + """This class represents Required Status Checks. + + The reference can be found here https://docs.github.com/en/rest/reference/repos#get-status-checks-protection + """ def _initAttributes(self) -> None: diff --git a/github/Secret.py b/github/Secret.py index 0f46fec853..2209017eff 100644 --- a/github/Secret.py +++ b/github/Secret.py @@ -27,8 +27,10 @@ class Secret(CompletableGithubObject): - """ - This class represents a GitHub secret. The reference can be found here https://docs.github.com/en/rest/actions/secrets + """This class represents a GitHub secret. + + The reference can be found here https://docs.github.com/en/rest/actions/secrets + """ def _initAttributes(self) -> None: diff --git a/github/SelfHostedActionsRunner.py b/github/SelfHostedActionsRunner.py index 42be491a31..8753cb16f8 100644 --- a/github/SelfHostedActionsRunner.py +++ b/github/SelfHostedActionsRunner.py @@ -28,9 +28,11 @@ class SelfHostedActionsRunner(NonCompletableGithubObject): - """ - This class represents Self-hosted GitHub Actions Runners. The reference can be found at + """This class represents Self-hosted GitHub Actions Runners. + + The reference can be found at https://docs.github.com/en/free-pro-team@latest/rest/reference/actions#self-hosted-runners + """ def _initAttributes(self) -> None: diff --git a/github/SourceImport.py b/github/SourceImport.py index 50c8dc4bcd..cc6683c9b9 100644 --- a/github/SourceImport.py +++ b/github/SourceImport.py @@ -28,8 +28,10 @@ class SourceImport(CompletableGithubObject): - """ - This class represents SourceImports. The reference can be found here https://docs.github.com/en/rest/reference/migrations#source-imports + """This class represents SourceImports. + + The reference can be found here https://docs.github.com/en/rest/reference/migrations#source-imports + """ def _initAttributes(self) -> None: diff --git a/github/Stargazer.py b/github/Stargazer.py index 4643d5b208..7c62e17b22 100644 --- a/github/Stargazer.py +++ b/github/Stargazer.py @@ -36,8 +36,10 @@ class Stargazer(NonCompletableGithubObject): - """ - This class represents Stargazers. The reference can be found here https://docs.github.com/en/rest/reference/activity#starring + """This class represents Stargazers. + + The reference can be found here https://docs.github.com/en/rest/reference/activity#starring + """ def _initAttributes(self) -> None: diff --git a/github/StatsCodeFrequency.py b/github/StatsCodeFrequency.py index 660a1ba760..842de13c28 100755 --- a/github/StatsCodeFrequency.py +++ b/github/StatsCodeFrequency.py @@ -31,9 +31,11 @@ class StatsCodeFrequency(NonCompletableGithubObject): - """ - This class represents statistics of StatsCodeFrequencies. - The reference can be found here https://docs.github.com/en/rest/metrics/statistics?apiVersion=2022-11-28#get-the-weekly-commit-activity + """This class represents statistics of StatsCodeFrequencies. + + The reference can be found here + https://docs.github.com/en/rest/metrics/statistics?apiVersion=2022-11-28#get-the-weekly-commit-activity + """ def _initAttributes(self) -> None: diff --git a/github/StatsCommitActivity.py b/github/StatsCommitActivity.py index d4944ae116..7dd6c6a84f 100755 --- a/github/StatsCommitActivity.py +++ b/github/StatsCommitActivity.py @@ -31,8 +31,11 @@ class StatsCommitActivity(github.GithubObject.NonCompletableGithubObject): - """ - This class represents StatsCommitActivities. The reference can be found here https://docs.github.com/en/rest/reference/repos#get-the-last-year-of-commit-activity + """This class represents StatsCommitActivities. + + The reference can be found here + https://docs.github.com/en/rest/reference/repos#get-the-last-year-of-commit-activity + """ def _initAttributes(self) -> None: diff --git a/github/StatsContributor.py b/github/StatsContributor.py index 0b4c2ff543..8b851ac11d 100755 --- a/github/StatsContributor.py +++ b/github/StatsContributor.py @@ -31,14 +31,15 @@ class StatsContributor(github.GithubObject.NonCompletableGithubObject): - """ - This class represents StatsContributors. The reference can be found here https://docs.github.com/en/rest/reference/repos#get-all-contributor-commit-activity + """This class represents StatsContributors. + + The reference can be found here + https://docs.github.com/en/rest/reference/repos#get-all-contributor-commit-activity + """ class Week(github.GithubObject.NonCompletableGithubObject): - """ - This class represents weekly statistics of a contributor. - """ + """This class represents weekly statistics of a contributor.""" @property def w(self): diff --git a/github/StatsParticipation.py b/github/StatsParticipation.py index 7f29811ec4..bd470d2ae6 100755 --- a/github/StatsParticipation.py +++ b/github/StatsParticipation.py @@ -31,8 +31,10 @@ class StatsParticipation(NonCompletableGithubObject): - """ - This class represents StatsParticipations. The reference can be found here https://docs.github.com/en/rest/reference/repos#get-the-weekly-commit-count + """This class represents StatsParticipations. + + The reference can be found here https://docs.github.com/en/rest/reference/repos#get-the-weekly-commit-count + """ def _initAttributes(self) -> None: diff --git a/github/StatsPunchCard.py b/github/StatsPunchCard.py index 81c6e1fc9e..cd2fd9d030 100755 --- a/github/StatsPunchCard.py +++ b/github/StatsPunchCard.py @@ -30,14 +30,17 @@ class StatsPunchCard(github.GithubObject.NonCompletableGithubObject): - """ - This class represents StatsPunchCards. The reference can be found here https://docs.github.com/en/rest/reference/repos#get-the-hourly-commit-count-for-each-day + """This class represents StatsPunchCards. + + The reference can be found here + https://docs.github.com/en/rest/reference/repos#get-the-hourly-commit-count-for-each-day + """ _dict: Dict[Tuple[int, int], int] def get(self, day: int, hour: int) -> int: - """Get a specific element""" + """Get a specific element.""" return self._dict[(day, hour)] def _initAttributes(self) -> None: diff --git a/github/Tag.py b/github/Tag.py index 7b4f9afb9e..14e792b614 100644 --- a/github/Tag.py +++ b/github/Tag.py @@ -40,8 +40,10 @@ class Tag(NonCompletableGithubObject): - """ - This class represents Tags. The reference can be found here https://docs.github.com/en/rest/reference/repos#list-repository-tags + """This class represents Tags. + + The reference can be found here https://docs.github.com/en/rest/reference/repos#list-repository-tags + """ def __repr__(self) -> str: diff --git a/github/Team.py b/github/Team.py index 38b605edb2..904169fd21 100644 --- a/github/Team.py +++ b/github/Team.py @@ -64,8 +64,10 @@ class Team(CompletableGithubObject): - """ - This class represents Teams. The reference can be found here https://docs.github.com/en/rest/reference/teams + """This class represents Teams. + + The reference can be found here https://docs.github.com/en/rest/reference/teams + """ def _initAttributes(self) -> None: diff --git a/github/TeamDiscussion.py b/github/TeamDiscussion.py index c3392b8e62..219b1248d3 100644 --- a/github/TeamDiscussion.py +++ b/github/TeamDiscussion.py @@ -30,8 +30,10 @@ class TeamDiscussion(CompletableGithubObject): - """ - This class represents TeamDiscussions. The reference can be found here https://docs.github.com/en/rest/reference/teams#discussions + """This class represents TeamDiscussions. + + The reference can be found here https://docs.github.com/en/rest/reference/teams#discussions + """ def _initAttributes(self) -> None: diff --git a/github/TimelineEvent.py b/github/TimelineEvent.py index a4834f641e..bf44261f79 100644 --- a/github/TimelineEvent.py +++ b/github/TimelineEvent.py @@ -31,8 +31,10 @@ class TimelineEvent(NonCompletableGithubObject): - """ - This class represents IssueTimelineEvents. The reference can be found here https://docs.github.com/en/rest/reference/issues#timeline + """This class represents IssueTimelineEvents. + + The reference can be found here https://docs.github.com/en/rest/reference/issues#timeline + """ def _initAttributes(self) -> None: diff --git a/github/TimelineEventSource.py b/github/TimelineEventSource.py index d1f5e95b47..737c8afe8e 100644 --- a/github/TimelineEventSource.py +++ b/github/TimelineEventSource.py @@ -32,8 +32,10 @@ class TimelineEventSource(NonCompletableGithubObject): - """ - This class represents IssueTimelineEventSource. The reference can be found here https://docs.github.com/en/rest/reference/issues#timeline + """This class represents IssueTimelineEventSource. + + The reference can be found here https://docs.github.com/en/rest/reference/issues#timeline + """ def _initAttributes(self) -> None: diff --git a/github/UserKey.py b/github/UserKey.py index 8f98681e0e..cfcce6f80b 100644 --- a/github/UserKey.py +++ b/github/UserKey.py @@ -36,8 +36,10 @@ class UserKey(github.GithubObject.CompletableGithubObject): - """ - This class represents UserKeys. The reference can be found here https://docs.github.com/en/rest/reference/users#keys + """This class represents UserKeys. + + The reference can be found here https://docs.github.com/en/rest/reference/users#keys + """ def _initAttributes(self) -> None: diff --git a/github/Variable.py b/github/Variable.py index 5e440ebd7f..a0144aeb9d 100644 --- a/github/Variable.py +++ b/github/Variable.py @@ -29,8 +29,10 @@ class Variable(CompletableGithubObject): - """ - This class represents a GitHub variable. The reference can be found here https://docs.github.com/en/rest/actions/variables + """This class represents a GitHub variable. + + The reference can be found here https://docs.github.com/en/rest/actions/variables + """ def _initAttributes(self) -> None: diff --git a/github/View.py b/github/View.py index a79f3d4b28..546e585068 100644 --- a/github/View.py +++ b/github/View.py @@ -30,9 +30,10 @@ class View(NonCompletableGithubObject): - """ - This class represents a popular Path for a GitHub repository. + """This class represents a popular Path for a GitHub repository. + The reference can be found here https://docs.github.com/en/rest/reference/repos#traffic + """ def _initAttributes(self) -> None: diff --git a/github/Workflow.py b/github/Workflow.py index fd79360e52..a8254cd1ef 100644 --- a/github/Workflow.py +++ b/github/Workflow.py @@ -35,8 +35,10 @@ class Workflow(CompletableGithubObject): - """ - This class represents Workflows. The reference can be found here https://docs.github.com/en/rest/reference/actions#workflows + """This class represents Workflows. + + The reference can be found here https://docs.github.com/en/rest/reference/actions#workflows + """ def _initAttributes(self) -> None: diff --git a/github/WorkflowJob.py b/github/WorkflowJob.py index a7f254d28f..b2650ee52a 100644 --- a/github/WorkflowJob.py +++ b/github/WorkflowJob.py @@ -30,8 +30,10 @@ class WorkflowJob(CompletableGithubObject): - """ - This class represents Workflow Jobs. The reference can be found here https://docs.github.com/en/rest/reference/actions#workflow-jobs + """This class represents Workflow Jobs. + + The reference can be found here https://docs.github.com/en/rest/reference/actions#workflow-jobs + """ def _initAttributes(self) -> None: diff --git a/github/WorkflowRun.py b/github/WorkflowRun.py index 72fe66d2d0..7b04649a53 100644 --- a/github/WorkflowRun.py +++ b/github/WorkflowRun.py @@ -46,8 +46,10 @@ class TimingData(NamedTuple): class WorkflowRun(CompletableGithubObject): - """ - This class represents Workflow Runs. The reference can be found here https://docs.github.com/en/rest/reference/actions#workflow-runs + """This class represents Workflow Runs. + + The reference can be found here https://docs.github.com/en/rest/reference/actions#workflow-runs + """ def _initAttributes(self) -> None: diff --git a/github/WorkflowStep.py b/github/WorkflowStep.py index 3de5991258..25493a1163 100644 --- a/github/WorkflowStep.py +++ b/github/WorkflowStep.py @@ -26,8 +26,10 @@ class WorkflowStep(CompletableGithubObject): - """ - This class represents steps in a Workflow Job. The reference can be found here https://docs.github.com/en/rest/reference/actions#workflow-jobs + """This class represents steps in a Workflow Job. + + The reference can be found here https://docs.github.com/en/rest/reference/actions#workflow-jobs + """ def _initAttributes(self) -> None: diff --git a/github/__init__.py b/github/__init__.py index ceca6297d4..f4d4dbfaae 100644 --- a/github/__init__.py +++ b/github/__init__.py @@ -26,13 +26,12 @@ # along with PyGithub. If not, see . # # # ################################################################################ - -""" -The primary class you will instantiate is :class:`github.MainClass.Github`. -From its ``get_``, ``create_`` methods, you will obtain instances of all Github objects -like :class:`github.NamedUser.NamedUser` or :class:`github.Repository.Repository`. +"""The primary class you will instantiate is :class:`github.MainClass.Github`. From its ``get_``, ``create_`` methods, +you will obtain instances of all Github objects like :class:`github.NamedUser.NamedUser` or +:class:`github.Repository.Repository`. All classes inherit from :class:`github.GithubObject.GithubObject`. + """ import logging @@ -63,17 +62,13 @@ def set_log_level(level: int) -> None: - """ - Set the log level of the github logger, e.g. set_log_level(logging.WARNING) - :param level: log level - """ + """Set the log level of the github logger, e.g. set_log_level(logging.WARNING) :param level: log level.""" logger.setLevel(level) def enable_console_debug_logging() -> None: # pragma no cover (Function useful only outside test environment) - """ - This function sets up a very simple logging configuration (log everything on standard output) that is useful for troubleshooting. - """ + """This function sets up a very simple logging configuration (log everything on standard output) that is useful for + troubleshooting.""" set_log_level(logging.DEBUG) From ff9619c529cc3d970f9ae77a0596155a266e2b0c Mon Sep 17 00:00:00 2001 From: Jirka Date: Tue, 26 Sep 2023 21:20:25 +0200 Subject: [PATCH 04/12] apply --- .pre-commit-config.yaml | 10 +++--- github/Repository.py | 72 +++++++++++++++++++++----------------- github/StatsContributor.py | 11 +++--- 3 files changed, 50 insertions(+), 43 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f82e383c46..236cd2ceb8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,14 +29,14 @@ repos: - --ignore-words-list="bloaded,nto,pullrequest,pullrequests,thi,tim,wan,Wan,chang,Chang" - --quiet-level=2 - - repo: https://github.com/psf/black - rev: 23.3.0 - hooks: - - id: black - - repo: https://github.com/PyCQA/docformatter rev: v1.7.5 hooks: - id: docformatter additional_dependencies: [tomli] args: ["--in-place"] + + - repo: https://github.com/psf/black + rev: 23.3.0 + hooks: + - id: black diff --git a/github/Repository.py b/github/Repository.py index 7537df3632..a5313b4605 100644 --- a/github/Repository.py +++ b/github/Repository.py @@ -276,8 +276,10 @@ class Repository(CompletableGithubObject): - """ - This class represents Repositories. The reference can be found here https://docs.github.com/en/rest/reference/repos + """This class represents Repositories. + + The reference can be found here https://docs.github.com/en/rest/reference/repos + """ def __repr__(self) -> str: @@ -1188,9 +1190,8 @@ def create_git_tag_and_release( prerelease: bool = False, generate_release_notes: bool = False, ) -> GitRelease: - """ - Convenience function that calls :meth:`Repository.create_git_tag` and - :meth:`Repository.create_git_release`. + """Convenience function that calls :meth:`Repository.create_git_tag` and :meth:`Repository.create_git_release`. + :param tag: string :param tag_message: string :param release_name: string @@ -1202,6 +1203,7 @@ def create_git_tag_and_release( :param prerelease: bool :param generate_release_notes: bool :rtype: :class:`github.GitRelease.GitRelease` + """ self.create_git_tag(tag, tag_message, object, type, tagger) return self.create_git_release( @@ -1686,9 +1688,7 @@ def create_secret(self, secret_name: str, unencrypted_value: str) -> github.Secr ) def get_secrets(self) -> PaginatedList[github.Secret.Secret]: - """ - Gets all repository secrets - """ + """Gets all repository secrets.""" return PaginatedList( github.Secret.Secret, self._requester, @@ -1732,10 +1732,7 @@ def create_variable(self, variable_name: str, value: str) -> github.Variable.Var ) def get_variables(self) -> PaginatedList[github.Variable.Variable]: - """ - Gets all repository variables - :rtype: :class:`PaginatedList` of :class:`github.Variable.Variable` - """ + """Gets all repository variables :rtype: :class:`PaginatedList` of :class:`github.Variable.Variable`""" return PaginatedList( github.Variable.Variable, self._requester, @@ -2372,16 +2369,20 @@ def create_file( ) -> dict[str, ContentFile | Commit]: """Create a file in this repository. - :calls: `PUT /repos/{owner}/{repo}/contents/{path} `_ + :calls: `PUT /repos/{owner}/{repo}/contents/{path} `_ :param path: string, (required), path of the file in the repository :param message: string, (required), commit message :param content: string, (required), the actual data in the file - :param branch: string, (optional), branch to create the commit on. Defaults to the default branch of the repository - :param committer: InputGitAuthor, (optional), if no information is given the authenticated user's information will be used. You must specify both a name and email. - :param author: InputGitAuthor, (optional), if omitted this will be filled in with committer information. If passed, you must specify both a name and email. - :rtype: { - 'content': :class:`ContentFile `:, - 'commit': :class:`Commit `} + :param branch: string, (optional), branch to create the commit on. Defaults to the default branch of the + repository + :param committer: InputGitAuthor, (optional), if no information is given the authenticated user's information + will be used. You must specify both a name and email. + :param author: InputGitAuthor, (optional), if omitted this will be filled in with committer information. If + passed, you must specify both a name and email. + :rtype: { 'content': :class:`ContentFile `:, 'commit': :class:`Commit + `} + """ assert isinstance(path, str) assert isinstance(message, str) @@ -2446,19 +2447,22 @@ def update_file( committer: Opt[InputGitAuthor] = NotSet, author: Opt[InputGitAuthor] = NotSet, ) -> dict[str, ContentFile | Commit]: - """This method updates a file in a repository + """This method updates a file in a repository. - :calls: `PUT /repos/{owner}/{repo}/contents/{path} `_ + :calls: `PUT /repos/{owner}/{repo}/contents/{path} `_ :param path: string, Required. The content path. :param message: string, Required. The commit message. :param content: string, Required. The updated file content, either base64 encoded, or ready to be encoded. :param sha: string, Required. The blob SHA of the file being replaced. :param branch: string. The branch name. Default: the repository’s default branch (usually master) - :param committer: InputGitAuthor, (optional), if no information is given the authenticated user's information will be used. You must specify both a name and email. - :param author: InputGitAuthor, (optional), if omitted this will be filled in with committer information. If passed, you must specify both a name and email. - :rtype: { - 'content': :class:`ContentFile `:, - 'commit': :class:`Commit `} + :param committer: InputGitAuthor, (optional), if no information is given the authenticated user's information + will be used. You must specify both a name and email. + :param author: InputGitAuthor, (optional), if omitted this will be filled in with committer information. If + passed, you must specify both a name and email. + :rtype: { 'content': :class:`ContentFile `:, 'commit': :class:`Commit + `} + """ assert isinstance(path, str) assert isinstance(message, str) @@ -2501,18 +2505,20 @@ def delete_file( committer: Opt[InputGitAuthor] = NotSet, author: Opt[InputGitAuthor] = NotSet, ) -> dict[str, Commit | _NotSetType]: - """This method deletes a file in a repository + """This method deletes a file in a repository. - :calls: `DELETE /repos/{owner}/{repo}/contents/{path} `_ + :calls: `DELETE /repos/{owner}/{repo}/contents/{path} `_ :param path: string, Required. The content path. :param message: string, Required. The commit message. :param sha: string, Required. The blob SHA of the file being replaced. :param branch: string. The branch name. Default: the repository’s default branch (usually master) - :param committer: InputGitAuthor, (optional), if no information is given the authenticated user's information will be used. You must specify both a name and email. - :param author: InputGitAuthor, (optional), if omitted this will be filled in with committer information. If passed, you must specify both a name and email. - :rtype: { - 'content': :class:`null `:, - 'commit': :class:`Commit `} + :param committer: InputGitAuthor, (optional), if no information is given the authenticated user's information + will be used. You must specify both a name and email. + :param author: InputGitAuthor, (optional), if omitted this will be filled in with committer information. If + passed, you must specify both a name and email. + :rtype: { 'content': :class:`null `:, 'commit': :class:`Commit `} + """ assert isinstance(path, str), "path must be str/unicode object" assert isinstance(message, str), "message must be str/unicode object" diff --git a/github/StatsContributor.py b/github/StatsContributor.py index 49e2c6e957..c7551f8207 100755 --- a/github/StatsContributor.py +++ b/github/StatsContributor.py @@ -34,14 +34,15 @@ class StatsContributor(NonCompletableGithubObject): - """ - This class represents StatsContributors. The reference can be found here https://docs.github.com/en/rest/reference/repos#get-all-contributor-commit-activity + """This class represents StatsContributors. + + The reference can be found here + https://docs.github.com/en/rest/reference/repos#get-all-contributor-commit-activity + """ class Week(NonCompletableGithubObject): - """ - This class represents weekly statistics of a contributor. - """ + """This class represents weekly statistics of a contributor.""" @property def w(self) -> datetime: From eeec2e923ab97e57775d6191ebfd79780c6a3802 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 1 Feb 2024 23:19:55 +0100 Subject: [PATCH 05/12] update --- github/Auth.py | 28 +++++++++++----------------- github/RepositoryAdvisory.py | 25 +++++++++++++++---------- 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/github/Auth.py b/github/Auth.py index 06723ac46f..fc4dce9ac1 100644 --- a/github/Auth.py +++ b/github/Auth.py @@ -86,9 +86,7 @@ def token(self) -> str: class Login(HTTPBasicAuth): - """ - This class is used to authenticate with login and password. - """ + """This class is used to authenticate with login and password.""" def __init__(self, login: str, password: str): assert isinstance(login, str) @@ -113,9 +111,7 @@ def password(self) -> str: class Token(Auth): - """ - This class is used to authenticate with a single constant token. - """ + """This class is used to authenticate with a single constant token.""" def __init__(self, token: str): assert isinstance(token, str) @@ -144,8 +140,8 @@ def token_type(self) -> str: class AppAuth(JWT): - """ - This class is used to authenticate as a GitHub App. + """This class is used to authenticate as a GitHub App. + https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app """ @@ -225,8 +221,8 @@ def create_jwt(self, expiration: Optional[int] = None) -> str: class AppAuthToken(JWT): - """ - This class is used to authenticate as a GitHub App with a single constant JWT. + """This class is used to authenticate as a GitHub App with a single constant JWT. + https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app """ @@ -242,8 +238,8 @@ def token(self) -> str: class AppInstallationAuth(Auth, WithRequester["AppInstallationAuth"]): - """ - This class is used to authenticate as a GitHub App Installation. + """This class is used to authenticate as a GitHub App Installation. + https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app-installation """ @@ -323,8 +319,8 @@ def _get_installation_authorization(self) -> InstallationAuthorization: class AppUserAuth(Auth, WithRequester["AppUserAuth"]): - """ - This class is used to authenticate as a GitHub App on behalf of a user. + """This class is used to authenticate as a GitHub App on behalf of a user. + https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-with-a-github-app-on-behalf-of-a-user """ @@ -452,9 +448,7 @@ def refresh_expires_at(self) -> Optional[datetime]: class NetrcAuth(HTTPBasicAuth, WithRequester["NetrcAuth"]): - """ - This class is used to authenticate via .netrc. - """ + """This class is used to authenticate via .netrc.""" def __init__(self) -> None: super().__init__() diff --git a/github/RepositoryAdvisory.py b/github/RepositoryAdvisory.py index fb9cf9079a..7519785b56 100644 --- a/github/RepositoryAdvisory.py +++ b/github/RepositoryAdvisory.py @@ -199,10 +199,11 @@ def offer_credit( login_or_user: str | github.NamedUser.NamedUser, credit_type: str, ) -> None: - """ - Offers credit to a user for a vulnerability in a repository. + """Offers credit to a user for a vulnerability in a repository. + Unless you are giving credit to yourself, the user having credit offered will need to explicitly accept the credit. :calls: `PATCH /repos/{owner}/{repo}/security-advisories/:advisory_id ` + """ self.offer_credits([{"login": login_or_user, "type": credit_type}]) @@ -210,11 +211,12 @@ def offer_credits( self, credited: Iterable[Credit], ) -> None: - """ - Offers credit to a list of users for a vulnerability in a repository. + """Offers credit to a list of users for a vulnerability in a repository. + Unless you are giving credit to yourself, the user having credit offered will need to explicitly accept the credit. :calls: `PATCH /repos/{owner}/{repo}/security-advisories/:advisory_id ` :param credited: iterable of dict with keys "login" and "type" + """ assert isinstance(credited, Iterable), credited for credit in credited: @@ -328,9 +330,10 @@ def edit( return self def accept_report(self) -> None: - """ - Accepts the advisory reported from an external reporter via private vulnerability reporting. + """Accepts the advisory reported from an external reporter via private vulnerability reporting. + :calls: `PATCH /repos/{owner}/{repo}/security-advisories/:advisory_id ` + """ patch_parameters = {"state": "draft"} headers, data = self._requester.requestJsonAndCheck( @@ -341,9 +344,10 @@ def accept_report(self) -> None: self._useAttributes(data) def publish(self) -> None: - """ - Publishes the advisory. + """Publishes the advisory. + :calls: `PATCH /repos/{owner}/{repo}/security-advisories/:advisory_id ` + """ patch_parameters = {"state": "published"} headers, data = self._requester.requestJsonAndCheck( @@ -354,9 +358,10 @@ def publish(self) -> None: self._useAttributes(data) def close(self) -> None: - """ - Closes the advisory. + """Closes the advisory. + :calls: `PATCH /repos/{owner}/{repo}/security-advisories/:advisory_id ` + """ patch_parameters = {"state": "closed"} headers, data = self._requester.requestJsonAndCheck( From 645546322c87181753df8954c12f491bf796b1e8 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 1 Feb 2024 23:21:09 +0100 Subject: [PATCH 06/12] docformatter --- .pre-commit-config.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 07c65962dd..f25eeccb7d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,6 +34,13 @@ repos: - id: codespell additional_dependencies: [tomli] + - repo: https://github.com/PyCQA/docformatter + rev: v1.7.5 + hooks: + - id: docformatter + additional_dependencies: [tomli] + args: ["--in-place"] + - repo: https://github.com/psf/black rev: 23.12.0 hooks: From 8be2494e00794bc25d8ee30b3c0f6e2416b3914a Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 1 Feb 2024 23:21:40 +0100 Subject: [PATCH 07/12] apply --- github/AdvisoryCredit.py | 11 ++- github/AdvisoryCreditDetailed.py | 7 +- github/AdvisoryVulnerability.py | 16 ++-- github/AdvisoryVulnerabilityPackage.py | 8 +- github/ApplicationOAuth.py | 7 +- github/Auth.py | 23 +++--- github/Authorization.py | 1 - github/Autolink.py | 4 +- github/Branch.py | 4 +- github/BranchProtection.py | 4 +- github/CVSS.py | 7 +- github/CWE.py | 4 +- github/CheckRun.py | 4 +- github/CheckRunAnnotation.py | 1 - github/CheckSuite.py | 4 +- github/Clones.py | 4 +- github/CodeScanAlert.py | 5 +- github/CodeScanAlertInstance.py | 4 +- github/CodeScanAlertInstanceLocation.py | 4 +- github/CodeScanRule.py | 4 +- github/CodeScanTool.py | 4 +- github/Commit.py | 4 +- github/CommitCombinedStatus.py | 4 +- github/CommitComment.py | 4 +- github/ContentFile.py | 4 +- github/DependabotAlert.py | 7 +- github/DependabotAlertAdvisory.py | 8 +- github/DependabotAlertDependency.py | 7 +- github/DependabotAlertVulnerability.py | 4 +- github/Deployment.py | 4 +- github/DeploymentStatus.py | 4 +- github/Download.py | 4 +- github/Enterprise.py | 6 +- github/EnterpriseConsumedLicenses.py | 1 - github/Environment.py | 14 ++-- github/EnvironmentDeploymentBranchPolicy.py | 7 +- github/EnvironmentProtectionRule.py | 4 +- github/EnvironmentProtectionRuleReviewer.py | 7 +- github/Event.py | 4 +- github/Gist.py | 4 +- github/GistComment.py | 4 +- github/GitBlob.py | 4 +- github/GitCommit.py | 4 +- github/GitRef.py | 4 +- github/GitRelease.py | 5 +- github/GitReleaseAsset.py | 4 +- github/GitTag.py | 4 +- github/GitTree.py | 4 +- github/GithubApp.py | 4 +- github/GithubException.py | 33 ++++---- github/GithubIntegration.py | 5 +- github/GithubObject.py | 12 +-- github/GithubRetry.py | 1 - github/GitignoreTemplate.py | 4 +- github/GlobalAdvisory.py | 4 +- github/Hook.py | 4 +- github/Installation.py | 4 +- github/Invitation.py | 4 +- github/Issue.py | 4 +- github/IssueComment.py | 4 +- github/IssueEvent.py | 4 +- github/Label.py | 4 +- github/License.py | 4 +- github/MainClass.py | 22 +++--- github/Membership.py | 4 +- github/Migration.py | 4 +- github/Milestone.py | 4 +- github/NamedEnterpriseUser.py | 1 - github/NamedUser.py | 4 +- github/Notification.py | 4 +- github/NotificationSubject.py | 1 - github/Organization.py | 20 +++-- github/OrganizationDependabotAlert.py | 6 +- github/OrganizationSecret.py | 4 +- github/OrganizationVariable.py | 4 +- github/Path.py | 4 +- github/Project.py | 4 +- github/ProjectCard.py | 4 +- github/ProjectColumn.py | 4 +- github/PublicKey.py | 9 ++- github/PullRequest.py | 4 +- github/PullRequestComment.py | 4 +- github/PullRequestMergeStatus.py | 1 - github/PullRequestReview.py | 4 +- github/Rate.py | 4 +- github/RateLimit.py | 4 +- github/Reaction.py | 4 +- github/Referrer.py | 4 +- github/Repository.py | 84 ++++++++++++--------- github/RepositoryAdvisory.py | 33 ++++---- github/RepositoryKey.py | 4 +- github/RepositoryPreferences.py | 1 - github/Requester.py | 12 +-- github/RequiredPullRequestReviews.py | 1 - github/RequiredStatusChecks.py | 4 +- github/Secret.py | 4 +- github/SelfHostedActionsRunner.py | 1 - github/SourceImport.py | 4 +- github/Stargazer.py | 4 +- github/StatsCodeFrequency.py | 1 - github/StatsCommitActivity.py | 1 - github/StatsContributor.py | 1 - github/StatsParticipation.py | 4 +- github/StatsPunchCard.py | 1 - github/Tag.py | 4 +- github/Team.py | 4 +- github/TeamDiscussion.py | 4 +- github/TimelineEvent.py | 4 +- github/TimelineEventSource.py | 4 +- github/UserKey.py | 4 +- github/Variable.py | 4 +- github/View.py | 4 +- github/Workflow.py | 4 +- github/WorkflowJob.py | 4 +- github/WorkflowRun.py | 4 +- github/WorkflowStep.py | 4 +- github/__init__.py | 13 ++-- tests/GlobalAdvisory.py | 3 +- 118 files changed, 362 insertions(+), 353 deletions(-) diff --git a/github/AdvisoryCredit.py b/github/AdvisoryCredit.py index 3d36d643f9..cfa7ea1141 100644 --- a/github/AdvisoryCredit.py +++ b/github/AdvisoryCredit.py @@ -35,9 +35,7 @@ class SimpleCredit(TypedDict): - """ - A simple credit for a security advisory. - """ + """A simple credit for a security advisory.""" login: str | github.NamedUser.NamedUser type: str @@ -47,9 +45,10 @@ class SimpleCredit(TypedDict): class AdvisoryCredit(NonCompletableGithubObject): - """ - This class represents a credit that is assigned to a SecurityAdvisory. - The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories + """This class represents a credit that is assigned to a SecurityAdvisory. + + The reference can be found here + https://docs.github.com/en/rest/security-advisories/repository-advisories """ @property diff --git a/github/AdvisoryCreditDetailed.py b/github/AdvisoryCreditDetailed.py index 2b1c289cf7..1cf61cb514 100644 --- a/github/AdvisoryCreditDetailed.py +++ b/github/AdvisoryCreditDetailed.py @@ -46,9 +46,10 @@ class AdvisoryCreditDetailed(NonCompletableGithubObject): - """ - This class represents a credit that is assigned to a SecurityAdvisory. - The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories + """This class represents a credit that is assigned to a SecurityAdvisory. + + The reference can be found here + https://docs.github.com/en/rest/security-advisories/repository-advisories """ @property diff --git a/github/AdvisoryVulnerability.py b/github/AdvisoryVulnerability.py index 511d17053f..a574c4cd51 100644 --- a/github/AdvisoryVulnerability.py +++ b/github/AdvisoryVulnerability.py @@ -38,18 +38,14 @@ class SimpleAdvisoryVulnerabilityPackage(TypedDict): - """ - A simple package in an advisory. - """ + """A simple package in an advisory.""" ecosystem: str name: str | None class SimpleAdvisoryVulnerability(TypedDict): - """ - A simple vulnerability in a security advisory. - """ + """A simple vulnerability in a security advisory.""" package: SimpleAdvisoryVulnerabilityPackage patched_versions: str | None @@ -61,9 +57,11 @@ class SimpleAdvisoryVulnerability(TypedDict): class AdvisoryVulnerability(NonCompletableGithubObject): - """ - This class represents a package that is vulnerable to a parent SecurityAdvisory. - The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories + """This class represents a package that is vulnerable to a parent + SecurityAdvisory. + + The reference can be found here + https://docs.github.com/en/rest/security-advisories/repository-advisories """ @property diff --git a/github/AdvisoryVulnerabilityPackage.py b/github/AdvisoryVulnerabilityPackage.py index a1a747f87d..675b31252f 100644 --- a/github/AdvisoryVulnerabilityPackage.py +++ b/github/AdvisoryVulnerabilityPackage.py @@ -47,9 +47,11 @@ class AdvisoryVulnerabilityPackage(NonCompletableGithubObject): - """ - This class represents an identifier for a package that is vulnerable to a parent SecurityAdvisory. - The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories + """This class represents an identifier for a package that is vulnerable to + a parent SecurityAdvisory. + + The reference can be found here + https://docs.github.com/en/rest/security-advisories/repository-advisories """ def _initAttributes(self) -> None: diff --git a/github/ApplicationOAuth.py b/github/ApplicationOAuth.py index 37eb6412ea..e1309822ac 100644 --- a/github/ApplicationOAuth.py +++ b/github/ApplicationOAuth.py @@ -42,11 +42,11 @@ class ApplicationOAuth(NonCompletableGithubObject): - """This class is used for identifying and authorizing users for Github Apps. + """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/building-github-apps/identifying-and-authorizing-users-for-github-apps - """ def _initAttributes(self) -> None: @@ -87,7 +87,8 @@ def get_login_url( state: str | None = None, login: str | None = None, ) -> str: - """Return the URL you need to redirect a user to in order to authorize your App.""" + """Return the URL you need to redirect a user to in order to authorize + your App.""" parameters = {"client_id": self.client_id} if redirect_uri is not None: assert isinstance(redirect_uri, str), redirect_uri diff --git a/github/Auth.py b/github/Auth.py index 243bea641e..748632c137 100644 --- a/github/Auth.py +++ b/github/Auth.py @@ -47,15 +47,16 @@ # add new implementations of github.Auth.Auth to docs/utilities.rst class Auth(abc.ABC): - """This class is the base class of all authentication methods for Requester.""" + """This class is the base class of all authentication methods for + Requester.""" @property @abc.abstractmethod def token_type(self) -> str: - """The type of the auth token as used in the HTTP Authorization header, e.g. Bearer or Basic. + """The type of the auth token as used in the HTTP Authorization header, + e.g. Bearer or Basic. :return: token type - """ @property @@ -64,7 +65,6 @@ def token(self) -> str: """The auth token as used in the HTTP Authorization header. :return: token - """ @@ -131,10 +131,10 @@ def token(self) -> str: class JWT(Auth, ABC): - """This class is the base class to authenticate with a JSON Web Token (JWT). + """This class is the base class to authenticate with a JSON Web Token + (JWT). https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-json-web-token-jwt-for-a-github-app - """ @property @@ -146,7 +146,6 @@ class AppAuth(JWT): """This class is used to authenticate as a GitHub App. https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app - """ def __init__( @@ -189,13 +188,13 @@ def get_installation_auth( token_permissions: Optional[Dict[str, str]] = None, requester: Optional[Requester] = None, ) -> "AppInstallationAuth": - """Creates a github.Auth.AppInstallationAuth instance for an installation. + """Creates a github.Auth.AppInstallationAuth instance for an + installation. :param installation_id: installation id :param token_permissions: optional permissions :param requester: optional requester with app authentication :return: - """ return AppInstallationAuth(self, installation_id, token_permissions, requester) @@ -224,10 +223,10 @@ def create_jwt(self, expiration: Optional[int] = None) -> str: class AppAuthToken(JWT): - """This class is used to authenticate as a GitHub App with a single constant JWT. + """This class is used to authenticate as a GitHub App with a single + constant JWT. https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app - """ def __init__(self, token: str): @@ -244,7 +243,6 @@ class AppInstallationAuth(Auth, WithRequester["AppInstallationAuth"]): """This class is used to authenticate as a GitHub App Installation. https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app-installation - """ # used to fetch live access token when calling self.token @@ -325,7 +323,6 @@ class AppUserAuth(Auth, WithRequester["AppUserAuth"]): """This class is used to authenticate as a GitHub App on behalf of a user. https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-with-a-github-app-on-behalf-of-a-user - """ _client_id: str diff --git a/github/Authorization.py b/github/Authorization.py index f39dc0bd70..231cae9da1 100644 --- a/github/Authorization.py +++ b/github/Authorization.py @@ -53,7 +53,6 @@ class Authorization(github.GithubObject.CompletableGithubObject): The reference can be found here https://docs.github.com/en/enterprise-server@3.0/rest/reference/oauth-authorizations - """ def _initAttributes(self) -> None: diff --git a/github/Autolink.py b/github/Autolink.py index ae95163985..94007377b5 100644 --- a/github/Autolink.py +++ b/github/Autolink.py @@ -44,8 +44,8 @@ class Autolink(NonCompletableGithubObject): """This class represents Repository autolinks. - The reference can be found here https://docs.github.com/en/rest/repos/autolinks?apiVersion=2022-11-28 - + The reference can be found here + https://docs.github.com/en/rest/repos/autolinks?apiVersion=2022-11-28 """ def _initAttributes(self) -> None: diff --git a/github/Branch.py b/github/Branch.py index f9c69ba09e..0cdff40c09 100644 --- a/github/Branch.py +++ b/github/Branch.py @@ -79,8 +79,8 @@ class Branch(NonCompletableGithubObject): """This class represents Branches. - The reference can be found here https://docs.github.com/en/rest/reference/repos#branches - + The reference can be found here + https://docs.github.com/en/rest/reference/repos#branches """ def __repr__(self) -> str: diff --git a/github/BranchProtection.py b/github/BranchProtection.py index c6e64e6777..b7049754ed 100644 --- a/github/BranchProtection.py +++ b/github/BranchProtection.py @@ -50,8 +50,8 @@ class BranchProtection(github.GithubObject.CompletableGithubObject): """This class represents Branch Protection. - The reference can be found here https://docs.github.com/en/rest/reference/repos#get-branch-protection - + The reference can be found here + https://docs.github.com/en/rest/reference/repos#get-branch-protection """ def __repr__(self) -> str: diff --git a/github/CVSS.py b/github/CVSS.py index 7f8694c4cd..e52a554218 100644 --- a/github/CVSS.py +++ b/github/CVSS.py @@ -43,9 +43,10 @@ class CVSS(NonCompletableGithubObject): - """ - This class represents a CVSS. - The reference can be found here + """This class represents a CVSS. + + The reference can be found here + """ def _initAttributes(self) -> None: diff --git a/github/CWE.py b/github/CWE.py index 444d14cc66..4241af36ab 100644 --- a/github/CWE.py +++ b/github/CWE.py @@ -45,8 +45,8 @@ class CWE(CompletableGithubObject): """This class represents a CWE. - The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories - + The reference can be found here + https://docs.github.com/en/rest/security-advisories/repository-advisories """ def _initAttributes(self) -> None: diff --git a/github/CheckRun.py b/github/CheckRun.py index cb20b43ca0..137a1f1914 100644 --- a/github/CheckRun.py +++ b/github/CheckRun.py @@ -57,8 +57,8 @@ class CheckRun(CompletableGithubObject): """This class represents check runs. - The reference can be found here https://docs.github.com/en/rest/reference/checks#check-runs - + The reference can be found here + https://docs.github.com/en/rest/reference/checks#check-runs """ def _initAttributes(self) -> None: diff --git a/github/CheckRunAnnotation.py b/github/CheckRunAnnotation.py index 8f60b27280..08c5890b81 100644 --- a/github/CheckRunAnnotation.py +++ b/github/CheckRunAnnotation.py @@ -33,7 +33,6 @@ class CheckRunAnnotation(NonCompletableGithubObject): """This class represents check run annotations. The reference can be found here: https://docs.github.com/en/rest/reference/checks#list-check-run-annotations - """ def _initAttributes(self) -> None: diff --git a/github/CheckSuite.py b/github/CheckSuite.py index 709cde710b..078a1eef74 100644 --- a/github/CheckSuite.py +++ b/github/CheckSuite.py @@ -50,8 +50,8 @@ class CheckSuite(CompletableGithubObject): """This class represents check suites. - The reference can be found here https://docs.github.com/en/rest/reference/checks#check-suites - + The reference can be found here + https://docs.github.com/en/rest/reference/checks#check-suites """ def _initAttributes(self) -> None: diff --git a/github/Clones.py b/github/Clones.py index bf3618960b..de3c7a68c2 100644 --- a/github/Clones.py +++ b/github/Clones.py @@ -44,8 +44,8 @@ class Clones(NonCompletableGithubObject): """This class represents a popular Path for a GitHub repository. - The reference can be found here https://docs.github.com/en/rest/reference/repos#get-repository-clones - + The reference can be found here + https://docs.github.com/en/rest/reference/repos#get-repository-clones """ def _initAttributes(self) -> None: diff --git a/github/CodeScanAlert.py b/github/CodeScanAlert.py index 0b55aaee50..398c480caf 100644 --- a/github/CodeScanAlert.py +++ b/github/CodeScanAlert.py @@ -40,8 +40,8 @@ class CodeScanAlert(NonCompletableGithubObject): """This class represents alerts from code scanning. - The reference can be found here https://docs.github.com/en/rest/reference/code-scanning. - + The reference can be found here + https://docs.github.com/en/rest/reference/code-scanning. """ def _initAttributes(self) -> None: @@ -113,7 +113,6 @@ def get_instances(self) -> PaginatedList[github.CodeScanAlertInstance.CodeScanAl """Get instances. :calls: `GET` on the URL for instances as provided by Github. - """ return PaginatedList( github.CodeScanAlertInstance.CodeScanAlertInstance, diff --git a/github/CodeScanAlertInstance.py b/github/CodeScanAlertInstance.py index f30bc80de6..03d4101436 100644 --- a/github/CodeScanAlertInstance.py +++ b/github/CodeScanAlertInstance.py @@ -37,8 +37,8 @@ class CodeScanAlertInstance(NonCompletableGithubObject): """This class represents code scanning alert instances. - The reference can be found here https://docs.github.com/en/rest/reference/code-scanning. - + The reference can be found here + https://docs.github.com/en/rest/reference/code-scanning. """ def _initAttributes(self) -> None: diff --git a/github/CodeScanAlertInstanceLocation.py b/github/CodeScanAlertInstanceLocation.py index 7eec17b223..6c19921c21 100644 --- a/github/CodeScanAlertInstanceLocation.py +++ b/github/CodeScanAlertInstanceLocation.py @@ -32,8 +32,8 @@ class CodeScanAlertInstanceLocation(NonCompletableGithubObject): """This class represents code scanning alert instance locations. - The reference can be found here https://docs.github.com/en/rest/reference/code-scanning. - + The reference can be found here + https://docs.github.com/en/rest/reference/code-scanning. """ def _initAttributes(self) -> None: diff --git a/github/CodeScanRule.py b/github/CodeScanRule.py index 5cf8d40098..42a05a16ca 100644 --- a/github/CodeScanRule.py +++ b/github/CodeScanRule.py @@ -46,8 +46,8 @@ class CodeScanRule(NonCompletableGithubObject): """This class represents Alerts from code scanning. - The reference can be found here https://docs.github.com/en/rest/reference/code-scanning. - + The reference can be found here + https://docs.github.com/en/rest/reference/code-scanning. """ def _initAttributes(self) -> None: diff --git a/github/CodeScanTool.py b/github/CodeScanTool.py index ed7a97c36c..f0728742cd 100644 --- a/github/CodeScanTool.py +++ b/github/CodeScanTool.py @@ -43,8 +43,8 @@ class CodeScanTool(NonCompletableGithubObject): """This class represents code scanning tools. - The reference can be found here https://docs.github.com/en/rest/reference/code-scanning. - + The reference can be found here + https://docs.github.com/en/rest/reference/code-scanning. """ def _initAttributes(self) -> None: diff --git a/github/Commit.py b/github/Commit.py index 3c819500d8..da3fb803bd 100644 --- a/github/Commit.py +++ b/github/Commit.py @@ -73,8 +73,8 @@ class Commit(CompletableGithubObject): """This class represents Commits. - The reference can be found here https://docs.github.com/en/rest/reference/git#commits - + The reference can be found here + https://docs.github.com/en/rest/reference/git#commits """ def _initAttributes(self) -> None: diff --git a/github/CommitCombinedStatus.py b/github/CommitCombinedStatus.py index bdb85f5557..c2324ddd3e 100644 --- a/github/CommitCombinedStatus.py +++ b/github/CommitCombinedStatus.py @@ -48,8 +48,8 @@ class CommitCombinedStatus(NonCompletableGithubObject): """This class represents CommitCombinedStatuses. - The reference can be found here https://docs.github.com/en/rest/reference/repos#statuses - + The reference can be found here + https://docs.github.com/en/rest/reference/repos#statuses """ def _initAttributes(self) -> None: diff --git a/github/CommitComment.py b/github/CommitComment.py index 3631829e7c..de1c395a33 100644 --- a/github/CommitComment.py +++ b/github/CommitComment.py @@ -57,8 +57,8 @@ class CommitComment(CompletableGithubObject): """This class represents CommitComments. - The reference can be found here https://docs.github.com/en/rest/reference/repos#comments - + The reference can be found here + https://docs.github.com/en/rest/reference/repos#comments """ def _initAttributes(self) -> None: diff --git a/github/ContentFile.py b/github/ContentFile.py index 246f7c9c70..fbdf744b94 100644 --- a/github/ContentFile.py +++ b/github/ContentFile.py @@ -56,8 +56,8 @@ class ContentFile(CompletableGithubObject): """This class represents ContentFiles. - The reference can be found here https://docs.github.com/en/rest/reference/repos#contents - + The reference can be found here + https://docs.github.com/en/rest/reference/repos#contents """ def _initAttributes(self) -> None: diff --git a/github/DependabotAlert.py b/github/DependabotAlert.py index 614543faa6..622fdefc85 100644 --- a/github/DependabotAlert.py +++ b/github/DependabotAlert.py @@ -40,9 +40,10 @@ class DependabotAlert(NonCompletableGithubObject): - """ - This class represents a DependabotAlert. - The reference can be found here https://docs.github.com/en/rest/dependabot/alerts + """This class represents a DependabotAlert. + + The reference can be found here + https://docs.github.com/en/rest/dependabot/alerts """ def _initAttributes(self) -> None: diff --git a/github/DependabotAlertAdvisory.py b/github/DependabotAlertAdvisory.py index e5410d58e0..e5a0f16b09 100644 --- a/github/DependabotAlertAdvisory.py +++ b/github/DependabotAlertAdvisory.py @@ -33,9 +33,11 @@ class DependabotAlertAdvisory(github.AdvisoryBase.AdvisoryBase): - """ - This class represents a package flagged by a Dependabot alert that is vulnerable to a parent SecurityAdvisory. - The reference can be found here https://docs.github.com/en/rest/dependabot/alerts + """This class represents a package flagged by a Dependabot alert that is + vulnerable to a parent SecurityAdvisory. + + The reference can be found here + https://docs.github.com/en/rest/dependabot/alerts """ def _initAttributes(self) -> None: diff --git a/github/DependabotAlertDependency.py b/github/DependabotAlertDependency.py index a59ed80c65..1ed2f72788 100644 --- a/github/DependabotAlertDependency.py +++ b/github/DependabotAlertDependency.py @@ -29,9 +29,10 @@ class DependabotAlertDependency(NonCompletableGithubObject): - """ - This class represents a DependabotAlertDependency. - The reference can be found here https://docs.github.com/en/rest/dependabot/alerts + """This class represents a DependabotAlertDependency. + + The reference can be found here + https://docs.github.com/en/rest/dependabot/alerts """ def _initAttributes(self) -> None: diff --git a/github/DependabotAlertVulnerability.py b/github/DependabotAlertVulnerability.py index b5ba5731b6..5d950a99a8 100644 --- a/github/DependabotAlertVulnerability.py +++ b/github/DependabotAlertVulnerability.py @@ -32,9 +32,7 @@ class DependabotAlertVulnerability(NonCompletableGithubObject): - """ - A vulnerability represented in a Dependabot alert. - """ + """A vulnerability represented in a Dependabot alert.""" def _initAttributes(self) -> None: self._package: Attribute[AdvisoryVulnerabilityPackage] = NotSet diff --git a/github/Deployment.py b/github/Deployment.py index 9b68bf46a1..c436c408f6 100644 --- a/github/Deployment.py +++ b/github/Deployment.py @@ -55,8 +55,8 @@ class Deployment(CompletableGithubObject): """This class represents Deployments. - The reference can be found here https://docs.github.com/en/rest/reference/repos#deployments - + The reference can be found here + https://docs.github.com/en/rest/reference/repos#deployments """ def _initAttributes(self) -> None: diff --git a/github/DeploymentStatus.py b/github/DeploymentStatus.py index 57d2277342..4b40c136cc 100644 --- a/github/DeploymentStatus.py +++ b/github/DeploymentStatus.py @@ -51,8 +51,8 @@ class DeploymentStatus(CompletableGithubObject): """This class represents Deployment Statuses. - The reference can be found here https://docs.github.com/en/rest/reference/repos#deployments - + The reference can be found here + https://docs.github.com/en/rest/reference/repos#deployments """ def _initAttributes(self) -> None: diff --git a/github/Download.py b/github/Download.py index 5073afe5ad..2d62df8ab8 100644 --- a/github/Download.py +++ b/github/Download.py @@ -45,8 +45,8 @@ class Download(CompletableGithubObject): """This class represents Downloads. - The reference can be found here https://docs.github.com/en/rest/reference/repos - + The reference can be found here + https://docs.github.com/en/rest/reference/repos """ def _initAttributes(self) -> None: diff --git a/github/Enterprise.py b/github/Enterprise.py index 39c6426120..03bc8393a7 100644 --- a/github/Enterprise.py +++ b/github/Enterprise.py @@ -46,10 +46,10 @@ class Enterprise(NonCompletableGithubObject): """This class represents Enterprises. - Such objects do not exist in the Github API, so this class merely collects all endpoints the start with - /enterprises/{enterprise}/. See methods below for specific endpoints and docs. + Such objects do not exist in the Github API, so this class merely + collects all endpoints the start with /enterprises/{enterprise}/. + See methods below for specific endpoints and docs. https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin?apiVersion=2022-11-28 - """ def __init__( diff --git a/github/EnterpriseConsumedLicenses.py b/github/EnterpriseConsumedLicenses.py index 5f147238cd..9f86d49ff5 100644 --- a/github/EnterpriseConsumedLicenses.py +++ b/github/EnterpriseConsumedLicenses.py @@ -48,7 +48,6 @@ class EnterpriseConsumedLicenses(CompletableGithubObject): The reference can be found here https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/license#list-enterprise-consumed-licenses - """ def _initAttributes(self) -> None: diff --git a/github/Environment.py b/github/Environment.py index 20aca6aa32..343b8c6a23 100644 --- a/github/Environment.py +++ b/github/Environment.py @@ -58,8 +58,8 @@ class Environment(CompletableGithubObject): """This class represents Environment. - The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments - + The reference can be found here + https://docs.github.com/en/rest/reference/deployments#environments """ def _initAttributes(self) -> None: @@ -172,9 +172,7 @@ def create_secret(self, secret_name: str, unencrypted_value: str) -> Secret: ) def get_secrets(self) -> PaginatedList[Secret]: - """ - Gets all repository secrets - """ + """Gets all repository secrets.""" return PaginatedList( Secret, self._requester, @@ -219,10 +217,8 @@ def create_variable(self, variable_name: str, value: str) -> Variable: ) def get_variables(self) -> PaginatedList[Variable]: - """ - Gets all repository variables - :rtype: :class:`PaginatedList` of :class:`Variable` - """ + """Gets all repository variables :rtype: :class:`PaginatedList` of + :class:`Variable`""" return PaginatedList( Variable, self._requester, diff --git a/github/EnvironmentDeploymentBranchPolicy.py b/github/EnvironmentDeploymentBranchPolicy.py index 1ae6fc24a9..da814105ad 100644 --- a/github/EnvironmentDeploymentBranchPolicy.py +++ b/github/EnvironmentDeploymentBranchPolicy.py @@ -31,8 +31,8 @@ class EnvironmentDeploymentBranchPolicy(NonCompletableGithubObject): """This class represents a deployment branch policy for an environment. - The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments - + The reference can be found here + https://docs.github.com/en/rest/reference/deployments#environments """ def _initAttributes(self) -> None: @@ -58,7 +58,8 @@ def _useAttributes(self, attributes: Dict[str, Any]) -> None: class EnvironmentDeploymentBranchPolicyParams: - """This class presents the deployment branch policy parameters as can be configured for an Environment.""" + """This class presents the deployment branch policy parameters as can be + configured for an Environment.""" def __init__(self, protected_branches: bool = False, custom_branch_policies: bool = False): assert isinstance(protected_branches, bool) diff --git a/github/EnvironmentProtectionRule.py b/github/EnvironmentProtectionRule.py index f03f34c57e..c893b5854d 100644 --- a/github/EnvironmentProtectionRule.py +++ b/github/EnvironmentProtectionRule.py @@ -51,8 +51,8 @@ class EnvironmentProtectionRule(NonCompletableGithubObject): """This class represents a protection rule for an environment. - The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments - + The reference can be found here + https://docs.github.com/en/rest/reference/deployments#environments """ def _initAttributes(self) -> None: diff --git a/github/EnvironmentProtectionRuleReviewer.py b/github/EnvironmentProtectionRuleReviewer.py index 690a9c3741..30d38d84cc 100644 --- a/github/EnvironmentProtectionRuleReviewer.py +++ b/github/EnvironmentProtectionRuleReviewer.py @@ -48,8 +48,8 @@ class EnvironmentProtectionRuleReviewer(NonCompletableGithubObject): """This class represents a reviewer for an EnvironmentProtectionRule. - The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments - + The reference can be found here + https://docs.github.com/en/rest/reference/deployments#environments """ def _initAttributes(self) -> None: @@ -79,7 +79,8 @@ def _useAttributes(self, attributes: dict[str, Any]) -> None: class ReviewerParams: - """This class presents reviewers as can be configured for an Environment.""" + """This class presents reviewers as can be configured for an + Environment.""" def __init__(self, type_: str, id_: int): assert isinstance(type_, str) and type_ in ("User", "Team") diff --git a/github/Event.py b/github/Event.py index 5b9747b2e9..c1654e113e 100644 --- a/github/Event.py +++ b/github/Event.py @@ -50,8 +50,8 @@ class Event(NonCompletableGithubObject): """This class represents Events. - The reference can be found here https://docs.github.com/en/rest/reference/activity#events - + The reference can be found here + https://docs.github.com/en/rest/reference/activity#events """ def _initAttributes(self) -> None: diff --git a/github/Gist.py b/github/Gist.py index 53954fc258..2817fbdd3a 100644 --- a/github/Gist.py +++ b/github/Gist.py @@ -63,8 +63,8 @@ class Gist(CompletableGithubObject): """This class represents Gists. - The reference can be found here https://docs.github.com/en/rest/reference/gists - + The reference can be found here + https://docs.github.com/en/rest/reference/gists """ def _initAttributes(self) -> None: diff --git a/github/GistComment.py b/github/GistComment.py index f9a8360ab6..b4999352d5 100644 --- a/github/GistComment.py +++ b/github/GistComment.py @@ -49,8 +49,8 @@ class GistComment(CompletableGithubObject): """This class represents GistComments. - The reference can be found here https://docs.github.com/en/rest/reference/gists#comments - + The reference can be found here + https://docs.github.com/en/rest/reference/gists#comments """ def _initAttributes(self) -> None: diff --git a/github/GitBlob.py b/github/GitBlob.py index fe9014d0f3..861864e287 100644 --- a/github/GitBlob.py +++ b/github/GitBlob.py @@ -42,8 +42,8 @@ class GitBlob(CompletableGithubObject): """This class represents GitBlobs. - The reference can be found here https://docs.github.com/en/rest/reference/git#blobs - + The reference can be found here + https://docs.github.com/en/rest/reference/git#blobs """ def _initAttributes(self) -> None: diff --git a/github/GitCommit.py b/github/GitCommit.py index 63a5a15106..c5809bb507 100644 --- a/github/GitCommit.py +++ b/github/GitCommit.py @@ -48,8 +48,8 @@ class GitCommit(CompletableGithubObject): """This class represents GitCommits. - The reference can be found here https://docs.github.com/en/rest/reference/git#commits - + The reference can be found here + https://docs.github.com/en/rest/reference/git#commits """ def _initAttributes(self) -> None: diff --git a/github/GitRef.py b/github/GitRef.py index 50a8a0deea..12bbed3916 100644 --- a/github/GitRef.py +++ b/github/GitRef.py @@ -51,8 +51,8 @@ class GitRef(CompletableGithubObject): """This class represents GitRefs. - The reference can be found here https://docs.github.com/en/rest/reference/git#references - + The reference can be found here + https://docs.github.com/en/rest/reference/git#references """ def _initAttributes(self) -> None: diff --git a/github/GitRelease.py b/github/GitRelease.py index 013324d620..5abb1a0a51 100644 --- a/github/GitRelease.py +++ b/github/GitRelease.py @@ -69,8 +69,8 @@ class GitRelease(CompletableGithubObject): """This class represents GitReleases. - The reference can be found here https://docs.github.com/en/rest/reference/repos#releases - + The reference can be found here + https://docs.github.com/en/rest/reference/repos#releases """ def _initAttributes(self) -> None: @@ -259,7 +259,6 @@ def upload_asset_from_memory( :calls: `POST https:///repos/{owner}/{repo}/releases/{release_id}/assets `_ :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`` - """ assert isinstance(name, str), name assert isinstance(file_size, int), file_size diff --git a/github/GitReleaseAsset.py b/github/GitReleaseAsset.py index 0c66d6856c..74a5637e31 100644 --- a/github/GitReleaseAsset.py +++ b/github/GitReleaseAsset.py @@ -49,8 +49,8 @@ class GitReleaseAsset(CompletableGithubObject): """This class represents GitReleaseAssets. - The reference can be found here https://docs.github.com/en/rest/reference/repos#releases - + The reference can be found here + https://docs.github.com/en/rest/reference/repos#releases """ def _initAttributes(self) -> None: diff --git a/github/GitTag.py b/github/GitTag.py index 9b892ac6fa..dd432d41da 100644 --- a/github/GitTag.py +++ b/github/GitTag.py @@ -53,8 +53,8 @@ class GitTag(CompletableGithubObject): """This class represents GitTags. - The reference can be found here https://docs.github.com/en/rest/reference/git#tags - + The reference can be found here + https://docs.github.com/en/rest/reference/git#tags """ def _initAttributes(self) -> None: diff --git a/github/GitTree.py b/github/GitTree.py index c3aa68facc..ffdbdd2516 100644 --- a/github/GitTree.py +++ b/github/GitTree.py @@ -49,8 +49,8 @@ class GitTree(CompletableGithubObject): """This class represents GitTrees. - The reference can be found here https://docs.github.com/en/rest/reference/git#trees - + The reference can be found here + https://docs.github.com/en/rest/reference/git#trees """ def _initAttributes(self) -> None: diff --git a/github/GithubApp.py b/github/GithubApp.py index 611f5daa23..86ae686351 100644 --- a/github/GithubApp.py +++ b/github/GithubApp.py @@ -52,8 +52,8 @@ class GithubApp(CompletableGithubObject): """This class represents github apps. - The reference can be found here https://docs.github.com/en/rest/reference/apps - + The reference can be found here + https://docs.github.com/en/rest/reference/apps """ def _initAttributes(self) -> None: diff --git a/github/GithubException.py b/github/GithubException.py index 87ed47ad82..afb43c9f2b 100644 --- a/github/GithubException.py +++ b/github/GithubException.py @@ -40,11 +40,12 @@ class GithubException(Exception): - """Error handling in PyGithub is done with exceptions. This class is the base of all exceptions raised by PyGithub - (but :class:`github.GithubException.BadAttributeException`). - - Some other types of exceptions might be raised by underlying libraries, for example for network-related issues. + """Error handling in PyGithub is done with exceptions. This class is the + base of all exceptions raised by PyGithub (but + :class:`github.GithubException.BadAttributeException`). + Some other types of exceptions might be raised by underlying + libraries, for example for network-related issues. """ def __init__( @@ -96,25 +97,28 @@ def __str__(self) -> str: class BadCredentialsException(GithubException): - """Exception raised in case of bad credentials (when Github API replies with a 401 or 403 HTML status)""" + """Exception raised in case of bad credentials (when Github API replies + with a 401 or 403 HTML status)""" class UnknownObjectException(GithubException): - """Exception raised when a non-existing object is requested (when Github API replies with a 404 HTML status)""" + """Exception raised when a non-existing object is requested (when Github + API replies with a 404 HTML status)""" class BadUserAgentException(GithubException): - """Exception raised when request is sent with a bad user agent header (when Github API replies with a 403 bad user - agent HTML status)""" + """Exception raised when request is sent with a bad user agent header (when + Github API replies with a 403 bad user agent HTML status)""" class RateLimitExceededException(GithubException): - """Exception raised when the rate limit is exceeded (when Github API replies with a 403 rate limit exceeded HTML - status)""" + """Exception raised when the rate limit is exceeded (when Github API + replies with a 403 rate limit exceeded HTML status)""" class BadAttributeException(Exception): - """Exception raised when Github returns an attribute with the wrong type.""" + """Exception raised when Github returns an attribute with the wrong + type.""" def __init__( self, @@ -155,9 +159,10 @@ def transformation_exception(self) -> Optional[Exception]: class TwoFactorException(GithubException): - """Exception raised when Github requires a onetime password for two-factor authentication.""" + """Exception raised when Github requires a onetime password for two-factor + authentication.""" class IncompletableObject(GithubException): - """Exception raised when we can not request an object from Github because the data returned did not include a - URL.""" + """Exception raised when we can not request an object from Github because + the data returned did not include a URL.""" diff --git a/github/GithubIntegration.py b/github/GithubIntegration.py index 618f501c5f..c0176ab4a5 100644 --- a/github/GithubIntegration.py +++ b/github/GithubIntegration.py @@ -155,13 +155,13 @@ def __init__( ) def close(self) -> None: - """Close connections to the server. Alternatively, use the GithubIntegration object as a context manager: + """Close connections to the server. Alternatively, use the + GithubIntegration object as a context manager: .. code-block:: python with github.GithubIntegration(...) as gi: # do something - """ self.__requester.close() @@ -238,7 +238,6 @@ def get_installation(self, owner: str, repo: str) -> Installation: :calls: `GET /repos/{owner}/{repo}/installation ` - """ owner = urllib.parse.quote(owner) repo = urllib.parse.quote(repo) diff --git a/github/GithubObject.py b/github/GithubObject.py index b583dd97b0..76bc4dbef1 100644 --- a/github/GithubObject.py +++ b/github/GithubObject.py @@ -73,8 +73,8 @@ def value(self) -> T_co: def _datetime_from_http_date(value: str) -> datetime: - """ - Convert an HTTP date to a datetime object. + """Convert an HTTP date to a datetime object. + Raises ValueError for invalid dates. """ @@ -86,8 +86,8 @@ def _datetime_from_http_date(value: str) -> datetime: def _datetime_from_github_isoformat(value: str) -> datetime: - """ - Convert an GitHub API timestamps to a datetime object. + """Convert an GitHub API timestamps to a datetime object. + Raises ValueError for invalid timestamps. """ @@ -418,8 +418,8 @@ def __complete(self) -> None: self.__completed = True def update(self, additional_headers: Optional[Dict[str, Any]] = None) -> bool: - """Check and update the object with conditional request :rtype: Boolean value indicating whether the object is - changed.""" + """Check and update the object with conditional request :rtype: Boolean + value indicating whether the object is changed.""" conditionalRequestHeader = dict() if self.etag is not None: conditionalRequestHeader[Consts.REQ_IF_NONE_MATCH] = self.etag diff --git a/github/GithubRetry.py b/github/GithubRetry.py index 6220b09ff3..1d6d3ff2b4 100644 --- a/github/GithubRetry.py +++ b/github/GithubRetry.py @@ -56,7 +56,6 @@ class GithubRetry(Retry): By default, all methods defined in `Retry.DEFAULT_ALLOWED_METHODS` are retried, plus GET and POST. This can be configured via the `allowed_methods` argument. - """ __logger: Optional[Logger] = None diff --git a/github/GitignoreTemplate.py b/github/GitignoreTemplate.py index 8e21165e31..5bbe35a30a 100644 --- a/github/GitignoreTemplate.py +++ b/github/GitignoreTemplate.py @@ -42,8 +42,8 @@ class GitignoreTemplate(NonCompletableGithubObject): """This class represents GitignoreTemplates. - The reference can be found here https://docs.github.com/en/rest/reference/gitignore - + The reference can be found here + https://docs.github.com/en/rest/reference/gitignore """ def _initAttributes(self) -> None: diff --git a/github/GlobalAdvisory.py b/github/GlobalAdvisory.py index cb59d7a15e..0654e8ccfa 100644 --- a/github/GlobalAdvisory.py +++ b/github/GlobalAdvisory.py @@ -34,8 +34,8 @@ class GlobalAdvisory(AdvisoryBase): - """ - This class represents a GlobalAdvisory. + """This class represents a GlobalAdvisory. + https://docs.github.com/en/rest/security-advisories/global-advisories """ diff --git a/github/Hook.py b/github/Hook.py index c57ee98d08..6f5b2d402c 100644 --- a/github/Hook.py +++ b/github/Hook.py @@ -50,8 +50,8 @@ class Hook(CompletableGithubObject): """This class represents Hooks. - The reference can be found here https://docs.github.com/en/rest/reference/repos#webhooks - + The reference can be found here + https://docs.github.com/en/rest/reference/repos#webhooks """ def _initAttributes(self) -> None: diff --git a/github/Installation.py b/github/Installation.py index 9035fedc19..37b66f6af2 100644 --- a/github/Installation.py +++ b/github/Installation.py @@ -68,8 +68,8 @@ class Installation(NonCompletableGithubObject): """This class represents Installations. - The reference can be found here https://docs.github.com/en/rest/reference/apps#installations - + The reference can be found here + https://docs.github.com/en/rest/reference/apps#installations """ def __init__( diff --git a/github/Invitation.py b/github/Invitation.py index bbae5e6537..b4f497dbc2 100644 --- a/github/Invitation.py +++ b/github/Invitation.py @@ -54,8 +54,8 @@ class Invitation(CompletableGithubObject): """This class represents repository invitations. - The reference can be found here https://docs.github.com/en/rest/reference/repos#invitations - + The reference can be found here + https://docs.github.com/en/rest/reference/repos#invitations """ def _initAttributes(self) -> None: diff --git a/github/Issue.py b/github/Issue.py index d224dff4c0..8db88fbace 100644 --- a/github/Issue.py +++ b/github/Issue.py @@ -101,8 +101,8 @@ class Issue(CompletableGithubObject): """This class represents Issues. - The reference can be found here https://docs.github.com/en/rest/reference/issues - + The reference can be found here + https://docs.github.com/en/rest/reference/issues """ def _initAttributes(self) -> None: diff --git a/github/IssueComment.py b/github/IssueComment.py index 29d64a6cd9..0ee0792e4e 100644 --- a/github/IssueComment.py +++ b/github/IssueComment.py @@ -59,8 +59,8 @@ class IssueComment(CompletableGithubObject): """This class represents IssueComments. - The reference can be found here https://docs.github.com/en/rest/reference/issues#comments - + The reference can be found here + https://docs.github.com/en/rest/reference/issues#comments """ def _initAttributes(self) -> None: diff --git a/github/IssueEvent.py b/github/IssueEvent.py index 7ee0fe7b60..343e2245f6 100644 --- a/github/IssueEvent.py +++ b/github/IssueEvent.py @@ -53,8 +53,8 @@ class IssueEvent(CompletableGithubObject): """This class represents IssueEvents. - The reference can be found here https://docs.github.com/en/rest/reference/issues#events - + The reference can be found here + https://docs.github.com/en/rest/reference/issues#events """ def _initAttributes(self) -> None: diff --git a/github/Label.py b/github/Label.py index c3b0f023fb..85f87b548a 100644 --- a/github/Label.py +++ b/github/Label.py @@ -48,8 +48,8 @@ class Label(CompletableGithubObject): """This class represents Labels. - The reference can be found here https://docs.github.com/en/rest/reference/issues#labels - + The reference can be found here + https://docs.github.com/en/rest/reference/issues#labels """ def _initAttributes(self) -> None: diff --git a/github/License.py b/github/License.py index 7435b0c8fa..2113ec1895 100644 --- a/github/License.py +++ b/github/License.py @@ -49,8 +49,8 @@ class License(CompletableGithubObject): """This class represents Licenses. - The reference can be found here https://docs.github.com/en/rest/reference/licenses - + The reference can be found here + https://docs.github.com/en/rest/reference/licenses """ def _initAttributes(self) -> None: diff --git a/github/MainClass.py b/github/MainClass.py index 6bc00d5036..bb0eb1cb5b 100644 --- a/github/MainClass.py +++ b/github/MainClass.py @@ -150,7 +150,6 @@ class Github: """This is the main class you instantiate to access the Github API v3. Optional parameters allow different authentication methods. - """ __requester: Requester @@ -254,13 +253,13 @@ def __init__( ) def close(self) -> None: - """Close connections to the server. Alternatively, use the Github object as a context manager: + """Close connections to the server. Alternatively, use the Github + object as a context manager: .. code-block:: python with github.Github(...) as gh: # do something - """ self.__requester.close() @@ -308,8 +307,8 @@ def rate_limiting_resettime(self) -> int: def get_rate_limit(self) -> RateLimit: """Rate limit status for different resources (core/search/graphql). - :calls: `GET /rate_limit `_ - + :calls: `GET /rate_limit + `_ """ headers, data = self.__requester.requestJsonAndCheck("GET", "/rate_limit") return RateLimit(self.__requester, headers, data["resources"], True) @@ -918,14 +917,14 @@ def get_emojis(self) -> dict[str, str]: def create_from_raw_data( self, klass: type[TGithubObject], raw_data: dict[str, Any], headers: dict[str, str | int] | None = None ) -> TGithubObject: - """Creates an object from raw_data previously obtained by :attr:`GithubObject.raw_data`, and optionally headers - previously obtained by :attr:`GithubObject.raw_headers`. + """Creates an object from raw_data previously obtained by + :attr:`GithubObject.raw_data`, and optionally headers previously + obtained by :attr:`GithubObject.raw_headers`. :param klass: the class of the object to create :param raw_data: dict :param headers: dict :rtype: instance of class ``klass`` - """ if headers is None: headers = {} @@ -933,8 +932,9 @@ def create_from_raw_data( return klass(self.__requester, headers, raw_data, completed=True) def dump(self, obj: GithubObject, file: BinaryIO, protocol: int = 0) -> None: - """Dumps (pickles) a PyGithub object to a file-like object. Some effort is made to not pickle sensitive - information like the Github credentials used in the :class:`Github` instance. But NO EFFORT is made to remove + """Dumps (pickles) a PyGithub object to a file-like object. Some effort + is made to not pickle sensitive information like the Github credentials + used in the :class:`Github` instance. But NO EFFORT is made to remove sensitive information from the object's attributes. :param obj: the object to pickle :param file: the file-like object to pickle to :param protocol: the @@ -961,7 +961,6 @@ def dump(self, obj: GithubObject, file: BinaryIO, protocol: int = 0) -> None: :param file: the file-like object to pickle to :param protocol: the `pickling protocol `_ - """ pickle.dump((obj.__class__, obj.raw_data, obj.raw_headers), file, protocol) @@ -970,7 +969,6 @@ def load(self, f: BinaryIO) -> Any: :param f: the file-like object to unpickle from :return: the unpickled object - """ return self.create_from_raw_data(*pickle.load(f)) diff --git a/github/Membership.py b/github/Membership.py index eec0e206c7..9e80f9d8e9 100644 --- a/github/Membership.py +++ b/github/Membership.py @@ -55,8 +55,8 @@ class Membership(CompletableGithubObject): """This class represents Membership of an organization. - The reference can be found here https://docs.github.com/en/rest/reference/orgs - + The reference can be found here + https://docs.github.com/en/rest/reference/orgs """ def _initAttributes(self) -> None: diff --git a/github/Migration.py b/github/Migration.py index 740e16c316..7f9a3f6c8a 100644 --- a/github/Migration.py +++ b/github/Migration.py @@ -58,8 +58,8 @@ class Migration(CompletableGithubObject): """This class represents Migrations. - The reference can be found here https://docs.github.com/en/rest/reference/migrations - + The reference can be found here + https://docs.github.com/en/rest/reference/migrations """ def _initAttributes(self) -> None: diff --git a/github/Milestone.py b/github/Milestone.py index 4622d6d83e..4189d4afa7 100644 --- a/github/Milestone.py +++ b/github/Milestone.py @@ -53,8 +53,8 @@ class Milestone(CompletableGithubObject): """This class represents Milestones. - The reference can be found here https://docs.github.com/en/rest/reference/issues#milestones - + The reference can be found here + https://docs.github.com/en/rest/reference/issues#milestones """ def _initAttributes(self) -> None: diff --git a/github/NamedEnterpriseUser.py b/github/NamedEnterpriseUser.py index 526d7bdf66..518eb34cba 100644 --- a/github/NamedEnterpriseUser.py +++ b/github/NamedEnterpriseUser.py @@ -31,7 +31,6 @@ class NamedEnterpriseUser(CompletableGithubObject): The reference can be found here https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/license#list-enterprise-consumed-licenses - """ def _initAttributes(self) -> None: diff --git a/github/NamedUser.py b/github/NamedUser.py index a1b285d3ea..ce2e23b5db 100644 --- a/github/NamedUser.py +++ b/github/NamedUser.py @@ -83,8 +83,8 @@ class NamedUser(github.GithubObject.CompletableGithubObject): """This class represents NamedUsers. - The reference can be found here https://docs.github.com/en/rest/reference/users#get-a-user - + The reference can be found here + https://docs.github.com/en/rest/reference/users#get-a-user """ def _initAttributes(self) -> None: diff --git a/github/Notification.py b/github/Notification.py index be3917d185..c455991506 100644 --- a/github/Notification.py +++ b/github/Notification.py @@ -54,8 +54,8 @@ class Notification(CompletableGithubObject): """This class represents Notifications. - The reference can be found here https://docs.github.com/en/rest/reference/activity#notifications - + The reference can be found here + https://docs.github.com/en/rest/reference/activity#notifications """ def _initAttributes(self) -> None: diff --git a/github/NotificationSubject.py b/github/NotificationSubject.py index 4d2a162c2c..199a7d2afe 100644 --- a/github/NotificationSubject.py +++ b/github/NotificationSubject.py @@ -47,7 +47,6 @@ class NotificationSubject(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/activity#list-notifications-for-the-authenticated-user - """ def _initAttributes(self) -> None: diff --git a/github/Organization.py b/github/Organization.py index 2f08f04d0e..ff946a2d66 100644 --- a/github/Organization.py +++ b/github/Organization.py @@ -124,8 +124,10 @@ class Organization(CompletableGithubObject): - """ - This class represents Organizations. The reference can be found here https://docs.github.com/en/rest/reference/orgs + """This class represents Organizations. + + The reference can be found here + https://docs.github.com/en/rest/reference/orgs """ def _initAttributes(self) -> None: @@ -620,11 +622,9 @@ def create_secret( ) def get_secrets(self, secret_type: str = "actions") -> PaginatedList[OrganizationSecret]: - """ - Gets all organization secrets - :param secret_type: string options actions or dependabot - :rtype: :class:`PaginatedList` of :class:`github.OrganizationSecret.OrganizationSecret` - """ + """Gets all organization secrets :param secret_type: string options + actions or dependabot :rtype: :class:`PaginatedList` of + :class:`github.OrganizationSecret.OrganizationSecret`""" assert secret_type in ["actions", "dependabot"], "secret_type should be actions or dependabot" return PaginatedList( github.OrganizationSecret.OrganizationSecret, @@ -745,10 +745,8 @@ def create_variable( ) def get_variables(self) -> PaginatedList[OrganizationVariable]: - """ - Gets all organization variables - :rtype: :class:`PaginatedList` of :class:`github.OrganizationVariable.OrganizationVariable` - """ + """Gets all organization variables :rtype: :class:`PaginatedList` of + :class:`github.OrganizationVariable.OrganizationVariable`""" return PaginatedList( github.OrganizationVariable.OrganizationVariable, self._requester, diff --git a/github/OrganizationDependabotAlert.py b/github/OrganizationDependabotAlert.py index 48e5bb57af..e839c9c203 100644 --- a/github/OrganizationDependabotAlert.py +++ b/github/OrganizationDependabotAlert.py @@ -30,8 +30,10 @@ class OrganizationDependabotAlert(DependabotAlert): - """ - This class represents a Dependabot alert on an organization. The reference can be found here https://docs.github.com/en/rest/dependabot/alerts#list-dependabot-alerts-for-an-organization + """This class represents a Dependabot alert on an organization. + + The reference can be found here + https://docs.github.com/en/rest/dependabot/alerts#list-dependabot-alerts-for-an-organization """ def _initAttributes(self) -> None: diff --git a/github/OrganizationSecret.py b/github/OrganizationSecret.py index 624c96b329..d9bd18cbee 100644 --- a/github/OrganizationSecret.py +++ b/github/OrganizationSecret.py @@ -33,8 +33,8 @@ class OrganizationSecret(Secret): """This class represents a org level GitHub secret. - The reference can be found here https://docs.github.com/en/rest/actions/secrets - + The reference can be found here + https://docs.github.com/en/rest/actions/secrets """ def _initAttributes(self) -> None: diff --git a/github/OrganizationVariable.py b/github/OrganizationVariable.py index 6afce359ea..51b335d7db 100644 --- a/github/OrganizationVariable.py +++ b/github/OrganizationVariable.py @@ -33,8 +33,8 @@ class OrganizationVariable(Variable): """This class represents a org level GitHub variable. - The reference can be found here https://docs.github.com/en/rest/actions/variables - + The reference can be found here + https://docs.github.com/en/rest/actions/variables """ def _initAttributes(self) -> None: diff --git a/github/Path.py b/github/Path.py index 65bc0cc51f..e668851168 100644 --- a/github/Path.py +++ b/github/Path.py @@ -43,8 +43,8 @@ class Path(NonCompletableGithubObject): """This class represents a popular Path for a GitHub repository. - The reference can be found here https://docs.github.com/en/rest/reference/repos#traffic - + The reference can be found here + https://docs.github.com/en/rest/reference/repos#traffic """ def _initAttributes(self) -> None: diff --git a/github/Project.py b/github/Project.py index e7c2f10e05..cbe0390559 100644 --- a/github/Project.py +++ b/github/Project.py @@ -58,8 +58,8 @@ class Project(CompletableGithubObject): """This class represents Projects. - The reference can be found here https://docs.github.com/en/rest/reference/projects - + The reference can be found here + https://docs.github.com/en/rest/reference/projects """ def _initAttributes(self) -> None: diff --git a/github/ProjectCard.py b/github/ProjectCard.py index defcb00e49..8979e466ad 100644 --- a/github/ProjectCard.py +++ b/github/ProjectCard.py @@ -63,8 +63,8 @@ class ProjectCard(CompletableGithubObject): """This class represents Project Cards. - The reference can be found here https://docs.github.com/en/rest/reference/projects#cards - + The reference can be found here + https://docs.github.com/en/rest/reference/projects#cards """ def _initAttributes(self) -> None: diff --git a/github/ProjectColumn.py b/github/ProjectColumn.py index 6cec014e43..d59d0b1a47 100644 --- a/github/ProjectColumn.py +++ b/github/ProjectColumn.py @@ -61,8 +61,8 @@ class ProjectColumn(CompletableGithubObject): """This class represents Project Columns. - The reference can be found here https://docs.github.com/en/rest/reference/projects#columns - + The reference can be found here + https://docs.github.com/en/rest/reference/projects#columns """ def _initAttributes(self) -> None: diff --git a/github/PublicKey.py b/github/PublicKey.py index 839ae6f3f5..d60e5c6c6d 100644 --- a/github/PublicKey.py +++ b/github/PublicKey.py @@ -56,12 +56,13 @@ def encrypt(public_key: str, secret_value: str) -> str: class PublicKey(CompletableGithubObject): - """This class represents either an organization public key or a repository public key. + """This class represents either an organization public key or a repository + public key. - The reference can be found here https://docs.github.com/en/rest/reference/actions#get-an-organization-public-key or - here + The reference can be found here + https://docs.github.com/en/rest/reference/actions#get-an-organization-public-key + or here https://docs.github.com/en/rest/reference/actions#get-a-repository-public-key - """ def _initAttributes(self) -> None: diff --git a/github/PullRequest.py b/github/PullRequest.py index 72489fe056..7b99d7d0ff 100644 --- a/github/PullRequest.py +++ b/github/PullRequest.py @@ -115,8 +115,8 @@ class ReviewComment(TypedDict): class PullRequest(CompletableGithubObject): """This class represents PullRequests. - The reference can be found here https://docs.github.com/en/rest/reference/pulls - + The reference can be found here + https://docs.github.com/en/rest/reference/pulls """ def _initAttributes(self) -> None: diff --git a/github/PullRequestComment.py b/github/PullRequestComment.py index 7c71cf3233..df188d55b2 100644 --- a/github/PullRequestComment.py +++ b/github/PullRequestComment.py @@ -58,8 +58,8 @@ class PullRequestComment(CompletableGithubObject): """This class represents PullRequestComments. - The reference can be found here https://docs.github.com/en/rest/reference/pulls#review-comments - + The reference can be found here + https://docs.github.com/en/rest/reference/pulls#review-comments """ def _initAttributes(self) -> None: diff --git a/github/PullRequestMergeStatus.py b/github/PullRequestMergeStatus.py index e96f8f1f66..0bec3f7446 100644 --- a/github/PullRequestMergeStatus.py +++ b/github/PullRequestMergeStatus.py @@ -46,7 +46,6 @@ class PullRequestMergeStatus(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/pulls#check-if-a-pull-request-has-been-merged - """ def _initAttributes(self) -> None: diff --git a/github/PullRequestReview.py b/github/PullRequestReview.py index 2ac7df8ca7..3d9bd0c337 100644 --- a/github/PullRequestReview.py +++ b/github/PullRequestReview.py @@ -53,8 +53,8 @@ class PullRequestReview(NonCompletableGithubObject): """This class represents PullRequestReviews. - The reference can be found here https://docs.github.com/en/rest/reference/pulls#reviews - + The reference can be found here + https://docs.github.com/en/rest/reference/pulls#reviews """ def _initAttributes(self) -> None: diff --git a/github/Rate.py b/github/Rate.py index c935ab8041..db2e0e990b 100644 --- a/github/Rate.py +++ b/github/Rate.py @@ -45,8 +45,8 @@ class Rate(NonCompletableGithubObject): """This class represents Rates. - The reference can be found here https://docs.github.com/en/rest/reference/rate-limit - + The reference can be found here + https://docs.github.com/en/rest/reference/rate-limit """ def _initAttributes(self) -> None: diff --git a/github/RateLimit.py b/github/RateLimit.py index 51afbefab0..bfc9ca474f 100644 --- a/github/RateLimit.py +++ b/github/RateLimit.py @@ -49,8 +49,8 @@ class RateLimit(NonCompletableGithubObject): """This class represents RateLimits. - The reference can be found here https://docs.github.com/en/rest/reference/rate-limit - + The reference can be found here + https://docs.github.com/en/rest/reference/rate-limit """ def _initAttributes(self) -> None: diff --git a/github/Reaction.py b/github/Reaction.py index 585d4a2a38..f22046fbb0 100644 --- a/github/Reaction.py +++ b/github/Reaction.py @@ -54,8 +54,8 @@ class Reaction(CompletableGithubObject): """This class represents Reactions. - The reference can be found here https://docs.github.com/en/rest/reference/reactions - + The reference can be found here + https://docs.github.com/en/rest/reference/reactions """ def _initAttributes(self) -> None: diff --git a/github/Referrer.py b/github/Referrer.py index 858651c915..dba18de659 100644 --- a/github/Referrer.py +++ b/github/Referrer.py @@ -43,8 +43,8 @@ class Referrer(NonCompletableGithubObject): """This class represents a popylar Referrer for a GitHub repository. - The reference can be found here https://docs.github.com/en/rest/reference/repos#traffic - + The reference can be found here + https://docs.github.com/en/rest/reference/repos#traffic """ def _initAttributes(self) -> None: diff --git a/github/Repository.py b/github/Repository.py index f4a0de9e05..c160c5d91f 100644 --- a/github/Repository.py +++ b/github/Repository.py @@ -303,8 +303,8 @@ class Repository(CompletableGithubObject): """This class represents Repositories. - The reference can be found here https://docs.github.com/en/rest/reference/repos - + The reference can be found here + https://docs.github.com/en/rest/reference/repos """ def __repr__(self) -> str: @@ -1227,7 +1227,8 @@ def create_git_tag_and_release( prerelease: bool = False, generate_release_notes: bool = False, ) -> GitRelease: - """Convenience function that calls :meth:`Repository.create_git_tag` and :meth:`Repository.create_git_release`. + """Convenience function that calls :meth:`Repository.create_git_tag` + and :meth:`Repository.create_git_release`. :param tag: string :param tag_message: string @@ -1240,7 +1241,6 @@ def create_git_tag_and_release( :param prerelease: bool :param generate_release_notes: bool :rtype: :class:`github.GitRelease.GitRelease` - """ self.create_git_tag(tag, tag_message, object, type, tagger) return self.create_git_release( @@ -1763,7 +1763,8 @@ def create_variable(self, variable_name: str, value: str) -> github.Variable.Var ) def get_variables(self) -> PaginatedList[github.Variable.Variable]: - """Gets all repository variables :rtype: :class:`PaginatedList` of :class:`github.Variable.Variable`""" + """Gets all repository variables :rtype: :class:`PaginatedList` of + :class:`github.Variable.Variable`""" return PaginatedList( github.Variable.Variable, self._requester, @@ -2349,20 +2350,24 @@ def create_file( ) -> dict[str, ContentFile | Commit]: """Create a file in this repository. - :calls: `PUT /repos/{owner}/{repo}/contents/{path} `_ - :param path: string, (required), path of the file in the repository + :param path: string, (required), path of the file in the + repository :param message: string, (required), commit message :param content: string, (required), the actual data in the file - :param branch: string, (optional), branch to create the commit on. Defaults to the default branch of the - repository - :param committer: InputGitAuthor, (optional), if no information is given the authenticated user's information - will be used. You must specify both a name and email. - :param author: InputGitAuthor, (optional), if omitted this will be filled in with committer information. If - passed, you must specify both a name and email. - :rtype: { 'content': :class:`ContentFile `:, 'commit': :class:`Commit + :param branch: string, (optional), branch to create the commit + on. Defaults to the default branch of the repository + :param committer: InputGitAuthor, (optional), if no information + is given the authenticated user's information will be used. + You must specify both a name and email. + :param author: InputGitAuthor, (optional), if omitted this will + be filled in with committer information. If passed, you must + specify both a name and email. + :rtype: { 'content': :class:`ContentFile + `:, 'commit': :class:`Commit `} - """ assert isinstance(path, str) assert isinstance(message, str) @@ -2430,20 +2435,26 @@ def update_file( ) -> dict[str, ContentFile | Commit]: """This method updates a file in a repository. - :calls: `PUT /repos/{owner}/{repo}/contents/{path} `_ :param path: string, Required. The content path. :param message: string, Required. The commit message. - :param content: string, Required. The updated file content, either base64 encoded, or ready to be encoded. - :param sha: string, Required. The blob SHA of the file being replaced. - :param branch: string. The branch name. Default: the repository’s default branch (usually master) - :param committer: InputGitAuthor, (optional), if no information is given the authenticated user's information - will be used. You must specify both a name and email. - :param author: InputGitAuthor, (optional), if omitted this will be filled in with committer information. If - passed, you must specify both a name and email. - :rtype: { 'content': :class:`ContentFile `:, 'commit': :class:`Commit + :param content: string, Required. The updated file content, + either base64 encoded, or ready to be encoded. + :param sha: string, Required. The blob SHA of the file being + replaced. + :param branch: string. The branch name. Default: the + repository’s default branch (usually master) + :param committer: InputGitAuthor, (optional), if no information + is given the authenticated user's information will be used. + You must specify both a name and email. + :param author: InputGitAuthor, (optional), if omitted this will + be filled in with committer information. If passed, you must + specify both a name and email. + :rtype: { 'content': :class:`ContentFile + `:, 'commit': :class:`Commit `} - """ assert isinstance(path, str) assert isinstance(message, str) @@ -2488,18 +2499,23 @@ def delete_file( ) -> dict[str, Commit | _NotSetType]: """This method deletes a file in a repository. - :calls: `DELETE /repos/{owner}/{repo}/contents/{path} `_ :param path: string, Required. The content path. :param message: string, Required. The commit message. - :param sha: string, Required. The blob SHA of the file being replaced. - :param branch: string. The branch name. Default: the repository’s default branch (usually master) - :param committer: InputGitAuthor, (optional), if no information is given the authenticated user's information - will be used. You must specify both a name and email. - :param author: InputGitAuthor, (optional), if omitted this will be filled in with committer information. If - passed, you must specify both a name and email. - :rtype: { 'content': :class:`null `:, 'commit': :class:`Commit `} - + :param sha: string, Required. The blob SHA of the file being + replaced. + :param branch: string. The branch name. Default: the + repository’s default branch (usually master) + :param committer: InputGitAuthor, (optional), if no information + is given the authenticated user's information will be used. + You must specify both a name and email. + :param author: InputGitAuthor, (optional), if omitted this will + be filled in with committer information. If passed, you must + specify both a name and email. + :rtype: { 'content': :class:`null `:, 'commit': + :class:`Commit `} """ assert isinstance(path, str), "path must be str/unicode object" assert isinstance(message, str), "message must be str/unicode object" diff --git a/github/RepositoryAdvisory.py b/github/RepositoryAdvisory.py index da43c464f1..29b5f42891 100644 --- a/github/RepositoryAdvisory.py +++ b/github/RepositoryAdvisory.py @@ -43,9 +43,10 @@ class RepositoryAdvisory(AdvisoryBase): - """ - This class represents a RepositoryAdvisory. - The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories + """This class represents a RepositoryAdvisory. + + The reference can be found here + https://docs.github.com/en/rest/security-advisories/repository-advisories """ def _initAttributes(self) -> None: @@ -146,8 +147,8 @@ def offer_credit( login_or_user: str | github.NamedUser.NamedUser, credit_type: str, ) -> None: - """ - Offers credit to a user for a vulnerability in a repository. + """Offers credit to a user for a vulnerability in a repository. + Unless you are giving credit to yourself, the user having credit offered will need to explicitly accept the credit. :calls: `PATCH /repos/{owner}/{repo}/security-advisories/:advisory_id ` """ @@ -157,8 +158,9 @@ def offer_credits( self, credited: Iterable[Credit], ) -> None: - """ - Offers credit to a list of users for a vulnerability in a repository. + """Offers credit to a list of users for a vulnerability in a + repository. + Unless you are giving credit to yourself, the user having credit offered will need to explicitly accept the credit. :calls: `PATCH /repos/{owner}/{repo}/security-advisories/:advisory_id ` :param credited: iterable of dict with keys "login" and "type" @@ -273,8 +275,9 @@ def edit( return self def accept_report(self) -> None: - """ - Accepts the advisory reported from an external reporter via private vulnerability reporting. + """Accepts the advisory reported from an external reporter via private + vulnerability reporting. + :calls: `PATCH /repos/{owner}/{repo}/security-advisories/:advisory_id ` """ patch_parameters = {"state": "draft"} @@ -286,8 +289,8 @@ def accept_report(self) -> None: self._useAttributes(data) def publish(self) -> None: - """ - Publishes the advisory. + """Publishes the advisory. + :calls: `PATCH /repos/{owner}/{repo}/security-advisories/:advisory_id ` """ patch_parameters = {"state": "published"} @@ -299,8 +302,8 @@ def publish(self) -> None: self._useAttributes(data) def request_cve(self) -> None: - """ - Requests a CVE for the advisory. + """Requests a CVE for the advisory. + :calls: `POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/cve `_ """ self._requester.requestJsonAndCheck( @@ -309,8 +312,8 @@ def request_cve(self) -> None: ) def close(self) -> None: - """ - Closes the advisory. + """Closes the advisory. + :calls: `PATCH /repos/{owner}/{repo}/security-advisories/:advisory_id ` """ patch_parameters = {"state": "closed"} diff --git a/github/RepositoryKey.py b/github/RepositoryKey.py index 52b9b1d2c1..616930d61a 100644 --- a/github/RepositoryKey.py +++ b/github/RepositoryKey.py @@ -50,8 +50,8 @@ class RepositoryKey(CompletableGithubObject): """This class represents RepositoryKeys. - The reference can be found here https://docs.github.com/en/rest/reference/repos#deploy-keys - + The reference can be found here + https://docs.github.com/en/rest/reference/repos#deploy-keys """ def _initAttributes(self) -> None: diff --git a/github/RepositoryPreferences.py b/github/RepositoryPreferences.py index 11b31514b4..8aed7a62ed 100644 --- a/github/RepositoryPreferences.py +++ b/github/RepositoryPreferences.py @@ -51,7 +51,6 @@ class RepositoryPreferences(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/free-pro-team@latest/rest/reference/checks#update-repository-preferences-for-check-suites - """ def _initAttributes(self) -> None: diff --git a/github/Requester.py b/github/Requester.py index a9ddd50e7f..f40c6afbb1 100644 --- a/github/Requester.py +++ b/github/Requester.py @@ -343,7 +343,8 @@ def NEW_DEBUG_FRAME(self, requestHeader: Dict[str, str]) -> None: self._frameCount = len(self._frameBuffer) - 1 def DEBUG_ON_RESPONSE(self, statusCode: int, responseHeader: Dict[str, Union[str, int]], data: str) -> None: - """Update current frame with response Current frame index will be attached to responseHeader.""" + """Update current frame with response Current frame index will be + attached to responseHeader.""" if self.DEBUG_FLAG: # pragma no branch (Flag always set in tests) self._frameBuffer[self._frameCount][1:4] = [ statusCode, @@ -477,8 +478,9 @@ def close(self) -> None: @property def kwargs(self) -> Dict[str, Any]: - """Returns arguments required to recreate this Requester with Requester.__init__, as well as with - MainClass.__init__ and GithubIntegration.__init__.""" + """Returns arguments required to recreate this Requester with + Requester.__init__, as well as with MainClass.__init__ and + GithubIntegration.__init__.""" return dict( auth=self.__auth, base_url=self.__base_url, @@ -509,11 +511,11 @@ def auth(self) -> Optional["Auth"]: return self.__auth def withAuth(self, auth: Optional["Auth"]) -> "Requester": - """Create a new requester instance with identical configuration but the given authentication method. + """Create a new requester instance with identical configuration but the + given authentication method. :param auth: authentication method :return: new Requester implementation - """ kwargs = self.kwargs kwargs.update(auth=auth) diff --git a/github/RequiredPullRequestReviews.py b/github/RequiredPullRequestReviews.py index fc7185f82d..31f16374ad 100644 --- a/github/RequiredPullRequestReviews.py +++ b/github/RequiredPullRequestReviews.py @@ -57,7 +57,6 @@ class RequiredPullRequestReviews(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#get-pull-request-review-protection - """ def _initAttributes(self) -> None: diff --git a/github/RequiredStatusChecks.py b/github/RequiredStatusChecks.py index 536e1e1844..965899f67f 100644 --- a/github/RequiredStatusChecks.py +++ b/github/RequiredStatusChecks.py @@ -46,8 +46,8 @@ class RequiredStatusChecks(CompletableGithubObject): """This class represents Required Status Checks. - The reference can be found here https://docs.github.com/en/rest/reference/repos#get-status-checks-protection - + The reference can be found here + https://docs.github.com/en/rest/reference/repos#get-status-checks-protection """ def _initAttributes(self) -> None: diff --git a/github/Secret.py b/github/Secret.py index 37f8dd7a01..60f9350298 100644 --- a/github/Secret.py +++ b/github/Secret.py @@ -44,8 +44,8 @@ class Secret(CompletableGithubObject): """This class represents a GitHub secret. - The reference can be found here https://docs.github.com/en/rest/actions/secrets - + The reference can be found here + https://docs.github.com/en/rest/actions/secrets """ def _initAttributes(self) -> None: diff --git a/github/SelfHostedActionsRunner.py b/github/SelfHostedActionsRunner.py index dc127dfd00..151c31a71b 100644 --- a/github/SelfHostedActionsRunner.py +++ b/github/SelfHostedActionsRunner.py @@ -46,7 +46,6 @@ class SelfHostedActionsRunner(NonCompletableGithubObject): The reference can be found at https://docs.github.com/en/free-pro-team@latest/rest/reference/actions#self-hosted-runners - """ def _initAttributes(self) -> None: diff --git a/github/SourceImport.py b/github/SourceImport.py index f39b9ee7ec..af299bd48a 100644 --- a/github/SourceImport.py +++ b/github/SourceImport.py @@ -40,8 +40,8 @@ class SourceImport(CompletableGithubObject): """This class represents SourceImports. - The reference can be found here https://docs.github.com/en/rest/reference/migrations#source-imports - + The reference can be found here + https://docs.github.com/en/rest/reference/migrations#source-imports """ def _initAttributes(self) -> None: diff --git a/github/Stargazer.py b/github/Stargazer.py index a80054b03a..088530a511 100644 --- a/github/Stargazer.py +++ b/github/Stargazer.py @@ -53,8 +53,8 @@ class Stargazer(NonCompletableGithubObject): """This class represents Stargazers. - The reference can be found here https://docs.github.com/en/rest/reference/activity#starring - + The reference can be found here + https://docs.github.com/en/rest/reference/activity#starring """ def _initAttributes(self) -> None: diff --git a/github/StatsCodeFrequency.py b/github/StatsCodeFrequency.py index 0d5c0c33aa..fac6cc61d5 100755 --- a/github/StatsCodeFrequency.py +++ b/github/StatsCodeFrequency.py @@ -46,7 +46,6 @@ class StatsCodeFrequency(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/metrics/statistics?apiVersion=2022-11-28#get-the-weekly-commit-activity - """ def _initAttributes(self) -> None: diff --git a/github/StatsCommitActivity.py b/github/StatsCommitActivity.py index ee322428d5..feac3cdc32 100755 --- a/github/StatsCommitActivity.py +++ b/github/StatsCommitActivity.py @@ -46,7 +46,6 @@ class StatsCommitActivity(github.GithubObject.NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#get-the-last-year-of-commit-activity - """ def _initAttributes(self) -> None: diff --git a/github/StatsContributor.py b/github/StatsContributor.py index ad293d66ea..95b294ded6 100755 --- a/github/StatsContributor.py +++ b/github/StatsContributor.py @@ -47,7 +47,6 @@ class StatsContributor(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#get-all-contributor-commit-activity - """ class Week(NonCompletableGithubObject): diff --git a/github/StatsParticipation.py b/github/StatsParticipation.py index 4c79a37705..6673a99cbb 100755 --- a/github/StatsParticipation.py +++ b/github/StatsParticipation.py @@ -45,8 +45,8 @@ class StatsParticipation(NonCompletableGithubObject): """This class represents StatsParticipations. - The reference can be found here https://docs.github.com/en/rest/reference/repos#get-the-weekly-commit-count - + The reference can be found here + https://docs.github.com/en/rest/reference/repos#get-the-weekly-commit-count """ def _initAttributes(self) -> None: diff --git a/github/StatsPunchCard.py b/github/StatsPunchCard.py index 7a09325a21..91022beebf 100755 --- a/github/StatsPunchCard.py +++ b/github/StatsPunchCard.py @@ -46,7 +46,6 @@ class StatsPunchCard(github.GithubObject.NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#get-the-hourly-commit-count-for-each-day - """ _dict: Dict[Tuple[int, int], int] diff --git a/github/Tag.py b/github/Tag.py index 9d2c70a72a..ca26f1506f 100644 --- a/github/Tag.py +++ b/github/Tag.py @@ -51,8 +51,8 @@ class Tag(NonCompletableGithubObject): """This class represents Tags. - The reference can be found here https://docs.github.com/en/rest/reference/repos#list-repository-tags - + The reference can be found here + https://docs.github.com/en/rest/reference/repos#list-repository-tags """ def __repr__(self) -> str: diff --git a/github/Team.py b/github/Team.py index 6320d0bacb..379c1693e5 100644 --- a/github/Team.py +++ b/github/Team.py @@ -87,8 +87,8 @@ class Team(CompletableGithubObject): """This class represents Teams. - The reference can be found here https://docs.github.com/en/rest/reference/teams - + The reference can be found here + https://docs.github.com/en/rest/reference/teams """ def _initAttributes(self) -> None: diff --git a/github/TeamDiscussion.py b/github/TeamDiscussion.py index 7f21797f44..26c3da5c69 100644 --- a/github/TeamDiscussion.py +++ b/github/TeamDiscussion.py @@ -53,8 +53,8 @@ class TeamDiscussion(CompletableGithubObject): """This class represents TeamDiscussions. - The reference can be found here https://docs.github.com/en/rest/reference/teams#discussions - + The reference can be found here + https://docs.github.com/en/rest/reference/teams#discussions """ def _initAttributes(self) -> None: diff --git a/github/TimelineEvent.py b/github/TimelineEvent.py index 50add80ac0..205e2fbc86 100644 --- a/github/TimelineEvent.py +++ b/github/TimelineEvent.py @@ -53,8 +53,8 @@ class TimelineEvent(NonCompletableGithubObject): """This class represents IssueTimelineEvents. - The reference can be found here https://docs.github.com/en/rest/reference/issues#timeline - + The reference can be found here + https://docs.github.com/en/rest/reference/issues#timeline """ def _initAttributes(self) -> None: diff --git a/github/TimelineEventSource.py b/github/TimelineEventSource.py index f0bc7cd2f3..2a9d44b2ff 100644 --- a/github/TimelineEventSource.py +++ b/github/TimelineEventSource.py @@ -49,8 +49,8 @@ class TimelineEventSource(NonCompletableGithubObject): """This class represents IssueTimelineEventSource. - The reference can be found here https://docs.github.com/en/rest/reference/issues#timeline - + The reference can be found here + https://docs.github.com/en/rest/reference/issues#timeline """ def _initAttributes(self) -> None: diff --git a/github/UserKey.py b/github/UserKey.py index dce5138242..3b166e92e8 100644 --- a/github/UserKey.py +++ b/github/UserKey.py @@ -45,8 +45,8 @@ class UserKey(github.GithubObject.CompletableGithubObject): """This class represents UserKeys. - The reference can be found here https://docs.github.com/en/rest/reference/users#keys - + The reference can be found here + https://docs.github.com/en/rest/reference/users#keys """ def _initAttributes(self) -> None: diff --git a/github/Variable.py b/github/Variable.py index 07b9a634fb..70961fc6a2 100644 --- a/github/Variable.py +++ b/github/Variable.py @@ -33,8 +33,8 @@ class Variable(CompletableGithubObject): """This class represents a GitHub variable. - The reference can be found here https://docs.github.com/en/rest/actions/variables - + The reference can be found here + https://docs.github.com/en/rest/actions/variables """ def _initAttributes(self) -> None: diff --git a/github/View.py b/github/View.py index fb5e04a613..c533e158d5 100644 --- a/github/View.py +++ b/github/View.py @@ -44,8 +44,8 @@ class View(NonCompletableGithubObject): """This class represents a popular Path for a GitHub repository. - The reference can be found here https://docs.github.com/en/rest/reference/repos#traffic - + The reference can be found here + https://docs.github.com/en/rest/reference/repos#traffic """ def _initAttributes(self) -> None: diff --git a/github/Workflow.py b/github/Workflow.py index eef9024019..5e9caabd77 100644 --- a/github/Workflow.py +++ b/github/Workflow.py @@ -57,8 +57,8 @@ class Workflow(CompletableGithubObject): """This class represents Workflows. - The reference can be found here https://docs.github.com/en/rest/reference/actions#workflows - + The reference can be found here + https://docs.github.com/en/rest/reference/actions#workflows """ def _initAttributes(self) -> None: diff --git a/github/WorkflowJob.py b/github/WorkflowJob.py index d9abefdb64..197cca1b7c 100644 --- a/github/WorkflowJob.py +++ b/github/WorkflowJob.py @@ -36,8 +36,8 @@ class WorkflowJob(CompletableGithubObject): """This class represents Workflow Jobs. - The reference can be found here https://docs.github.com/en/rest/reference/actions#workflow-jobs - + The reference can be found here + https://docs.github.com/en/rest/reference/actions#workflow-jobs """ def _initAttributes(self) -> None: diff --git a/github/WorkflowRun.py b/github/WorkflowRun.py index ef9cf2d5c2..9551e436d5 100644 --- a/github/WorkflowRun.py +++ b/github/WorkflowRun.py @@ -56,8 +56,8 @@ class TimingData(NamedTuple): class WorkflowRun(CompletableGithubObject): """This class represents Workflow Runs. - The reference can be found here https://docs.github.com/en/rest/reference/actions#workflow-runs - + The reference can be found here + https://docs.github.com/en/rest/reference/actions#workflow-runs """ def _initAttributes(self) -> None: diff --git a/github/WorkflowStep.py b/github/WorkflowStep.py index 1338f6b959..a65962e499 100644 --- a/github/WorkflowStep.py +++ b/github/WorkflowStep.py @@ -45,8 +45,8 @@ class WorkflowStep(CompletableGithubObject): """This class represents steps in a Workflow Job. - The reference can be found here https://docs.github.com/en/rest/reference/actions#workflow-jobs - + The reference can be found here + https://docs.github.com/en/rest/reference/actions#workflow-jobs """ def _initAttributes(self) -> None: diff --git a/github/__init__.py b/github/__init__.py index 3f2fc6bcab..558d231d48 100644 --- a/github/__init__.py +++ b/github/__init__.py @@ -37,12 +37,12 @@ # along with PyGithub. If not, see . # # # ################################################################################ -"""The primary class you will instantiate is :class:`github.MainClass.Github`. From its ``get_``, ``create_`` methods, -you will obtain instances of all Github objects like :class:`github.NamedUser.NamedUser` or +"""The primary class you will instantiate is :class:`github.MainClass.Github`. +From its ``get_``, ``create_`` methods, you will obtain instances of all Github +objects like :class:`github.NamedUser.NamedUser` or :class:`github.Repository.Repository`. All classes inherit from :class:`github.GithubObject.GithubObject`. - """ import logging @@ -73,13 +73,14 @@ def set_log_level(level: int) -> None: - """Set the log level of the github logger, e.g. set_log_level(logging.WARNING) :param level: log level.""" + """Set the log level of the github logger, e.g. + set_log_level(logging.WARNING) :param level: log level.""" logger.setLevel(level) def enable_console_debug_logging() -> None: # pragma no cover (Function useful only outside test environment) - """This function sets up a very simple logging configuration (log everything on standard output) that is useful for - troubleshooting.""" + """This function sets up a very simple logging configuration (log + everything on standard output) that is useful for troubleshooting.""" set_log_level(logging.DEBUG) diff --git a/tests/GlobalAdvisory.py b/tests/GlobalAdvisory.py index 5b8a26579b..fbf0fb7086 100644 --- a/tests/GlobalAdvisory.py +++ b/tests/GlobalAdvisory.py @@ -133,7 +133,8 @@ def testAttributes(self): self.assertEqual(self.advisory.withdrawn_at, None) def testNewlyReleased(self): - """Test an advisory that was freshly released and does not have values for all fields.""" + """Test an advisory that was freshly released and does not have values + for all fields.""" self.advisory = self.g.get_global_advisory("GHSA-cx3j-qqxj-9597") self.assertListKeyEqual( self.advisory.credits, From 8b6a312e3affb5aad0ff0382b7a06b695f5b6987 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 1 Feb 2024 23:24:56 +0100 Subject: [PATCH 08/12] configure & apply --- github/AdvisoryCredit.py | 1 + github/AdvisoryCreditDetailed.py | 1 + github/AdvisoryVulnerability.py | 4 +- github/AdvisoryVulnerabilityPackage.py | 4 +- github/ApplicationOAuth.py | 7 +- github/Auth.py | 23 +++--- github/Authorization.py | 1 + github/Autolink.py | 1 + github/Branch.py | 1 + github/BranchProtection.py | 1 + github/CVSS.py | 1 + github/CWE.py | 1 + github/CheckRun.py | 1 + github/CheckRunAnnotation.py | 1 + github/CheckSuite.py | 1 + github/Clones.py | 1 + github/CodeScanAlert.py | 2 + github/CodeScanAlertInstance.py | 1 + github/CodeScanAlertInstanceLocation.py | 1 + github/CodeScanRule.py | 1 + github/CodeScanTool.py | 1 + github/Commit.py | 1 + github/CommitCombinedStatus.py | 1 + github/CommitComment.py | 1 + github/ContentFile.py | 1 + github/DependabotAlert.py | 1 + github/DependabotAlertAdvisory.py | 4 +- github/DependabotAlertDependency.py | 1 + github/Deployment.py | 1 + github/DeploymentStatus.py | 1 + github/Download.py | 1 + github/Enterprise.py | 6 +- github/EnterpriseConsumedLicenses.py | 1 + github/Environment.py | 4 +- github/EnvironmentDeploymentBranchPolicy.py | 4 +- github/EnvironmentProtectionRule.py | 1 + github/EnvironmentProtectionRuleReviewer.py | 4 +- github/Event.py | 1 + github/Gist.py | 1 + github/GistComment.py | 1 + github/GitBlob.py | 1 + github/GitCommit.py | 1 + github/GitRef.py | 1 + github/GitRelease.py | 2 + github/GitReleaseAsset.py | 1 + github/GitTag.py | 1 + github/GitTree.py | 1 + github/GithubApp.py | 1 + github/GithubException.py | 33 ++++----- github/GithubIntegration.py | 1 + github/GithubObject.py | 6 +- github/GithubRetry.py | 1 + github/GitignoreTemplate.py | 1 + github/GlobalAdvisory.py | 1 + github/Hook.py | 1 + github/Installation.py | 1 + github/Invitation.py | 1 + github/Issue.py | 1 + github/IssueComment.py | 1 + github/IssueEvent.py | 1 + github/Label.py | 1 + github/License.py | 1 + github/MainClass.py | 15 ++-- github/Membership.py | 1 + github/Migration.py | 1 + github/Milestone.py | 1 + github/NamedEnterpriseUser.py | 1 + github/NamedUser.py | 1 + github/Notification.py | 1 + github/NotificationSubject.py | 1 + github/Organization.py | 9 ++- github/OrganizationDependabotAlert.py | 1 + github/OrganizationSecret.py | 1 + github/OrganizationVariable.py | 1 + github/Path.py | 1 + github/Project.py | 1 + github/ProjectCard.py | 1 + github/ProjectColumn.py | 1 + github/PublicKey.py | 4 +- github/PullRequest.py | 1 + github/PullRequestComment.py | 1 + github/PullRequestMergeStatus.py | 1 + github/PullRequestReview.py | 1 + github/Rate.py | 1 + github/RateLimit.py | 1 + github/Reaction.py | 1 + github/Referrer.py | 1 + github/Repository.py | 81 +++++++++------------ github/RepositoryAdvisory.py | 13 +++- github/RepositoryKey.py | 1 + github/RepositoryPreferences.py | 1 + github/Requester.py | 12 ++- github/RequiredPullRequestReviews.py | 1 + github/RequiredStatusChecks.py | 1 + github/Secret.py | 1 + github/SelfHostedActionsRunner.py | 1 + github/SourceImport.py | 1 + github/Stargazer.py | 1 + github/StatsCodeFrequency.py | 1 + github/StatsCommitActivity.py | 1 + github/StatsContributor.py | 1 + github/StatsParticipation.py | 1 + github/StatsPunchCard.py | 1 + github/Tag.py | 1 + github/Team.py | 1 + github/TeamDiscussion.py | 1 + github/TimelineEvent.py | 1 + github/TimelineEventSource.py | 1 + github/UserKey.py | 1 + github/Variable.py | 1 + github/View.py | 1 + github/Workflow.py | 1 + github/WorkflowJob.py | 1 + github/WorkflowRun.py | 1 + github/WorkflowStep.py | 1 + github/__init__.py | 13 ++-- pyproject.toml | 7 ++ tests/GlobalAdvisory.py | 3 +- 118 files changed, 227 insertions(+), 129 deletions(-) diff --git a/github/AdvisoryCredit.py b/github/AdvisoryCredit.py index cfa7ea1141..fbd9778143 100644 --- a/github/AdvisoryCredit.py +++ b/github/AdvisoryCredit.py @@ -49,6 +49,7 @@ class AdvisoryCredit(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories + """ @property diff --git a/github/AdvisoryCreditDetailed.py b/github/AdvisoryCreditDetailed.py index 1cf61cb514..9c55447d2f 100644 --- a/github/AdvisoryCreditDetailed.py +++ b/github/AdvisoryCreditDetailed.py @@ -50,6 +50,7 @@ class AdvisoryCreditDetailed(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories + """ @property diff --git a/github/AdvisoryVulnerability.py b/github/AdvisoryVulnerability.py index a574c4cd51..616120f53e 100644 --- a/github/AdvisoryVulnerability.py +++ b/github/AdvisoryVulnerability.py @@ -57,11 +57,11 @@ class SimpleAdvisoryVulnerability(TypedDict): class AdvisoryVulnerability(NonCompletableGithubObject): - """This class represents a package that is vulnerable to a parent - SecurityAdvisory. + """This class represents a package that is vulnerable to a parent SecurityAdvisory. The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories + """ @property diff --git a/github/AdvisoryVulnerabilityPackage.py b/github/AdvisoryVulnerabilityPackage.py index 675b31252f..010bc5c355 100644 --- a/github/AdvisoryVulnerabilityPackage.py +++ b/github/AdvisoryVulnerabilityPackage.py @@ -47,11 +47,11 @@ class AdvisoryVulnerabilityPackage(NonCompletableGithubObject): - """This class represents an identifier for a package that is vulnerable to - a parent SecurityAdvisory. + """This class represents an identifier for a package that is vulnerable to a parent SecurityAdvisory. The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories + """ def _initAttributes(self) -> None: diff --git a/github/ApplicationOAuth.py b/github/ApplicationOAuth.py index e1309822ac..37eb6412ea 100644 --- a/github/ApplicationOAuth.py +++ b/github/ApplicationOAuth.py @@ -42,11 +42,11 @@ class ApplicationOAuth(NonCompletableGithubObject): - """This class is used for identifying and authorizing users for Github - Apps. + """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/building-github-apps/identifying-and-authorizing-users-for-github-apps + """ def _initAttributes(self) -> None: @@ -87,8 +87,7 @@ def get_login_url( state: str | None = None, login: str | None = None, ) -> str: - """Return the URL you need to redirect a user to in order to authorize - your App.""" + """Return the URL you need to redirect a user to in order to authorize your App.""" parameters = {"client_id": self.client_id} if redirect_uri is not None: assert isinstance(redirect_uri, str), redirect_uri diff --git a/github/Auth.py b/github/Auth.py index 748632c137..243bea641e 100644 --- a/github/Auth.py +++ b/github/Auth.py @@ -47,16 +47,15 @@ # add new implementations of github.Auth.Auth to docs/utilities.rst class Auth(abc.ABC): - """This class is the base class of all authentication methods for - Requester.""" + """This class is the base class of all authentication methods for Requester.""" @property @abc.abstractmethod def token_type(self) -> str: - """The type of the auth token as used in the HTTP Authorization header, - e.g. Bearer or Basic. + """The type of the auth token as used in the HTTP Authorization header, e.g. Bearer or Basic. :return: token type + """ @property @@ -65,6 +64,7 @@ def token(self) -> str: """The auth token as used in the HTTP Authorization header. :return: token + """ @@ -131,10 +131,10 @@ def token(self) -> str: class JWT(Auth, ABC): - """This class is the base class to authenticate with a JSON Web Token - (JWT). + """This class is the base class to authenticate with a JSON Web Token (JWT). https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-json-web-token-jwt-for-a-github-app + """ @property @@ -146,6 +146,7 @@ class AppAuth(JWT): """This class is used to authenticate as a GitHub App. https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app + """ def __init__( @@ -188,13 +189,13 @@ def get_installation_auth( token_permissions: Optional[Dict[str, str]] = None, requester: Optional[Requester] = None, ) -> "AppInstallationAuth": - """Creates a github.Auth.AppInstallationAuth instance for an - installation. + """Creates a github.Auth.AppInstallationAuth instance for an installation. :param installation_id: installation id :param token_permissions: optional permissions :param requester: optional requester with app authentication :return: + """ return AppInstallationAuth(self, installation_id, token_permissions, requester) @@ -223,10 +224,10 @@ def create_jwt(self, expiration: Optional[int] = None) -> str: class AppAuthToken(JWT): - """This class is used to authenticate as a GitHub App with a single - constant JWT. + """This class is used to authenticate as a GitHub App with a single constant JWT. https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app + """ def __init__(self, token: str): @@ -243,6 +244,7 @@ class AppInstallationAuth(Auth, WithRequester["AppInstallationAuth"]): """This class is used to authenticate as a GitHub App Installation. https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app-installation + """ # used to fetch live access token when calling self.token @@ -323,6 +325,7 @@ class AppUserAuth(Auth, WithRequester["AppUserAuth"]): """This class is used to authenticate as a GitHub App on behalf of a user. https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-with-a-github-app-on-behalf-of-a-user + """ _client_id: str diff --git a/github/Authorization.py b/github/Authorization.py index 231cae9da1..f39dc0bd70 100644 --- a/github/Authorization.py +++ b/github/Authorization.py @@ -53,6 +53,7 @@ class Authorization(github.GithubObject.CompletableGithubObject): The reference can be found here https://docs.github.com/en/enterprise-server@3.0/rest/reference/oauth-authorizations + """ def _initAttributes(self) -> None: diff --git a/github/Autolink.py b/github/Autolink.py index 94007377b5..ab20e1b49c 100644 --- a/github/Autolink.py +++ b/github/Autolink.py @@ -46,6 +46,7 @@ class Autolink(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/repos/autolinks?apiVersion=2022-11-28 + """ def _initAttributes(self) -> None: diff --git a/github/Branch.py b/github/Branch.py index 0cdff40c09..92966b1300 100644 --- a/github/Branch.py +++ b/github/Branch.py @@ -81,6 +81,7 @@ class Branch(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#branches + """ def __repr__(self) -> str: diff --git a/github/BranchProtection.py b/github/BranchProtection.py index b7049754ed..afa034b0ca 100644 --- a/github/BranchProtection.py +++ b/github/BranchProtection.py @@ -52,6 +52,7 @@ class BranchProtection(github.GithubObject.CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#get-branch-protection + """ def __repr__(self) -> str: diff --git a/github/CVSS.py b/github/CVSS.py index e52a554218..cbf5f5c718 100644 --- a/github/CVSS.py +++ b/github/CVSS.py @@ -47,6 +47,7 @@ class CVSS(NonCompletableGithubObject): The reference can be found here + """ def _initAttributes(self) -> None: diff --git a/github/CWE.py b/github/CWE.py index 4241af36ab..7a025ebc03 100644 --- a/github/CWE.py +++ b/github/CWE.py @@ -47,6 +47,7 @@ class CWE(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories + """ def _initAttributes(self) -> None: diff --git a/github/CheckRun.py b/github/CheckRun.py index 137a1f1914..92bc963196 100644 --- a/github/CheckRun.py +++ b/github/CheckRun.py @@ -59,6 +59,7 @@ class CheckRun(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/checks#check-runs + """ def _initAttributes(self) -> None: diff --git a/github/CheckRunAnnotation.py b/github/CheckRunAnnotation.py index 08c5890b81..8f60b27280 100644 --- a/github/CheckRunAnnotation.py +++ b/github/CheckRunAnnotation.py @@ -33,6 +33,7 @@ class CheckRunAnnotation(NonCompletableGithubObject): """This class represents check run annotations. The reference can be found here: https://docs.github.com/en/rest/reference/checks#list-check-run-annotations + """ def _initAttributes(self) -> None: diff --git a/github/CheckSuite.py b/github/CheckSuite.py index 078a1eef74..a399bc474e 100644 --- a/github/CheckSuite.py +++ b/github/CheckSuite.py @@ -52,6 +52,7 @@ class CheckSuite(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/checks#check-suites + """ def _initAttributes(self) -> None: diff --git a/github/Clones.py b/github/Clones.py index de3c7a68c2..57c27a4dca 100644 --- a/github/Clones.py +++ b/github/Clones.py @@ -46,6 +46,7 @@ class Clones(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#get-repository-clones + """ def _initAttributes(self) -> None: diff --git a/github/CodeScanAlert.py b/github/CodeScanAlert.py index 398c480caf..47c7ae179a 100644 --- a/github/CodeScanAlert.py +++ b/github/CodeScanAlert.py @@ -42,6 +42,7 @@ class CodeScanAlert(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/code-scanning. + """ def _initAttributes(self) -> None: @@ -113,6 +114,7 @@ def get_instances(self) -> PaginatedList[github.CodeScanAlertInstance.CodeScanAl """Get instances. :calls: `GET` on the URL for instances as provided by Github. + """ return PaginatedList( github.CodeScanAlertInstance.CodeScanAlertInstance, diff --git a/github/CodeScanAlertInstance.py b/github/CodeScanAlertInstance.py index 03d4101436..7f244049f9 100644 --- a/github/CodeScanAlertInstance.py +++ b/github/CodeScanAlertInstance.py @@ -39,6 +39,7 @@ class CodeScanAlertInstance(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/code-scanning. + """ def _initAttributes(self) -> None: diff --git a/github/CodeScanAlertInstanceLocation.py b/github/CodeScanAlertInstanceLocation.py index 6c19921c21..049cda2e43 100644 --- a/github/CodeScanAlertInstanceLocation.py +++ b/github/CodeScanAlertInstanceLocation.py @@ -34,6 +34,7 @@ class CodeScanAlertInstanceLocation(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/code-scanning. + """ def _initAttributes(self) -> None: diff --git a/github/CodeScanRule.py b/github/CodeScanRule.py index 42a05a16ca..101f7f32c0 100644 --- a/github/CodeScanRule.py +++ b/github/CodeScanRule.py @@ -48,6 +48,7 @@ class CodeScanRule(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/code-scanning. + """ def _initAttributes(self) -> None: diff --git a/github/CodeScanTool.py b/github/CodeScanTool.py index f0728742cd..b007f06d23 100644 --- a/github/CodeScanTool.py +++ b/github/CodeScanTool.py @@ -45,6 +45,7 @@ class CodeScanTool(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/code-scanning. + """ def _initAttributes(self) -> None: diff --git a/github/Commit.py b/github/Commit.py index da3fb803bd..9095faa059 100644 --- a/github/Commit.py +++ b/github/Commit.py @@ -75,6 +75,7 @@ class Commit(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/git#commits + """ def _initAttributes(self) -> None: diff --git a/github/CommitCombinedStatus.py b/github/CommitCombinedStatus.py index c2324ddd3e..bb503e6141 100644 --- a/github/CommitCombinedStatus.py +++ b/github/CommitCombinedStatus.py @@ -50,6 +50,7 @@ class CommitCombinedStatus(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#statuses + """ def _initAttributes(self) -> None: diff --git a/github/CommitComment.py b/github/CommitComment.py index de1c395a33..bb7a0ed1c5 100644 --- a/github/CommitComment.py +++ b/github/CommitComment.py @@ -59,6 +59,7 @@ class CommitComment(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#comments + """ def _initAttributes(self) -> None: diff --git a/github/ContentFile.py b/github/ContentFile.py index fbdf744b94..1e2182c9e2 100644 --- a/github/ContentFile.py +++ b/github/ContentFile.py @@ -58,6 +58,7 @@ class ContentFile(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#contents + """ def _initAttributes(self) -> None: diff --git a/github/DependabotAlert.py b/github/DependabotAlert.py index 622fdefc85..31887f9669 100644 --- a/github/DependabotAlert.py +++ b/github/DependabotAlert.py @@ -44,6 +44,7 @@ class DependabotAlert(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/dependabot/alerts + """ def _initAttributes(self) -> None: diff --git a/github/DependabotAlertAdvisory.py b/github/DependabotAlertAdvisory.py index e5a0f16b09..2c4c6fc9fc 100644 --- a/github/DependabotAlertAdvisory.py +++ b/github/DependabotAlertAdvisory.py @@ -33,11 +33,11 @@ class DependabotAlertAdvisory(github.AdvisoryBase.AdvisoryBase): - """This class represents a package flagged by a Dependabot alert that is - vulnerable to a parent SecurityAdvisory. + """This class represents a package flagged by a Dependabot alert that is vulnerable to a parent SecurityAdvisory. The reference can be found here https://docs.github.com/en/rest/dependabot/alerts + """ def _initAttributes(self) -> None: diff --git a/github/DependabotAlertDependency.py b/github/DependabotAlertDependency.py index 1ed2f72788..30b18c8112 100644 --- a/github/DependabotAlertDependency.py +++ b/github/DependabotAlertDependency.py @@ -33,6 +33,7 @@ class DependabotAlertDependency(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/dependabot/alerts + """ def _initAttributes(self) -> None: diff --git a/github/Deployment.py b/github/Deployment.py index c436c408f6..62643aa503 100644 --- a/github/Deployment.py +++ b/github/Deployment.py @@ -57,6 +57,7 @@ class Deployment(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#deployments + """ def _initAttributes(self) -> None: diff --git a/github/DeploymentStatus.py b/github/DeploymentStatus.py index 4b40c136cc..f047848d77 100644 --- a/github/DeploymentStatus.py +++ b/github/DeploymentStatus.py @@ -53,6 +53,7 @@ class DeploymentStatus(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#deployments + """ def _initAttributes(self) -> None: diff --git a/github/Download.py b/github/Download.py index 2d62df8ab8..682d86d7d7 100644 --- a/github/Download.py +++ b/github/Download.py @@ -47,6 +47,7 @@ class Download(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos + """ def _initAttributes(self) -> None: diff --git a/github/Enterprise.py b/github/Enterprise.py index 03bc8393a7..39c6426120 100644 --- a/github/Enterprise.py +++ b/github/Enterprise.py @@ -46,10 +46,10 @@ class Enterprise(NonCompletableGithubObject): """This class represents Enterprises. - Such objects do not exist in the Github API, so this class merely - collects all endpoints the start with /enterprises/{enterprise}/. - See methods below for specific endpoints and docs. + Such objects do not exist in the Github API, so this class merely collects all endpoints the start with + /enterprises/{enterprise}/. See methods below for specific endpoints and docs. https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin?apiVersion=2022-11-28 + """ def __init__( diff --git a/github/EnterpriseConsumedLicenses.py b/github/EnterpriseConsumedLicenses.py index 9f86d49ff5..5f147238cd 100644 --- a/github/EnterpriseConsumedLicenses.py +++ b/github/EnterpriseConsumedLicenses.py @@ -48,6 +48,7 @@ class EnterpriseConsumedLicenses(CompletableGithubObject): The reference can be found here https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/license#list-enterprise-consumed-licenses + """ def _initAttributes(self) -> None: diff --git a/github/Environment.py b/github/Environment.py index 343b8c6a23..48ec61b7e4 100644 --- a/github/Environment.py +++ b/github/Environment.py @@ -60,6 +60,7 @@ class Environment(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments + """ def _initAttributes(self) -> None: @@ -217,8 +218,7 @@ def create_variable(self, variable_name: str, value: str) -> Variable: ) def get_variables(self) -> PaginatedList[Variable]: - """Gets all repository variables :rtype: :class:`PaginatedList` of - :class:`Variable`""" + """Gets all repository variables :rtype: :class:`PaginatedList` of :class:`Variable`""" return PaginatedList( Variable, self._requester, diff --git a/github/EnvironmentDeploymentBranchPolicy.py b/github/EnvironmentDeploymentBranchPolicy.py index da814105ad..0f640afcbb 100644 --- a/github/EnvironmentDeploymentBranchPolicy.py +++ b/github/EnvironmentDeploymentBranchPolicy.py @@ -33,6 +33,7 @@ class EnvironmentDeploymentBranchPolicy(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments + """ def _initAttributes(self) -> None: @@ -58,8 +59,7 @@ def _useAttributes(self, attributes: Dict[str, Any]) -> None: class EnvironmentDeploymentBranchPolicyParams: - """This class presents the deployment branch policy parameters as can be - configured for an Environment.""" + """This class presents the deployment branch policy parameters as can be configured for an Environment.""" def __init__(self, protected_branches: bool = False, custom_branch_policies: bool = False): assert isinstance(protected_branches, bool) diff --git a/github/EnvironmentProtectionRule.py b/github/EnvironmentProtectionRule.py index c893b5854d..f36900533b 100644 --- a/github/EnvironmentProtectionRule.py +++ b/github/EnvironmentProtectionRule.py @@ -53,6 +53,7 @@ class EnvironmentProtectionRule(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments + """ def _initAttributes(self) -> None: diff --git a/github/EnvironmentProtectionRuleReviewer.py b/github/EnvironmentProtectionRuleReviewer.py index 30d38d84cc..facc378275 100644 --- a/github/EnvironmentProtectionRuleReviewer.py +++ b/github/EnvironmentProtectionRuleReviewer.py @@ -50,6 +50,7 @@ class EnvironmentProtectionRuleReviewer(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments + """ def _initAttributes(self) -> None: @@ -79,8 +80,7 @@ def _useAttributes(self, attributes: dict[str, Any]) -> None: class ReviewerParams: - """This class presents reviewers as can be configured for an - Environment.""" + """This class presents reviewers as can be configured for an Environment.""" def __init__(self, type_: str, id_: int): assert isinstance(type_, str) and type_ in ("User", "Team") diff --git a/github/Event.py b/github/Event.py index c1654e113e..716cc885e9 100644 --- a/github/Event.py +++ b/github/Event.py @@ -52,6 +52,7 @@ class Event(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/activity#events + """ def _initAttributes(self) -> None: diff --git a/github/Gist.py b/github/Gist.py index 2817fbdd3a..8dceff1305 100644 --- a/github/Gist.py +++ b/github/Gist.py @@ -65,6 +65,7 @@ class Gist(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/gists + """ def _initAttributes(self) -> None: diff --git a/github/GistComment.py b/github/GistComment.py index b4999352d5..9c03ee4982 100644 --- a/github/GistComment.py +++ b/github/GistComment.py @@ -51,6 +51,7 @@ class GistComment(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/gists#comments + """ def _initAttributes(self) -> None: diff --git a/github/GitBlob.py b/github/GitBlob.py index 861864e287..940c9dbbeb 100644 --- a/github/GitBlob.py +++ b/github/GitBlob.py @@ -44,6 +44,7 @@ class GitBlob(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/git#blobs + """ def _initAttributes(self) -> None: diff --git a/github/GitCommit.py b/github/GitCommit.py index c5809bb507..24d26f96f6 100644 --- a/github/GitCommit.py +++ b/github/GitCommit.py @@ -50,6 +50,7 @@ class GitCommit(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/git#commits + """ def _initAttributes(self) -> None: diff --git a/github/GitRef.py b/github/GitRef.py index 12bbed3916..53dd94f0a8 100644 --- a/github/GitRef.py +++ b/github/GitRef.py @@ -53,6 +53,7 @@ class GitRef(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/git#references + """ def _initAttributes(self) -> None: diff --git a/github/GitRelease.py b/github/GitRelease.py index 5abb1a0a51..1228562cee 100644 --- a/github/GitRelease.py +++ b/github/GitRelease.py @@ -71,6 +71,7 @@ class GitRelease(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#releases + """ def _initAttributes(self) -> None: @@ -259,6 +260,7 @@ def upload_asset_from_memory( :calls: `POST https:///repos/{owner}/{repo}/releases/{release_id}/assets `_ :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`` + """ assert isinstance(name, str), name assert isinstance(file_size, int), file_size diff --git a/github/GitReleaseAsset.py b/github/GitReleaseAsset.py index 74a5637e31..529cec53c7 100644 --- a/github/GitReleaseAsset.py +++ b/github/GitReleaseAsset.py @@ -51,6 +51,7 @@ class GitReleaseAsset(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#releases + """ def _initAttributes(self) -> None: diff --git a/github/GitTag.py b/github/GitTag.py index dd432d41da..abd85b2254 100644 --- a/github/GitTag.py +++ b/github/GitTag.py @@ -55,6 +55,7 @@ class GitTag(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/git#tags + """ def _initAttributes(self) -> None: diff --git a/github/GitTree.py b/github/GitTree.py index ffdbdd2516..934fb8d581 100644 --- a/github/GitTree.py +++ b/github/GitTree.py @@ -51,6 +51,7 @@ class GitTree(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/git#trees + """ def _initAttributes(self) -> None: diff --git a/github/GithubApp.py b/github/GithubApp.py index 86ae686351..b9d49fbe79 100644 --- a/github/GithubApp.py +++ b/github/GithubApp.py @@ -54,6 +54,7 @@ class GithubApp(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/apps + """ def _initAttributes(self) -> None: diff --git a/github/GithubException.py b/github/GithubException.py index afb43c9f2b..87ed47ad82 100644 --- a/github/GithubException.py +++ b/github/GithubException.py @@ -40,12 +40,11 @@ class GithubException(Exception): - """Error handling in PyGithub is done with exceptions. This class is the - base of all exceptions raised by PyGithub (but - :class:`github.GithubException.BadAttributeException`). + """Error handling in PyGithub is done with exceptions. This class is the base of all exceptions raised by PyGithub + (but :class:`github.GithubException.BadAttributeException`). + + Some other types of exceptions might be raised by underlying libraries, for example for network-related issues. - Some other types of exceptions might be raised by underlying - libraries, for example for network-related issues. """ def __init__( @@ -97,28 +96,25 @@ def __str__(self) -> str: class BadCredentialsException(GithubException): - """Exception raised in case of bad credentials (when Github API replies - with a 401 or 403 HTML status)""" + """Exception raised in case of bad credentials (when Github API replies with a 401 or 403 HTML status)""" class UnknownObjectException(GithubException): - """Exception raised when a non-existing object is requested (when Github - API replies with a 404 HTML status)""" + """Exception raised when a non-existing object is requested (when Github API replies with a 404 HTML status)""" class BadUserAgentException(GithubException): - """Exception raised when request is sent with a bad user agent header (when - Github API replies with a 403 bad user agent HTML status)""" + """Exception raised when request is sent with a bad user agent header (when Github API replies with a 403 bad user + agent HTML status)""" class RateLimitExceededException(GithubException): - """Exception raised when the rate limit is exceeded (when Github API - replies with a 403 rate limit exceeded HTML status)""" + """Exception raised when the rate limit is exceeded (when Github API replies with a 403 rate limit exceeded HTML + status)""" class BadAttributeException(Exception): - """Exception raised when Github returns an attribute with the wrong - type.""" + """Exception raised when Github returns an attribute with the wrong type.""" def __init__( self, @@ -159,10 +155,9 @@ def transformation_exception(self) -> Optional[Exception]: class TwoFactorException(GithubException): - """Exception raised when Github requires a onetime password for two-factor - authentication.""" + """Exception raised when Github requires a onetime password for two-factor authentication.""" class IncompletableObject(GithubException): - """Exception raised when we can not request an object from Github because - the data returned did not include a URL.""" + """Exception raised when we can not request an object from Github because the data returned did not include a + URL.""" diff --git a/github/GithubIntegration.py b/github/GithubIntegration.py index c0176ab4a5..7e090eeaaf 100644 --- a/github/GithubIntegration.py +++ b/github/GithubIntegration.py @@ -238,6 +238,7 @@ def get_installation(self, owner: str, repo: str) -> Installation: :calls: `GET /repos/{owner}/{repo}/installation ` + """ owner = urllib.parse.quote(owner) repo = urllib.parse.quote(repo) diff --git a/github/GithubObject.py b/github/GithubObject.py index 76bc4dbef1..3c3768600a 100644 --- a/github/GithubObject.py +++ b/github/GithubObject.py @@ -76,6 +76,7 @@ def _datetime_from_http_date(value: str) -> datetime: """Convert an HTTP date to a datetime object. Raises ValueError for invalid dates. + """ dt = email.utils.parsedate_to_datetime(value) @@ -89,6 +90,7 @@ def _datetime_from_github_isoformat(value: str) -> datetime: """Convert an GitHub API timestamps to a datetime object. Raises ValueError for invalid timestamps. + """ # Github always returns YYYY-MM-DDTHH:MM:SSZ, so we can use the stdlib parser @@ -418,8 +420,8 @@ def __complete(self) -> None: self.__completed = True def update(self, additional_headers: Optional[Dict[str, Any]] = None) -> bool: - """Check and update the object with conditional request :rtype: Boolean - value indicating whether the object is changed.""" + """Check and update the object with conditional request :rtype: Boolean value indicating whether the object is + changed.""" conditionalRequestHeader = dict() if self.etag is not None: conditionalRequestHeader[Consts.REQ_IF_NONE_MATCH] = self.etag diff --git a/github/GithubRetry.py b/github/GithubRetry.py index 1d6d3ff2b4..6220b09ff3 100644 --- a/github/GithubRetry.py +++ b/github/GithubRetry.py @@ -56,6 +56,7 @@ class GithubRetry(Retry): By default, all methods defined in `Retry.DEFAULT_ALLOWED_METHODS` are retried, plus GET and POST. This can be configured via the `allowed_methods` argument. + """ __logger: Optional[Logger] = None diff --git a/github/GitignoreTemplate.py b/github/GitignoreTemplate.py index 5bbe35a30a..053f29a10e 100644 --- a/github/GitignoreTemplate.py +++ b/github/GitignoreTemplate.py @@ -44,6 +44,7 @@ class GitignoreTemplate(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/gitignore + """ def _initAttributes(self) -> None: diff --git a/github/GlobalAdvisory.py b/github/GlobalAdvisory.py index 0654e8ccfa..df3e10472b 100644 --- a/github/GlobalAdvisory.py +++ b/github/GlobalAdvisory.py @@ -37,6 +37,7 @@ class GlobalAdvisory(AdvisoryBase): """This class represents a GlobalAdvisory. https://docs.github.com/en/rest/security-advisories/global-advisories + """ def _initAttributes(self) -> None: diff --git a/github/Hook.py b/github/Hook.py index 6f5b2d402c..119688e144 100644 --- a/github/Hook.py +++ b/github/Hook.py @@ -52,6 +52,7 @@ class Hook(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#webhooks + """ def _initAttributes(self) -> None: diff --git a/github/Installation.py b/github/Installation.py index 37b66f6af2..4b4d0b746f 100644 --- a/github/Installation.py +++ b/github/Installation.py @@ -70,6 +70,7 @@ class Installation(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/apps#installations + """ def __init__( diff --git a/github/Invitation.py b/github/Invitation.py index b4f497dbc2..6eeeed0f76 100644 --- a/github/Invitation.py +++ b/github/Invitation.py @@ -56,6 +56,7 @@ class Invitation(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#invitations + """ def _initAttributes(self) -> None: diff --git a/github/Issue.py b/github/Issue.py index 8db88fbace..2af1e36adb 100644 --- a/github/Issue.py +++ b/github/Issue.py @@ -103,6 +103,7 @@ class Issue(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/issues + """ def _initAttributes(self) -> None: diff --git a/github/IssueComment.py b/github/IssueComment.py index 0ee0792e4e..9535dda8d1 100644 --- a/github/IssueComment.py +++ b/github/IssueComment.py @@ -61,6 +61,7 @@ class IssueComment(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/issues#comments + """ def _initAttributes(self) -> None: diff --git a/github/IssueEvent.py b/github/IssueEvent.py index 343e2245f6..0bbd1c5d2b 100644 --- a/github/IssueEvent.py +++ b/github/IssueEvent.py @@ -55,6 +55,7 @@ class IssueEvent(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/issues#events + """ def _initAttributes(self) -> None: diff --git a/github/Label.py b/github/Label.py index 85f87b548a..917952fd6a 100644 --- a/github/Label.py +++ b/github/Label.py @@ -50,6 +50,7 @@ class Label(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/issues#labels + """ def _initAttributes(self) -> None: diff --git a/github/License.py b/github/License.py index 2113ec1895..9280cd4548 100644 --- a/github/License.py +++ b/github/License.py @@ -51,6 +51,7 @@ class License(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/licenses + """ def _initAttributes(self) -> None: diff --git a/github/MainClass.py b/github/MainClass.py index bb0eb1cb5b..9ae08bd460 100644 --- a/github/MainClass.py +++ b/github/MainClass.py @@ -150,6 +150,7 @@ class Github: """This is the main class you instantiate to access the Github API v3. Optional parameters allow different authentication methods. + """ __requester: Requester @@ -309,6 +310,7 @@ def get_rate_limit(self) -> RateLimit: :calls: `GET /rate_limit `_ + """ headers, data = self.__requester.requestJsonAndCheck("GET", "/rate_limit") return RateLimit(self.__requester, headers, data["resources"], True) @@ -917,14 +919,14 @@ def get_emojis(self) -> dict[str, str]: def create_from_raw_data( self, klass: type[TGithubObject], raw_data: dict[str, Any], headers: dict[str, str | int] | None = None ) -> TGithubObject: - """Creates an object from raw_data previously obtained by - :attr:`GithubObject.raw_data`, and optionally headers previously - obtained by :attr:`GithubObject.raw_headers`. + """Creates an object from raw_data previously obtained by :attr:`GithubObject.raw_data`, and optionally headers + previously obtained by :attr:`GithubObject.raw_headers`. :param klass: the class of the object to create :param raw_data: dict :param headers: dict :rtype: instance of class ``klass`` + """ if headers is None: headers = {} @@ -932,9 +934,8 @@ def create_from_raw_data( return klass(self.__requester, headers, raw_data, completed=True) def dump(self, obj: GithubObject, file: BinaryIO, protocol: int = 0) -> None: - """Dumps (pickles) a PyGithub object to a file-like object. Some effort - is made to not pickle sensitive information like the Github credentials - used in the :class:`Github` instance. But NO EFFORT is made to remove + """Dumps (pickles) a PyGithub object to a file-like object. Some effort is made to not pickle sensitive + information like the Github credentials used in the :class:`Github` instance. But NO EFFORT is made to remove sensitive information from the object's attributes. :param obj: the object to pickle :param file: the file-like object to pickle to :param protocol: the @@ -961,6 +962,7 @@ def dump(self, obj: GithubObject, file: BinaryIO, protocol: int = 0) -> None: :param file: the file-like object to pickle to :param protocol: the `pickling protocol `_ + """ pickle.dump((obj.__class__, obj.raw_data, obj.raw_headers), file, protocol) @@ -969,6 +971,7 @@ def load(self, f: BinaryIO) -> Any: :param f: the file-like object to unpickle from :return: the unpickled object + """ return self.create_from_raw_data(*pickle.load(f)) diff --git a/github/Membership.py b/github/Membership.py index 9e80f9d8e9..ee89d1eb7e 100644 --- a/github/Membership.py +++ b/github/Membership.py @@ -57,6 +57,7 @@ class Membership(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/orgs + """ def _initAttributes(self) -> None: diff --git a/github/Migration.py b/github/Migration.py index 7f9a3f6c8a..a1a644e2c7 100644 --- a/github/Migration.py +++ b/github/Migration.py @@ -60,6 +60,7 @@ class Migration(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/migrations + """ def _initAttributes(self) -> None: diff --git a/github/Milestone.py b/github/Milestone.py index 4189d4afa7..21124b2bc7 100644 --- a/github/Milestone.py +++ b/github/Milestone.py @@ -55,6 +55,7 @@ class Milestone(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/issues#milestones + """ def _initAttributes(self) -> None: diff --git a/github/NamedEnterpriseUser.py b/github/NamedEnterpriseUser.py index 518eb34cba..526d7bdf66 100644 --- a/github/NamedEnterpriseUser.py +++ b/github/NamedEnterpriseUser.py @@ -31,6 +31,7 @@ class NamedEnterpriseUser(CompletableGithubObject): The reference can be found here https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/license#list-enterprise-consumed-licenses + """ def _initAttributes(self) -> None: diff --git a/github/NamedUser.py b/github/NamedUser.py index ce2e23b5db..75f79e9c6c 100644 --- a/github/NamedUser.py +++ b/github/NamedUser.py @@ -85,6 +85,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/users#get-a-user + """ def _initAttributes(self) -> None: diff --git a/github/Notification.py b/github/Notification.py index c455991506..144a05b86c 100644 --- a/github/Notification.py +++ b/github/Notification.py @@ -56,6 +56,7 @@ class Notification(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/activity#notifications + """ def _initAttributes(self) -> None: diff --git a/github/NotificationSubject.py b/github/NotificationSubject.py index 199a7d2afe..4d2a162c2c 100644 --- a/github/NotificationSubject.py +++ b/github/NotificationSubject.py @@ -47,6 +47,7 @@ class NotificationSubject(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/activity#list-notifications-for-the-authenticated-user + """ def _initAttributes(self) -> None: diff --git a/github/Organization.py b/github/Organization.py index ff946a2d66..5b5373030e 100644 --- a/github/Organization.py +++ b/github/Organization.py @@ -128,6 +128,7 @@ class Organization(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/orgs + """ def _initAttributes(self) -> None: @@ -622,9 +623,11 @@ def create_secret( ) def get_secrets(self, secret_type: str = "actions") -> PaginatedList[OrganizationSecret]: - """Gets all organization secrets :param secret_type: string options - actions or dependabot :rtype: :class:`PaginatedList` of - :class:`github.OrganizationSecret.OrganizationSecret`""" + """Gets all organization secrets :param secret_type: string options actions or dependabot :rtype: + + :class:`PaginatedList` of :class:`github.OrganizationSecret.OrganizationSecret` + + """ assert secret_type in ["actions", "dependabot"], "secret_type should be actions or dependabot" return PaginatedList( github.OrganizationSecret.OrganizationSecret, diff --git a/github/OrganizationDependabotAlert.py b/github/OrganizationDependabotAlert.py index e839c9c203..fe5ea9d560 100644 --- a/github/OrganizationDependabotAlert.py +++ b/github/OrganizationDependabotAlert.py @@ -34,6 +34,7 @@ class OrganizationDependabotAlert(DependabotAlert): The reference can be found here https://docs.github.com/en/rest/dependabot/alerts#list-dependabot-alerts-for-an-organization + """ def _initAttributes(self) -> None: diff --git a/github/OrganizationSecret.py b/github/OrganizationSecret.py index d9bd18cbee..5c990c59db 100644 --- a/github/OrganizationSecret.py +++ b/github/OrganizationSecret.py @@ -35,6 +35,7 @@ class OrganizationSecret(Secret): The reference can be found here https://docs.github.com/en/rest/actions/secrets + """ def _initAttributes(self) -> None: diff --git a/github/OrganizationVariable.py b/github/OrganizationVariable.py index 51b335d7db..ccc8b76b41 100644 --- a/github/OrganizationVariable.py +++ b/github/OrganizationVariable.py @@ -35,6 +35,7 @@ class OrganizationVariable(Variable): The reference can be found here https://docs.github.com/en/rest/actions/variables + """ def _initAttributes(self) -> None: diff --git a/github/Path.py b/github/Path.py index e668851168..3d1a504ca2 100644 --- a/github/Path.py +++ b/github/Path.py @@ -45,6 +45,7 @@ class Path(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#traffic + """ def _initAttributes(self) -> None: diff --git a/github/Project.py b/github/Project.py index cbe0390559..3f3a3ba54b 100644 --- a/github/Project.py +++ b/github/Project.py @@ -60,6 +60,7 @@ class Project(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/projects + """ def _initAttributes(self) -> None: diff --git a/github/ProjectCard.py b/github/ProjectCard.py index 8979e466ad..b9ec6a79fe 100644 --- a/github/ProjectCard.py +++ b/github/ProjectCard.py @@ -65,6 +65,7 @@ class ProjectCard(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/projects#cards + """ def _initAttributes(self) -> None: diff --git a/github/ProjectColumn.py b/github/ProjectColumn.py index d59d0b1a47..a40ef94dd7 100644 --- a/github/ProjectColumn.py +++ b/github/ProjectColumn.py @@ -63,6 +63,7 @@ class ProjectColumn(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/projects#columns + """ def _initAttributes(self) -> None: diff --git a/github/PublicKey.py b/github/PublicKey.py index d60e5c6c6d..78160ba1ff 100644 --- a/github/PublicKey.py +++ b/github/PublicKey.py @@ -56,13 +56,13 @@ def encrypt(public_key: str, secret_value: str) -> str: class PublicKey(CompletableGithubObject): - """This class represents either an organization public key or a repository - public key. + """This class represents either an organization public key or a repository public key. The reference can be found here https://docs.github.com/en/rest/reference/actions#get-an-organization-public-key or here https://docs.github.com/en/rest/reference/actions#get-a-repository-public-key + """ def _initAttributes(self) -> None: diff --git a/github/PullRequest.py b/github/PullRequest.py index 7b99d7d0ff..20175efd28 100644 --- a/github/PullRequest.py +++ b/github/PullRequest.py @@ -117,6 +117,7 @@ class PullRequest(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/pulls + """ def _initAttributes(self) -> None: diff --git a/github/PullRequestComment.py b/github/PullRequestComment.py index df188d55b2..aa2a390a04 100644 --- a/github/PullRequestComment.py +++ b/github/PullRequestComment.py @@ -60,6 +60,7 @@ class PullRequestComment(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/pulls#review-comments + """ def _initAttributes(self) -> None: diff --git a/github/PullRequestMergeStatus.py b/github/PullRequestMergeStatus.py index 0bec3f7446..e96f8f1f66 100644 --- a/github/PullRequestMergeStatus.py +++ b/github/PullRequestMergeStatus.py @@ -46,6 +46,7 @@ class PullRequestMergeStatus(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/pulls#check-if-a-pull-request-has-been-merged + """ def _initAttributes(self) -> None: diff --git a/github/PullRequestReview.py b/github/PullRequestReview.py index 3d9bd0c337..3a3414ebff 100644 --- a/github/PullRequestReview.py +++ b/github/PullRequestReview.py @@ -55,6 +55,7 @@ class PullRequestReview(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/pulls#reviews + """ def _initAttributes(self) -> None: diff --git a/github/Rate.py b/github/Rate.py index db2e0e990b..cd0ead258c 100644 --- a/github/Rate.py +++ b/github/Rate.py @@ -47,6 +47,7 @@ class Rate(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/rate-limit + """ def _initAttributes(self) -> None: diff --git a/github/RateLimit.py b/github/RateLimit.py index bfc9ca474f..eff48e36e5 100644 --- a/github/RateLimit.py +++ b/github/RateLimit.py @@ -51,6 +51,7 @@ class RateLimit(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/rate-limit + """ def _initAttributes(self) -> None: diff --git a/github/Reaction.py b/github/Reaction.py index f22046fbb0..be73be7f70 100644 --- a/github/Reaction.py +++ b/github/Reaction.py @@ -56,6 +56,7 @@ class Reaction(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/reactions + """ def _initAttributes(self) -> None: diff --git a/github/Referrer.py b/github/Referrer.py index dba18de659..62a1358e68 100644 --- a/github/Referrer.py +++ b/github/Referrer.py @@ -45,6 +45,7 @@ class Referrer(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#traffic + """ def _initAttributes(self) -> None: diff --git a/github/Repository.py b/github/Repository.py index c160c5d91f..45ba0f524a 100644 --- a/github/Repository.py +++ b/github/Repository.py @@ -305,6 +305,7 @@ class Repository(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos + """ def __repr__(self) -> str: @@ -1227,8 +1228,7 @@ def create_git_tag_and_release( prerelease: bool = False, generate_release_notes: bool = False, ) -> GitRelease: - """Convenience function that calls :meth:`Repository.create_git_tag` - and :meth:`Repository.create_git_release`. + """Convenience function that calls :meth:`Repository.create_git_tag` and :meth:`Repository.create_git_release`. :param tag: string :param tag_message: string @@ -1241,6 +1241,7 @@ def create_git_tag_and_release( :param prerelease: bool :param generate_release_notes: bool :rtype: :class:`github.GitRelease.GitRelease` + """ self.create_git_tag(tag, tag_message, object, type, tagger) return self.create_git_release( @@ -1763,8 +1764,7 @@ def create_variable(self, variable_name: str, value: str) -> github.Variable.Var ) def get_variables(self) -> PaginatedList[github.Variable.Variable]: - """Gets all repository variables :rtype: :class:`PaginatedList` of - :class:`github.Variable.Variable`""" + """Gets all repository variables :rtype: :class:`PaginatedList` of :class:`github.Variable.Variable`""" return PaginatedList( github.Variable.Variable, self._requester, @@ -2350,24 +2350,20 @@ def create_file( ) -> dict[str, ContentFile | Commit]: """Create a file in this repository. - :calls: `PUT /repos/{owner}/{repo}/contents/{path} - `_ - :param path: string, (required), path of the file in the - repository + :param path: string, (required), path of the file in the repository :param message: string, (required), commit message :param content: string, (required), the actual data in the file - :param branch: string, (optional), branch to create the commit - on. Defaults to the default branch of the repository - :param committer: InputGitAuthor, (optional), if no information - is given the authenticated user's information will be used. - You must specify both a name and email. - :param author: InputGitAuthor, (optional), if omitted this will - be filled in with committer information. If passed, you must - specify both a name and email. - :rtype: { 'content': :class:`ContentFile - `:, 'commit': :class:`Commit + :param branch: string, (optional), branch to create the commit on. Defaults to the default branch of the + repository + :param committer: InputGitAuthor, (optional), if no information is given the authenticated user's information + will be used. You must specify both a name and email. + :param author: InputGitAuthor, (optional), if omitted this will be filled in with committer information. If + passed, you must specify both a name and email. + :rtype: { 'content': :class:`ContentFile `:, 'commit': :class:`Commit `} + """ assert isinstance(path, str) assert isinstance(message, str) @@ -2435,26 +2431,20 @@ def update_file( ) -> dict[str, ContentFile | Commit]: """This method updates a file in a repository. - :calls: `PUT /repos/{owner}/{repo}/contents/{path} - `_ :param path: string, Required. The content path. :param message: string, Required. The commit message. - :param content: string, Required. The updated file content, - either base64 encoded, or ready to be encoded. - :param sha: string, Required. The blob SHA of the file being - replaced. - :param branch: string. The branch name. Default: the - repository’s default branch (usually master) - :param committer: InputGitAuthor, (optional), if no information - is given the authenticated user's information will be used. - You must specify both a name and email. - :param author: InputGitAuthor, (optional), if omitted this will - be filled in with committer information. If passed, you must - specify both a name and email. - :rtype: { 'content': :class:`ContentFile - `:, 'commit': :class:`Commit + :param content: string, Required. The updated file content, either base64 encoded, or ready to be encoded. + :param sha: string, Required. The blob SHA of the file being replaced. + :param branch: string. The branch name. Default: the repository’s default branch (usually master) + :param committer: InputGitAuthor, (optional), if no information is given the authenticated user's information + will be used. You must specify both a name and email. + :param author: InputGitAuthor, (optional), if omitted this will be filled in with committer information. If + passed, you must specify both a name and email. + :rtype: { 'content': :class:`ContentFile `:, 'commit': :class:`Commit `} + """ assert isinstance(path, str) assert isinstance(message, str) @@ -2499,23 +2489,18 @@ def delete_file( ) -> dict[str, Commit | _NotSetType]: """This method deletes a file in a repository. - :calls: `DELETE /repos/{owner}/{repo}/contents/{path} - `_ :param path: string, Required. The content path. :param message: string, Required. The commit message. - :param sha: string, Required. The blob SHA of the file being - replaced. - :param branch: string. The branch name. Default: the - repository’s default branch (usually master) - :param committer: InputGitAuthor, (optional), if no information - is given the authenticated user's information will be used. - You must specify both a name and email. - :param author: InputGitAuthor, (optional), if omitted this will - be filled in with committer information. If passed, you must - specify both a name and email. - :rtype: { 'content': :class:`null `:, 'commit': - :class:`Commit `} + :param sha: string, Required. The blob SHA of the file being replaced. + :param branch: string. The branch name. Default: the repository’s default branch (usually master) + :param committer: InputGitAuthor, (optional), if no information is given the authenticated user's information + will be used. You must specify both a name and email. + :param author: InputGitAuthor, (optional), if omitted this will be filled in with committer information. If + passed, you must specify both a name and email. + :rtype: { 'content': :class:`null `:, 'commit': :class:`Commit `} + """ assert isinstance(path, str), "path must be str/unicode object" assert isinstance(message, str), "message must be str/unicode object" diff --git a/github/RepositoryAdvisory.py b/github/RepositoryAdvisory.py index 29b5f42891..59c7d45ed4 100644 --- a/github/RepositoryAdvisory.py +++ b/github/RepositoryAdvisory.py @@ -47,6 +47,7 @@ class RepositoryAdvisory(AdvisoryBase): The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories + """ def _initAttributes(self) -> None: @@ -151,6 +152,7 @@ def offer_credit( Unless you are giving credit to yourself, the user having credit offered will need to explicitly accept the credit. :calls: `PATCH /repos/{owner}/{repo}/security-advisories/:advisory_id ` + """ self.offer_credits([{"login": login_or_user, "type": credit_type}]) @@ -158,12 +160,12 @@ def offer_credits( self, credited: Iterable[Credit], ) -> None: - """Offers credit to a list of users for a vulnerability in a - repository. + """Offers credit to a list of users for a vulnerability in a repository. Unless you are giving credit to yourself, the user having credit offered will need to explicitly accept the credit. :calls: `PATCH /repos/{owner}/{repo}/security-advisories/:advisory_id ` :param credited: iterable of dict with keys "login" and "type" + """ assert isinstance(credited, Iterable), credited for credit in credited: @@ -275,10 +277,10 @@ def edit( return self def accept_report(self) -> None: - """Accepts the advisory reported from an external reporter via private - vulnerability reporting. + """Accepts the advisory reported from an external reporter via private vulnerability reporting. :calls: `PATCH /repos/{owner}/{repo}/security-advisories/:advisory_id ` + """ patch_parameters = {"state": "draft"} headers, data = self._requester.requestJsonAndCheck( @@ -292,6 +294,7 @@ def publish(self) -> None: """Publishes the advisory. :calls: `PATCH /repos/{owner}/{repo}/security-advisories/:advisory_id ` + """ patch_parameters = {"state": "published"} headers, data = self._requester.requestJsonAndCheck( @@ -305,6 +308,7 @@ def request_cve(self) -> None: """Requests a CVE for the advisory. :calls: `POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/cve `_ + """ self._requester.requestJsonAndCheck( "POST", @@ -315,6 +319,7 @@ def close(self) -> None: """Closes the advisory. :calls: `PATCH /repos/{owner}/{repo}/security-advisories/:advisory_id ` + """ patch_parameters = {"state": "closed"} headers, data = self._requester.requestJsonAndCheck( diff --git a/github/RepositoryKey.py b/github/RepositoryKey.py index 616930d61a..3c2b7ca7e7 100644 --- a/github/RepositoryKey.py +++ b/github/RepositoryKey.py @@ -52,6 +52,7 @@ class RepositoryKey(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#deploy-keys + """ def _initAttributes(self) -> None: diff --git a/github/RepositoryPreferences.py b/github/RepositoryPreferences.py index 8aed7a62ed..11b31514b4 100644 --- a/github/RepositoryPreferences.py +++ b/github/RepositoryPreferences.py @@ -51,6 +51,7 @@ class RepositoryPreferences(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/free-pro-team@latest/rest/reference/checks#update-repository-preferences-for-check-suites + """ def _initAttributes(self) -> None: diff --git a/github/Requester.py b/github/Requester.py index f40c6afbb1..a9ddd50e7f 100644 --- a/github/Requester.py +++ b/github/Requester.py @@ -343,8 +343,7 @@ def NEW_DEBUG_FRAME(self, requestHeader: Dict[str, str]) -> None: self._frameCount = len(self._frameBuffer) - 1 def DEBUG_ON_RESPONSE(self, statusCode: int, responseHeader: Dict[str, Union[str, int]], data: str) -> None: - """Update current frame with response Current frame index will be - attached to responseHeader.""" + """Update current frame with response Current frame index will be attached to responseHeader.""" if self.DEBUG_FLAG: # pragma no branch (Flag always set in tests) self._frameBuffer[self._frameCount][1:4] = [ statusCode, @@ -478,9 +477,8 @@ def close(self) -> None: @property def kwargs(self) -> Dict[str, Any]: - """Returns arguments required to recreate this Requester with - Requester.__init__, as well as with MainClass.__init__ and - GithubIntegration.__init__.""" + """Returns arguments required to recreate this Requester with Requester.__init__, as well as with + MainClass.__init__ and GithubIntegration.__init__.""" return dict( auth=self.__auth, base_url=self.__base_url, @@ -511,11 +509,11 @@ def auth(self) -> Optional["Auth"]: return self.__auth def withAuth(self, auth: Optional["Auth"]) -> "Requester": - """Create a new requester instance with identical configuration but the - given authentication method. + """Create a new requester instance with identical configuration but the given authentication method. :param auth: authentication method :return: new Requester implementation + """ kwargs = self.kwargs kwargs.update(auth=auth) diff --git a/github/RequiredPullRequestReviews.py b/github/RequiredPullRequestReviews.py index 31f16374ad..fc7185f82d 100644 --- a/github/RequiredPullRequestReviews.py +++ b/github/RequiredPullRequestReviews.py @@ -57,6 +57,7 @@ class RequiredPullRequestReviews(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#get-pull-request-review-protection + """ def _initAttributes(self) -> None: diff --git a/github/RequiredStatusChecks.py b/github/RequiredStatusChecks.py index 965899f67f..6a4c65aec3 100644 --- a/github/RequiredStatusChecks.py +++ b/github/RequiredStatusChecks.py @@ -48,6 +48,7 @@ class RequiredStatusChecks(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#get-status-checks-protection + """ def _initAttributes(self) -> None: diff --git a/github/Secret.py b/github/Secret.py index 60f9350298..9e369d50c1 100644 --- a/github/Secret.py +++ b/github/Secret.py @@ -46,6 +46,7 @@ class Secret(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/actions/secrets + """ def _initAttributes(self) -> None: diff --git a/github/SelfHostedActionsRunner.py b/github/SelfHostedActionsRunner.py index 151c31a71b..dc127dfd00 100644 --- a/github/SelfHostedActionsRunner.py +++ b/github/SelfHostedActionsRunner.py @@ -46,6 +46,7 @@ class SelfHostedActionsRunner(NonCompletableGithubObject): The reference can be found at https://docs.github.com/en/free-pro-team@latest/rest/reference/actions#self-hosted-runners + """ def _initAttributes(self) -> None: diff --git a/github/SourceImport.py b/github/SourceImport.py index af299bd48a..a3523e5a82 100644 --- a/github/SourceImport.py +++ b/github/SourceImport.py @@ -42,6 +42,7 @@ class SourceImport(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/migrations#source-imports + """ def _initAttributes(self) -> None: diff --git a/github/Stargazer.py b/github/Stargazer.py index 088530a511..1b9f6547ae 100644 --- a/github/Stargazer.py +++ b/github/Stargazer.py @@ -55,6 +55,7 @@ class Stargazer(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/activity#starring + """ def _initAttributes(self) -> None: diff --git a/github/StatsCodeFrequency.py b/github/StatsCodeFrequency.py index fac6cc61d5..0d5c0c33aa 100755 --- a/github/StatsCodeFrequency.py +++ b/github/StatsCodeFrequency.py @@ -46,6 +46,7 @@ class StatsCodeFrequency(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/metrics/statistics?apiVersion=2022-11-28#get-the-weekly-commit-activity + """ def _initAttributes(self) -> None: diff --git a/github/StatsCommitActivity.py b/github/StatsCommitActivity.py index feac3cdc32..ee322428d5 100755 --- a/github/StatsCommitActivity.py +++ b/github/StatsCommitActivity.py @@ -46,6 +46,7 @@ class StatsCommitActivity(github.GithubObject.NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#get-the-last-year-of-commit-activity + """ def _initAttributes(self) -> None: diff --git a/github/StatsContributor.py b/github/StatsContributor.py index 95b294ded6..ad293d66ea 100755 --- a/github/StatsContributor.py +++ b/github/StatsContributor.py @@ -47,6 +47,7 @@ class StatsContributor(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#get-all-contributor-commit-activity + """ class Week(NonCompletableGithubObject): diff --git a/github/StatsParticipation.py b/github/StatsParticipation.py index 6673a99cbb..f027b9e18f 100755 --- a/github/StatsParticipation.py +++ b/github/StatsParticipation.py @@ -47,6 +47,7 @@ class StatsParticipation(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#get-the-weekly-commit-count + """ def _initAttributes(self) -> None: diff --git a/github/StatsPunchCard.py b/github/StatsPunchCard.py index 91022beebf..7a09325a21 100755 --- a/github/StatsPunchCard.py +++ b/github/StatsPunchCard.py @@ -46,6 +46,7 @@ class StatsPunchCard(github.GithubObject.NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#get-the-hourly-commit-count-for-each-day + """ _dict: Dict[Tuple[int, int], int] diff --git a/github/Tag.py b/github/Tag.py index ca26f1506f..9d74ca306f 100644 --- a/github/Tag.py +++ b/github/Tag.py @@ -53,6 +53,7 @@ class Tag(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#list-repository-tags + """ def __repr__(self) -> str: diff --git a/github/Team.py b/github/Team.py index 379c1693e5..4510370424 100644 --- a/github/Team.py +++ b/github/Team.py @@ -89,6 +89,7 @@ class Team(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/teams + """ def _initAttributes(self) -> None: diff --git a/github/TeamDiscussion.py b/github/TeamDiscussion.py index 26c3da5c69..21e2501357 100644 --- a/github/TeamDiscussion.py +++ b/github/TeamDiscussion.py @@ -55,6 +55,7 @@ class TeamDiscussion(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/teams#discussions + """ def _initAttributes(self) -> None: diff --git a/github/TimelineEvent.py b/github/TimelineEvent.py index 205e2fbc86..4e4f804840 100644 --- a/github/TimelineEvent.py +++ b/github/TimelineEvent.py @@ -55,6 +55,7 @@ class TimelineEvent(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/issues#timeline + """ def _initAttributes(self) -> None: diff --git a/github/TimelineEventSource.py b/github/TimelineEventSource.py index 2a9d44b2ff..7cb9a34b29 100644 --- a/github/TimelineEventSource.py +++ b/github/TimelineEventSource.py @@ -51,6 +51,7 @@ class TimelineEventSource(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/issues#timeline + """ def _initAttributes(self) -> None: diff --git a/github/UserKey.py b/github/UserKey.py index 3b166e92e8..d66a1d93d8 100644 --- a/github/UserKey.py +++ b/github/UserKey.py @@ -47,6 +47,7 @@ class UserKey(github.GithubObject.CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/users#keys + """ def _initAttributes(self) -> None: diff --git a/github/Variable.py b/github/Variable.py index 70961fc6a2..31e3c0695f 100644 --- a/github/Variable.py +++ b/github/Variable.py @@ -35,6 +35,7 @@ class Variable(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/actions/variables + """ def _initAttributes(self) -> None: diff --git a/github/View.py b/github/View.py index c533e158d5..51542bc6bd 100644 --- a/github/View.py +++ b/github/View.py @@ -46,6 +46,7 @@ class View(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#traffic + """ def _initAttributes(self) -> None: diff --git a/github/Workflow.py b/github/Workflow.py index 5e9caabd77..0cade30073 100644 --- a/github/Workflow.py +++ b/github/Workflow.py @@ -59,6 +59,7 @@ class Workflow(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/actions#workflows + """ def _initAttributes(self) -> None: diff --git a/github/WorkflowJob.py b/github/WorkflowJob.py index 197cca1b7c..2678c818b9 100644 --- a/github/WorkflowJob.py +++ b/github/WorkflowJob.py @@ -38,6 +38,7 @@ class WorkflowJob(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/actions#workflow-jobs + """ def _initAttributes(self) -> None: diff --git a/github/WorkflowRun.py b/github/WorkflowRun.py index 9551e436d5..d8fed6e917 100644 --- a/github/WorkflowRun.py +++ b/github/WorkflowRun.py @@ -58,6 +58,7 @@ class WorkflowRun(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/actions#workflow-runs + """ def _initAttributes(self) -> None: diff --git a/github/WorkflowStep.py b/github/WorkflowStep.py index a65962e499..d7cb58e2bb 100644 --- a/github/WorkflowStep.py +++ b/github/WorkflowStep.py @@ -47,6 +47,7 @@ class WorkflowStep(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/actions#workflow-jobs + """ def _initAttributes(self) -> None: diff --git a/github/__init__.py b/github/__init__.py index 558d231d48..3f2fc6bcab 100644 --- a/github/__init__.py +++ b/github/__init__.py @@ -37,12 +37,12 @@ # along with PyGithub. If not, see . # # # ################################################################################ -"""The primary class you will instantiate is :class:`github.MainClass.Github`. -From its ``get_``, ``create_`` methods, you will obtain instances of all Github -objects like :class:`github.NamedUser.NamedUser` or +"""The primary class you will instantiate is :class:`github.MainClass.Github`. From its ``get_``, ``create_`` methods, +you will obtain instances of all Github objects like :class:`github.NamedUser.NamedUser` or :class:`github.Repository.Repository`. All classes inherit from :class:`github.GithubObject.GithubObject`. + """ import logging @@ -73,14 +73,13 @@ def set_log_level(level: int) -> None: - """Set the log level of the github logger, e.g. - set_log_level(logging.WARNING) :param level: log level.""" + """Set the log level of the github logger, e.g. set_log_level(logging.WARNING) :param level: log level.""" logger.setLevel(level) def enable_console_debug_logging() -> None: # pragma no cover (Function useful only outside test environment) - """This function sets up a very simple logging configuration (log - everything on standard output) that is useful for troubleshooting.""" + """This function sets up a very simple logging configuration (log everything on standard output) that is useful for + troubleshooting.""" set_log_level(logging.DEBUG) diff --git a/pyproject.toml b/pyproject.toml index 7e5c7733d4..b46feafef0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,6 +64,13 @@ warn_no_return = false # https://github.com/psf/black line-length = 120 +[tool.docformatter] +recursive = true +# some docstring start with r""" +wrap-summaries = 119 +wrap-descriptions = 120 +blank = true + [tool.codespell] skip = 'tests/*' quiet-level = 3 diff --git a/tests/GlobalAdvisory.py b/tests/GlobalAdvisory.py index fbf0fb7086..5b8a26579b 100644 --- a/tests/GlobalAdvisory.py +++ b/tests/GlobalAdvisory.py @@ -133,8 +133,7 @@ def testAttributes(self): self.assertEqual(self.advisory.withdrawn_at, None) def testNewlyReleased(self): - """Test an advisory that was freshly released and does not have values - for all fields.""" + """Test an advisory that was freshly released and does not have values for all fields.""" self.advisory = self.g.get_global_advisory("GHSA-cx3j-qqxj-9597") self.assertListKeyEqual( self.advisory.credits, From aea955e5ebdf16f6f340c6340c639e48611fa48d Mon Sep 17 00:00:00 2001 From: Jirka Borovec <6035284+Borda@users.noreply.github.com> Date: Sun, 4 Feb 2024 23:17:41 +0100 Subject: [PATCH 09/12] Multi line summary Co-authored-by: Enrico Minack --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f25eeccb7d..d9b4d9f7a7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,7 +39,7 @@ repos: hooks: - id: docformatter additional_dependencies: [tomli] - args: ["--in-place"] + args: ["--in-place", "--pre-summary-newline", "--make-summary-multi-line"] - repo: https://github.com/psf/black rev: 23.12.0 From c9a56e01a790171b9a748caad4aede7a07a92941 Mon Sep 17 00:00:00 2001 From: Jirka Date: Mon, 5 Feb 2024 10:12:34 +0100 Subject: [PATCH 10/12] revert apply --- github/AdvisoryCredit.py | 1 - github/AdvisoryCreditDetailed.py | 1 - github/AdvisoryVulnerability.py | 4 +- github/AdvisoryVulnerabilityPackage.py | 4 +- github/ApplicationOAuth.py | 7 +- github/Auth.py | 23 +++--- github/Authorization.py | 1 - github/Autolink.py | 1 - github/Branch.py | 1 - github/BranchProtection.py | 1 - github/CVSS.py | 1 - github/CWE.py | 1 - github/CheckRun.py | 1 - github/CheckRunAnnotation.py | 1 - github/CheckSuite.py | 1 - github/Clones.py | 1 - github/CodeScanAlert.py | 2 - github/CodeScanAlertInstance.py | 1 - github/CodeScanAlertInstanceLocation.py | 1 - github/CodeScanRule.py | 1 - github/CodeScanTool.py | 1 - github/Commit.py | 1 - github/CommitCombinedStatus.py | 1 - github/CommitComment.py | 1 - github/ContentFile.py | 1 - github/DependabotAlert.py | 1 - github/DependabotAlertAdvisory.py | 4 +- github/DependabotAlertDependency.py | 1 - github/Deployment.py | 1 - github/DeploymentStatus.py | 1 - github/Download.py | 1 - github/Enterprise.py | 6 +- github/EnterpriseConsumedLicenses.py | 1 - github/Environment.py | 4 +- github/EnvironmentDeploymentBranchPolicy.py | 4 +- github/EnvironmentProtectionRule.py | 1 - github/EnvironmentProtectionRuleReviewer.py | 4 +- github/Event.py | 1 - github/Gist.py | 1 - github/GistComment.py | 1 - github/GitBlob.py | 1 - github/GitCommit.py | 1 - github/GitRef.py | 1 - github/GitRelease.py | 2 - github/GitReleaseAsset.py | 1 - github/GitTag.py | 1 - github/GitTree.py | 1 - github/GithubApp.py | 1 - github/GithubException.py | 33 +++++---- github/GithubIntegration.py | 1 - github/GithubObject.py | 6 +- github/GithubRetry.py | 1 - github/GitignoreTemplate.py | 1 - github/GlobalAdvisory.py | 1 - github/Hook.py | 1 - github/Installation.py | 1 - github/Invitation.py | 1 - github/Issue.py | 1 - github/IssueComment.py | 1 - github/IssueEvent.py | 1 - github/Label.py | 1 - github/License.py | 1 - github/MainClass.py | 15 ++-- github/Membership.py | 1 - github/Migration.py | 1 - github/Milestone.py | 1 - github/NamedEnterpriseUser.py | 1 - github/NamedUser.py | 1 - github/Notification.py | 1 - github/NotificationSubject.py | 1 - github/Organization.py | 9 +-- github/OrganizationDependabotAlert.py | 1 - github/OrganizationSecret.py | 1 - github/OrganizationVariable.py | 1 - github/Path.py | 1 - github/Project.py | 1 - github/ProjectCard.py | 1 - github/ProjectColumn.py | 1 - github/PublicKey.py | 4 +- github/PullRequest.py | 1 - github/PullRequestComment.py | 1 - github/PullRequestMergeStatus.py | 1 - github/PullRequestReview.py | 1 - github/Rate.py | 1 - github/RateLimit.py | 1 - github/Reaction.py | 1 - github/Referrer.py | 1 - github/Repository.py | 81 ++++++++++++--------- github/RepositoryAdvisory.py | 13 +--- github/RepositoryKey.py | 1 - github/RepositoryPreferences.py | 1 - github/Requester.py | 12 +-- github/RequiredPullRequestReviews.py | 1 - github/RequiredStatusChecks.py | 1 - github/Secret.py | 1 - github/SelfHostedActionsRunner.py | 1 - github/SourceImport.py | 1 - github/Stargazer.py | 1 - github/StatsCodeFrequency.py | 1 - github/StatsCommitActivity.py | 1 - github/StatsContributor.py | 1 - github/StatsParticipation.py | 1 - github/StatsPunchCard.py | 1 - github/Tag.py | 1 - github/Team.py | 1 - github/TeamDiscussion.py | 1 - github/TimelineEvent.py | 1 - github/TimelineEventSource.py | 1 - github/UserKey.py | 1 - github/Variable.py | 1 - github/View.py | 1 - github/Workflow.py | 1 - github/WorkflowJob.py | 1 - github/WorkflowRun.py | 1 - github/WorkflowStep.py | 1 - github/__init__.py | 13 ++-- tests/GlobalAdvisory.py | 3 +- 117 files changed, 129 insertions(+), 220 deletions(-) diff --git a/github/AdvisoryCredit.py b/github/AdvisoryCredit.py index fbd9778143..cfa7ea1141 100644 --- a/github/AdvisoryCredit.py +++ b/github/AdvisoryCredit.py @@ -49,7 +49,6 @@ class AdvisoryCredit(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories - """ @property diff --git a/github/AdvisoryCreditDetailed.py b/github/AdvisoryCreditDetailed.py index 9c55447d2f..1cf61cb514 100644 --- a/github/AdvisoryCreditDetailed.py +++ b/github/AdvisoryCreditDetailed.py @@ -50,7 +50,6 @@ class AdvisoryCreditDetailed(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories - """ @property diff --git a/github/AdvisoryVulnerability.py b/github/AdvisoryVulnerability.py index 616120f53e..a574c4cd51 100644 --- a/github/AdvisoryVulnerability.py +++ b/github/AdvisoryVulnerability.py @@ -57,11 +57,11 @@ class SimpleAdvisoryVulnerability(TypedDict): class AdvisoryVulnerability(NonCompletableGithubObject): - """This class represents a package that is vulnerable to a parent SecurityAdvisory. + """This class represents a package that is vulnerable to a parent + SecurityAdvisory. The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories - """ @property diff --git a/github/AdvisoryVulnerabilityPackage.py b/github/AdvisoryVulnerabilityPackage.py index 010bc5c355..675b31252f 100644 --- a/github/AdvisoryVulnerabilityPackage.py +++ b/github/AdvisoryVulnerabilityPackage.py @@ -47,11 +47,11 @@ class AdvisoryVulnerabilityPackage(NonCompletableGithubObject): - """This class represents an identifier for a package that is vulnerable to a parent SecurityAdvisory. + """This class represents an identifier for a package that is vulnerable to + a parent SecurityAdvisory. The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories - """ def _initAttributes(self) -> None: diff --git a/github/ApplicationOAuth.py b/github/ApplicationOAuth.py index 37eb6412ea..e1309822ac 100644 --- a/github/ApplicationOAuth.py +++ b/github/ApplicationOAuth.py @@ -42,11 +42,11 @@ class ApplicationOAuth(NonCompletableGithubObject): - """This class is used for identifying and authorizing users for Github Apps. + """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/building-github-apps/identifying-and-authorizing-users-for-github-apps - """ def _initAttributes(self) -> None: @@ -87,7 +87,8 @@ def get_login_url( state: str | None = None, login: str | None = None, ) -> str: - """Return the URL you need to redirect a user to in order to authorize your App.""" + """Return the URL you need to redirect a user to in order to authorize + your App.""" parameters = {"client_id": self.client_id} if redirect_uri is not None: assert isinstance(redirect_uri, str), redirect_uri diff --git a/github/Auth.py b/github/Auth.py index 243bea641e..748632c137 100644 --- a/github/Auth.py +++ b/github/Auth.py @@ -47,15 +47,16 @@ # add new implementations of github.Auth.Auth to docs/utilities.rst class Auth(abc.ABC): - """This class is the base class of all authentication methods for Requester.""" + """This class is the base class of all authentication methods for + Requester.""" @property @abc.abstractmethod def token_type(self) -> str: - """The type of the auth token as used in the HTTP Authorization header, e.g. Bearer or Basic. + """The type of the auth token as used in the HTTP Authorization header, + e.g. Bearer or Basic. :return: token type - """ @property @@ -64,7 +65,6 @@ def token(self) -> str: """The auth token as used in the HTTP Authorization header. :return: token - """ @@ -131,10 +131,10 @@ def token(self) -> str: class JWT(Auth, ABC): - """This class is the base class to authenticate with a JSON Web Token (JWT). + """This class is the base class to authenticate with a JSON Web Token + (JWT). https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-json-web-token-jwt-for-a-github-app - """ @property @@ -146,7 +146,6 @@ class AppAuth(JWT): """This class is used to authenticate as a GitHub App. https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app - """ def __init__( @@ -189,13 +188,13 @@ def get_installation_auth( token_permissions: Optional[Dict[str, str]] = None, requester: Optional[Requester] = None, ) -> "AppInstallationAuth": - """Creates a github.Auth.AppInstallationAuth instance for an installation. + """Creates a github.Auth.AppInstallationAuth instance for an + installation. :param installation_id: installation id :param token_permissions: optional permissions :param requester: optional requester with app authentication :return: - """ return AppInstallationAuth(self, installation_id, token_permissions, requester) @@ -224,10 +223,10 @@ def create_jwt(self, expiration: Optional[int] = None) -> str: class AppAuthToken(JWT): - """This class is used to authenticate as a GitHub App with a single constant JWT. + """This class is used to authenticate as a GitHub App with a single + constant JWT. https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app - """ def __init__(self, token: str): @@ -244,7 +243,6 @@ class AppInstallationAuth(Auth, WithRequester["AppInstallationAuth"]): """This class is used to authenticate as a GitHub App Installation. https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app-installation - """ # used to fetch live access token when calling self.token @@ -325,7 +323,6 @@ class AppUserAuth(Auth, WithRequester["AppUserAuth"]): """This class is used to authenticate as a GitHub App on behalf of a user. https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-with-a-github-app-on-behalf-of-a-user - """ _client_id: str diff --git a/github/Authorization.py b/github/Authorization.py index f39dc0bd70..231cae9da1 100644 --- a/github/Authorization.py +++ b/github/Authorization.py @@ -53,7 +53,6 @@ class Authorization(github.GithubObject.CompletableGithubObject): The reference can be found here https://docs.github.com/en/enterprise-server@3.0/rest/reference/oauth-authorizations - """ def _initAttributes(self) -> None: diff --git a/github/Autolink.py b/github/Autolink.py index ab20e1b49c..94007377b5 100644 --- a/github/Autolink.py +++ b/github/Autolink.py @@ -46,7 +46,6 @@ class Autolink(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/repos/autolinks?apiVersion=2022-11-28 - """ def _initAttributes(self) -> None: diff --git a/github/Branch.py b/github/Branch.py index 92966b1300..0cdff40c09 100644 --- a/github/Branch.py +++ b/github/Branch.py @@ -81,7 +81,6 @@ class Branch(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#branches - """ def __repr__(self) -> str: diff --git a/github/BranchProtection.py b/github/BranchProtection.py index afa034b0ca..b7049754ed 100644 --- a/github/BranchProtection.py +++ b/github/BranchProtection.py @@ -52,7 +52,6 @@ class BranchProtection(github.GithubObject.CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#get-branch-protection - """ def __repr__(self) -> str: diff --git a/github/CVSS.py b/github/CVSS.py index cbf5f5c718..e52a554218 100644 --- a/github/CVSS.py +++ b/github/CVSS.py @@ -47,7 +47,6 @@ class CVSS(NonCompletableGithubObject): The reference can be found here - """ def _initAttributes(self) -> None: diff --git a/github/CWE.py b/github/CWE.py index 7a025ebc03..4241af36ab 100644 --- a/github/CWE.py +++ b/github/CWE.py @@ -47,7 +47,6 @@ class CWE(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories - """ def _initAttributes(self) -> None: diff --git a/github/CheckRun.py b/github/CheckRun.py index 92bc963196..137a1f1914 100644 --- a/github/CheckRun.py +++ b/github/CheckRun.py @@ -59,7 +59,6 @@ class CheckRun(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/checks#check-runs - """ def _initAttributes(self) -> None: diff --git a/github/CheckRunAnnotation.py b/github/CheckRunAnnotation.py index 8f60b27280..08c5890b81 100644 --- a/github/CheckRunAnnotation.py +++ b/github/CheckRunAnnotation.py @@ -33,7 +33,6 @@ class CheckRunAnnotation(NonCompletableGithubObject): """This class represents check run annotations. The reference can be found here: https://docs.github.com/en/rest/reference/checks#list-check-run-annotations - """ def _initAttributes(self) -> None: diff --git a/github/CheckSuite.py b/github/CheckSuite.py index a399bc474e..078a1eef74 100644 --- a/github/CheckSuite.py +++ b/github/CheckSuite.py @@ -52,7 +52,6 @@ class CheckSuite(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/checks#check-suites - """ def _initAttributes(self) -> None: diff --git a/github/Clones.py b/github/Clones.py index 57c27a4dca..de3c7a68c2 100644 --- a/github/Clones.py +++ b/github/Clones.py @@ -46,7 +46,6 @@ class Clones(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#get-repository-clones - """ def _initAttributes(self) -> None: diff --git a/github/CodeScanAlert.py b/github/CodeScanAlert.py index 47c7ae179a..398c480caf 100644 --- a/github/CodeScanAlert.py +++ b/github/CodeScanAlert.py @@ -42,7 +42,6 @@ class CodeScanAlert(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/code-scanning. - """ def _initAttributes(self) -> None: @@ -114,7 +113,6 @@ def get_instances(self) -> PaginatedList[github.CodeScanAlertInstance.CodeScanAl """Get instances. :calls: `GET` on the URL for instances as provided by Github. - """ return PaginatedList( github.CodeScanAlertInstance.CodeScanAlertInstance, diff --git a/github/CodeScanAlertInstance.py b/github/CodeScanAlertInstance.py index 7f244049f9..03d4101436 100644 --- a/github/CodeScanAlertInstance.py +++ b/github/CodeScanAlertInstance.py @@ -39,7 +39,6 @@ class CodeScanAlertInstance(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/code-scanning. - """ def _initAttributes(self) -> None: diff --git a/github/CodeScanAlertInstanceLocation.py b/github/CodeScanAlertInstanceLocation.py index 049cda2e43..6c19921c21 100644 --- a/github/CodeScanAlertInstanceLocation.py +++ b/github/CodeScanAlertInstanceLocation.py @@ -34,7 +34,6 @@ class CodeScanAlertInstanceLocation(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/code-scanning. - """ def _initAttributes(self) -> None: diff --git a/github/CodeScanRule.py b/github/CodeScanRule.py index 101f7f32c0..42a05a16ca 100644 --- a/github/CodeScanRule.py +++ b/github/CodeScanRule.py @@ -48,7 +48,6 @@ class CodeScanRule(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/code-scanning. - """ def _initAttributes(self) -> None: diff --git a/github/CodeScanTool.py b/github/CodeScanTool.py index b007f06d23..f0728742cd 100644 --- a/github/CodeScanTool.py +++ b/github/CodeScanTool.py @@ -45,7 +45,6 @@ class CodeScanTool(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/code-scanning. - """ def _initAttributes(self) -> None: diff --git a/github/Commit.py b/github/Commit.py index 9095faa059..da3fb803bd 100644 --- a/github/Commit.py +++ b/github/Commit.py @@ -75,7 +75,6 @@ class Commit(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/git#commits - """ def _initAttributes(self) -> None: diff --git a/github/CommitCombinedStatus.py b/github/CommitCombinedStatus.py index bb503e6141..c2324ddd3e 100644 --- a/github/CommitCombinedStatus.py +++ b/github/CommitCombinedStatus.py @@ -50,7 +50,6 @@ class CommitCombinedStatus(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#statuses - """ def _initAttributes(self) -> None: diff --git a/github/CommitComment.py b/github/CommitComment.py index bb7a0ed1c5..de1c395a33 100644 --- a/github/CommitComment.py +++ b/github/CommitComment.py @@ -59,7 +59,6 @@ class CommitComment(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#comments - """ def _initAttributes(self) -> None: diff --git a/github/ContentFile.py b/github/ContentFile.py index 1e2182c9e2..fbdf744b94 100644 --- a/github/ContentFile.py +++ b/github/ContentFile.py @@ -58,7 +58,6 @@ class ContentFile(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#contents - """ def _initAttributes(self) -> None: diff --git a/github/DependabotAlert.py b/github/DependabotAlert.py index 31887f9669..622fdefc85 100644 --- a/github/DependabotAlert.py +++ b/github/DependabotAlert.py @@ -44,7 +44,6 @@ class DependabotAlert(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/dependabot/alerts - """ def _initAttributes(self) -> None: diff --git a/github/DependabotAlertAdvisory.py b/github/DependabotAlertAdvisory.py index 2c4c6fc9fc..e5a0f16b09 100644 --- a/github/DependabotAlertAdvisory.py +++ b/github/DependabotAlertAdvisory.py @@ -33,11 +33,11 @@ class DependabotAlertAdvisory(github.AdvisoryBase.AdvisoryBase): - """This class represents a package flagged by a Dependabot alert that is vulnerable to a parent SecurityAdvisory. + """This class represents a package flagged by a Dependabot alert that is + vulnerable to a parent SecurityAdvisory. The reference can be found here https://docs.github.com/en/rest/dependabot/alerts - """ def _initAttributes(self) -> None: diff --git a/github/DependabotAlertDependency.py b/github/DependabotAlertDependency.py index 30b18c8112..1ed2f72788 100644 --- a/github/DependabotAlertDependency.py +++ b/github/DependabotAlertDependency.py @@ -33,7 +33,6 @@ class DependabotAlertDependency(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/dependabot/alerts - """ def _initAttributes(self) -> None: diff --git a/github/Deployment.py b/github/Deployment.py index 62643aa503..c436c408f6 100644 --- a/github/Deployment.py +++ b/github/Deployment.py @@ -57,7 +57,6 @@ class Deployment(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#deployments - """ def _initAttributes(self) -> None: diff --git a/github/DeploymentStatus.py b/github/DeploymentStatus.py index f047848d77..4b40c136cc 100644 --- a/github/DeploymentStatus.py +++ b/github/DeploymentStatus.py @@ -53,7 +53,6 @@ class DeploymentStatus(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#deployments - """ def _initAttributes(self) -> None: diff --git a/github/Download.py b/github/Download.py index 682d86d7d7..2d62df8ab8 100644 --- a/github/Download.py +++ b/github/Download.py @@ -47,7 +47,6 @@ class Download(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos - """ def _initAttributes(self) -> None: diff --git a/github/Enterprise.py b/github/Enterprise.py index 39c6426120..03bc8393a7 100644 --- a/github/Enterprise.py +++ b/github/Enterprise.py @@ -46,10 +46,10 @@ class Enterprise(NonCompletableGithubObject): """This class represents Enterprises. - Such objects do not exist in the Github API, so this class merely collects all endpoints the start with - /enterprises/{enterprise}/. See methods below for specific endpoints and docs. + Such objects do not exist in the Github API, so this class merely + collects all endpoints the start with /enterprises/{enterprise}/. + See methods below for specific endpoints and docs. https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin?apiVersion=2022-11-28 - """ def __init__( diff --git a/github/EnterpriseConsumedLicenses.py b/github/EnterpriseConsumedLicenses.py index 5f147238cd..9f86d49ff5 100644 --- a/github/EnterpriseConsumedLicenses.py +++ b/github/EnterpriseConsumedLicenses.py @@ -48,7 +48,6 @@ class EnterpriseConsumedLicenses(CompletableGithubObject): The reference can be found here https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/license#list-enterprise-consumed-licenses - """ def _initAttributes(self) -> None: diff --git a/github/Environment.py b/github/Environment.py index 48ec61b7e4..343b8c6a23 100644 --- a/github/Environment.py +++ b/github/Environment.py @@ -60,7 +60,6 @@ class Environment(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments - """ def _initAttributes(self) -> None: @@ -218,7 +217,8 @@ def create_variable(self, variable_name: str, value: str) -> Variable: ) def get_variables(self) -> PaginatedList[Variable]: - """Gets all repository variables :rtype: :class:`PaginatedList` of :class:`Variable`""" + """Gets all repository variables :rtype: :class:`PaginatedList` of + :class:`Variable`""" return PaginatedList( Variable, self._requester, diff --git a/github/EnvironmentDeploymentBranchPolicy.py b/github/EnvironmentDeploymentBranchPolicy.py index 0f640afcbb..da814105ad 100644 --- a/github/EnvironmentDeploymentBranchPolicy.py +++ b/github/EnvironmentDeploymentBranchPolicy.py @@ -33,7 +33,6 @@ class EnvironmentDeploymentBranchPolicy(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments - """ def _initAttributes(self) -> None: @@ -59,7 +58,8 @@ def _useAttributes(self, attributes: Dict[str, Any]) -> None: class EnvironmentDeploymentBranchPolicyParams: - """This class presents the deployment branch policy parameters as can be configured for an Environment.""" + """This class presents the deployment branch policy parameters as can be + configured for an Environment.""" def __init__(self, protected_branches: bool = False, custom_branch_policies: bool = False): assert isinstance(protected_branches, bool) diff --git a/github/EnvironmentProtectionRule.py b/github/EnvironmentProtectionRule.py index f36900533b..c893b5854d 100644 --- a/github/EnvironmentProtectionRule.py +++ b/github/EnvironmentProtectionRule.py @@ -53,7 +53,6 @@ class EnvironmentProtectionRule(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments - """ def _initAttributes(self) -> None: diff --git a/github/EnvironmentProtectionRuleReviewer.py b/github/EnvironmentProtectionRuleReviewer.py index facc378275..30d38d84cc 100644 --- a/github/EnvironmentProtectionRuleReviewer.py +++ b/github/EnvironmentProtectionRuleReviewer.py @@ -50,7 +50,6 @@ class EnvironmentProtectionRuleReviewer(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments - """ def _initAttributes(self) -> None: @@ -80,7 +79,8 @@ def _useAttributes(self, attributes: dict[str, Any]) -> None: class ReviewerParams: - """This class presents reviewers as can be configured for an Environment.""" + """This class presents reviewers as can be configured for an + Environment.""" def __init__(self, type_: str, id_: int): assert isinstance(type_, str) and type_ in ("User", "Team") diff --git a/github/Event.py b/github/Event.py index 716cc885e9..c1654e113e 100644 --- a/github/Event.py +++ b/github/Event.py @@ -52,7 +52,6 @@ class Event(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/activity#events - """ def _initAttributes(self) -> None: diff --git a/github/Gist.py b/github/Gist.py index 8dceff1305..2817fbdd3a 100644 --- a/github/Gist.py +++ b/github/Gist.py @@ -65,7 +65,6 @@ class Gist(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/gists - """ def _initAttributes(self) -> None: diff --git a/github/GistComment.py b/github/GistComment.py index 9c03ee4982..b4999352d5 100644 --- a/github/GistComment.py +++ b/github/GistComment.py @@ -51,7 +51,6 @@ class GistComment(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/gists#comments - """ def _initAttributes(self) -> None: diff --git a/github/GitBlob.py b/github/GitBlob.py index 940c9dbbeb..861864e287 100644 --- a/github/GitBlob.py +++ b/github/GitBlob.py @@ -44,7 +44,6 @@ class GitBlob(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/git#blobs - """ def _initAttributes(self) -> None: diff --git a/github/GitCommit.py b/github/GitCommit.py index 24d26f96f6..c5809bb507 100644 --- a/github/GitCommit.py +++ b/github/GitCommit.py @@ -50,7 +50,6 @@ class GitCommit(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/git#commits - """ def _initAttributes(self) -> None: diff --git a/github/GitRef.py b/github/GitRef.py index 53dd94f0a8..12bbed3916 100644 --- a/github/GitRef.py +++ b/github/GitRef.py @@ -53,7 +53,6 @@ class GitRef(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/git#references - """ def _initAttributes(self) -> None: diff --git a/github/GitRelease.py b/github/GitRelease.py index 1228562cee..5abb1a0a51 100644 --- a/github/GitRelease.py +++ b/github/GitRelease.py @@ -71,7 +71,6 @@ class GitRelease(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#releases - """ def _initAttributes(self) -> None: @@ -260,7 +259,6 @@ def upload_asset_from_memory( :calls: `POST https:///repos/{owner}/{repo}/releases/{release_id}/assets `_ :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`` - """ assert isinstance(name, str), name assert isinstance(file_size, int), file_size diff --git a/github/GitReleaseAsset.py b/github/GitReleaseAsset.py index 529cec53c7..74a5637e31 100644 --- a/github/GitReleaseAsset.py +++ b/github/GitReleaseAsset.py @@ -51,7 +51,6 @@ class GitReleaseAsset(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#releases - """ def _initAttributes(self) -> None: diff --git a/github/GitTag.py b/github/GitTag.py index abd85b2254..dd432d41da 100644 --- a/github/GitTag.py +++ b/github/GitTag.py @@ -55,7 +55,6 @@ class GitTag(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/git#tags - """ def _initAttributes(self) -> None: diff --git a/github/GitTree.py b/github/GitTree.py index 934fb8d581..ffdbdd2516 100644 --- a/github/GitTree.py +++ b/github/GitTree.py @@ -51,7 +51,6 @@ class GitTree(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/git#trees - """ def _initAttributes(self) -> None: diff --git a/github/GithubApp.py b/github/GithubApp.py index b9d49fbe79..86ae686351 100644 --- a/github/GithubApp.py +++ b/github/GithubApp.py @@ -54,7 +54,6 @@ class GithubApp(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/apps - """ def _initAttributes(self) -> None: diff --git a/github/GithubException.py b/github/GithubException.py index 87ed47ad82..afb43c9f2b 100644 --- a/github/GithubException.py +++ b/github/GithubException.py @@ -40,11 +40,12 @@ class GithubException(Exception): - """Error handling in PyGithub is done with exceptions. This class is the base of all exceptions raised by PyGithub - (but :class:`github.GithubException.BadAttributeException`). - - Some other types of exceptions might be raised by underlying libraries, for example for network-related issues. + """Error handling in PyGithub is done with exceptions. This class is the + base of all exceptions raised by PyGithub (but + :class:`github.GithubException.BadAttributeException`). + Some other types of exceptions might be raised by underlying + libraries, for example for network-related issues. """ def __init__( @@ -96,25 +97,28 @@ def __str__(self) -> str: class BadCredentialsException(GithubException): - """Exception raised in case of bad credentials (when Github API replies with a 401 or 403 HTML status)""" + """Exception raised in case of bad credentials (when Github API replies + with a 401 or 403 HTML status)""" class UnknownObjectException(GithubException): - """Exception raised when a non-existing object is requested (when Github API replies with a 404 HTML status)""" + """Exception raised when a non-existing object is requested (when Github + API replies with a 404 HTML status)""" class BadUserAgentException(GithubException): - """Exception raised when request is sent with a bad user agent header (when Github API replies with a 403 bad user - agent HTML status)""" + """Exception raised when request is sent with a bad user agent header (when + Github API replies with a 403 bad user agent HTML status)""" class RateLimitExceededException(GithubException): - """Exception raised when the rate limit is exceeded (when Github API replies with a 403 rate limit exceeded HTML - status)""" + """Exception raised when the rate limit is exceeded (when Github API + replies with a 403 rate limit exceeded HTML status)""" class BadAttributeException(Exception): - """Exception raised when Github returns an attribute with the wrong type.""" + """Exception raised when Github returns an attribute with the wrong + type.""" def __init__( self, @@ -155,9 +159,10 @@ def transformation_exception(self) -> Optional[Exception]: class TwoFactorException(GithubException): - """Exception raised when Github requires a onetime password for two-factor authentication.""" + """Exception raised when Github requires a onetime password for two-factor + authentication.""" class IncompletableObject(GithubException): - """Exception raised when we can not request an object from Github because the data returned did not include a - URL.""" + """Exception raised when we can not request an object from Github because + the data returned did not include a URL.""" diff --git a/github/GithubIntegration.py b/github/GithubIntegration.py index 7e090eeaaf..c0176ab4a5 100644 --- a/github/GithubIntegration.py +++ b/github/GithubIntegration.py @@ -238,7 +238,6 @@ def get_installation(self, owner: str, repo: str) -> Installation: :calls: `GET /repos/{owner}/{repo}/installation ` - """ owner = urllib.parse.quote(owner) repo = urllib.parse.quote(repo) diff --git a/github/GithubObject.py b/github/GithubObject.py index 3c3768600a..76bc4dbef1 100644 --- a/github/GithubObject.py +++ b/github/GithubObject.py @@ -76,7 +76,6 @@ def _datetime_from_http_date(value: str) -> datetime: """Convert an HTTP date to a datetime object. Raises ValueError for invalid dates. - """ dt = email.utils.parsedate_to_datetime(value) @@ -90,7 +89,6 @@ def _datetime_from_github_isoformat(value: str) -> datetime: """Convert an GitHub API timestamps to a datetime object. Raises ValueError for invalid timestamps. - """ # Github always returns YYYY-MM-DDTHH:MM:SSZ, so we can use the stdlib parser @@ -420,8 +418,8 @@ def __complete(self) -> None: self.__completed = True def update(self, additional_headers: Optional[Dict[str, Any]] = None) -> bool: - """Check and update the object with conditional request :rtype: Boolean value indicating whether the object is - changed.""" + """Check and update the object with conditional request :rtype: Boolean + value indicating whether the object is changed.""" conditionalRequestHeader = dict() if self.etag is not None: conditionalRequestHeader[Consts.REQ_IF_NONE_MATCH] = self.etag diff --git a/github/GithubRetry.py b/github/GithubRetry.py index 6220b09ff3..1d6d3ff2b4 100644 --- a/github/GithubRetry.py +++ b/github/GithubRetry.py @@ -56,7 +56,6 @@ class GithubRetry(Retry): By default, all methods defined in `Retry.DEFAULT_ALLOWED_METHODS` are retried, plus GET and POST. This can be configured via the `allowed_methods` argument. - """ __logger: Optional[Logger] = None diff --git a/github/GitignoreTemplate.py b/github/GitignoreTemplate.py index 053f29a10e..5bbe35a30a 100644 --- a/github/GitignoreTemplate.py +++ b/github/GitignoreTemplate.py @@ -44,7 +44,6 @@ class GitignoreTemplate(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/gitignore - """ def _initAttributes(self) -> None: diff --git a/github/GlobalAdvisory.py b/github/GlobalAdvisory.py index df3e10472b..0654e8ccfa 100644 --- a/github/GlobalAdvisory.py +++ b/github/GlobalAdvisory.py @@ -37,7 +37,6 @@ class GlobalAdvisory(AdvisoryBase): """This class represents a GlobalAdvisory. https://docs.github.com/en/rest/security-advisories/global-advisories - """ def _initAttributes(self) -> None: diff --git a/github/Hook.py b/github/Hook.py index 119688e144..6f5b2d402c 100644 --- a/github/Hook.py +++ b/github/Hook.py @@ -52,7 +52,6 @@ class Hook(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#webhooks - """ def _initAttributes(self) -> None: diff --git a/github/Installation.py b/github/Installation.py index 4b4d0b746f..37b66f6af2 100644 --- a/github/Installation.py +++ b/github/Installation.py @@ -70,7 +70,6 @@ class Installation(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/apps#installations - """ def __init__( diff --git a/github/Invitation.py b/github/Invitation.py index 6eeeed0f76..b4f497dbc2 100644 --- a/github/Invitation.py +++ b/github/Invitation.py @@ -56,7 +56,6 @@ class Invitation(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#invitations - """ def _initAttributes(self) -> None: diff --git a/github/Issue.py b/github/Issue.py index 2af1e36adb..8db88fbace 100644 --- a/github/Issue.py +++ b/github/Issue.py @@ -103,7 +103,6 @@ class Issue(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/issues - """ def _initAttributes(self) -> None: diff --git a/github/IssueComment.py b/github/IssueComment.py index 9535dda8d1..0ee0792e4e 100644 --- a/github/IssueComment.py +++ b/github/IssueComment.py @@ -61,7 +61,6 @@ class IssueComment(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/issues#comments - """ def _initAttributes(self) -> None: diff --git a/github/IssueEvent.py b/github/IssueEvent.py index 0bbd1c5d2b..343e2245f6 100644 --- a/github/IssueEvent.py +++ b/github/IssueEvent.py @@ -55,7 +55,6 @@ class IssueEvent(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/issues#events - """ def _initAttributes(self) -> None: diff --git a/github/Label.py b/github/Label.py index 917952fd6a..85f87b548a 100644 --- a/github/Label.py +++ b/github/Label.py @@ -50,7 +50,6 @@ class Label(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/issues#labels - """ def _initAttributes(self) -> None: diff --git a/github/License.py b/github/License.py index 9280cd4548..2113ec1895 100644 --- a/github/License.py +++ b/github/License.py @@ -51,7 +51,6 @@ class License(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/licenses - """ def _initAttributes(self) -> None: diff --git a/github/MainClass.py b/github/MainClass.py index 9ae08bd460..bb0eb1cb5b 100644 --- a/github/MainClass.py +++ b/github/MainClass.py @@ -150,7 +150,6 @@ class Github: """This is the main class you instantiate to access the Github API v3. Optional parameters allow different authentication methods. - """ __requester: Requester @@ -310,7 +309,6 @@ def get_rate_limit(self) -> RateLimit: :calls: `GET /rate_limit `_ - """ headers, data = self.__requester.requestJsonAndCheck("GET", "/rate_limit") return RateLimit(self.__requester, headers, data["resources"], True) @@ -919,14 +917,14 @@ def get_emojis(self) -> dict[str, str]: def create_from_raw_data( self, klass: type[TGithubObject], raw_data: dict[str, Any], headers: dict[str, str | int] | None = None ) -> TGithubObject: - """Creates an object from raw_data previously obtained by :attr:`GithubObject.raw_data`, and optionally headers - previously obtained by :attr:`GithubObject.raw_headers`. + """Creates an object from raw_data previously obtained by + :attr:`GithubObject.raw_data`, and optionally headers previously + obtained by :attr:`GithubObject.raw_headers`. :param klass: the class of the object to create :param raw_data: dict :param headers: dict :rtype: instance of class ``klass`` - """ if headers is None: headers = {} @@ -934,8 +932,9 @@ def create_from_raw_data( return klass(self.__requester, headers, raw_data, completed=True) def dump(self, obj: GithubObject, file: BinaryIO, protocol: int = 0) -> None: - """Dumps (pickles) a PyGithub object to a file-like object. Some effort is made to not pickle sensitive - information like the Github credentials used in the :class:`Github` instance. But NO EFFORT is made to remove + """Dumps (pickles) a PyGithub object to a file-like object. Some effort + is made to not pickle sensitive information like the Github credentials + used in the :class:`Github` instance. But NO EFFORT is made to remove sensitive information from the object's attributes. :param obj: the object to pickle :param file: the file-like object to pickle to :param protocol: the @@ -962,7 +961,6 @@ def dump(self, obj: GithubObject, file: BinaryIO, protocol: int = 0) -> None: :param file: the file-like object to pickle to :param protocol: the `pickling protocol `_ - """ pickle.dump((obj.__class__, obj.raw_data, obj.raw_headers), file, protocol) @@ -971,7 +969,6 @@ def load(self, f: BinaryIO) -> Any: :param f: the file-like object to unpickle from :return: the unpickled object - """ return self.create_from_raw_data(*pickle.load(f)) diff --git a/github/Membership.py b/github/Membership.py index ee89d1eb7e..9e80f9d8e9 100644 --- a/github/Membership.py +++ b/github/Membership.py @@ -57,7 +57,6 @@ class Membership(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/orgs - """ def _initAttributes(self) -> None: diff --git a/github/Migration.py b/github/Migration.py index a1a644e2c7..7f9a3f6c8a 100644 --- a/github/Migration.py +++ b/github/Migration.py @@ -60,7 +60,6 @@ class Migration(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/migrations - """ def _initAttributes(self) -> None: diff --git a/github/Milestone.py b/github/Milestone.py index 21124b2bc7..4189d4afa7 100644 --- a/github/Milestone.py +++ b/github/Milestone.py @@ -55,7 +55,6 @@ class Milestone(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/issues#milestones - """ def _initAttributes(self) -> None: diff --git a/github/NamedEnterpriseUser.py b/github/NamedEnterpriseUser.py index 526d7bdf66..518eb34cba 100644 --- a/github/NamedEnterpriseUser.py +++ b/github/NamedEnterpriseUser.py @@ -31,7 +31,6 @@ class NamedEnterpriseUser(CompletableGithubObject): The reference can be found here https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/license#list-enterprise-consumed-licenses - """ def _initAttributes(self) -> None: diff --git a/github/NamedUser.py b/github/NamedUser.py index 75f79e9c6c..ce2e23b5db 100644 --- a/github/NamedUser.py +++ b/github/NamedUser.py @@ -85,7 +85,6 @@ class NamedUser(github.GithubObject.CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/users#get-a-user - """ def _initAttributes(self) -> None: diff --git a/github/Notification.py b/github/Notification.py index 144a05b86c..c455991506 100644 --- a/github/Notification.py +++ b/github/Notification.py @@ -56,7 +56,6 @@ class Notification(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/activity#notifications - """ def _initAttributes(self) -> None: diff --git a/github/NotificationSubject.py b/github/NotificationSubject.py index 4d2a162c2c..199a7d2afe 100644 --- a/github/NotificationSubject.py +++ b/github/NotificationSubject.py @@ -47,7 +47,6 @@ class NotificationSubject(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/activity#list-notifications-for-the-authenticated-user - """ def _initAttributes(self) -> None: diff --git a/github/Organization.py b/github/Organization.py index 5b5373030e..ff946a2d66 100644 --- a/github/Organization.py +++ b/github/Organization.py @@ -128,7 +128,6 @@ class Organization(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/orgs - """ def _initAttributes(self) -> None: @@ -623,11 +622,9 @@ def create_secret( ) def get_secrets(self, secret_type: str = "actions") -> PaginatedList[OrganizationSecret]: - """Gets all organization secrets :param secret_type: string options actions or dependabot :rtype: - - :class:`PaginatedList` of :class:`github.OrganizationSecret.OrganizationSecret` - - """ + """Gets all organization secrets :param secret_type: string options + actions or dependabot :rtype: :class:`PaginatedList` of + :class:`github.OrganizationSecret.OrganizationSecret`""" assert secret_type in ["actions", "dependabot"], "secret_type should be actions or dependabot" return PaginatedList( github.OrganizationSecret.OrganizationSecret, diff --git a/github/OrganizationDependabotAlert.py b/github/OrganizationDependabotAlert.py index fe5ea9d560..e839c9c203 100644 --- a/github/OrganizationDependabotAlert.py +++ b/github/OrganizationDependabotAlert.py @@ -34,7 +34,6 @@ class OrganizationDependabotAlert(DependabotAlert): The reference can be found here https://docs.github.com/en/rest/dependabot/alerts#list-dependabot-alerts-for-an-organization - """ def _initAttributes(self) -> None: diff --git a/github/OrganizationSecret.py b/github/OrganizationSecret.py index 5c990c59db..d9bd18cbee 100644 --- a/github/OrganizationSecret.py +++ b/github/OrganizationSecret.py @@ -35,7 +35,6 @@ class OrganizationSecret(Secret): The reference can be found here https://docs.github.com/en/rest/actions/secrets - """ def _initAttributes(self) -> None: diff --git a/github/OrganizationVariable.py b/github/OrganizationVariable.py index ccc8b76b41..51b335d7db 100644 --- a/github/OrganizationVariable.py +++ b/github/OrganizationVariable.py @@ -35,7 +35,6 @@ class OrganizationVariable(Variable): The reference can be found here https://docs.github.com/en/rest/actions/variables - """ def _initAttributes(self) -> None: diff --git a/github/Path.py b/github/Path.py index 3d1a504ca2..e668851168 100644 --- a/github/Path.py +++ b/github/Path.py @@ -45,7 +45,6 @@ class Path(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#traffic - """ def _initAttributes(self) -> None: diff --git a/github/Project.py b/github/Project.py index 3f3a3ba54b..cbe0390559 100644 --- a/github/Project.py +++ b/github/Project.py @@ -60,7 +60,6 @@ class Project(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/projects - """ def _initAttributes(self) -> None: diff --git a/github/ProjectCard.py b/github/ProjectCard.py index b9ec6a79fe..8979e466ad 100644 --- a/github/ProjectCard.py +++ b/github/ProjectCard.py @@ -65,7 +65,6 @@ class ProjectCard(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/projects#cards - """ def _initAttributes(self) -> None: diff --git a/github/ProjectColumn.py b/github/ProjectColumn.py index a40ef94dd7..d59d0b1a47 100644 --- a/github/ProjectColumn.py +++ b/github/ProjectColumn.py @@ -63,7 +63,6 @@ class ProjectColumn(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/projects#columns - """ def _initAttributes(self) -> None: diff --git a/github/PublicKey.py b/github/PublicKey.py index 78160ba1ff..d60e5c6c6d 100644 --- a/github/PublicKey.py +++ b/github/PublicKey.py @@ -56,13 +56,13 @@ def encrypt(public_key: str, secret_value: str) -> str: class PublicKey(CompletableGithubObject): - """This class represents either an organization public key or a repository public key. + """This class represents either an organization public key or a repository + public key. The reference can be found here https://docs.github.com/en/rest/reference/actions#get-an-organization-public-key or here https://docs.github.com/en/rest/reference/actions#get-a-repository-public-key - """ def _initAttributes(self) -> None: diff --git a/github/PullRequest.py b/github/PullRequest.py index 20175efd28..7b99d7d0ff 100644 --- a/github/PullRequest.py +++ b/github/PullRequest.py @@ -117,7 +117,6 @@ class PullRequest(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/pulls - """ def _initAttributes(self) -> None: diff --git a/github/PullRequestComment.py b/github/PullRequestComment.py index aa2a390a04..df188d55b2 100644 --- a/github/PullRequestComment.py +++ b/github/PullRequestComment.py @@ -60,7 +60,6 @@ class PullRequestComment(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/pulls#review-comments - """ def _initAttributes(self) -> None: diff --git a/github/PullRequestMergeStatus.py b/github/PullRequestMergeStatus.py index e96f8f1f66..0bec3f7446 100644 --- a/github/PullRequestMergeStatus.py +++ b/github/PullRequestMergeStatus.py @@ -46,7 +46,6 @@ class PullRequestMergeStatus(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/pulls#check-if-a-pull-request-has-been-merged - """ def _initAttributes(self) -> None: diff --git a/github/PullRequestReview.py b/github/PullRequestReview.py index 3a3414ebff..3d9bd0c337 100644 --- a/github/PullRequestReview.py +++ b/github/PullRequestReview.py @@ -55,7 +55,6 @@ class PullRequestReview(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/pulls#reviews - """ def _initAttributes(self) -> None: diff --git a/github/Rate.py b/github/Rate.py index cd0ead258c..db2e0e990b 100644 --- a/github/Rate.py +++ b/github/Rate.py @@ -47,7 +47,6 @@ class Rate(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/rate-limit - """ def _initAttributes(self) -> None: diff --git a/github/RateLimit.py b/github/RateLimit.py index eff48e36e5..bfc9ca474f 100644 --- a/github/RateLimit.py +++ b/github/RateLimit.py @@ -51,7 +51,6 @@ class RateLimit(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/rate-limit - """ def _initAttributes(self) -> None: diff --git a/github/Reaction.py b/github/Reaction.py index be73be7f70..f22046fbb0 100644 --- a/github/Reaction.py +++ b/github/Reaction.py @@ -56,7 +56,6 @@ class Reaction(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/reactions - """ def _initAttributes(self) -> None: diff --git a/github/Referrer.py b/github/Referrer.py index 62a1358e68..dba18de659 100644 --- a/github/Referrer.py +++ b/github/Referrer.py @@ -45,7 +45,6 @@ class Referrer(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#traffic - """ def _initAttributes(self) -> None: diff --git a/github/Repository.py b/github/Repository.py index 45ba0f524a..c160c5d91f 100644 --- a/github/Repository.py +++ b/github/Repository.py @@ -305,7 +305,6 @@ class Repository(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos - """ def __repr__(self) -> str: @@ -1228,7 +1227,8 @@ def create_git_tag_and_release( prerelease: bool = False, generate_release_notes: bool = False, ) -> GitRelease: - """Convenience function that calls :meth:`Repository.create_git_tag` and :meth:`Repository.create_git_release`. + """Convenience function that calls :meth:`Repository.create_git_tag` + and :meth:`Repository.create_git_release`. :param tag: string :param tag_message: string @@ -1241,7 +1241,6 @@ def create_git_tag_and_release( :param prerelease: bool :param generate_release_notes: bool :rtype: :class:`github.GitRelease.GitRelease` - """ self.create_git_tag(tag, tag_message, object, type, tagger) return self.create_git_release( @@ -1764,7 +1763,8 @@ def create_variable(self, variable_name: str, value: str) -> github.Variable.Var ) def get_variables(self) -> PaginatedList[github.Variable.Variable]: - """Gets all repository variables :rtype: :class:`PaginatedList` of :class:`github.Variable.Variable`""" + """Gets all repository variables :rtype: :class:`PaginatedList` of + :class:`github.Variable.Variable`""" return PaginatedList( github.Variable.Variable, self._requester, @@ -2350,20 +2350,24 @@ def create_file( ) -> dict[str, ContentFile | Commit]: """Create a file in this repository. - :calls: `PUT /repos/{owner}/{repo}/contents/{path} `_ - :param path: string, (required), path of the file in the repository + :param path: string, (required), path of the file in the + repository :param message: string, (required), commit message :param content: string, (required), the actual data in the file - :param branch: string, (optional), branch to create the commit on. Defaults to the default branch of the - repository - :param committer: InputGitAuthor, (optional), if no information is given the authenticated user's information - will be used. You must specify both a name and email. - :param author: InputGitAuthor, (optional), if omitted this will be filled in with committer information. If - passed, you must specify both a name and email. - :rtype: { 'content': :class:`ContentFile `:, 'commit': :class:`Commit + :param branch: string, (optional), branch to create the commit + on. Defaults to the default branch of the repository + :param committer: InputGitAuthor, (optional), if no information + is given the authenticated user's information will be used. + You must specify both a name and email. + :param author: InputGitAuthor, (optional), if omitted this will + be filled in with committer information. If passed, you must + specify both a name and email. + :rtype: { 'content': :class:`ContentFile + `:, 'commit': :class:`Commit `} - """ assert isinstance(path, str) assert isinstance(message, str) @@ -2431,20 +2435,26 @@ def update_file( ) -> dict[str, ContentFile | Commit]: """This method updates a file in a repository. - :calls: `PUT /repos/{owner}/{repo}/contents/{path} `_ :param path: string, Required. The content path. :param message: string, Required. The commit message. - :param content: string, Required. The updated file content, either base64 encoded, or ready to be encoded. - :param sha: string, Required. The blob SHA of the file being replaced. - :param branch: string. The branch name. Default: the repository’s default branch (usually master) - :param committer: InputGitAuthor, (optional), if no information is given the authenticated user's information - will be used. You must specify both a name and email. - :param author: InputGitAuthor, (optional), if omitted this will be filled in with committer information. If - passed, you must specify both a name and email. - :rtype: { 'content': :class:`ContentFile `:, 'commit': :class:`Commit + :param content: string, Required. The updated file content, + either base64 encoded, or ready to be encoded. + :param sha: string, Required. The blob SHA of the file being + replaced. + :param branch: string. The branch name. Default: the + repository’s default branch (usually master) + :param committer: InputGitAuthor, (optional), if no information + is given the authenticated user's information will be used. + You must specify both a name and email. + :param author: InputGitAuthor, (optional), if omitted this will + be filled in with committer information. If passed, you must + specify both a name and email. + :rtype: { 'content': :class:`ContentFile + `:, 'commit': :class:`Commit `} - """ assert isinstance(path, str) assert isinstance(message, str) @@ -2489,18 +2499,23 @@ def delete_file( ) -> dict[str, Commit | _NotSetType]: """This method deletes a file in a repository. - :calls: `DELETE /repos/{owner}/{repo}/contents/{path} `_ :param path: string, Required. The content path. :param message: string, Required. The commit message. - :param sha: string, Required. The blob SHA of the file being replaced. - :param branch: string. The branch name. Default: the repository’s default branch (usually master) - :param committer: InputGitAuthor, (optional), if no information is given the authenticated user's information - will be used. You must specify both a name and email. - :param author: InputGitAuthor, (optional), if omitted this will be filled in with committer information. If - passed, you must specify both a name and email. - :rtype: { 'content': :class:`null `:, 'commit': :class:`Commit `} - + :param sha: string, Required. The blob SHA of the file being + replaced. + :param branch: string. The branch name. Default: the + repository’s default branch (usually master) + :param committer: InputGitAuthor, (optional), if no information + is given the authenticated user's information will be used. + You must specify both a name and email. + :param author: InputGitAuthor, (optional), if omitted this will + be filled in with committer information. If passed, you must + specify both a name and email. + :rtype: { 'content': :class:`null `:, 'commit': + :class:`Commit `} """ assert isinstance(path, str), "path must be str/unicode object" assert isinstance(message, str), "message must be str/unicode object" diff --git a/github/RepositoryAdvisory.py b/github/RepositoryAdvisory.py index 59c7d45ed4..29b5f42891 100644 --- a/github/RepositoryAdvisory.py +++ b/github/RepositoryAdvisory.py @@ -47,7 +47,6 @@ class RepositoryAdvisory(AdvisoryBase): The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories - """ def _initAttributes(self) -> None: @@ -152,7 +151,6 @@ def offer_credit( Unless you are giving credit to yourself, the user having credit offered will need to explicitly accept the credit. :calls: `PATCH /repos/{owner}/{repo}/security-advisories/:advisory_id ` - """ self.offer_credits([{"login": login_or_user, "type": credit_type}]) @@ -160,12 +158,12 @@ def offer_credits( self, credited: Iterable[Credit], ) -> None: - """Offers credit to a list of users for a vulnerability in a repository. + """Offers credit to a list of users for a vulnerability in a + repository. Unless you are giving credit to yourself, the user having credit offered will need to explicitly accept the credit. :calls: `PATCH /repos/{owner}/{repo}/security-advisories/:advisory_id ` :param credited: iterable of dict with keys "login" and "type" - """ assert isinstance(credited, Iterable), credited for credit in credited: @@ -277,10 +275,10 @@ def edit( return self def accept_report(self) -> None: - """Accepts the advisory reported from an external reporter via private vulnerability reporting. + """Accepts the advisory reported from an external reporter via private + vulnerability reporting. :calls: `PATCH /repos/{owner}/{repo}/security-advisories/:advisory_id ` - """ patch_parameters = {"state": "draft"} headers, data = self._requester.requestJsonAndCheck( @@ -294,7 +292,6 @@ def publish(self) -> None: """Publishes the advisory. :calls: `PATCH /repos/{owner}/{repo}/security-advisories/:advisory_id ` - """ patch_parameters = {"state": "published"} headers, data = self._requester.requestJsonAndCheck( @@ -308,7 +305,6 @@ def request_cve(self) -> None: """Requests a CVE for the advisory. :calls: `POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/cve `_ - """ self._requester.requestJsonAndCheck( "POST", @@ -319,7 +315,6 @@ def close(self) -> None: """Closes the advisory. :calls: `PATCH /repos/{owner}/{repo}/security-advisories/:advisory_id ` - """ patch_parameters = {"state": "closed"} headers, data = self._requester.requestJsonAndCheck( diff --git a/github/RepositoryKey.py b/github/RepositoryKey.py index 3c2b7ca7e7..616930d61a 100644 --- a/github/RepositoryKey.py +++ b/github/RepositoryKey.py @@ -52,7 +52,6 @@ class RepositoryKey(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#deploy-keys - """ def _initAttributes(self) -> None: diff --git a/github/RepositoryPreferences.py b/github/RepositoryPreferences.py index 11b31514b4..8aed7a62ed 100644 --- a/github/RepositoryPreferences.py +++ b/github/RepositoryPreferences.py @@ -51,7 +51,6 @@ class RepositoryPreferences(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/free-pro-team@latest/rest/reference/checks#update-repository-preferences-for-check-suites - """ def _initAttributes(self) -> None: diff --git a/github/Requester.py b/github/Requester.py index a9ddd50e7f..f40c6afbb1 100644 --- a/github/Requester.py +++ b/github/Requester.py @@ -343,7 +343,8 @@ def NEW_DEBUG_FRAME(self, requestHeader: Dict[str, str]) -> None: self._frameCount = len(self._frameBuffer) - 1 def DEBUG_ON_RESPONSE(self, statusCode: int, responseHeader: Dict[str, Union[str, int]], data: str) -> None: - """Update current frame with response Current frame index will be attached to responseHeader.""" + """Update current frame with response Current frame index will be + attached to responseHeader.""" if self.DEBUG_FLAG: # pragma no branch (Flag always set in tests) self._frameBuffer[self._frameCount][1:4] = [ statusCode, @@ -477,8 +478,9 @@ def close(self) -> None: @property def kwargs(self) -> Dict[str, Any]: - """Returns arguments required to recreate this Requester with Requester.__init__, as well as with - MainClass.__init__ and GithubIntegration.__init__.""" + """Returns arguments required to recreate this Requester with + Requester.__init__, as well as with MainClass.__init__ and + GithubIntegration.__init__.""" return dict( auth=self.__auth, base_url=self.__base_url, @@ -509,11 +511,11 @@ def auth(self) -> Optional["Auth"]: return self.__auth def withAuth(self, auth: Optional["Auth"]) -> "Requester": - """Create a new requester instance with identical configuration but the given authentication method. + """Create a new requester instance with identical configuration but the + given authentication method. :param auth: authentication method :return: new Requester implementation - """ kwargs = self.kwargs kwargs.update(auth=auth) diff --git a/github/RequiredPullRequestReviews.py b/github/RequiredPullRequestReviews.py index fc7185f82d..31f16374ad 100644 --- a/github/RequiredPullRequestReviews.py +++ b/github/RequiredPullRequestReviews.py @@ -57,7 +57,6 @@ class RequiredPullRequestReviews(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#get-pull-request-review-protection - """ def _initAttributes(self) -> None: diff --git a/github/RequiredStatusChecks.py b/github/RequiredStatusChecks.py index 6a4c65aec3..965899f67f 100644 --- a/github/RequiredStatusChecks.py +++ b/github/RequiredStatusChecks.py @@ -48,7 +48,6 @@ class RequiredStatusChecks(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#get-status-checks-protection - """ def _initAttributes(self) -> None: diff --git a/github/Secret.py b/github/Secret.py index 9e369d50c1..60f9350298 100644 --- a/github/Secret.py +++ b/github/Secret.py @@ -46,7 +46,6 @@ class Secret(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/actions/secrets - """ def _initAttributes(self) -> None: diff --git a/github/SelfHostedActionsRunner.py b/github/SelfHostedActionsRunner.py index dc127dfd00..151c31a71b 100644 --- a/github/SelfHostedActionsRunner.py +++ b/github/SelfHostedActionsRunner.py @@ -46,7 +46,6 @@ class SelfHostedActionsRunner(NonCompletableGithubObject): The reference can be found at https://docs.github.com/en/free-pro-team@latest/rest/reference/actions#self-hosted-runners - """ def _initAttributes(self) -> None: diff --git a/github/SourceImport.py b/github/SourceImport.py index a3523e5a82..af299bd48a 100644 --- a/github/SourceImport.py +++ b/github/SourceImport.py @@ -42,7 +42,6 @@ class SourceImport(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/migrations#source-imports - """ def _initAttributes(self) -> None: diff --git a/github/Stargazer.py b/github/Stargazer.py index 1b9f6547ae..088530a511 100644 --- a/github/Stargazer.py +++ b/github/Stargazer.py @@ -55,7 +55,6 @@ class Stargazer(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/activity#starring - """ def _initAttributes(self) -> None: diff --git a/github/StatsCodeFrequency.py b/github/StatsCodeFrequency.py index 0d5c0c33aa..fac6cc61d5 100755 --- a/github/StatsCodeFrequency.py +++ b/github/StatsCodeFrequency.py @@ -46,7 +46,6 @@ class StatsCodeFrequency(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/metrics/statistics?apiVersion=2022-11-28#get-the-weekly-commit-activity - """ def _initAttributes(self) -> None: diff --git a/github/StatsCommitActivity.py b/github/StatsCommitActivity.py index ee322428d5..feac3cdc32 100755 --- a/github/StatsCommitActivity.py +++ b/github/StatsCommitActivity.py @@ -46,7 +46,6 @@ class StatsCommitActivity(github.GithubObject.NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#get-the-last-year-of-commit-activity - """ def _initAttributes(self) -> None: diff --git a/github/StatsContributor.py b/github/StatsContributor.py index ad293d66ea..95b294ded6 100755 --- a/github/StatsContributor.py +++ b/github/StatsContributor.py @@ -47,7 +47,6 @@ class StatsContributor(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#get-all-contributor-commit-activity - """ class Week(NonCompletableGithubObject): diff --git a/github/StatsParticipation.py b/github/StatsParticipation.py index f027b9e18f..6673a99cbb 100755 --- a/github/StatsParticipation.py +++ b/github/StatsParticipation.py @@ -47,7 +47,6 @@ class StatsParticipation(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#get-the-weekly-commit-count - """ def _initAttributes(self) -> None: diff --git a/github/StatsPunchCard.py b/github/StatsPunchCard.py index 7a09325a21..91022beebf 100755 --- a/github/StatsPunchCard.py +++ b/github/StatsPunchCard.py @@ -46,7 +46,6 @@ class StatsPunchCard(github.GithubObject.NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#get-the-hourly-commit-count-for-each-day - """ _dict: Dict[Tuple[int, int], int] diff --git a/github/Tag.py b/github/Tag.py index 9d74ca306f..ca26f1506f 100644 --- a/github/Tag.py +++ b/github/Tag.py @@ -53,7 +53,6 @@ class Tag(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#list-repository-tags - """ def __repr__(self) -> str: diff --git a/github/Team.py b/github/Team.py index 4510370424..379c1693e5 100644 --- a/github/Team.py +++ b/github/Team.py @@ -89,7 +89,6 @@ class Team(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/teams - """ def _initAttributes(self) -> None: diff --git a/github/TeamDiscussion.py b/github/TeamDiscussion.py index 21e2501357..26c3da5c69 100644 --- a/github/TeamDiscussion.py +++ b/github/TeamDiscussion.py @@ -55,7 +55,6 @@ class TeamDiscussion(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/teams#discussions - """ def _initAttributes(self) -> None: diff --git a/github/TimelineEvent.py b/github/TimelineEvent.py index 4e4f804840..205e2fbc86 100644 --- a/github/TimelineEvent.py +++ b/github/TimelineEvent.py @@ -55,7 +55,6 @@ class TimelineEvent(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/issues#timeline - """ def _initAttributes(self) -> None: diff --git a/github/TimelineEventSource.py b/github/TimelineEventSource.py index 7cb9a34b29..2a9d44b2ff 100644 --- a/github/TimelineEventSource.py +++ b/github/TimelineEventSource.py @@ -51,7 +51,6 @@ class TimelineEventSource(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/issues#timeline - """ def _initAttributes(self) -> None: diff --git a/github/UserKey.py b/github/UserKey.py index d66a1d93d8..3b166e92e8 100644 --- a/github/UserKey.py +++ b/github/UserKey.py @@ -47,7 +47,6 @@ class UserKey(github.GithubObject.CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/users#keys - """ def _initAttributes(self) -> None: diff --git a/github/Variable.py b/github/Variable.py index 31e3c0695f..70961fc6a2 100644 --- a/github/Variable.py +++ b/github/Variable.py @@ -35,7 +35,6 @@ class Variable(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/actions/variables - """ def _initAttributes(self) -> None: diff --git a/github/View.py b/github/View.py index 51542bc6bd..c533e158d5 100644 --- a/github/View.py +++ b/github/View.py @@ -46,7 +46,6 @@ class View(NonCompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/repos#traffic - """ def _initAttributes(self) -> None: diff --git a/github/Workflow.py b/github/Workflow.py index 0cade30073..5e9caabd77 100644 --- a/github/Workflow.py +++ b/github/Workflow.py @@ -59,7 +59,6 @@ class Workflow(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/actions#workflows - """ def _initAttributes(self) -> None: diff --git a/github/WorkflowJob.py b/github/WorkflowJob.py index 2678c818b9..197cca1b7c 100644 --- a/github/WorkflowJob.py +++ b/github/WorkflowJob.py @@ -38,7 +38,6 @@ class WorkflowJob(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/actions#workflow-jobs - """ def _initAttributes(self) -> None: diff --git a/github/WorkflowRun.py b/github/WorkflowRun.py index d8fed6e917..9551e436d5 100644 --- a/github/WorkflowRun.py +++ b/github/WorkflowRun.py @@ -58,7 +58,6 @@ class WorkflowRun(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/actions#workflow-runs - """ def _initAttributes(self) -> None: diff --git a/github/WorkflowStep.py b/github/WorkflowStep.py index d7cb58e2bb..a65962e499 100644 --- a/github/WorkflowStep.py +++ b/github/WorkflowStep.py @@ -47,7 +47,6 @@ class WorkflowStep(CompletableGithubObject): The reference can be found here https://docs.github.com/en/rest/reference/actions#workflow-jobs - """ def _initAttributes(self) -> None: diff --git a/github/__init__.py b/github/__init__.py index 3f2fc6bcab..558d231d48 100644 --- a/github/__init__.py +++ b/github/__init__.py @@ -37,12 +37,12 @@ # along with PyGithub. If not, see . # # # ################################################################################ -"""The primary class you will instantiate is :class:`github.MainClass.Github`. From its ``get_``, ``create_`` methods, -you will obtain instances of all Github objects like :class:`github.NamedUser.NamedUser` or +"""The primary class you will instantiate is :class:`github.MainClass.Github`. +From its ``get_``, ``create_`` methods, you will obtain instances of all Github +objects like :class:`github.NamedUser.NamedUser` or :class:`github.Repository.Repository`. All classes inherit from :class:`github.GithubObject.GithubObject`. - """ import logging @@ -73,13 +73,14 @@ def set_log_level(level: int) -> None: - """Set the log level of the github logger, e.g. set_log_level(logging.WARNING) :param level: log level.""" + """Set the log level of the github logger, e.g. + set_log_level(logging.WARNING) :param level: log level.""" logger.setLevel(level) def enable_console_debug_logging() -> None: # pragma no cover (Function useful only outside test environment) - """This function sets up a very simple logging configuration (log everything on standard output) that is useful for - troubleshooting.""" + """This function sets up a very simple logging configuration (log + everything on standard output) that is useful for troubleshooting.""" set_log_level(logging.DEBUG) diff --git a/tests/GlobalAdvisory.py b/tests/GlobalAdvisory.py index 5b8a26579b..fbf0fb7086 100644 --- a/tests/GlobalAdvisory.py +++ b/tests/GlobalAdvisory.py @@ -133,7 +133,8 @@ def testAttributes(self): self.assertEqual(self.advisory.withdrawn_at, None) def testNewlyReleased(self): - """Test an advisory that was freshly released and does not have values for all fields.""" + """Test an advisory that was freshly released and does not have values + for all fields.""" self.advisory = self.g.get_global_advisory("GHSA-cx3j-qqxj-9597") self.assertListKeyEqual( self.advisory.credits, From c46363dadd3ab8f39a5540e5e7b3105884d878cc Mon Sep 17 00:00:00 2001 From: Jirka Date: Mon, 5 Feb 2024 10:19:25 +0100 Subject: [PATCH 11/12] apply again --- .pre-commit-config.yaml | 5 +- github/AccessToken.py | 4 +- github/AdvisoryCredit.py | 8 +- github/AdvisoryCreditDetailed.py | 4 +- github/AdvisoryVulnerability.py | 13 ++- github/AdvisoryVulnerabilityPackage.py | 5 +- github/ApplicationOAuth.py | 10 +- github/Artifact.py | 4 +- github/Auth.py | 61 ++++++++---- github/Authorization.py | 4 +- github/AuthorizationApplication.py | 4 +- github/Autolink.py | 4 +- github/Branch.py | 4 +- github/BranchProtection.py | 4 +- github/CVSS.py | 4 +- github/CWE.py | 4 +- github/CheckRun.py | 4 +- github/CheckRunAnnotation.py | 4 +- github/CheckRunOutput.py | 4 +- github/CheckSuite.py | 4 +- github/Clones.py | 4 +- github/CodeScanAlert.py | 8 +- github/CodeScanAlertInstance.py | 4 +- github/CodeScanAlertInstanceLocation.py | 4 +- github/CodeScanRule.py | 4 +- github/CodeScanTool.py | 4 +- github/Commit.py | 4 +- github/CommitCombinedStatus.py | 4 +- github/CommitComment.py | 4 +- github/CommitStats.py | 4 +- github/Comparison.py | 4 +- github/ContentFile.py | 4 +- github/DependabotAlert.py | 4 +- github/DependabotAlertAdvisory.py | 5 +- github/DependabotAlertDependency.py | 4 +- github/DependabotAlertVulnerability.py | 4 +- github/Deployment.py | 4 +- github/DeploymentStatus.py | 4 +- github/Download.py | 4 +- github/Enterprise.py | 9 +- github/EnterpriseConsumedLicenses.py | 4 +- github/Environment.py | 13 ++- github/EnvironmentDeploymentBranchPolicy.py | 9 +- github/EnvironmentProtectionRule.py | 4 +- github/EnvironmentProtectionRuleReviewer.py | 9 +- github/Event.py | 4 +- github/File.py | 4 +- github/Gist.py | 4 +- github/GistComment.py | 4 +- github/GistFile.py | 4 +- github/GistHistoryState.py | 4 +- github/GitAuthor.py | 4 +- github/GitBlob.py | 4 +- github/GitCommit.py | 4 +- github/GitObject.py | 4 +- github/GitRef.py | 4 +- github/GitRelease.py | 8 +- github/GitReleaseAsset.py | 12 ++- github/GitTag.py | 4 +- github/GitTree.py | 4 +- github/GitTreeElement.py | 4 +- github/GithubApp.py | 4 +- github/GithubException.py | 71 +++++++++----- github/GithubIntegration.py | 16 +++- github/GithubObject.py | 22 +++-- github/GithubRetry.py | 4 +- github/GitignoreTemplate.py | 4 +- github/GlobalAdvisory.py | 4 +- github/Hook.py | 4 +- github/HookDelivery.py | 16 +++- github/HookDescription.py | 4 +- github/HookResponse.py | 4 +- github/InputFileContent.py | 4 +- github/InputGitAuthor.py | 4 +- github/InputGitTreeElement.py | 4 +- github/Installation.py | 4 +- github/InstallationAuthorization.py | 4 +- github/Invitation.py | 4 +- github/Issue.py | 4 +- github/IssueComment.py | 4 +- github/IssueEvent.py | 4 +- github/IssuePullRequest.py | 4 +- github/Label.py | 4 +- github/License.py | 4 +- github/MainClass.py | 34 ++++--- github/Membership.py | 4 +- github/Migration.py | 4 +- github/Milestone.py | 4 +- github/NamedEnterpriseUser.py | 4 +- github/NamedUser.py | 4 +- github/Notification.py | 4 +- github/NotificationSubject.py | 4 +- github/Organization.py | 19 ++-- github/OrganizationDependabotAlert.py | 4 +- github/OrganizationSecret.py | 4 +- github/OrganizationVariable.py | 4 +- github/Path.py | 4 +- github/Permissions.py | 4 +- github/Plan.py | 4 +- github/Project.py | 4 +- github/ProjectCard.py | 4 +- github/ProjectColumn.py | 4 +- github/PublicKey.py | 9 +- github/PullRequest.py | 4 +- github/PullRequestComment.py | 4 +- github/PullRequestMergeStatus.py | 4 +- github/PullRequestPart.py | 4 +- github/PullRequestReview.py | 4 +- github/Rate.py | 4 +- github/RateLimit.py | 16 +++- github/Reaction.py | 4 +- github/Referrer.py | 4 +- github/Repository.py | 100 +++++++++----------- github/RepositoryAdvisory.py | 30 ++++-- github/RepositoryKey.py | 4 +- github/RepositoryPreferences.py | 4 +- github/Requester.py | 25 +++-- github/RequiredPullRequestReviews.py | 4 +- github/RequiredStatusChecks.py | 4 +- github/Secret.py | 4 +- github/SelfHostedActionsRunner.py | 4 +- github/SourceImport.py | 4 +- github/Stargazer.py | 4 +- github/StatsCodeFrequency.py | 4 +- github/StatsCommitActivity.py | 4 +- github/StatsContributor.py | 8 +- github/StatsParticipation.py | 4 +- github/StatsPunchCard.py | 8 +- github/Tag.py | 4 +- github/Team.py | 4 +- github/TeamDiscussion.py | 4 +- github/TimelineEvent.py | 4 +- github/TimelineEventSource.py | 4 +- github/UserKey.py | 4 +- github/Variable.py | 4 +- github/View.py | 4 +- github/Workflow.py | 4 +- github/WorkflowJob.py | 4 +- github/WorkflowRun.py | 4 +- github/WorkflowStep.py | 4 +- github/__init__.py | 18 ++-- tests/GlobalAdvisory.py | 5 +- 142 files changed, 709 insertions(+), 315 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d9b4d9f7a7..b3d7acf35b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,7 +39,10 @@ repos: hooks: - id: docformatter additional_dependencies: [tomli] - args: ["--in-place", "--pre-summary-newline", "--make-summary-multi-line"] + args: + - "--in-place" + - "--pre-summary-newline" + - "--make-summary-multi-line" - repo: https://github.com/psf/black rev: 23.12.0 diff --git a/github/AccessToken.py b/github/AccessToken.py index 85df232ef7..a7c21805a4 100644 --- a/github/AccessToken.py +++ b/github/AccessToken.py @@ -46,7 +46,9 @@ class AccessToken(NonCompletableGithubObject): - """This class represents access tokens.""" + """ + This class represents access tokens. + """ _created: datetime diff --git a/github/AdvisoryCredit.py b/github/AdvisoryCredit.py index cfa7ea1141..a21df3d873 100644 --- a/github/AdvisoryCredit.py +++ b/github/AdvisoryCredit.py @@ -35,7 +35,9 @@ class SimpleCredit(TypedDict): - """A simple credit for a security advisory.""" + """ + A simple credit for a security advisory. + """ login: str | github.NamedUser.NamedUser type: str @@ -45,10 +47,12 @@ class SimpleCredit(TypedDict): class AdvisoryCredit(NonCompletableGithubObject): - """This class represents a credit that is assigned to a SecurityAdvisory. + """ + This class represents a credit that is assigned to a SecurityAdvisory. The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories + """ @property diff --git a/github/AdvisoryCreditDetailed.py b/github/AdvisoryCreditDetailed.py index 1cf61cb514..550f024b91 100644 --- a/github/AdvisoryCreditDetailed.py +++ b/github/AdvisoryCreditDetailed.py @@ -46,10 +46,12 @@ class AdvisoryCreditDetailed(NonCompletableGithubObject): - """This class represents a credit that is assigned to a SecurityAdvisory. + """ + This class represents a credit that is assigned to a SecurityAdvisory. The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories + """ @property diff --git a/github/AdvisoryVulnerability.py b/github/AdvisoryVulnerability.py index a574c4cd51..46f16eeb61 100644 --- a/github/AdvisoryVulnerability.py +++ b/github/AdvisoryVulnerability.py @@ -38,14 +38,18 @@ class SimpleAdvisoryVulnerabilityPackage(TypedDict): - """A simple package in an advisory.""" + """ + A simple package in an advisory. + """ ecosystem: str name: str | None class SimpleAdvisoryVulnerability(TypedDict): - """A simple vulnerability in a security advisory.""" + """ + A simple vulnerability in a security advisory. + """ package: SimpleAdvisoryVulnerabilityPackage patched_versions: str | None @@ -57,11 +61,12 @@ class SimpleAdvisoryVulnerability(TypedDict): class AdvisoryVulnerability(NonCompletableGithubObject): - """This class represents a package that is vulnerable to a parent - SecurityAdvisory. + """ + This class represents a package that is vulnerable to a parent SecurityAdvisory. The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories + """ @property diff --git a/github/AdvisoryVulnerabilityPackage.py b/github/AdvisoryVulnerabilityPackage.py index 675b31252f..812e85985b 100644 --- a/github/AdvisoryVulnerabilityPackage.py +++ b/github/AdvisoryVulnerabilityPackage.py @@ -47,11 +47,12 @@ class AdvisoryVulnerabilityPackage(NonCompletableGithubObject): - """This class represents an identifier for a package that is vulnerable to - a parent SecurityAdvisory. + """ + This class represents an identifier for a package that is vulnerable to a parent SecurityAdvisory. The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories + """ def _initAttributes(self) -> None: diff --git a/github/ApplicationOAuth.py b/github/ApplicationOAuth.py index e1309822ac..b846361648 100644 --- a/github/ApplicationOAuth.py +++ b/github/ApplicationOAuth.py @@ -42,11 +42,12 @@ class ApplicationOAuth(NonCompletableGithubObject): - """This class is used for identifying and authorizing users for Github - Apps. + """ + 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/building-github-apps/identifying-and-authorizing-users-for-github-apps + """ def _initAttributes(self) -> None: @@ -87,8 +88,9 @@ def get_login_url( state: str | None = None, login: str | None = None, ) -> str: - """Return the URL you need to redirect a user to in order to authorize - your App.""" + """ + Return the URL you need to redirect a user to in order to authorize your App. + """ parameters = {"client_id": self.client_id} if redirect_uri is not None: assert isinstance(redirect_uri, str), redirect_uri diff --git a/github/Artifact.py b/github/Artifact.py index b09dc416a9..bd5c580d76 100644 --- a/github/Artifact.py +++ b/github/Artifact.py @@ -53,7 +53,9 @@ class Artifact(NonCompletableGithubObject): - """This class represents an Artifact of Github Run.""" + """ + This class represents an Artifact of Github Run. + """ def _initAttributes(self) -> None: self._archive_download_url: Attribute[str] = NotSet diff --git a/github/Auth.py b/github/Auth.py index 748632c137..607d317144 100644 --- a/github/Auth.py +++ b/github/Auth.py @@ -47,24 +47,28 @@ # add new implementations of github.Auth.Auth to docs/utilities.rst class Auth(abc.ABC): - """This class is the base class of all authentication methods for - Requester.""" + """ + This class is the base class of all authentication methods for Requester. + """ @property @abc.abstractmethod def token_type(self) -> str: - """The type of the auth token as used in the HTTP Authorization header, - e.g. Bearer or Basic. + """ + The type of the auth token as used in the HTTP Authorization header, e.g. Bearer or Basic. :return: token type + """ @property @abc.abstractmethod def token(self) -> str: - """The auth token as used in the HTTP Authorization header. + """ + The auth token as used in the HTTP Authorization header. :return: token + """ @@ -72,12 +76,16 @@ class HTTPBasicAuth(Auth, abc.ABC): @property @abc.abstractmethod def username(self) -> str: - """The username.""" + """ + The username. + """ @property @abc.abstractmethod def password(self) -> str: - """The password.""" + """ + The password. + """ @property def token_type(self) -> str: @@ -89,7 +97,9 @@ def token(self) -> str: class Login(HTTPBasicAuth): - """This class is used to authenticate with login and password.""" + """ + This class is used to authenticate with login and password. + """ def __init__(self, login: str, password: str): assert isinstance(login, str) @@ -114,7 +124,9 @@ def password(self) -> str: class Token(Auth): - """This class is used to authenticate with a single constant token.""" + """ + This class is used to authenticate with a single constant token. + """ def __init__(self, token: str): assert isinstance(token, str) @@ -131,10 +143,11 @@ def token(self) -> str: class JWT(Auth, ABC): - """This class is the base class to authenticate with a JSON Web Token - (JWT). + """ + This class is the base class to authenticate with a JSON Web Token (JWT). https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-json-web-token-jwt-for-a-github-app + """ @property @@ -143,9 +156,11 @@ def token_type(self) -> str: class AppAuth(JWT): - """This class is used to authenticate as a GitHub App. + """ + This class is used to authenticate as a GitHub App. https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app + """ def __init__( @@ -188,13 +203,14 @@ def get_installation_auth( token_permissions: Optional[Dict[str, str]] = None, requester: Optional[Requester] = None, ) -> "AppInstallationAuth": - """Creates a github.Auth.AppInstallationAuth instance for an - installation. + """ + Creates a github.Auth.AppInstallationAuth instance for an installation. :param installation_id: installation id :param token_permissions: optional permissions :param requester: optional requester with app authentication :return: + """ return AppInstallationAuth(self, installation_id, token_permissions, requester) @@ -223,10 +239,11 @@ def create_jwt(self, expiration: Optional[int] = None) -> str: class AppAuthToken(JWT): - """This class is used to authenticate as a GitHub App with a single - constant JWT. + """ + This class is used to authenticate as a GitHub App with a single constant JWT. https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app + """ def __init__(self, token: str): @@ -240,9 +257,11 @@ def token(self) -> str: class AppInstallationAuth(Auth, WithRequester["AppInstallationAuth"]): - """This class is used to authenticate as a GitHub App Installation. + """ + This class is used to authenticate as a GitHub App Installation. https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app-installation + """ # used to fetch live access token when calling self.token @@ -320,9 +339,11 @@ def _get_installation_authorization(self) -> InstallationAuthorization: class AppUserAuth(Auth, WithRequester["AppUserAuth"]): - """This class is used to authenticate as a GitHub App on behalf of a user. + """ + This class is used to authenticate as a GitHub App on behalf of a user. https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-with-a-github-app-on-behalf-of-a-user + """ _client_id: str @@ -448,7 +469,9 @@ def refresh_expires_at(self) -> Optional[datetime]: class NetrcAuth(HTTPBasicAuth, WithRequester["NetrcAuth"]): - """This class is used to authenticate via .netrc.""" + """ + This class is used to authenticate via .netrc. + """ def __init__(self) -> None: super().__init__() diff --git a/github/Authorization.py b/github/Authorization.py index 231cae9da1..c8c8b85ed8 100644 --- a/github/Authorization.py +++ b/github/Authorization.py @@ -49,10 +49,12 @@ class Authorization(github.GithubObject.CompletableGithubObject): - """This class represents Authorizations. + """ + This class represents Authorizations. The reference can be found here https://docs.github.com/en/enterprise-server@3.0/rest/reference/oauth-authorizations + """ def _initAttributes(self) -> None: diff --git a/github/AuthorizationApplication.py b/github/AuthorizationApplication.py index 915d83914f..4b2e78035a 100644 --- a/github/AuthorizationApplication.py +++ b/github/AuthorizationApplication.py @@ -39,7 +39,9 @@ class AuthorizationApplication(CompletableGithubObject): - """This class represents AuthorizationApplications.""" + """ + This class represents AuthorizationApplications. + """ def _initAttributes(self) -> None: self._name: Attribute[str] = NotSet diff --git a/github/Autolink.py b/github/Autolink.py index 94007377b5..f80ba61030 100644 --- a/github/Autolink.py +++ b/github/Autolink.py @@ -42,10 +42,12 @@ class Autolink(NonCompletableGithubObject): - """This class represents Repository autolinks. + """ + This class represents Repository autolinks. The reference can be found here https://docs.github.com/en/rest/repos/autolinks?apiVersion=2022-11-28 + """ def _initAttributes(self) -> None: diff --git a/github/Branch.py b/github/Branch.py index 0cdff40c09..c0fdcb42cd 100644 --- a/github/Branch.py +++ b/github/Branch.py @@ -77,10 +77,12 @@ class Branch(NonCompletableGithubObject): - """This class represents Branches. + """ + This class represents Branches. The reference can be found here https://docs.github.com/en/rest/reference/repos#branches + """ def __repr__(self) -> str: diff --git a/github/BranchProtection.py b/github/BranchProtection.py index b7049754ed..a9238cf6ec 100644 --- a/github/BranchProtection.py +++ b/github/BranchProtection.py @@ -48,10 +48,12 @@ class BranchProtection(github.GithubObject.CompletableGithubObject): - """This class represents Branch Protection. + """ + This class represents Branch Protection. The reference can be found here https://docs.github.com/en/rest/reference/repos#get-branch-protection + """ def __repr__(self) -> str: diff --git a/github/CVSS.py b/github/CVSS.py index e52a554218..2341281040 100644 --- a/github/CVSS.py +++ b/github/CVSS.py @@ -43,10 +43,12 @@ class CVSS(NonCompletableGithubObject): - """This class represents a CVSS. + """ + This class represents a CVSS. The reference can be found here + """ def _initAttributes(self) -> None: diff --git a/github/CWE.py b/github/CWE.py index 4241af36ab..10915f916f 100644 --- a/github/CWE.py +++ b/github/CWE.py @@ -43,10 +43,12 @@ class CWE(CompletableGithubObject): - """This class represents a CWE. + """ + This class represents a CWE. The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories + """ def _initAttributes(self) -> None: diff --git a/github/CheckRun.py b/github/CheckRun.py index 137a1f1914..e9ade82274 100644 --- a/github/CheckRun.py +++ b/github/CheckRun.py @@ -55,10 +55,12 @@ class CheckRun(CompletableGithubObject): - """This class represents check runs. + """ + This class represents check runs. The reference can be found here https://docs.github.com/en/rest/reference/checks#check-runs + """ def _initAttributes(self) -> None: diff --git a/github/CheckRunAnnotation.py b/github/CheckRunAnnotation.py index 08c5890b81..ce6658cdc4 100644 --- a/github/CheckRunAnnotation.py +++ b/github/CheckRunAnnotation.py @@ -30,9 +30,11 @@ class CheckRunAnnotation(NonCompletableGithubObject): - """This class represents check run annotations. + """ + This class represents check run annotations. The reference can be found here: https://docs.github.com/en/rest/reference/checks#list-check-run-annotations + """ def _initAttributes(self) -> None: diff --git a/github/CheckRunOutput.py b/github/CheckRunOutput.py index 2a9f258a13..0fff1fd0c5 100644 --- a/github/CheckRunOutput.py +++ b/github/CheckRunOutput.py @@ -41,7 +41,9 @@ class CheckRunOutput(NonCompletableGithubObject): - """This class represents the output of check run.""" + """ + This class represents the output of check run. + """ def _initAttributes(self) -> None: self._annotations_count: Attribute[int] = NotSet diff --git a/github/CheckSuite.py b/github/CheckSuite.py index 078a1eef74..461593a23d 100644 --- a/github/CheckSuite.py +++ b/github/CheckSuite.py @@ -48,10 +48,12 @@ class CheckSuite(CompletableGithubObject): - """This class represents check suites. + """ + This class represents check suites. The reference can be found here https://docs.github.com/en/rest/reference/checks#check-suites + """ def _initAttributes(self) -> None: diff --git a/github/Clones.py b/github/Clones.py index de3c7a68c2..38c7ce0bed 100644 --- a/github/Clones.py +++ b/github/Clones.py @@ -42,10 +42,12 @@ class Clones(NonCompletableGithubObject): - """This class represents a popular Path for a GitHub repository. + """ + This class represents a popular Path for a GitHub repository. The reference can be found here https://docs.github.com/en/rest/reference/repos#get-repository-clones + """ def _initAttributes(self) -> None: diff --git a/github/CodeScanAlert.py b/github/CodeScanAlert.py index 398c480caf..fa751433cc 100644 --- a/github/CodeScanAlert.py +++ b/github/CodeScanAlert.py @@ -38,10 +38,12 @@ class CodeScanAlert(NonCompletableGithubObject): - """This class represents alerts from code scanning. + """ + This class represents alerts from code scanning. The reference can be found here https://docs.github.com/en/rest/reference/code-scanning. + """ def _initAttributes(self) -> None: @@ -110,9 +112,11 @@ def state(self) -> str: return self._state.value def get_instances(self) -> PaginatedList[github.CodeScanAlertInstance.CodeScanAlertInstance]: - """Get instances. + """ + Get instances. :calls: `GET` on the URL for instances as provided by Github. + """ return PaginatedList( github.CodeScanAlertInstance.CodeScanAlertInstance, diff --git a/github/CodeScanAlertInstance.py b/github/CodeScanAlertInstance.py index 03d4101436..e838347546 100644 --- a/github/CodeScanAlertInstance.py +++ b/github/CodeScanAlertInstance.py @@ -35,10 +35,12 @@ class CodeScanAlertInstance(NonCompletableGithubObject): - """This class represents code scanning alert instances. + """ + This class represents code scanning alert instances. The reference can be found here https://docs.github.com/en/rest/reference/code-scanning. + """ def _initAttributes(self) -> None: diff --git a/github/CodeScanAlertInstanceLocation.py b/github/CodeScanAlertInstanceLocation.py index 6c19921c21..69e675262a 100644 --- a/github/CodeScanAlertInstanceLocation.py +++ b/github/CodeScanAlertInstanceLocation.py @@ -30,10 +30,12 @@ class CodeScanAlertInstanceLocation(NonCompletableGithubObject): - """This class represents code scanning alert instance locations. + """ + This class represents code scanning alert instance locations. The reference can be found here https://docs.github.com/en/rest/reference/code-scanning. + """ def _initAttributes(self) -> None: diff --git a/github/CodeScanRule.py b/github/CodeScanRule.py index 42a05a16ca..991fca3e0a 100644 --- a/github/CodeScanRule.py +++ b/github/CodeScanRule.py @@ -44,10 +44,12 @@ class CodeScanRule(NonCompletableGithubObject): - """This class represents Alerts from code scanning. + """ + This class represents Alerts from code scanning. The reference can be found here https://docs.github.com/en/rest/reference/code-scanning. + """ def _initAttributes(self) -> None: diff --git a/github/CodeScanTool.py b/github/CodeScanTool.py index f0728742cd..b9d669b217 100644 --- a/github/CodeScanTool.py +++ b/github/CodeScanTool.py @@ -41,10 +41,12 @@ class CodeScanTool(NonCompletableGithubObject): - """This class represents code scanning tools. + """ + This class represents code scanning tools. The reference can be found here https://docs.github.com/en/rest/reference/code-scanning. + """ def _initAttributes(self) -> None: diff --git a/github/Commit.py b/github/Commit.py index da3fb803bd..0672a30f51 100644 --- a/github/Commit.py +++ b/github/Commit.py @@ -71,10 +71,12 @@ class Commit(CompletableGithubObject): - """This class represents Commits. + """ + This class represents Commits. The reference can be found here https://docs.github.com/en/rest/reference/git#commits + """ def _initAttributes(self) -> None: diff --git a/github/CommitCombinedStatus.py b/github/CommitCombinedStatus.py index c2324ddd3e..b840497930 100644 --- a/github/CommitCombinedStatus.py +++ b/github/CommitCombinedStatus.py @@ -46,10 +46,12 @@ class CommitCombinedStatus(NonCompletableGithubObject): - """This class represents CommitCombinedStatuses. + """ + This class represents CommitCombinedStatuses. The reference can be found here https://docs.github.com/en/rest/reference/repos#statuses + """ def _initAttributes(self) -> None: diff --git a/github/CommitComment.py b/github/CommitComment.py index de1c395a33..387c634306 100644 --- a/github/CommitComment.py +++ b/github/CommitComment.py @@ -55,10 +55,12 @@ class CommitComment(CompletableGithubObject): - """This class represents CommitComments. + """ + This class represents CommitComments. The reference can be found here https://docs.github.com/en/rest/reference/repos#comments + """ def _initAttributes(self) -> None: diff --git a/github/CommitStats.py b/github/CommitStats.py index 3c59d13ae0..263cea8ad1 100644 --- a/github/CommitStats.py +++ b/github/CommitStats.py @@ -38,7 +38,9 @@ class CommitStats(NonCompletableGithubObject): - """This class represents CommitStats.""" + """ + This class represents CommitStats. + """ def _initAttributes(self) -> None: self._total: Attribute[int] = NotSet diff --git a/github/Comparison.py b/github/Comparison.py index ea2f058fc8..5467a5052c 100644 --- a/github/Comparison.py +++ b/github/Comparison.py @@ -45,7 +45,9 @@ class Comparison(CompletableGithubObject): - """This class represents Comparisons.""" + """ + This class represents Comparisons. + """ def _initAttributes(self) -> None: self._ahead_by: Attribute[int] = NotSet diff --git a/github/ContentFile.py b/github/ContentFile.py index fbdf744b94..703e9dc988 100644 --- a/github/ContentFile.py +++ b/github/ContentFile.py @@ -54,10 +54,12 @@ class ContentFile(CompletableGithubObject): - """This class represents ContentFiles. + """ + This class represents ContentFiles. The reference can be found here https://docs.github.com/en/rest/reference/repos#contents + """ def _initAttributes(self) -> None: diff --git a/github/DependabotAlert.py b/github/DependabotAlert.py index 622fdefc85..8fe7ccdfc1 100644 --- a/github/DependabotAlert.py +++ b/github/DependabotAlert.py @@ -40,10 +40,12 @@ class DependabotAlert(NonCompletableGithubObject): - """This class represents a DependabotAlert. + """ + This class represents a DependabotAlert. The reference can be found here https://docs.github.com/en/rest/dependabot/alerts + """ def _initAttributes(self) -> None: diff --git a/github/DependabotAlertAdvisory.py b/github/DependabotAlertAdvisory.py index e5a0f16b09..306f9c252e 100644 --- a/github/DependabotAlertAdvisory.py +++ b/github/DependabotAlertAdvisory.py @@ -33,11 +33,12 @@ class DependabotAlertAdvisory(github.AdvisoryBase.AdvisoryBase): - """This class represents a package flagged by a Dependabot alert that is - vulnerable to a parent SecurityAdvisory. + """ + This class represents a package flagged by a Dependabot alert that is vulnerable to a parent SecurityAdvisory. The reference can be found here https://docs.github.com/en/rest/dependabot/alerts + """ def _initAttributes(self) -> None: diff --git a/github/DependabotAlertDependency.py b/github/DependabotAlertDependency.py index 1ed2f72788..fe31144807 100644 --- a/github/DependabotAlertDependency.py +++ b/github/DependabotAlertDependency.py @@ -29,10 +29,12 @@ class DependabotAlertDependency(NonCompletableGithubObject): - """This class represents a DependabotAlertDependency. + """ + This class represents a DependabotAlertDependency. The reference can be found here https://docs.github.com/en/rest/dependabot/alerts + """ def _initAttributes(self) -> None: diff --git a/github/DependabotAlertVulnerability.py b/github/DependabotAlertVulnerability.py index 5d950a99a8..b5ba5731b6 100644 --- a/github/DependabotAlertVulnerability.py +++ b/github/DependabotAlertVulnerability.py @@ -32,7 +32,9 @@ class DependabotAlertVulnerability(NonCompletableGithubObject): - """A vulnerability represented in a Dependabot alert.""" + """ + A vulnerability represented in a Dependabot alert. + """ def _initAttributes(self) -> None: self._package: Attribute[AdvisoryVulnerabilityPackage] = NotSet diff --git a/github/Deployment.py b/github/Deployment.py index c436c408f6..bf6231ea8a 100644 --- a/github/Deployment.py +++ b/github/Deployment.py @@ -53,10 +53,12 @@ class Deployment(CompletableGithubObject): - """This class represents Deployments. + """ + This class represents Deployments. The reference can be found here https://docs.github.com/en/rest/reference/repos#deployments + """ def _initAttributes(self) -> None: diff --git a/github/DeploymentStatus.py b/github/DeploymentStatus.py index 4b40c136cc..d258265cf7 100644 --- a/github/DeploymentStatus.py +++ b/github/DeploymentStatus.py @@ -49,10 +49,12 @@ class DeploymentStatus(CompletableGithubObject): - """This class represents Deployment Statuses. + """ + This class represents Deployment Statuses. The reference can be found here https://docs.github.com/en/rest/reference/repos#deployments + """ def _initAttributes(self) -> None: diff --git a/github/Download.py b/github/Download.py index 2d62df8ab8..13e83c6f41 100644 --- a/github/Download.py +++ b/github/Download.py @@ -43,10 +43,12 @@ class Download(CompletableGithubObject): - """This class represents Downloads. + """ + This class represents Downloads. The reference can be found here https://docs.github.com/en/rest/reference/repos + """ def _initAttributes(self) -> None: diff --git a/github/Enterprise.py b/github/Enterprise.py index 03bc8393a7..7f0043c43d 100644 --- a/github/Enterprise.py +++ b/github/Enterprise.py @@ -44,12 +44,13 @@ class Enterprise(NonCompletableGithubObject): - """This class represents Enterprises. + """ + This class represents Enterprises. - Such objects do not exist in the Github API, so this class merely - collects all endpoints the start with /enterprises/{enterprise}/. - See methods below for specific endpoints and docs. + Such objects do not exist in the Github API, so this class merely collects all endpoints the start with + /enterprises/{enterprise}/. See methods below for specific endpoints and docs. https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin?apiVersion=2022-11-28 + """ def __init__( diff --git a/github/EnterpriseConsumedLicenses.py b/github/EnterpriseConsumedLicenses.py index 9f86d49ff5..06a88b9bd5 100644 --- a/github/EnterpriseConsumedLicenses.py +++ b/github/EnterpriseConsumedLicenses.py @@ -44,10 +44,12 @@ class EnterpriseConsumedLicenses(CompletableGithubObject): - """This class represents license consumed by enterprises. + """ + This class represents license consumed by enterprises. The reference can be found here https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/license#list-enterprise-consumed-licenses + """ def _initAttributes(self) -> None: diff --git a/github/Environment.py b/github/Environment.py index 343b8c6a23..9599838d6b 100644 --- a/github/Environment.py +++ b/github/Environment.py @@ -56,10 +56,12 @@ class Environment(CompletableGithubObject): - """This class represents Environment. + """ + This class represents Environment. The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments + """ def _initAttributes(self) -> None: @@ -172,7 +174,9 @@ def create_secret(self, secret_name: str, unencrypted_value: str) -> Secret: ) def get_secrets(self) -> PaginatedList[Secret]: - """Gets all repository secrets.""" + """ + Gets all repository secrets. + """ return PaginatedList( Secret, self._requester, @@ -217,8 +221,9 @@ def create_variable(self, variable_name: str, value: str) -> Variable: ) def get_variables(self) -> PaginatedList[Variable]: - """Gets all repository variables :rtype: :class:`PaginatedList` of - :class:`Variable`""" + """ + Gets all repository variables :rtype: :class:`PaginatedList` of :class:`Variable` + """ return PaginatedList( Variable, self._requester, diff --git a/github/EnvironmentDeploymentBranchPolicy.py b/github/EnvironmentDeploymentBranchPolicy.py index da814105ad..8c5b2b1f73 100644 --- a/github/EnvironmentDeploymentBranchPolicy.py +++ b/github/EnvironmentDeploymentBranchPolicy.py @@ -29,10 +29,12 @@ class EnvironmentDeploymentBranchPolicy(NonCompletableGithubObject): - """This class represents a deployment branch policy for an environment. + """ + This class represents a deployment branch policy for an environment. The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments + """ def _initAttributes(self) -> None: @@ -58,8 +60,9 @@ def _useAttributes(self, attributes: Dict[str, Any]) -> None: class EnvironmentDeploymentBranchPolicyParams: - """This class presents the deployment branch policy parameters as can be - configured for an Environment.""" + """ + This class presents the deployment branch policy parameters as can be configured for an Environment. + """ def __init__(self, protected_branches: bool = False, custom_branch_policies: bool = False): assert isinstance(protected_branches, bool) diff --git a/github/EnvironmentProtectionRule.py b/github/EnvironmentProtectionRule.py index c893b5854d..59f62fde4b 100644 --- a/github/EnvironmentProtectionRule.py +++ b/github/EnvironmentProtectionRule.py @@ -49,10 +49,12 @@ class EnvironmentProtectionRule(NonCompletableGithubObject): - """This class represents a protection rule for an environment. + """ + This class represents a protection rule for an environment. The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments + """ def _initAttributes(self) -> None: diff --git a/github/EnvironmentProtectionRuleReviewer.py b/github/EnvironmentProtectionRuleReviewer.py index 30d38d84cc..fbac7f5beb 100644 --- a/github/EnvironmentProtectionRuleReviewer.py +++ b/github/EnvironmentProtectionRuleReviewer.py @@ -46,10 +46,12 @@ class EnvironmentProtectionRuleReviewer(NonCompletableGithubObject): - """This class represents a reviewer for an EnvironmentProtectionRule. + """ + This class represents a reviewer for an EnvironmentProtectionRule. The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments + """ def _initAttributes(self) -> None: @@ -79,8 +81,9 @@ def _useAttributes(self, attributes: dict[str, Any]) -> None: class ReviewerParams: - """This class presents reviewers as can be configured for an - Environment.""" + """ + This class presents reviewers as can be configured for an Environment. + """ def __init__(self, type_: str, id_: int): assert isinstance(type_, str) and type_ in ("User", "Team") diff --git a/github/Event.py b/github/Event.py index c1654e113e..90c37c882f 100644 --- a/github/Event.py +++ b/github/Event.py @@ -48,10 +48,12 @@ class Event(NonCompletableGithubObject): - """This class represents Events. + """ + This class represents Events. The reference can be found here https://docs.github.com/en/rest/reference/activity#events + """ def _initAttributes(self) -> None: diff --git a/github/File.py b/github/File.py index 7f33da65cd..23e17507c7 100644 --- a/github/File.py +++ b/github/File.py @@ -42,7 +42,9 @@ class File(NonCompletableGithubObject): - """This class represents Files.""" + """ + This class represents Files. + """ def _initAttributes(self) -> None: self._additions: Attribute[int] = NotSet diff --git a/github/Gist.py b/github/Gist.py index 2817fbdd3a..d5a7a12322 100644 --- a/github/Gist.py +++ b/github/Gist.py @@ -61,10 +61,12 @@ class Gist(CompletableGithubObject): - """This class represents Gists. + """ + This class represents Gists. The reference can be found here https://docs.github.com/en/rest/reference/gists + """ def _initAttributes(self) -> None: diff --git a/github/GistComment.py b/github/GistComment.py index b4999352d5..a57b73f322 100644 --- a/github/GistComment.py +++ b/github/GistComment.py @@ -47,10 +47,12 @@ class GistComment(CompletableGithubObject): - """This class represents GistComments. + """ + This class represents GistComments. The reference can be found here https://docs.github.com/en/rest/reference/gists#comments + """ def _initAttributes(self) -> None: diff --git a/github/GistFile.py b/github/GistFile.py index ea8840bd40..731c6a7abf 100644 --- a/github/GistFile.py +++ b/github/GistFile.py @@ -39,7 +39,9 @@ class GistFile(NonCompletableGithubObject): - """This class represents GistFiles.""" + """ + This class represents GistFiles. + """ def _initAttributes(self) -> None: self._content: Attribute[str] = NotSet diff --git a/github/GistHistoryState.py b/github/GistHistoryState.py index 9e8766afff..83c5dab305 100644 --- a/github/GistHistoryState.py +++ b/github/GistHistoryState.py @@ -47,7 +47,9 @@ class GistHistoryState(CompletableGithubObject): - """This class represents GistHistoryStates.""" + """ + This class represents GistHistoryStates. + """ def _initAttributes(self) -> None: self._change_status: Attribute[github.CommitStats.CommitStats] = NotSet diff --git a/github/GitAuthor.py b/github/GitAuthor.py index 66b49c578c..764e328e47 100644 --- a/github/GitAuthor.py +++ b/github/GitAuthor.py @@ -40,7 +40,9 @@ class GitAuthor(NonCompletableGithubObject): - """This class represents GitAuthors.""" + """ + This class represents GitAuthors. + """ def _initAttributes(self) -> None: self._name: Attribute[str] = NotSet diff --git a/github/GitBlob.py b/github/GitBlob.py index 861864e287..c7efc781cc 100644 --- a/github/GitBlob.py +++ b/github/GitBlob.py @@ -40,10 +40,12 @@ class GitBlob(CompletableGithubObject): - """This class represents GitBlobs. + """ + This class represents GitBlobs. The reference can be found here https://docs.github.com/en/rest/reference/git#blobs + """ def _initAttributes(self) -> None: diff --git a/github/GitCommit.py b/github/GitCommit.py index c5809bb507..e24c9840f8 100644 --- a/github/GitCommit.py +++ b/github/GitCommit.py @@ -46,10 +46,12 @@ class GitCommit(CompletableGithubObject): - """This class represents GitCommits. + """ + This class represents GitCommits. The reference can be found here https://docs.github.com/en/rest/reference/git#commits + """ def _initAttributes(self) -> None: diff --git a/github/GitObject.py b/github/GitObject.py index 05ca441c62..76830ea745 100644 --- a/github/GitObject.py +++ b/github/GitObject.py @@ -39,7 +39,9 @@ class GitObject(NonCompletableGithubObject): - """This class represents GitObjects.""" + """ + This class represents GitObjects. + """ def _initAttributes(self) -> None: self._sha: Attribute[str] = NotSet diff --git a/github/GitRef.py b/github/GitRef.py index 12bbed3916..3ee1deb9d2 100644 --- a/github/GitRef.py +++ b/github/GitRef.py @@ -49,10 +49,12 @@ class GitRef(CompletableGithubObject): - """This class represents GitRefs. + """ + This class represents GitRefs. The reference can be found here https://docs.github.com/en/rest/reference/git#references + """ def _initAttributes(self) -> None: diff --git a/github/GitRelease.py b/github/GitRelease.py index 5abb1a0a51..f8d6ed6acb 100644 --- a/github/GitRelease.py +++ b/github/GitRelease.py @@ -67,10 +67,12 @@ class GitRelease(CompletableGithubObject): - """This class represents GitReleases. + """ + This class represents GitReleases. The reference can be found here https://docs.github.com/en/rest/reference/repos#releases + """ def _initAttributes(self) -> None: @@ -252,13 +254,15 @@ def upload_asset_from_memory( content_type: Opt[str] = NotSet, label: str = "", ) -> github.GitReleaseAsset.GitReleaseAsset: - """Uploads an asset. + """ + 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:///repos/{owner}/{repo}/releases/{release_id}/assets `_ :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`` + """ assert isinstance(name, str), name assert isinstance(file_size, int), file_size diff --git a/github/GitReleaseAsset.py b/github/GitReleaseAsset.py index 74a5637e31..0a512585b4 100644 --- a/github/GitReleaseAsset.py +++ b/github/GitReleaseAsset.py @@ -47,10 +47,12 @@ class GitReleaseAsset(CompletableGithubObject): - """This class represents GitReleaseAssets. + """ + This class represents GitReleaseAssets. The reference can be found here https://docs.github.com/en/rest/reference/repos#releases + """ def _initAttributes(self) -> None: @@ -131,12 +133,16 @@ def uploader(self) -> github.NamedUser.NamedUser: return self._uploader.value def delete_asset(self) -> bool: - """Delete asset from the release.""" + """ + Delete asset from the release. + """ headers, data = self._requester.requestJsonAndCheck("DELETE", self.url) return True def update_asset(self, name: str, label: str = "") -> GitReleaseAsset: - """Update asset metadata.""" + """ + Update asset metadata. + """ assert isinstance(name, str), name assert isinstance(label, str), label post_parameters = {"name": name, "label": label} diff --git a/github/GitTag.py b/github/GitTag.py index dd432d41da..70dfc345db 100644 --- a/github/GitTag.py +++ b/github/GitTag.py @@ -51,10 +51,12 @@ class GitTag(CompletableGithubObject): - """This class represents GitTags. + """ + This class represents GitTags. The reference can be found here https://docs.github.com/en/rest/reference/git#tags + """ def _initAttributes(self) -> None: diff --git a/github/GitTree.py b/github/GitTree.py index ffdbdd2516..c41f8ebfec 100644 --- a/github/GitTree.py +++ b/github/GitTree.py @@ -47,10 +47,12 @@ class GitTree(CompletableGithubObject): - """This class represents GitTrees. + """ + This class represents GitTrees. The reference can be found here https://docs.github.com/en/rest/reference/git#trees + """ def _initAttributes(self) -> None: diff --git a/github/GitTreeElement.py b/github/GitTreeElement.py index 69236a830b..9b73922ad2 100644 --- a/github/GitTreeElement.py +++ b/github/GitTreeElement.py @@ -39,7 +39,9 @@ class GitTreeElement(NonCompletableGithubObject): - """This class represents GitTreeElements.""" + """ + This class represents GitTreeElements. + """ def _initAttributes(self) -> None: self._mode: Attribute[str] = NotSet diff --git a/github/GithubApp.py b/github/GithubApp.py index 86ae686351..159a2a558b 100644 --- a/github/GithubApp.py +++ b/github/GithubApp.py @@ -50,10 +50,12 @@ class GithubApp(CompletableGithubObject): - """This class represents github apps. + """ + This class represents github apps. The reference can be found here https://docs.github.com/en/rest/reference/apps + """ def _initAttributes(self) -> None: diff --git a/github/GithubException.py b/github/GithubException.py index afb43c9f2b..a043718693 100644 --- a/github/GithubException.py +++ b/github/GithubException.py @@ -40,12 +40,12 @@ class GithubException(Exception): - """Error handling in PyGithub is done with exceptions. This class is the - base of all exceptions raised by PyGithub (but - :class:`github.GithubException.BadAttributeException`). + """ + Error handling in PyGithub is done with exceptions. This class is the base of all exceptions raised by PyGithub + (but :class:`github.GithubException.BadAttributeException`). + + Some other types of exceptions might be raised by underlying libraries, for example for network-related issues. - Some other types of exceptions might be raised by underlying - libraries, for example for network-related issues. """ def __init__( @@ -68,17 +68,23 @@ def message(self) -> Optional[str]: @property def status(self) -> int: - """The status returned by the Github API.""" + """ + The status returned by the Github API. + """ return self.__status @property def data(self) -> Any: - """The (decoded) data returned by the Github API.""" + """ + The (decoded) data returned by the Github API. + """ return self.__data @property def headers(self) -> Optional[Dict[str, str]]: - """The headers returned by the Github API.""" + """ + The headers returned by the Github API. + """ return self.__headers def __repr__(self) -> str: @@ -97,28 +103,35 @@ def __str__(self) -> str: class BadCredentialsException(GithubException): - """Exception raised in case of bad credentials (when Github API replies - with a 401 or 403 HTML status)""" + """ + Exception raised in case of bad credentials (when Github API replies with a 401 or 403 HTML status) + """ class UnknownObjectException(GithubException): - """Exception raised when a non-existing object is requested (when Github - API replies with a 404 HTML status)""" + """ + Exception raised when a non-existing object is requested (when Github API replies with a 404 HTML status) + """ class BadUserAgentException(GithubException): - """Exception raised when request is sent with a bad user agent header (when - Github API replies with a 403 bad user agent HTML status)""" + """ + Exception raised when request is sent with a bad user agent header (when Github API replies with a 403 bad user + agent HTML status) + """ class RateLimitExceededException(GithubException): - """Exception raised when the rate limit is exceeded (when Github API - replies with a 403 rate limit exceeded HTML status)""" + """ + Exception raised when the rate limit is exceeded (when Github API replies with a 403 rate limit exceeded HTML + status) + """ class BadAttributeException(Exception): - """Exception raised when Github returns an attribute with the wrong - type.""" + """ + Exception raised when Github returns an attribute with the wrong type. + """ def __init__( self, @@ -137,7 +150,9 @@ def __init__( @property def actual_value(self) -> Any: - """The value returned by Github.""" + """ + The value returned by Github. + """ return self.__actualValue @property @@ -149,20 +164,26 @@ def expected_type( Dict[Tuple[Type[str], Type[str]], Type[dict]], List[Tuple[Type[str], Type[str]]], ]: - """The type PyGithub expected.""" + """ + The type PyGithub expected. + """ return self.__expectedType @property def transformation_exception(self) -> Optional[Exception]: - """The exception raised when PyGithub tried to parse the value.""" + """ + The exception raised when PyGithub tried to parse the value. + """ return self.__transformationException class TwoFactorException(GithubException): - """Exception raised when Github requires a onetime password for two-factor - authentication.""" + """ + Exception raised when Github requires a onetime password for two-factor authentication. + """ class IncompletableObject(GithubException): - """Exception raised when we can not request an object from Github because - the data returned did not include a URL.""" + """ + Exception raised when we can not request an object from Github because the data returned did not include a URL. + """ diff --git a/github/GithubIntegration.py b/github/GithubIntegration.py index c0176ab4a5..011135bc37 100644 --- a/github/GithubIntegration.py +++ b/github/GithubIntegration.py @@ -48,7 +48,9 @@ class GithubIntegration: - """Main class to obtain tokens for a GitHub integration.""" + """ + Main class to obtain tokens for a GitHub integration. + """ # keep non-deprecated arguments in-sync with Requester # v3: remove integration_id, private_key, jwt_expiry, jwt_issued_at and jwt_algorithm @@ -179,13 +181,17 @@ def get_github_for_installation( return github.Github(**self.__requester.withAuth(auth).kwargs) def _get_headers(self) -> dict[str, str]: - """Get headers for the requests.""" + """ + Get headers for the requests. + """ return { "Accept": Consts.mediaTypeIntegrationPreview, } def _get_installed_app(self, url: str) -> Installation: - """Get installation for the given URL.""" + """ + Get installation for the given URL. + """ headers, response = self.__requester.requestJsonAndCheck("GET", url, headers=self._get_headers()) return Installation( @@ -234,10 +240,12 @@ def get_access_token( @deprecated.deprecated("Use get_repo_installation") def get_installation(self, owner: str, repo: str) -> Installation: - """Deprecated by get_repo_installation. + """ + Deprecated by get_repo_installation. :calls: `GET /repos/{owner}/{repo}/installation ` + """ owner = urllib.parse.quote(owner) repo = urllib.parse.quote(repo) diff --git a/github/GithubObject.py b/github/GithubObject.py index 76bc4dbef1..7d89574bb5 100644 --- a/github/GithubObject.py +++ b/github/GithubObject.py @@ -73,9 +73,11 @@ def value(self) -> T_co: def _datetime_from_http_date(value: str) -> datetime: - """Convert an HTTP date to a datetime object. + """ + Convert an HTTP date to a datetime object. Raises ValueError for invalid dates. + """ dt = email.utils.parsedate_to_datetime(value) @@ -86,9 +88,11 @@ def _datetime_from_http_date(value: str) -> datetime: def _datetime_from_github_isoformat(value: str) -> datetime: - """Convert an GitHub API timestamps to a datetime object. + """ + Convert an GitHub API timestamps to a datetime object. Raises ValueError for invalid timestamps. + """ # Github always returns YYYY-MM-DDTHH:MM:SSZ, so we can use the stdlib parser @@ -156,7 +160,9 @@ def value(self) -> Any: # v3: add * to edit function of all GithubObject implementations, # this allows to rename attributes and maintain the order of attributes class GithubObject: - """Base class for all classes representing objects returned by the API.""" + """ + Base class for all classes representing objects returned by the API. + """ """ A global debug flag to enable header validation by requester for all objects @@ -351,7 +357,9 @@ def last_modified_datetime(self) -> Optional[datetime]: return self._makeHttpDatetimeAttribute(self.last_modified).value # type: ignore def get__repr__(self, params: Dict[str, Any]) -> str: - """Converts the object to a nicely printable string.""" + """ + Converts the object to a nicely printable string. + """ def format_params(params: Dict[str, Any]) -> typing.Generator[str, None, None]: items = list(params.items()) @@ -418,8 +426,10 @@ def __complete(self) -> None: self.__completed = True def update(self, additional_headers: Optional[Dict[str, Any]] = None) -> bool: - """Check and update the object with conditional request :rtype: Boolean - value indicating whether the object is changed.""" + """ + Check and update the object with conditional request :rtype: Boolean value indicating whether the object is + changed. + """ conditionalRequestHeader = dict() if self.etag is not None: conditionalRequestHeader[Consts.REQ_IF_NONE_MATCH] = self.etag diff --git a/github/GithubRetry.py b/github/GithubRetry.py index 1d6d3ff2b4..9790db95e9 100644 --- a/github/GithubRetry.py +++ b/github/GithubRetry.py @@ -46,7 +46,8 @@ class GithubRetry(Retry): - """A Github-specific implementation of `urllib3.Retry` + """ + A Github-specific implementation of `urllib3.Retry` This retries 403 responses if they are retry-able. Github requests are retry-able when the response provides a `"Retry-After"` header, or the content indicates a rate limit error. @@ -56,6 +57,7 @@ class GithubRetry(Retry): By default, all methods defined in `Retry.DEFAULT_ALLOWED_METHODS` are retried, plus GET and POST. This can be configured via the `allowed_methods` argument. + """ __logger: Optional[Logger] = None diff --git a/github/GitignoreTemplate.py b/github/GitignoreTemplate.py index 5bbe35a30a..b8bc0c41e5 100644 --- a/github/GitignoreTemplate.py +++ b/github/GitignoreTemplate.py @@ -40,10 +40,12 @@ class GitignoreTemplate(NonCompletableGithubObject): - """This class represents GitignoreTemplates. + """ + This class represents GitignoreTemplates. The reference can be found here https://docs.github.com/en/rest/reference/gitignore + """ def _initAttributes(self) -> None: diff --git a/github/GlobalAdvisory.py b/github/GlobalAdvisory.py index 0654e8ccfa..7f51d00d66 100644 --- a/github/GlobalAdvisory.py +++ b/github/GlobalAdvisory.py @@ -34,9 +34,11 @@ class GlobalAdvisory(AdvisoryBase): - """This class represents a GlobalAdvisory. + """ + This class represents a GlobalAdvisory. https://docs.github.com/en/rest/security-advisories/global-advisories + """ def _initAttributes(self) -> None: diff --git a/github/Hook.py b/github/Hook.py index 6f5b2d402c..c169e39a6f 100644 --- a/github/Hook.py +++ b/github/Hook.py @@ -48,10 +48,12 @@ class Hook(CompletableGithubObject): - """This class represents Hooks. + """ + This class represents Hooks. The reference can be found here https://docs.github.com/en/rest/reference/repos#webhooks + """ def _initAttributes(self) -> None: diff --git a/github/HookDelivery.py b/github/HookDelivery.py index 837791d0cb..0a2f1201ba 100644 --- a/github/HookDelivery.py +++ b/github/HookDelivery.py @@ -31,7 +31,9 @@ class HookDeliverySummary(github.GithubObject.NonCompletableGithubObject): - """This class represents a Summary of HookDeliveries.""" + """ + This class represents a Summary of HookDeliveries. + """ def _initAttributes(self) -> None: self._id: Attribute[int] = NotSet @@ -126,7 +128,9 @@ def _useAttributes(self, attributes: Dict[str, Any]) -> None: class HookDeliveryRequest(github.GithubObject.NonCompletableGithubObject): - """This class represents a HookDeliveryRequest.""" + """ + This class represents a HookDeliveryRequest. + """ def _initAttributes(self) -> None: self._request_headers: Attribute[Dict] = NotSet @@ -151,7 +155,9 @@ def _useAttributes(self, attributes: Dict[str, Any]) -> None: class HookDeliveryResponse(github.GithubObject.NonCompletableGithubObject): - """This class represents a HookDeliveryResponse.""" + """ + This class represents a HookDeliveryResponse. + """ def __repr__(self) -> str: return self.get__repr__({"payload": self._payload.value}) @@ -176,7 +182,9 @@ def _useAttributes(self, attributes: Dict[str, Any]) -> None: class HookDelivery(HookDeliverySummary): - """This class represents a HookDelivery.""" + """ + This class represents a HookDelivery. + """ def _initAttributes(self) -> None: super()._initAttributes() diff --git a/github/HookDescription.py b/github/HookDescription.py index 400c73ec6d..f0d3124c0e 100644 --- a/github/HookDescription.py +++ b/github/HookDescription.py @@ -42,7 +42,9 @@ class HookDescription(NonCompletableGithubObject): - """This class represents HookDescriptions.""" + """ + This class represents HookDescriptions. + """ def _initAttributes(self) -> None: self._events: Attribute[list[str]] = NotSet diff --git a/github/HookResponse.py b/github/HookResponse.py index c1972a45fa..a52be69f52 100644 --- a/github/HookResponse.py +++ b/github/HookResponse.py @@ -39,7 +39,9 @@ class HookResponse(NonCompletableGithubObject): - """This class represents HookResponses.""" + """ + This class represents HookResponses. + """ def _initAttributes(self) -> None: self._code: Attribute[int] = NotSet diff --git a/github/InputFileContent.py b/github/InputFileContent.py index 174d8e2ceb..7a216c3525 100644 --- a/github/InputFileContent.py +++ b/github/InputFileContent.py @@ -40,7 +40,9 @@ class InputFileContent: - """This class represents InputFileContents.""" + """ + This class represents InputFileContents. + """ def __init__(self, content: str, new_name: Opt[str] = NotSet): assert isinstance(content, str), content diff --git a/github/InputGitAuthor.py b/github/InputGitAuthor.py index 8f87f1a86f..a65ce5dd25 100644 --- a/github/InputGitAuthor.py +++ b/github/InputGitAuthor.py @@ -41,7 +41,9 @@ class InputGitAuthor: - """This class represents InputGitAuthors.""" + """ + This class represents InputGitAuthors. + """ def __init__(self, name: str, email: str, date: Opt[str] = NotSet): assert isinstance(name, str), name diff --git a/github/InputGitTreeElement.py b/github/InputGitTreeElement.py index 8df9ec7bd0..29626f753a 100644 --- a/github/InputGitTreeElement.py +++ b/github/InputGitTreeElement.py @@ -39,7 +39,9 @@ class InputGitTreeElement: - """This class represents InputGitTreeElements.""" + """ + This class represents InputGitTreeElements. + """ def __init__( self, diff --git a/github/Installation.py b/github/Installation.py index 37b66f6af2..d5401e574f 100644 --- a/github/Installation.py +++ b/github/Installation.py @@ -66,10 +66,12 @@ class Installation(NonCompletableGithubObject): - """This class represents Installations. + """ + This class represents Installations. The reference can be found here https://docs.github.com/en/rest/reference/apps#installations + """ def __init__( diff --git a/github/InstallationAuthorization.py b/github/InstallationAuthorization.py index 0acc3e16a7..85839f6e86 100644 --- a/github/InstallationAuthorization.py +++ b/github/InstallationAuthorization.py @@ -50,7 +50,9 @@ class InstallationAuthorization(NonCompletableGithubObject): - """This class represents InstallationAuthorizations.""" + """ + This class represents InstallationAuthorizations. + """ def _initAttributes(self) -> None: self._token: Attribute[str] = NotSet diff --git a/github/Invitation.py b/github/Invitation.py index b4f497dbc2..c54f0c66d5 100644 --- a/github/Invitation.py +++ b/github/Invitation.py @@ -52,10 +52,12 @@ class Invitation(CompletableGithubObject): - """This class represents repository invitations. + """ + This class represents repository invitations. The reference can be found here https://docs.github.com/en/rest/reference/repos#invitations + """ def _initAttributes(self) -> None: diff --git a/github/Issue.py b/github/Issue.py index 8db88fbace..b89f18db03 100644 --- a/github/Issue.py +++ b/github/Issue.py @@ -99,10 +99,12 @@ class Issue(CompletableGithubObject): - """This class represents Issues. + """ + This class represents Issues. The reference can be found here https://docs.github.com/en/rest/reference/issues + """ def _initAttributes(self) -> None: diff --git a/github/IssueComment.py b/github/IssueComment.py index 0ee0792e4e..b8d42524a3 100644 --- a/github/IssueComment.py +++ b/github/IssueComment.py @@ -57,10 +57,12 @@ class IssueComment(CompletableGithubObject): - """This class represents IssueComments. + """ + This class represents IssueComments. The reference can be found here https://docs.github.com/en/rest/reference/issues#comments + """ def _initAttributes(self) -> None: diff --git a/github/IssueEvent.py b/github/IssueEvent.py index 343e2245f6..36fb9d9f27 100644 --- a/github/IssueEvent.py +++ b/github/IssueEvent.py @@ -51,10 +51,12 @@ class IssueEvent(CompletableGithubObject): - """This class represents IssueEvents. + """ + This class represents IssueEvents. The reference can be found here https://docs.github.com/en/rest/reference/issues#events + """ def _initAttributes(self) -> None: diff --git a/github/IssuePullRequest.py b/github/IssuePullRequest.py index cf156ad25e..4d59bdbe4f 100644 --- a/github/IssuePullRequest.py +++ b/github/IssuePullRequest.py @@ -39,7 +39,9 @@ class IssuePullRequest(NonCompletableGithubObject): - """This class represents IssuePullRequests.""" + """ + This class represents IssuePullRequests. + """ def _initAttributes(self) -> None: self._diff_url: Attribute[str] = NotSet diff --git a/github/Label.py b/github/Label.py index 85f87b548a..7b5b6d1b58 100644 --- a/github/Label.py +++ b/github/Label.py @@ -46,10 +46,12 @@ class Label(CompletableGithubObject): - """This class represents Labels. + """ + This class represents Labels. The reference can be found here https://docs.github.com/en/rest/reference/issues#labels + """ def _initAttributes(self) -> None: diff --git a/github/License.py b/github/License.py index 2113ec1895..36bf673b7d 100644 --- a/github/License.py +++ b/github/License.py @@ -47,10 +47,12 @@ class License(CompletableGithubObject): - """This class represents Licenses. + """ + This class represents Licenses. The reference can be found here https://docs.github.com/en/rest/reference/licenses + """ def _initAttributes(self) -> None: diff --git a/github/MainClass.py b/github/MainClass.py index bb0eb1cb5b..37ed51c662 100644 --- a/github/MainClass.py +++ b/github/MainClass.py @@ -147,9 +147,11 @@ class Github: - """This is the main class you instantiate to access the Github API v3. + """ + This is the main class you instantiate to access the Github API v3. Optional parameters allow different authentication methods. + """ __requester: Requester @@ -291,7 +293,9 @@ def per_page(self, value: int) -> None: # v3: Return an instance of a class: using a tuple did not allow to add a field "resettime" @property def rate_limiting(self) -> tuple[int, int]: - """First value is requests remaining, second value is request limit.""" + """ + First value is requests remaining, second value is request limit. + """ remaining, limit = self.__requester.rate_limiting if limit < 0: self.get_rate_limit() @@ -299,16 +303,20 @@ def rate_limiting(self) -> tuple[int, int]: @property def rate_limiting_resettime(self) -> int: - """Unix timestamp indicating when rate limiting will reset.""" + """ + Unix timestamp indicating when rate limiting will reset. + """ if self.__requester.rate_limiting_resettime == 0: self.get_rate_limit() return self.__requester.rate_limiting_resettime def get_rate_limit(self) -> RateLimit: - """Rate limit status for different resources (core/search/graphql). + """ + Rate limit status for different resources (core/search/graphql). :calls: `GET /rate_limit `_ + """ headers, data = self.__requester.requestJsonAndCheck("GET", "/rate_limit") return RateLimit(self.__requester, headers, data["resources"], True) @@ -917,14 +925,15 @@ def get_emojis(self) -> dict[str, str]: def create_from_raw_data( self, klass: type[TGithubObject], raw_data: dict[str, Any], headers: dict[str, str | int] | None = None ) -> TGithubObject: - """Creates an object from raw_data previously obtained by - :attr:`GithubObject.raw_data`, and optionally headers previously - obtained by :attr:`GithubObject.raw_headers`. + """ + Creates an object from raw_data previously obtained by :attr:`GithubObject.raw_data`, and optionally headers + previously obtained by :attr:`GithubObject.raw_headers`. :param klass: the class of the object to create :param raw_data: dict :param headers: dict :rtype: instance of class ``klass`` + """ if headers is None: headers = {} @@ -932,9 +941,9 @@ def create_from_raw_data( return klass(self.__requester, headers, raw_data, completed=True) def dump(self, obj: GithubObject, file: BinaryIO, protocol: int = 0) -> None: - """Dumps (pickles) a PyGithub object to a file-like object. Some effort - is made to not pickle sensitive information like the Github credentials - used in the :class:`Github` instance. But NO EFFORT is made to remove + """ + Dumps (pickles) a PyGithub object to a file-like object. Some effort is made to not pickle sensitive + information like the Github credentials used in the :class:`Github` instance. But NO EFFORT is made to remove sensitive information from the object's attributes. :param obj: the object to pickle :param file: the file-like object to pickle to :param protocol: the @@ -961,14 +970,17 @@ def dump(self, obj: GithubObject, file: BinaryIO, protocol: int = 0) -> None: :param file: the file-like object to pickle to :param protocol: the `pickling protocol `_ + """ pickle.dump((obj.__class__, obj.raw_data, obj.raw_headers), file, protocol) def load(self, f: BinaryIO) -> Any: - """Loads (unpickles) a PyGithub object from a file-like object. + """ + Loads (unpickles) a PyGithub object from a file-like object. :param f: the file-like object to unpickle from :return: the unpickled object + """ return self.create_from_raw_data(*pickle.load(f)) diff --git a/github/Membership.py b/github/Membership.py index 9e80f9d8e9..6ee475b930 100644 --- a/github/Membership.py +++ b/github/Membership.py @@ -53,10 +53,12 @@ class Membership(CompletableGithubObject): - """This class represents Membership of an organization. + """ + This class represents Membership of an organization. The reference can be found here https://docs.github.com/en/rest/reference/orgs + """ def _initAttributes(self) -> None: diff --git a/github/Migration.py b/github/Migration.py index 7f9a3f6c8a..833a8c68fe 100644 --- a/github/Migration.py +++ b/github/Migration.py @@ -56,10 +56,12 @@ class Migration(CompletableGithubObject): - """This class represents Migrations. + """ + This class represents Migrations. The reference can be found here https://docs.github.com/en/rest/reference/migrations + """ def _initAttributes(self) -> None: diff --git a/github/Milestone.py b/github/Milestone.py index 4189d4afa7..b90f6d4cd3 100644 --- a/github/Milestone.py +++ b/github/Milestone.py @@ -51,10 +51,12 @@ class Milestone(CompletableGithubObject): - """This class represents Milestones. + """ + This class represents Milestones. The reference can be found here https://docs.github.com/en/rest/reference/issues#milestones + """ def _initAttributes(self) -> None: diff --git a/github/NamedEnterpriseUser.py b/github/NamedEnterpriseUser.py index 518eb34cba..866c90b7c2 100644 --- a/github/NamedEnterpriseUser.py +++ b/github/NamedEnterpriseUser.py @@ -27,10 +27,12 @@ class NamedEnterpriseUser(CompletableGithubObject): - """This class represents NamedEnterpriseUsers. + """ + This class represents NamedEnterpriseUsers. The reference can be found here https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/license#list-enterprise-consumed-licenses + """ def _initAttributes(self) -> None: diff --git a/github/NamedUser.py b/github/NamedUser.py index ce2e23b5db..269f8c91ab 100644 --- a/github/NamedUser.py +++ b/github/NamedUser.py @@ -81,10 +81,12 @@ class NamedUser(github.GithubObject.CompletableGithubObject): - """This class represents NamedUsers. + """ + This class represents NamedUsers. The reference can be found here https://docs.github.com/en/rest/reference/users#get-a-user + """ def _initAttributes(self) -> None: diff --git a/github/Notification.py b/github/Notification.py index c455991506..2e881f2448 100644 --- a/github/Notification.py +++ b/github/Notification.py @@ -52,10 +52,12 @@ class Notification(CompletableGithubObject): - """This class represents Notifications. + """ + This class represents Notifications. The reference can be found here https://docs.github.com/en/rest/reference/activity#notifications + """ def _initAttributes(self) -> None: diff --git a/github/NotificationSubject.py b/github/NotificationSubject.py index 199a7d2afe..216a15d287 100644 --- a/github/NotificationSubject.py +++ b/github/NotificationSubject.py @@ -43,10 +43,12 @@ class NotificationSubject(NonCompletableGithubObject): - """This class represents Subjects of Notifications. + """ + This class represents Subjects of Notifications. The reference can be found here https://docs.github.com/en/rest/reference/activity#list-notifications-for-the-authenticated-user + """ def _initAttributes(self) -> None: diff --git a/github/Organization.py b/github/Organization.py index ff946a2d66..22d22ac991 100644 --- a/github/Organization.py +++ b/github/Organization.py @@ -124,10 +124,12 @@ class Organization(CompletableGithubObject): - """This class represents Organizations. + """ + This class represents Organizations. The reference can be found here https://docs.github.com/en/rest/reference/orgs + """ def _initAttributes(self) -> None: @@ -622,9 +624,12 @@ def create_secret( ) def get_secrets(self, secret_type: str = "actions") -> PaginatedList[OrganizationSecret]: - """Gets all organization secrets :param secret_type: string options - actions or dependabot :rtype: :class:`PaginatedList` of - :class:`github.OrganizationSecret.OrganizationSecret`""" + """ + Gets all organization secrets :param secret_type: string options actions or dependabot :rtype: + + :class:`PaginatedList` of :class:`github.OrganizationSecret.OrganizationSecret` + + """ assert secret_type in ["actions", "dependabot"], "secret_type should be actions or dependabot" return PaginatedList( github.OrganizationSecret.OrganizationSecret, @@ -745,8 +750,10 @@ def create_variable( ) def get_variables(self) -> PaginatedList[OrganizationVariable]: - """Gets all organization variables :rtype: :class:`PaginatedList` of - :class:`github.OrganizationVariable.OrganizationVariable`""" + """ + Gets all organization variables :rtype: :class:`PaginatedList` of + :class:`github.OrganizationVariable.OrganizationVariable` + """ return PaginatedList( github.OrganizationVariable.OrganizationVariable, self._requester, diff --git a/github/OrganizationDependabotAlert.py b/github/OrganizationDependabotAlert.py index e839c9c203..11717ca9d1 100644 --- a/github/OrganizationDependabotAlert.py +++ b/github/OrganizationDependabotAlert.py @@ -30,10 +30,12 @@ class OrganizationDependabotAlert(DependabotAlert): - """This class represents a Dependabot alert on an organization. + """ + This class represents a Dependabot alert on an organization. The reference can be found here https://docs.github.com/en/rest/dependabot/alerts#list-dependabot-alerts-for-an-organization + """ def _initAttributes(self) -> None: diff --git a/github/OrganizationSecret.py b/github/OrganizationSecret.py index d9bd18cbee..97e1173cf6 100644 --- a/github/OrganizationSecret.py +++ b/github/OrganizationSecret.py @@ -31,10 +31,12 @@ class OrganizationSecret(Secret): - """This class represents a org level GitHub secret. + """ + This class represents a org level GitHub secret. The reference can be found here https://docs.github.com/en/rest/actions/secrets + """ def _initAttributes(self) -> None: diff --git a/github/OrganizationVariable.py b/github/OrganizationVariable.py index 51b335d7db..dcee4d196d 100644 --- a/github/OrganizationVariable.py +++ b/github/OrganizationVariable.py @@ -31,10 +31,12 @@ class OrganizationVariable(Variable): - """This class represents a org level GitHub variable. + """ + This class represents a org level GitHub variable. The reference can be found here https://docs.github.com/en/rest/actions/variables + """ def _initAttributes(self) -> None: diff --git a/github/Path.py b/github/Path.py index e668851168..c75b4fd65b 100644 --- a/github/Path.py +++ b/github/Path.py @@ -41,10 +41,12 @@ class Path(NonCompletableGithubObject): - """This class represents a popular Path for a GitHub repository. + """ + This class represents a popular Path for a GitHub repository. The reference can be found here https://docs.github.com/en/rest/reference/repos#traffic + """ def _initAttributes(self) -> None: diff --git a/github/Permissions.py b/github/Permissions.py index 62065a24d7..cd5d61645b 100644 --- a/github/Permissions.py +++ b/github/Permissions.py @@ -40,7 +40,9 @@ class Permissions(NonCompletableGithubObject): - """This class represents Permissions.""" + """ + This class represents Permissions. + """ def _initAttributes(self) -> None: self._admin: Attribute[bool] = NotSet diff --git a/github/Plan.py b/github/Plan.py index 6c21986941..5c2b0f0e65 100644 --- a/github/Plan.py +++ b/github/Plan.py @@ -40,7 +40,9 @@ class Plan(NonCompletableGithubObject): - """This class represents Plans.""" + """ + This class represents Plans. + """ def _initAttributes(self) -> None: self._collaborators: Attribute[int] = NotSet diff --git a/github/Project.py b/github/Project.py index cbe0390559..eed150cd7f 100644 --- a/github/Project.py +++ b/github/Project.py @@ -56,10 +56,12 @@ class Project(CompletableGithubObject): - """This class represents Projects. + """ + This class represents Projects. The reference can be found here https://docs.github.com/en/rest/reference/projects + """ def _initAttributes(self) -> None: diff --git a/github/ProjectCard.py b/github/ProjectCard.py index 8979e466ad..6b0a8d0d64 100644 --- a/github/ProjectCard.py +++ b/github/ProjectCard.py @@ -61,10 +61,12 @@ class ProjectCard(CompletableGithubObject): - """This class represents Project Cards. + """ + This class represents Project Cards. The reference can be found here https://docs.github.com/en/rest/reference/projects#cards + """ def _initAttributes(self) -> None: diff --git a/github/ProjectColumn.py b/github/ProjectColumn.py index d59d0b1a47..a14a87ae44 100644 --- a/github/ProjectColumn.py +++ b/github/ProjectColumn.py @@ -59,10 +59,12 @@ class ProjectColumn(CompletableGithubObject): - """This class represents Project Columns. + """ + This class represents Project Columns. The reference can be found here https://docs.github.com/en/rest/reference/projects#columns + """ def _initAttributes(self) -> None: diff --git a/github/PublicKey.py b/github/PublicKey.py index d60e5c6c6d..e117199048 100644 --- a/github/PublicKey.py +++ b/github/PublicKey.py @@ -48,7 +48,9 @@ def encrypt(public_key: str, secret_value: str) -> str: - """Encrypt a Unicode string using the public key.""" + """ + Encrypt a Unicode string using the public key. + """ pk = public.PublicKey(public_key.encode("utf-8"), encoding.Base64Encoder) sealed_box = public.SealedBox(pk) encrypted = sealed_box.encrypt(secret_value.encode("utf-8")) @@ -56,13 +58,14 @@ def encrypt(public_key: str, secret_value: str) -> str: class PublicKey(CompletableGithubObject): - """This class represents either an organization public key or a repository - public key. + """ + This class represents either an organization public key or a repository public key. The reference can be found here https://docs.github.com/en/rest/reference/actions#get-an-organization-public-key or here https://docs.github.com/en/rest/reference/actions#get-a-repository-public-key + """ def _initAttributes(self) -> None: diff --git a/github/PullRequest.py b/github/PullRequest.py index 7b99d7d0ff..377be11fc4 100644 --- a/github/PullRequest.py +++ b/github/PullRequest.py @@ -113,10 +113,12 @@ class ReviewComment(TypedDict): class PullRequest(CompletableGithubObject): - """This class represents PullRequests. + """ + This class represents PullRequests. The reference can be found here https://docs.github.com/en/rest/reference/pulls + """ def _initAttributes(self) -> None: diff --git a/github/PullRequestComment.py b/github/PullRequestComment.py index df188d55b2..274c94ed02 100644 --- a/github/PullRequestComment.py +++ b/github/PullRequestComment.py @@ -56,10 +56,12 @@ class PullRequestComment(CompletableGithubObject): - """This class represents PullRequestComments. + """ + This class represents PullRequestComments. The reference can be found here https://docs.github.com/en/rest/reference/pulls#review-comments + """ def _initAttributes(self) -> None: diff --git a/github/PullRequestMergeStatus.py b/github/PullRequestMergeStatus.py index 0bec3f7446..2c0bc04830 100644 --- a/github/PullRequestMergeStatus.py +++ b/github/PullRequestMergeStatus.py @@ -42,10 +42,12 @@ class PullRequestMergeStatus(NonCompletableGithubObject): - """This class represents PullRequestMergeStatuses. + """ + This class represents PullRequestMergeStatuses. The reference can be found here https://docs.github.com/en/rest/reference/pulls#check-if-a-pull-request-has-been-merged + """ def _initAttributes(self) -> None: diff --git a/github/PullRequestPart.py b/github/PullRequestPart.py index b48574754d..49f5977803 100644 --- a/github/PullRequestPart.py +++ b/github/PullRequestPart.py @@ -48,7 +48,9 @@ class PullRequestPart(NonCompletableGithubObject): - """This class represents PullRequestParts.""" + """ + This class represents PullRequestParts. + """ def _initAttributes(self) -> None: self._label: Attribute[str] = NotSet diff --git a/github/PullRequestReview.py b/github/PullRequestReview.py index 3d9bd0c337..b1152f6a3c 100644 --- a/github/PullRequestReview.py +++ b/github/PullRequestReview.py @@ -51,10 +51,12 @@ class PullRequestReview(NonCompletableGithubObject): - """This class represents PullRequestReviews. + """ + This class represents PullRequestReviews. The reference can be found here https://docs.github.com/en/rest/reference/pulls#reviews + """ def _initAttributes(self) -> None: diff --git a/github/Rate.py b/github/Rate.py index db2e0e990b..24e7b588c8 100644 --- a/github/Rate.py +++ b/github/Rate.py @@ -43,10 +43,12 @@ class Rate(NonCompletableGithubObject): - """This class represents Rates. + """ + This class represents Rates. The reference can be found here https://docs.github.com/en/rest/reference/rate-limit + """ def _initAttributes(self) -> None: diff --git a/github/RateLimit.py b/github/RateLimit.py index bfc9ca474f..bfc26df2dd 100644 --- a/github/RateLimit.py +++ b/github/RateLimit.py @@ -47,10 +47,12 @@ class RateLimit(NonCompletableGithubObject): - """This class represents RateLimits. + """ + This class represents RateLimits. The reference can be found here https://docs.github.com/en/rest/reference/rate-limit + """ def _initAttributes(self) -> None: @@ -63,17 +65,23 @@ def __repr__(self) -> str: @property def core(self) -> Rate: - """Rate limit for the non-search-related API.""" + """ + Rate limit for the non-search-related API. + """ return self._core.value @property def search(self) -> Rate: - """Rate limit for the Search API.""" + """ + Rate limit for the Search API. + """ return self._search.value @property def graphql(self) -> Rate: - """(Experimental) Rate limit for GraphQL API, use with caution.""" + """ + (Experimental) Rate limit for GraphQL API, use with caution. + """ return self._graphql.value def _useAttributes(self, attributes: dict[str, Any]) -> None: diff --git a/github/Reaction.py b/github/Reaction.py index f22046fbb0..8dd608a327 100644 --- a/github/Reaction.py +++ b/github/Reaction.py @@ -52,10 +52,12 @@ class Reaction(CompletableGithubObject): - """This class represents Reactions. + """ + This class represents Reactions. The reference can be found here https://docs.github.com/en/rest/reference/reactions + """ def _initAttributes(self) -> None: diff --git a/github/Referrer.py b/github/Referrer.py index dba18de659..6ce6671b6d 100644 --- a/github/Referrer.py +++ b/github/Referrer.py @@ -41,10 +41,12 @@ class Referrer(NonCompletableGithubObject): - """This class represents a popylar Referrer for a GitHub repository. + """ + This class represents a popylar Referrer for a GitHub repository. The reference can be found here https://docs.github.com/en/rest/reference/repos#traffic + """ def _initAttributes(self) -> None: diff --git a/github/Repository.py b/github/Repository.py index c160c5d91f..f6cef1f06d 100644 --- a/github/Repository.py +++ b/github/Repository.py @@ -301,10 +301,12 @@ class Repository(CompletableGithubObject): - """This class represents Repositories. + """ + This class represents Repositories. The reference can be found here https://docs.github.com/en/rest/reference/repos + """ def __repr__(self) -> str: @@ -1227,8 +1229,8 @@ def create_git_tag_and_release( prerelease: bool = False, generate_release_notes: bool = False, ) -> GitRelease: - """Convenience function that calls :meth:`Repository.create_git_tag` - and :meth:`Repository.create_git_release`. + """ + Convenience function that calls :meth:`Repository.create_git_tag` and :meth:`Repository.create_git_release`. :param tag: string :param tag_message: string @@ -1241,6 +1243,7 @@ def create_git_tag_and_release( :param prerelease: bool :param generate_release_notes: bool :rtype: :class:`github.GitRelease.GitRelease` + """ self.create_git_tag(tag, tag_message, object, type, tagger) return self.create_git_release( @@ -1717,7 +1720,9 @@ def create_secret(self, secret_name: str, unencrypted_value: str) -> github.Secr ) def get_secrets(self) -> PaginatedList[github.Secret.Secret]: - """Gets all repository secrets.""" + """ + Gets all repository secrets. + """ return PaginatedList( github.Secret.Secret, self._requester, @@ -1763,8 +1768,9 @@ def create_variable(self, variable_name: str, value: str) -> github.Variable.Var ) def get_variables(self) -> PaginatedList[github.Variable.Variable]: - """Gets all repository variables :rtype: :class:`PaginatedList` of - :class:`github.Variable.Variable`""" + """ + Gets all repository variables :rtype: :class:`PaginatedList` of :class:`github.Variable.Variable` + """ return PaginatedList( github.Variable.Variable, self._requester, @@ -2348,26 +2354,23 @@ def create_file( committer: Opt[InputGitAuthor] = NotSet, author: Opt[InputGitAuthor] = NotSet, ) -> dict[str, ContentFile | Commit]: - """Create a file in this repository. + """ + Create a file in this repository. - :calls: `PUT /repos/{owner}/{repo}/contents/{path} - `_ - :param path: string, (required), path of the file in the - repository + :param path: string, (required), path of the file in the repository :param message: string, (required), commit message :param content: string, (required), the actual data in the file - :param branch: string, (optional), branch to create the commit - on. Defaults to the default branch of the repository - :param committer: InputGitAuthor, (optional), if no information - is given the authenticated user's information will be used. - You must specify both a name and email. - :param author: InputGitAuthor, (optional), if omitted this will - be filled in with committer information. If passed, you must - specify both a name and email. - :rtype: { 'content': :class:`ContentFile - `:, 'commit': :class:`Commit + :param branch: string, (optional), branch to create the commit on. Defaults to the default branch of the + repository + :param committer: InputGitAuthor, (optional), if no information is given the authenticated user's information + will be used. You must specify both a name and email. + :param author: InputGitAuthor, (optional), if omitted this will be filled in with committer information. If + passed, you must specify both a name and email. + :rtype: { 'content': :class:`ContentFile `:, 'commit': :class:`Commit `} + """ assert isinstance(path, str) assert isinstance(message, str) @@ -2433,28 +2436,23 @@ def update_file( committer: Opt[InputGitAuthor] = NotSet, author: Opt[InputGitAuthor] = NotSet, ) -> dict[str, ContentFile | Commit]: - """This method updates a file in a repository. + """ + This method updates a file in a repository. - :calls: `PUT /repos/{owner}/{repo}/contents/{path} - `_ :param path: string, Required. The content path. :param message: string, Required. The commit message. - :param content: string, Required. The updated file content, - either base64 encoded, or ready to be encoded. - :param sha: string, Required. The blob SHA of the file being - replaced. - :param branch: string. The branch name. Default: the - repository’s default branch (usually master) - :param committer: InputGitAuthor, (optional), if no information - is given the authenticated user's information will be used. - You must specify both a name and email. - :param author: InputGitAuthor, (optional), if omitted this will - be filled in with committer information. If passed, you must - specify both a name and email. - :rtype: { 'content': :class:`ContentFile - `:, 'commit': :class:`Commit + :param content: string, Required. The updated file content, either base64 encoded, or ready to be encoded. + :param sha: string, Required. The blob SHA of the file being replaced. + :param branch: string. The branch name. Default: the repository’s default branch (usually master) + :param committer: InputGitAuthor, (optional), if no information is given the authenticated user's information + will be used. You must specify both a name and email. + :param author: InputGitAuthor, (optional), if omitted this will be filled in with committer information. If + passed, you must specify both a name and email. + :rtype: { 'content': :class:`ContentFile `:, 'commit': :class:`Commit `} + """ assert isinstance(path, str) assert isinstance(message, str) @@ -2497,25 +2495,21 @@ def delete_file( committer: Opt[InputGitAuthor] = NotSet, author: Opt[InputGitAuthor] = NotSet, ) -> dict[str, Commit | _NotSetType]: - """This method deletes a file in a repository. + """ + This method deletes a file in a repository. - :calls: `DELETE /repos/{owner}/{repo}/contents/{path} - `_ :param path: string, Required. The content path. :param message: string, Required. The commit message. - :param sha: string, Required. The blob SHA of the file being - replaced. - :param branch: string. The branch name. Default: the - repository’s default branch (usually master) - :param committer: InputGitAuthor, (optional), if no information - is given the authenticated user's information will be used. - You must specify both a name and email. - :param author: InputGitAuthor, (optional), if omitted this will - be filled in with committer information. If passed, you must - specify both a name and email. - :rtype: { 'content': :class:`null `:, 'commit': - :class:`Commit `} + :param sha: string, Required. The blob SHA of the file being replaced. + :param branch: string. The branch name. Default: the repository’s default branch (usually master) + :param committer: InputGitAuthor, (optional), if no information is given the authenticated user's information + will be used. You must specify both a name and email. + :param author: InputGitAuthor, (optional), if omitted this will be filled in with committer information. If + passed, you must specify both a name and email. + :rtype: { 'content': :class:`null `:, 'commit': :class:`Commit `} + """ assert isinstance(path, str), "path must be str/unicode object" assert isinstance(message, str), "message must be str/unicode object" diff --git a/github/RepositoryAdvisory.py b/github/RepositoryAdvisory.py index 29b5f42891..09b55e8b97 100644 --- a/github/RepositoryAdvisory.py +++ b/github/RepositoryAdvisory.py @@ -43,10 +43,12 @@ class RepositoryAdvisory(AdvisoryBase): - """This class represents a RepositoryAdvisory. + """ + This class represents a RepositoryAdvisory. The reference can be found here https://docs.github.com/en/rest/security-advisories/repository-advisories + """ def _initAttributes(self) -> None: @@ -147,10 +149,12 @@ def offer_credit( login_or_user: str | github.NamedUser.NamedUser, credit_type: str, ) -> None: - """Offers credit to a user for a vulnerability in a repository. + """ + Offers credit to a user for a vulnerability in a repository. Unless you are giving credit to yourself, the user having credit offered will need to explicitly accept the credit. :calls: `PATCH /repos/{owner}/{repo}/security-advisories/:advisory_id ` + """ self.offer_credits([{"login": login_or_user, "type": credit_type}]) @@ -158,12 +162,13 @@ def offer_credits( self, credited: Iterable[Credit], ) -> None: - """Offers credit to a list of users for a vulnerability in a - repository. + """ + Offers credit to a list of users for a vulnerability in a repository. Unless you are giving credit to yourself, the user having credit offered will need to explicitly accept the credit. :calls: `PATCH /repos/{owner}/{repo}/security-advisories/:advisory_id ` :param credited: iterable of dict with keys "login" and "type" + """ assert isinstance(credited, Iterable), credited for credit in credited: @@ -275,10 +280,11 @@ def edit( return self def accept_report(self) -> None: - """Accepts the advisory reported from an external reporter via private - vulnerability reporting. + """ + Accepts the advisory reported from an external reporter via private vulnerability reporting. :calls: `PATCH /repos/{owner}/{repo}/security-advisories/:advisory_id ` + """ patch_parameters = {"state": "draft"} headers, data = self._requester.requestJsonAndCheck( @@ -289,9 +295,11 @@ def accept_report(self) -> None: self._useAttributes(data) def publish(self) -> None: - """Publishes the advisory. + """ + Publishes the advisory. :calls: `PATCH /repos/{owner}/{repo}/security-advisories/:advisory_id ` + """ patch_parameters = {"state": "published"} headers, data = self._requester.requestJsonAndCheck( @@ -302,9 +310,11 @@ def publish(self) -> None: self._useAttributes(data) def request_cve(self) -> None: - """Requests a CVE for the advisory. + """ + Requests a CVE for the advisory. :calls: `POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/cve `_ + """ self._requester.requestJsonAndCheck( "POST", @@ -312,9 +322,11 @@ def request_cve(self) -> None: ) def close(self) -> None: - """Closes the advisory. + """ + Closes the advisory. :calls: `PATCH /repos/{owner}/{repo}/security-advisories/:advisory_id ` + """ patch_parameters = {"state": "closed"} headers, data = self._requester.requestJsonAndCheck( diff --git a/github/RepositoryKey.py b/github/RepositoryKey.py index 616930d61a..ed690b7477 100644 --- a/github/RepositoryKey.py +++ b/github/RepositoryKey.py @@ -48,10 +48,12 @@ class RepositoryKey(CompletableGithubObject): - """This class represents RepositoryKeys. + """ + This class represents RepositoryKeys. The reference can be found here https://docs.github.com/en/rest/reference/repos#deploy-keys + """ def _initAttributes(self) -> None: diff --git a/github/RepositoryPreferences.py b/github/RepositoryPreferences.py index 8aed7a62ed..a76c689ec6 100644 --- a/github/RepositoryPreferences.py +++ b/github/RepositoryPreferences.py @@ -47,10 +47,12 @@ class RepositoryPreferences(NonCompletableGithubObject): - """This class represents repository preferences. + """ + This class represents repository preferences. The reference can be found here https://docs.github.com/en/free-pro-team@latest/rest/reference/checks#update-repository-preferences-for-check-suites + """ def _initAttributes(self) -> None: diff --git a/github/Requester.py b/github/Requester.py index f40c6afbb1..baa912e8b5 100644 --- a/github/Requester.py +++ b/github/Requester.py @@ -343,8 +343,9 @@ def NEW_DEBUG_FRAME(self, requestHeader: Dict[str, str]) -> None: self._frameCount = len(self._frameBuffer) - 1 def DEBUG_ON_RESPONSE(self, statusCode: int, responseHeader: Dict[str, Union[str, int]], data: str) -> None: - """Update current frame with response Current frame index will be - attached to responseHeader.""" + """ + Update current frame with response Current frame index will be attached to responseHeader. + """ if self.DEBUG_FLAG: # pragma no branch (Flag always set in tests) self._frameBuffer[self._frameCount][1:4] = [ statusCode, @@ -468,7 +469,9 @@ def get_graphql_prefix(path: Optional[str]) -> str: return path + "/graphql" def close(self) -> None: - """Close the connection to the server.""" + """ + Close the connection to the server. + """ with self.__connection_lock: if self.__connection is not None: self.__connection.close() @@ -478,9 +481,10 @@ def close(self) -> None: @property def kwargs(self) -> Dict[str, Any]: - """Returns arguments required to recreate this Requester with - Requester.__init__, as well as with MainClass.__init__ and - GithubIntegration.__init__.""" + """ + Returns arguments required to recreate this Requester with Requester.__init__, as well as with + MainClass.__init__ and GithubIntegration.__init__. + """ return dict( auth=self.__auth, base_url=self.__base_url, @@ -511,11 +515,12 @@ def auth(self) -> Optional["Auth"]: return self.__auth def withAuth(self, auth: Optional["Auth"]) -> "Requester": - """Create a new requester instance with identical configuration but the - given authentication method. + """ + Create a new requester instance with identical configuration but the given authentication method. :param auth: authentication method :return: new Requester implementation + """ kwargs = self.kwargs kwargs.update(auth=auth) @@ -995,7 +1000,9 @@ def __log( class WithRequester(Generic[T]): - """Mixin class that allows to set a requester.""" + """ + Mixin class that allows to set a requester. + """ __requester: Requester diff --git a/github/RequiredPullRequestReviews.py b/github/RequiredPullRequestReviews.py index 31f16374ad..ce5329fa87 100644 --- a/github/RequiredPullRequestReviews.py +++ b/github/RequiredPullRequestReviews.py @@ -53,10 +53,12 @@ class RequiredPullRequestReviews(CompletableGithubObject): - """This class represents Required Pull Request Reviews. + """ + This class represents Required Pull Request Reviews. The reference can be found here https://docs.github.com/en/rest/reference/repos#get-pull-request-review-protection + """ def _initAttributes(self) -> None: diff --git a/github/RequiredStatusChecks.py b/github/RequiredStatusChecks.py index 965899f67f..7411a18c27 100644 --- a/github/RequiredStatusChecks.py +++ b/github/RequiredStatusChecks.py @@ -44,10 +44,12 @@ class RequiredStatusChecks(CompletableGithubObject): - """This class represents Required Status Checks. + """ + This class represents Required Status Checks. The reference can be found here https://docs.github.com/en/rest/reference/repos#get-status-checks-protection + """ def _initAttributes(self) -> None: diff --git a/github/Secret.py b/github/Secret.py index 60f9350298..db48376980 100644 --- a/github/Secret.py +++ b/github/Secret.py @@ -42,10 +42,12 @@ class Secret(CompletableGithubObject): - """This class represents a GitHub secret. + """ + This class represents a GitHub secret. The reference can be found here https://docs.github.com/en/rest/actions/secrets + """ def _initAttributes(self) -> None: diff --git a/github/SelfHostedActionsRunner.py b/github/SelfHostedActionsRunner.py index 151c31a71b..1b08c64dd4 100644 --- a/github/SelfHostedActionsRunner.py +++ b/github/SelfHostedActionsRunner.py @@ -42,10 +42,12 @@ class SelfHostedActionsRunner(NonCompletableGithubObject): - """This class represents Self-hosted GitHub Actions Runners. + """ + This class represents Self-hosted GitHub Actions Runners. The reference can be found at https://docs.github.com/en/free-pro-team@latest/rest/reference/actions#self-hosted-runners + """ def _initAttributes(self) -> None: diff --git a/github/SourceImport.py b/github/SourceImport.py index af299bd48a..56c1163b54 100644 --- a/github/SourceImport.py +++ b/github/SourceImport.py @@ -38,10 +38,12 @@ class SourceImport(CompletableGithubObject): - """This class represents SourceImports. + """ + This class represents SourceImports. The reference can be found here https://docs.github.com/en/rest/reference/migrations#source-imports + """ def _initAttributes(self) -> None: diff --git a/github/Stargazer.py b/github/Stargazer.py index 088530a511..8038a2340a 100644 --- a/github/Stargazer.py +++ b/github/Stargazer.py @@ -51,10 +51,12 @@ class Stargazer(NonCompletableGithubObject): - """This class represents Stargazers. + """ + This class represents Stargazers. The reference can be found here https://docs.github.com/en/rest/reference/activity#starring + """ def _initAttributes(self) -> None: diff --git a/github/StatsCodeFrequency.py b/github/StatsCodeFrequency.py index fac6cc61d5..26872efcbb 100755 --- a/github/StatsCodeFrequency.py +++ b/github/StatsCodeFrequency.py @@ -42,10 +42,12 @@ class StatsCodeFrequency(NonCompletableGithubObject): - """This class represents statistics of StatsCodeFrequencies. + """ + This class represents statistics of StatsCodeFrequencies. The reference can be found here https://docs.github.com/en/rest/metrics/statistics?apiVersion=2022-11-28#get-the-weekly-commit-activity + """ def _initAttributes(self) -> None: diff --git a/github/StatsCommitActivity.py b/github/StatsCommitActivity.py index feac3cdc32..3fff35323b 100755 --- a/github/StatsCommitActivity.py +++ b/github/StatsCommitActivity.py @@ -42,10 +42,12 @@ class StatsCommitActivity(github.GithubObject.NonCompletableGithubObject): - """This class represents StatsCommitActivities. + """ + This class represents StatsCommitActivities. The reference can be found here https://docs.github.com/en/rest/reference/repos#get-the-last-year-of-commit-activity + """ def _initAttributes(self) -> None: diff --git a/github/StatsContributor.py b/github/StatsContributor.py index 95b294ded6..f44434bc4d 100755 --- a/github/StatsContributor.py +++ b/github/StatsContributor.py @@ -43,14 +43,18 @@ class StatsContributor(NonCompletableGithubObject): - """This class represents StatsContributors. + """ + This class represents StatsContributors. The reference can be found here https://docs.github.com/en/rest/reference/repos#get-all-contributor-commit-activity + """ class Week(NonCompletableGithubObject): - """This class represents weekly statistics of a contributor.""" + """ + This class represents weekly statistics of a contributor. + """ @property def w(self) -> datetime: diff --git a/github/StatsParticipation.py b/github/StatsParticipation.py index 6673a99cbb..7297f3703d 100755 --- a/github/StatsParticipation.py +++ b/github/StatsParticipation.py @@ -43,10 +43,12 @@ class StatsParticipation(NonCompletableGithubObject): - """This class represents StatsParticipations. + """ + This class represents StatsParticipations. The reference can be found here https://docs.github.com/en/rest/reference/repos#get-the-weekly-commit-count + """ def _initAttributes(self) -> None: diff --git a/github/StatsPunchCard.py b/github/StatsPunchCard.py index 91022beebf..1797458120 100755 --- a/github/StatsPunchCard.py +++ b/github/StatsPunchCard.py @@ -42,16 +42,20 @@ class StatsPunchCard(github.GithubObject.NonCompletableGithubObject): - """This class represents StatsPunchCards. + """ + This class represents StatsPunchCards. The reference can be found here https://docs.github.com/en/rest/reference/repos#get-the-hourly-commit-count-for-each-day + """ _dict: Dict[Tuple[int, int], int] def get(self, day: int, hour: int) -> int: - """Get a specific element.""" + """ + Get a specific element. + """ return self._dict[(day, hour)] def _initAttributes(self) -> None: diff --git a/github/Tag.py b/github/Tag.py index ca26f1506f..9933b6a3d5 100644 --- a/github/Tag.py +++ b/github/Tag.py @@ -49,10 +49,12 @@ class Tag(NonCompletableGithubObject): - """This class represents Tags. + """ + This class represents Tags. The reference can be found here https://docs.github.com/en/rest/reference/repos#list-repository-tags + """ def __repr__(self) -> str: diff --git a/github/Team.py b/github/Team.py index 379c1693e5..766ff741b2 100644 --- a/github/Team.py +++ b/github/Team.py @@ -85,10 +85,12 @@ class Team(CompletableGithubObject): - """This class represents Teams. + """ + This class represents Teams. The reference can be found here https://docs.github.com/en/rest/reference/teams + """ def _initAttributes(self) -> None: diff --git a/github/TeamDiscussion.py b/github/TeamDiscussion.py index 26c3da5c69..a61e922b61 100644 --- a/github/TeamDiscussion.py +++ b/github/TeamDiscussion.py @@ -51,10 +51,12 @@ class TeamDiscussion(CompletableGithubObject): - """This class represents TeamDiscussions. + """ + This class represents TeamDiscussions. The reference can be found here https://docs.github.com/en/rest/reference/teams#discussions + """ def _initAttributes(self) -> None: diff --git a/github/TimelineEvent.py b/github/TimelineEvent.py index 205e2fbc86..7894ce71ab 100644 --- a/github/TimelineEvent.py +++ b/github/TimelineEvent.py @@ -51,10 +51,12 @@ class TimelineEvent(NonCompletableGithubObject): - """This class represents IssueTimelineEvents. + """ + This class represents IssueTimelineEvents. The reference can be found here https://docs.github.com/en/rest/reference/issues#timeline + """ def _initAttributes(self) -> None: diff --git a/github/TimelineEventSource.py b/github/TimelineEventSource.py index 2a9d44b2ff..c86c8ed88c 100644 --- a/github/TimelineEventSource.py +++ b/github/TimelineEventSource.py @@ -47,10 +47,12 @@ class TimelineEventSource(NonCompletableGithubObject): - """This class represents IssueTimelineEventSource. + """ + This class represents IssueTimelineEventSource. The reference can be found here https://docs.github.com/en/rest/reference/issues#timeline + """ def _initAttributes(self) -> None: diff --git a/github/UserKey.py b/github/UserKey.py index 3b166e92e8..9c5f64c97f 100644 --- a/github/UserKey.py +++ b/github/UserKey.py @@ -43,10 +43,12 @@ class UserKey(github.GithubObject.CompletableGithubObject): - """This class represents UserKeys. + """ + This class represents UserKeys. The reference can be found here https://docs.github.com/en/rest/reference/users#keys + """ def _initAttributes(self) -> None: diff --git a/github/Variable.py b/github/Variable.py index 70961fc6a2..8dcdcd0305 100644 --- a/github/Variable.py +++ b/github/Variable.py @@ -31,10 +31,12 @@ class Variable(CompletableGithubObject): - """This class represents a GitHub variable. + """ + This class represents a GitHub variable. The reference can be found here https://docs.github.com/en/rest/actions/variables + """ def _initAttributes(self) -> None: diff --git a/github/View.py b/github/View.py index c533e158d5..74dd10fb99 100644 --- a/github/View.py +++ b/github/View.py @@ -42,10 +42,12 @@ class View(NonCompletableGithubObject): - """This class represents a popular Path for a GitHub repository. + """ + This class represents a popular Path for a GitHub repository. The reference can be found here https://docs.github.com/en/rest/reference/repos#traffic + """ def _initAttributes(self) -> None: diff --git a/github/Workflow.py b/github/Workflow.py index 5e9caabd77..2f6fa58e44 100644 --- a/github/Workflow.py +++ b/github/Workflow.py @@ -55,10 +55,12 @@ class Workflow(CompletableGithubObject): - """This class represents Workflows. + """ + This class represents Workflows. The reference can be found here https://docs.github.com/en/rest/reference/actions#workflows + """ def _initAttributes(self) -> None: diff --git a/github/WorkflowJob.py b/github/WorkflowJob.py index 197cca1b7c..c81c0b1783 100644 --- a/github/WorkflowJob.py +++ b/github/WorkflowJob.py @@ -34,10 +34,12 @@ class WorkflowJob(CompletableGithubObject): - """This class represents Workflow Jobs. + """ + This class represents Workflow Jobs. The reference can be found here https://docs.github.com/en/rest/reference/actions#workflow-jobs + """ def _initAttributes(self) -> None: diff --git a/github/WorkflowRun.py b/github/WorkflowRun.py index 9551e436d5..ecb3afcfd0 100644 --- a/github/WorkflowRun.py +++ b/github/WorkflowRun.py @@ -54,10 +54,12 @@ class TimingData(NamedTuple): class WorkflowRun(CompletableGithubObject): - """This class represents Workflow Runs. + """ + This class represents Workflow Runs. The reference can be found here https://docs.github.com/en/rest/reference/actions#workflow-runs + """ def _initAttributes(self) -> None: diff --git a/github/WorkflowStep.py b/github/WorkflowStep.py index a65962e499..92ad2553b0 100644 --- a/github/WorkflowStep.py +++ b/github/WorkflowStep.py @@ -43,10 +43,12 @@ class WorkflowStep(CompletableGithubObject): - """This class represents steps in a Workflow Job. + """ + This class represents steps in a Workflow Job. The reference can be found here https://docs.github.com/en/rest/reference/actions#workflow-jobs + """ def _initAttributes(self) -> None: diff --git a/github/__init__.py b/github/__init__.py index 558d231d48..546f7a6542 100644 --- a/github/__init__.py +++ b/github/__init__.py @@ -37,12 +37,13 @@ # along with PyGithub. If not, see . # # # ################################################################################ -"""The primary class you will instantiate is :class:`github.MainClass.Github`. -From its ``get_``, ``create_`` methods, you will obtain instances of all Github -objects like :class:`github.NamedUser.NamedUser` or +""" +The primary class you will instantiate is :class:`github.MainClass.Github`. From its ``get_``, ``create_`` methods, you +will obtain instances of all Github objects like :class:`github.NamedUser.NamedUser` or :class:`github.Repository.Repository`. All classes inherit from :class:`github.GithubObject.GithubObject`. + """ import logging @@ -73,14 +74,17 @@ def set_log_level(level: int) -> None: - """Set the log level of the github logger, e.g. - set_log_level(logging.WARNING) :param level: log level.""" + """ + Set the log level of the github logger, e.g. set_log_level(logging.WARNING) :param level: log level. + """ logger.setLevel(level) def enable_console_debug_logging() -> None: # pragma no cover (Function useful only outside test environment) - """This function sets up a very simple logging configuration (log - everything on standard output) that is useful for troubleshooting.""" + """ + This function sets up a very simple logging configuration (log everything on standard output) that is useful for + troubleshooting. + """ set_log_level(logging.DEBUG) diff --git a/tests/GlobalAdvisory.py b/tests/GlobalAdvisory.py index fbf0fb7086..70d4b001f2 100644 --- a/tests/GlobalAdvisory.py +++ b/tests/GlobalAdvisory.py @@ -133,8 +133,9 @@ def testAttributes(self): self.assertEqual(self.advisory.withdrawn_at, None) def testNewlyReleased(self): - """Test an advisory that was freshly released and does not have values - for all fields.""" + """ + Test an advisory that was freshly released and does not have values for all fields. + """ self.advisory = self.g.get_global_advisory("GHSA-cx3j-qqxj-9597") self.assertListKeyEqual( self.advisory.credits, From 154b468461a7d9e799f0f3892012c57088572216 Mon Sep 17 00:00:00 2001 From: Jirka Date: Mon, 5 Feb 2024 10:20:19 +0100 Subject: [PATCH 12/12] config --- .pre-commit-config.yaml | 5 +---- pyproject.toml | 2 ++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b3d7acf35b..f25eeccb7d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,10 +39,7 @@ repos: hooks: - id: docformatter additional_dependencies: [tomli] - args: - - "--in-place" - - "--pre-summary-newline" - - "--make-summary-multi-line" + args: ["--in-place"] - repo: https://github.com/psf/black rev: 23.12.0 diff --git a/pyproject.toml b/pyproject.toml index b46feafef0..40cc6c49ba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,6 +70,8 @@ recursive = true wrap-summaries = 119 wrap-descriptions = 120 blank = true +pre-summary-newline = true +make-summary-multi-line = true [tool.codespell] skip = 'tests/*'