diff --git a/aiogithubapi/const.py b/aiogithubapi/const.py index 6b18a04..bd92af6 100644 --- a/aiogithubapi/const.py +++ b/aiogithubapi/const.py @@ -14,13 +14,13 @@ from enum import Enum class StrEnum(str, Enum): - """Workaround untill lowest version is Python3.11.""" + """Workaround until lowest version is Python3.11.""" def __str__(self) -> str: return str(self.value) class IntEnum(int, Enum): - """Workaround untill lowest version is Python3.11.""" + """Workaround until lowest version is Python3.11.""" GenericType = TypeVar("GenericType") @@ -36,7 +36,7 @@ class IntEnum(int, Enum): } # This is the default user agent, -# but it is adviced to use your own when building out your application +# but it is advised to use your own when building out your application DEFAULT_USER_AGENT = f"aiogithubapi/{PROJECT_VERSION}" # https://docs.github.com/en/rest/overview/api-versions @@ -93,7 +93,7 @@ class GitHubClientKwarg(StrEnum): HEADERS: Used to set the base headers for all requests. BASE_URL: - Used to ovveride the base url for all requests. Defaults to https://api.github.com . + Used to override the base url for all requests. Defaults to https://api.github.com . TIMEOUT: Used to set the timeout for all requests. Defaults to 20 CLIENT_NAME: diff --git a/aiogithubapi/device.py b/aiogithubapi/device.py index b6bfb8f..36884fb 100644 --- a/aiogithubapi/device.py +++ b/aiogithubapi/device.py @@ -98,7 +98,7 @@ async def register( self, **kwargs: Dict[GitHubRequestKwarg, Any], ) -> GitHubResponseModel[GitHubLoginDeviceModel]: - """Register the device and return a object that contains the user code for authorization.""" + """Register the device and return an object that contains the user code for authorization.""" response = await self._client.async_call_api( endpoint=OAUTH_DEVICE_LOGIN_PATH, **{ diff --git a/aiogithubapi/exceptions.py b/aiogithubapi/exceptions.py index 797ab99..40ec2c6 100644 --- a/aiogithubapi/exceptions.py +++ b/aiogithubapi/exceptions.py @@ -3,7 +3,7 @@ class GitHubException(BaseException): """ - This is raised when unknown exceptions occour. + This is raised when unknown exceptions occur. And it's used as a base for all other exceptions so if you want to catch all GitHub related errors @@ -28,7 +28,7 @@ class GitHubPayloadException(GitHubException): class GitHubGraphQLException(GitHubException): - """This is raised when the response from GraphQL calls have erros.""" + """This is raised when the response from GraphQL calls have errors.""" class GitHubPermissionException(GitHubException): @@ -40,4 +40,4 @@ class GitHubNotModifiedException(GitHubException): class GitHubAuthenticationException(GitHubException): - """This is raised when we recieve an authentication issue.""" + """This is raised when we receive an authentication issue.""" diff --git a/aiogithubapi/legacy/device.py b/aiogithubapi/legacy/device.py index 84229eb..fce23e1 100644 --- a/aiogithubapi/legacy/device.py +++ b/aiogithubapi/legacy/device.py @@ -65,7 +65,7 @@ async def __aexit__(self, *exc_info) -> None: await self._close() async def async_register_device(self) -> AIOGitHubAPILoginDevice: - """Register the device and return a object that contains the user code for authorization.""" + """Register the device and return an object that contains the user code for authorization.""" params = {"client_id": self.client_id, "scope": self.scope} response = await async_call_api( session=self.session, diff --git a/aiogithubapi/legacy/github.py b/aiogithubapi/legacy/github.py index 23834c7..1366d3c 100644 --- a/aiogithubapi/legacy/github.py +++ b/aiogithubapi/legacy/github.py @@ -63,7 +63,7 @@ async def get_repo( repo: str, etag: Optional[str] = None, ) -> AIOGitHubAPIRepository: - """Retrun AIOGitHubAPIRepository object.""" + """Return AIOGitHubAPIRepository object.""" _endpoint = f"/repos/{repo}" _headers = {"Accept": ACCEPT_HEADERS["preview"]} if etag: @@ -77,7 +77,7 @@ async def get_org_repos( self, org: str, page: int = 1, etag: Optional[str] = None ) -> List[AIOGitHubAPIRepository]: """ - Retrun a list of AIOGitHubAPIRepository objects. + Return a list of AIOGitHubAPIRepository objects. param | required | Default | description -- | -- | -- | -- @@ -104,7 +104,7 @@ async def graphql(self, query: str, variables: dict = {}) -> dict: return response.data.get("data") async def get_rate_limit(self) -> dict: - """Retrun current rate limits.""" + """Return current rate limits.""" _endpoint = "/rate_limit" await self.client.get(endpoint=_endpoint) @@ -112,7 +112,7 @@ async def get_rate_limit(self) -> dict: async def render_markdown(self, content: str, etag: Optional[str] = None) -> str: """ - Retrun AIOGitHubAPIRepository object. + Return AIOGitHubAPIRepository object. [API Docs](https://docs.github.com/en/rest/reference/markdown#render-a-markdown-document-in-raw-mode) diff --git a/aiogithubapi/namespaces/events.py b/aiogithubapi/namespaces/events.py index b401605..6ab886c 100644 --- a/aiogithubapi/namespaces/events.py +++ b/aiogithubapi/namespaces/events.py @@ -66,12 +66,12 @@ async def subscribe( `event_callback` - An async funtion that will be called when new events come in, + An async function that will be called when new events come in, the event will be passed as the first argument. `error_callback` (Optional) - An async funtion that will be called when errors occour, + An async function that will be called when errors occur, the exception that where raised will be passed. https://docs.github.com/en/rest/reference/activity#list-public-events @@ -202,12 +202,12 @@ async def subscribe( `event_callback` - An async funtion that will be called when new events come in, + An async function that will be called when new events come in, the event will be passed as the first argument. `error_callback` (Optional) - An async funtion that will be called when errors occour, + An async function that will be called when errors occur, the exception that where raised will be passed. https://docs.github.com/en/rest/reference/activity#list-repository-events diff --git a/aiogithubapi/objects/repository/__init__.py b/aiogithubapi/objects/repository/__init__.py index 46a6cea..d1aa03e 100644 --- a/aiogithubapi/objects/repository/__init__.py +++ b/aiogithubapi/objects/repository/__init__.py @@ -97,7 +97,7 @@ def owner(self) -> AIOGitHubAPIUsersUser: async def get_contents( self, path: str, ref: str or None = None, etag: Optional[str] = None ) -> list["AIOGitHubAPIRepositoryContent"] or "AIOGitHubAPIRepositoryContent": - """Retrun a list of repository content objects.""" + """Return a list of repository content objects.""" _endpoint = f"/repos/{self.full_name}/contents/{path}" _params = {"path": path} _headers = {} @@ -115,7 +115,7 @@ async def get_contents( async def get_tree( self, ref: str or None = None, etag: Optional[str] = None ) -> list["AIOGitHubAPIRepositoryTreeContent"] or list: - """Retrun a list of repository tree objects.""" + """Return a list of repository tree objects.""" if ref is None: raise AIOGitHubAPIException("Missing ref") _endpoint = f"/repos/{self.full_name}/git/trees/{ref}" @@ -134,7 +134,7 @@ async def get_tree( async def get_rendered_contents( self, path: str, ref: str or None = None, etag: Optional[str] = None ) -> str: - """Retrun a redered representation of a file.""" + """Return a rendered representation of a file.""" _endpoint = f"/repos/{self.full_name}/contents/{path}" _headers = {"Accept": "application/vnd.github.v3.html"} _params = {"path": path} @@ -152,7 +152,7 @@ async def get_rendered_contents( async def get_releases( self, prerelease: bool = False, returnlimit: int = 5, etag: Optional[str] = None ) -> list["AIOGitHubAPIRepositoryRelease"] or list: - """Retrun a list of repository release objects.""" + """Return a list of repository release objects.""" _endpoint = f"/repos/{self.full_name}/releases" _headers = {} if etag: @@ -172,7 +172,7 @@ async def get_releases( return contents async def set_last_commit(self, etag: Optional[str] = None) -> None: - """Retrun a list of repository release objects.""" + """Return a list of repository release objects.""" _endpoint = f"/repos/{self.full_name}/branches/{self.default_branch}" _headers = {} if etag: @@ -181,7 +181,7 @@ async def set_last_commit(self, etag: Optional[str] = None) -> None: self._last_commit = response.data["commit"]["sha"][0:7] async def get_last_commit(self, etag: Optional[str] = None) -> None: - """Retrun a list of repository release objects.""" + """Return a list of repository release objects.""" _endpoint = f"/repos/{self.full_name}/branches/{self.default_branch}" _headers = {} if etag: diff --git a/aiogithubapi/objects/repository/issue/__init__.py b/aiogithubapi/objects/repository/issue/__init__.py index 47cd097..40f509b 100644 --- a/aiogithubapi/objects/repository/issue/__init__.py +++ b/aiogithubapi/objects/repository/issue/__init__.py @@ -12,7 +12,7 @@ class AIOGitHubAPIRepositoryIssue(AIOGitHubAPIBaseClient): - """Issue commment user GitHub API implementation.""" + """Issue comment user GitHub API implementation.""" @property def html_url(self): diff --git a/aiogithubapi/objects/repository/issue/comment.py b/aiogithubapi/objects/repository/issue/comment.py index d9ac1f0..8dd2c45 100644 --- a/aiogithubapi/objects/repository/issue/comment.py +++ b/aiogithubapi/objects/repository/issue/comment.py @@ -11,7 +11,7 @@ class AIOGitHubAPIRepositoryIssueCommentUser(AIOGitHubAPIUsersUser): - """Issue commment user GitHub API implementation.""" + """Issue comment user GitHub API implementation.""" @property def login(self): diff --git a/documentation.md b/documentation.md index e29890e..d21d715 100644 --- a/documentation.md +++ b/documentation.md @@ -42,5 +42,5 @@ asyncio.get_event_loop().run_until_complete(with_token()) ## Usage notes - When constructing the client, you should pass a `client_name` parameter, or a user agent string. -- Each response object has a `etag` attribute, which can be used to make subsequent requests. - - If you pass a `etag` parameter, and the API returns a 304 Not Modified, the client will raise `GitHubNotModifiedException` \ No newline at end of file +- Each response object has an `etag` attribute, which can be used to make subsequent requests. + - If you pass an `etag` parameter, and the API returns a 304 Not Modified, the client will raise `GitHubNotModifiedException` diff --git a/tests/client/test_construction.py b/tests/client/test_construction.py index 2b226e3..c9ed010 100644 --- a/tests/client/test_construction.py +++ b/tests/client/test_construction.py @@ -10,7 +10,7 @@ @pytest.mark.asyncio -async def test_client_constrution_defaults( +async def test_client_construction_defaults( client_session: ClientSession, caplog: pytest.CaptureFixture ): client = GitHubClient(session=client_session) @@ -31,7 +31,7 @@ async def test_client_constrution_defaults( @pytest.mark.asyncio -async def test_client_constrution_with_token(client_session: ClientSession): +async def test_client_construction_with_token(client_session: ClientSession): client = GitHubClient(session=client_session, token=TOKEN) base_request_data = client._base_request_data assert base_request_data.token == TOKEN @@ -42,7 +42,7 @@ async def test_client_constrution_with_token(client_session: ClientSession): @pytest.mark.asyncio -async def test_client_constrution_with_api_version(client_session: ClientSession): +async def test_client_construction_with_api_version(client_session: ClientSession): client = GitHubClient(session=client_session, token=TOKEN, api_version="3000-01-01") base_request_data = client._base_request_data assert base_request_data.token == TOKEN @@ -54,14 +54,14 @@ async def test_client_constrution_with_api_version(client_session: ClientSession @pytest.mark.asyncio -async def test_client_constrution_with_kwargs_timeout(client_session: ClientSession): +async def test_client_construction_with_kwargs_timeout(client_session: ClientSession): client = GitHubClient(session=client_session, **{GitHubClientKwarg.TIMEOUT: 10}) base_request_data = client._base_request_data assert base_request_data.timeout == 10 @pytest.mark.asyncio -async def test_client_constrution_with_kwargs_base_url(client_session: ClientSession): +async def test_client_construction_with_kwargs_base_url(client_session: ClientSession): client = GitHubClient( session=client_session, **{GitHubClientKwarg.BASE_URL: "https://example.com"} ) @@ -70,7 +70,7 @@ async def test_client_constrution_with_kwargs_base_url(client_session: ClientSes @pytest.mark.asyncio -async def test_client_constrution_with_kwargs_headers(client_session: ClientSession): +async def test_client_construction_with_kwargs_headers(client_session: ClientSession): client = GitHubClient( session=client_session, **{GitHubClientKwarg.HEADERS: {"User-Agent": "test/client"}} ) @@ -79,7 +79,7 @@ async def test_client_constrution_with_kwargs_headers(client_session: ClientSess @pytest.mark.asyncio -async def test_client_constrution_with_kwargs_client_name(client_session: ClientSession): +async def test_client_construction_with_kwargs_client_name(client_session: ClientSession): client = GitHubClient( session=client_session, **{GitHubClientKwarg.CLIENT_NAME: "test_client/1.2.3"} ) diff --git a/tests/conftest.py b/tests/conftest.py index 1ed0bc3..dbcae9c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -28,19 +28,19 @@ def asyncio_sleep(): @pytest.fixture() def mock_requests(): - """Return a new mock request instanse.""" + """Return a new mock request instance.""" yield MockedRequests() @pytest.fixture() def response(): - """Return a new mock response instanse.""" + """Return a new mock response instance.""" yield MockResponse() @pytest.fixture() def mock_response(): - """Return a new mock response instanse.""" + """Return a new mock response instance.""" yield MockResponse()