Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
sfdye committed Oct 13, 2022
2 parents 36f7fef + 7e6333d commit dd3e30c
Show file tree
Hide file tree
Showing 18 changed files with 44 additions and 41 deletions.
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Expand Up @@ -9,3 +9,6 @@

# Add pyupgrade to pre-commit
e113e37de1ec687c68337d777f3629251b35ab28

Run pre-commit autoupdate and run all hooks
4c24c73d34b54a061b0c800eeea64dc64c230a63
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
@@ -1,30 +1,30 @@
repos:
- repo: https://github.com/psf/black
rev: 20.8b1
rev: 22.10.0
hooks:
- id: black
- repo: https://github.com/asottile/seed-isort-config
rev: v1.9.4
rev: v2.2.0
hooks:
- id: seed-isort-config
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
rev: v5.10.1
hooks:
- id: isort
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.9
rev: 3.9.2
hooks:
- id: flake8
- repo: https://github.com/codespell-project/codespell
rev: v1.16.0
rev: v2.2.1
hooks:
- id: codespell
exclude: tests/
args:
- --ignore-words-list="bloaded,nto,pullrequest,pullrequests,thi,tim,wan,Wan,chang,Chang"
- --quiet-level=2
- repo: https://github.com/asottile/pyupgrade
rev: v2.7.4
rev: v3.1.0
hooks:
- id: pyupgrade
args:
Expand Down
2 changes: 1 addition & 1 deletion github/AccessToken.py
Expand Up @@ -31,7 +31,7 @@ class AccessToken(github.GithubObject.NonCompletableGithubObject):
def __repr__(self):
return self.get__repr__(
{
"token": "{}...".format(self.token[:5]),
"token": f"{self.token[:5]}...",
"scope": self.scope,
"type": self.type,
}
Expand Down
11 changes: 2 additions & 9 deletions github/ApplicationOAuth.pyi
Expand Up @@ -12,13 +12,6 @@ class ApplicationOAuth(NonCompletableGithubObject):
@property
def client_secret(self) -> str: ...
def get_login_url(
self,
redirect_uri: Optional[str],
state: Optional[str],
login: Optional[str]
self, redirect_uri: Optional[str], state: Optional[str], login: Optional[str]
) -> str: ...
def get_access_token(
self,
code: str,
state: Optional[str]
) -> AccessToken: ...
def get_access_token(self, code: str, state: Optional[str]) -> AccessToken: ...
1 change: 0 additions & 1 deletion github/DeploymentStatus.pyi
Expand Up @@ -4,7 +4,6 @@ from typing import Any, Dict
from github.GithubObject import CompletableGithubObject
from github.NamedUser import NamedUser


class DeploymentStatus(CompletableGithubObject):
def __repr__(self) -> str: ...
def _initAttributes(self) -> None: ...
Expand Down
2 changes: 0 additions & 2 deletions github/GithubApp.pyi
@@ -1,11 +1,9 @@

from typing import Any, Dict, List

from datetime import datetime
from github.GithubObject import CompletableGithubObject
from github.NamedUser import NamedUser


class GithubApp(CompletableGithubObject):
def __repr__(self) -> str: ...
def _initAttributes(self) -> None: ...
Expand Down
2 changes: 1 addition & 1 deletion github/GithubException.py
Expand Up @@ -67,7 +67,7 @@ def headers(self):
return self.__headers

def __str__(self):
return "{status} {data}".format(status=self.status, data=json.dumps(self.data))
return f"{self.status} {json.dumps(self.data)}"


class BadCredentialsException(GithubException):
Expand Down
5 changes: 3 additions & 2 deletions github/GithubException.pyi
@@ -1,13 +1,14 @@
from typing import Any, Dict, List, Optional, Tuple, Type, Union

class GithubException(Exception):
def __init__(self, status: Union[int, str], data: Any, headers: Optional[Dict[str, str]]) -> None: ...
def __init__(
self, status: Union[int, str], data: Any, headers: Optional[Dict[str, str]]
) -> None: ...
def __str__(self) -> str: ...
@property
def data(self) -> Dict[str, Union[str, List[str], List[Dict[str, str]]]]: ...
@property
def status(self) -> int: ...

@property
def headers(self) -> Union[None, Dict[str, str]]: ...

Expand Down
8 changes: 2 additions & 6 deletions github/MainClass.pyi
Expand Up @@ -24,7 +24,7 @@ from github.Topic import Topic

# from urllib3.util.retry import Retry

TGithubObject = TypeVar('TGithubObject', bound=GithubObject)
TGithubObject = TypeVar("TGithubObject", bound=GithubObject)

class Github:
def __init__(
Expand Down Expand Up @@ -130,11 +130,7 @@ class Github:
order: Union[str, _NotSetType] = ...,
**qualifiers: Any
) -> PaginatedList[Repository]: ...
def search_topics(
self,
query: str,
**qualifiers: Any
) -> PaginatedList[Topic]: ...
def search_topics(self, query: str, **qualifiers: Any) -> PaginatedList[Topic]: ...
def search_users(
self,
query: str,
Expand Down
1 change: 0 additions & 1 deletion github/Organization.pyi
Expand Up @@ -218,4 +218,3 @@ class Organization(CompletableGithubObject):
def updated_at(self) -> datetime: ...
@property
def url(self) -> str: ...

1 change: 1 addition & 0 deletions github/PaginatedList.pyi
Expand Up @@ -14,6 +14,7 @@ class PaginatedListBase(Generic[T]):
def __iter__(self) -> Iterator[T]: ...
def _grow(self) -> Any: ...
def _isBiggerThan(self, index: int) -> bool: ...

class _Slice:
def __init__(self, theList: PaginatedList[T], theSlice: slice) -> None: ...
def __iter__(self) -> Iterator[T]: ...
Expand Down
1 change: 0 additions & 1 deletion github/ProjectColumn.pyi
Expand Up @@ -37,4 +37,3 @@ class ProjectColumn(CompletableGithubObject):
def move(self, position: str) -> bool: ...
def delete(self) -> bool: ...
def edit(self, name: str) -> None: ...

4 changes: 1 addition & 3 deletions github/Repository.pyi
Expand Up @@ -310,9 +310,7 @@ class Repository(CompletableGithubObject):
def get_artifacts(self) -> PaginatedList[Artifact]: ...
def get_assignees(self) -> PaginatedList[NamedUser]: ...
def get_branch(self, branch: str) -> Branch: ...
def rename_branch(
self, branch: Union[str, Branch], new_name: str
) -> bool: ...
def rename_branch(self, branch: Union[str, Branch], new_name: str) -> bool: ...
def get_branches(self) -> PaginatedList[Branch]: ...
def get_check_run(self, check_run_id: int) -> CheckRun: ...
def get_check_suite(self, check_suite_id: int) -> CheckSuite: ...
Expand Down
2 changes: 1 addition & 1 deletion github/Requester.py
Expand Up @@ -307,7 +307,7 @@ def __init__(
if password is not None:
login = login_or_token
b64 = (
base64.b64encode((f"{login}:{password}").encode("utf-8"))
base64.b64encode((f"{login}:{password}").encode())
.decode("utf-8")
.replace("\n", "")
)
Expand Down
24 changes: 19 additions & 5 deletions github/Requester.pyi
Expand Up @@ -50,20 +50,34 @@ class Requester:
) -> None: ...
def NEW_DEBUG_FRAME(self, requestHeader: Dict[str, str]) -> None: ...
def __check(
self, status: int, responseHeader: Dict[str, Any], output: str,
self,
status: int,
responseHeader: Dict[str, Any],
output: str,
) -> Tuple[Dict[str, Any], Dict[str, Any]]: ...
def __addParametersToUrl(self, url: str, parameters: Dict[str, Any],) -> str: ...
def __addParametersToUrl(
self,
url: str,
parameters: Dict[str, Any],
) -> str: ...
def __authenticate(
self, url: str, responseHeader: Dict[str, Any], parameters: Dict[str, Any],
self,
url: str,
responseHeader: Dict[str, Any],
parameters: Dict[str, Any],
) -> None: ...
def __customConnection(
self, url: str,
self,
url: str,
) -> Optional[Union[HTTPRequestsConnectionClass, HTTPSRequestsConnectionClass]]: ...
def __createConnection(
self,
) -> Union[HTTPRequestsConnectionClass, HTTPSRequestsConnectionClass]: ...
def __createException(
self, status: int, headers: Dict[str, Any], output: str,
self,
status: int,
headers: Dict[str, Any],
output: str,
) -> Any: ...
def __log(
self,
Expand Down
1 change: 1 addition & 0 deletions github/StatsContributor.pyi
Expand Up @@ -13,6 +13,7 @@ class StatsContributor(NonCompletableGithubObject):
def total(self) -> int: ...
@property
def weeks(self) -> List[Week]: ...

class Week(NonCompletableGithubObject):
def _initAttributes(self) -> None: ...
def _useAttributes(self, attributes: Dict[str, int]) -> None: ...
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Expand Up @@ -2,5 +2,6 @@ pynacl>=1.4.0
requests>=2.14.0
pyjwt>=2.0
sphinx<3
Jinja2<3.1
sphinx-rtd-theme<1.1
Deprecated
4 changes: 2 additions & 2 deletions tests/PaginatedList.py
Expand Up @@ -289,9 +289,9 @@ def testCustomPerPage(self):
self.assertEqual(len(list(self.repo.get_issues())), 456)

def testCustomPerPageWithNoUrlParams(self):
from . import (
from . import ( # Don't polute github.tests namespace, it would conflict with github.tests.CommitComment
CommitComment,
) # Don't polute github.tests namespace, it would conflict with github.tests.CommitComment
)

self.g.per_page = 100
PaginatedListImpl(
Expand Down

0 comments on commit dd3e30c

Please sign in to comment.