Skip to content

Commit

Permalink
ci: fix pyright errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ahal committed Dec 15, 2023
1 parent dc2ea27 commit 5700c17
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/simple_github/client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import asyncio
import json
from abc import abstractmethod
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
from typing import TYPE_CHECKING, Any, Coroutine, Dict, List, Optional, Union

from aiohttp import ClientSession, ContentTypeError
from gql import Client as GqlClient
Expand All @@ -21,6 +21,11 @@
Response = Union[Dict[str, Any], List[Any], str]
RequestData = Optional[Dict[str, Any]]

# Implementations of the base class can be either sync or async.
BaseDict = Union[Dict[str, Any], Coroutine[None, None, Dict[str, Any]]]
BaseNone = Union[None, Coroutine[None, None, None]]
BaseResponse = Union[Response, Coroutine[None, None, Response]]


class Client:
def __init__(self, auth: "Auth"):
Expand All @@ -41,35 +46,35 @@ def __init__(self, auth: "Auth"):
] = None

@abstractmethod
def close(self) -> None:
def close(self) -> BaseNone:
...

@abstractmethod
def request(self, method: str, query: str, **kwargs: Any) -> Response:
def request(self, method: str, query: str, **kwargs: Any) -> BaseResponse:
...

@abstractmethod
def get(self, query: str) -> Response:
def get(self, query: str) -> BaseResponse:
...

@abstractmethod
def post(self, query: str, data: RequestData = None) -> Response:
def post(self, query: str, data: RequestData = None) -> BaseResponse:
...

@abstractmethod
def put(self, query: str, data: RequestData = None) -> Response:
def put(self, query: str, data: RequestData = None) -> BaseResponse:
...

@abstractmethod
def patch(self, query: str, data: RequestData = None) -> Response:
def patch(self, query: str, data: RequestData = None) -> BaseResponse:
...

@abstractmethod
def delete(self, query: str, data: RequestData = None) -> None:
def delete(self, query: str, data: RequestData = None) -> BaseNone:
...

@abstractmethod
def execute(self, query: str, variables: RequestData = None) -> Dict[str, Any]:
def execute(self, query: str, variables: RequestData = None) -> BaseDict:
...


Expand Down

0 comments on commit 5700c17

Please sign in to comment.