diff --git a/docs/conf.py b/docs/conf.py index 83fc54f..a5721ae 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -79,7 +79,7 @@ copyright = '2022 - Present, VarMonke & sudosnok' version = '' with open('../github/__init__.py') as f: - version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE).group(1) + version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE).group(1) #type: ignore # The full version, including alpha/beta/rc tags. release = version diff --git a/docs/extensions/attributetable.py b/docs/extensions/attributetable.py index b38e12a..f0b843e 100644 --- a/docs/extensions/attributetable.py +++ b/docs/extensions/attributetable.py @@ -148,11 +148,11 @@ class PyAttributeTable(SphinxDirective): return [node] -def build_lookup_table(env: BuildEnvironment) -> Dict[str, List[str]]: +def build_lookup_table(env: Optional[BuildEnvironment]) -> Dict[str, List[str]]: # Given an environment, load up a lookup table of # full-class-name: objects result = {} - domain = env.domains['py'] + domain = env.domains['py'] #type: ignore ignored = { 'data', @@ -181,7 +181,7 @@ class TableElement(NamedTuple): def process_attributetable(app: Sphinx, doctree: nodes.Node, fromdocname: str) -> None: - env = app.builder.env + env = app.builder.env #type: ignore lookup = build_lookup_table(env) for node in doctree.traverse(attributetableplaceholder): diff --git a/docs/extensions/builder.py b/docs/extensions/builder.py index 3f2b259..0ac806d 100644 --- a/docs/extensions/builder.py +++ b/docs/extensions/builder.py @@ -25,7 +25,7 @@ class DPYStandaloneHTMLBuilder(StandaloneHTMLBuilder): def write_genindex(self) -> None: # the total count of lines for each index letter, used to distribute # the entries into two columns - genindex = IndexEntries(self.env).create_index(self, group_entries=False) + genindex = IndexEntries(self.env).create_index(self, group_entries=False) #type: ignore indexcounts = [] for _k, entries in genindex: indexcounts.append(sum(1 + len(subitems) diff --git a/docs/extensions/details.py b/docs/extensions/details.py index 96f39d5..ad5e09d 100644 --- a/docs/extensions/details.py +++ b/docs/extensions/details.py @@ -1,5 +1,5 @@ from docutils.parsers.rst import Directive -from docutils.parsers.rst import states, directives +from docutils.parsers.rst import states, directives #type: ignore from docutils.parsers.rst.roles import set_classes from docutils import nodes diff --git a/docs/extensions/exception_hierarchy.py b/docs/extensions/exception_hierarchy.py index cc69a7c..9a1ad94 100644 --- a/docs/extensions/exception_hierarchy.py +++ b/docs/extensions/exception_hierarchy.py @@ -1,5 +1,5 @@ from docutils.parsers.rst import Directive -from docutils.parsers.rst import states, directives +from docutils.parsers.rst import states, directives #type: ignore from docutils.parsers.rst.roles import set_classes from docutils import nodes from sphinx.locale import _ diff --git a/github/client.py b/github/client.py index 8fb6c80..cf0efe9 100644 --- a/github/client.py +++ b/github/client.py @@ -68,7 +68,7 @@ class GHClient: token: Optional[str] = None, user_cache_size: int = 30, repo_cache_size: int = 15, - custom_headers: Optional[Dict[str, Union[str, int]]] = {}, + custom_headers: Dict[str, Union[str, int]] = {}, ): self._headers = custom_headers @@ -238,7 +238,7 @@ class GHClient: repo: :class:`str` The name of the repository to fetch. """ - return Repository(await self.http.get_repo(owner, repo), self.http) + return Repository(await self.http.get_repo(owner, repo), self.http) #type: ignore async def get_issue(self, *, owner: str, repo: str, issue: int) -> Issue: """:class:`Issue`: Fetch a Github Issue from it's name. @@ -252,7 +252,7 @@ class GHClient: issue: :class:`int` The ID of the issue to fetch. """ - return Issue(await self.http.get_repo_issue(owner, repo, issue), self.http) + return Issue(await self.http.get_repo_issue(owner, repo, issue), self.http) #type: ignore #fwiw, this shouldn't error but pyright <3 async def create_repo( self, diff --git a/github/http.py b/github/http.py index 2f5ebd1..8a48fb7 100644 --- a/github/http.py +++ b/github/http.py @@ -6,7 +6,7 @@ import json import re from datetime import datetime from types import SimpleNamespace -from typing import Dict, NamedTuple, Optional, Type, Tuple, Union, List +from typing import Any, Dict, NamedTuple, Optional, Type, Tuple, Union, List from typing_extensions import TypeAlias import platform @@ -219,30 +219,30 @@ class http: print('This shouldn\'t be reachable') return [] - async def get_repo(self, owner: str, repo_name: str) -> Dict[str, Union[str, int]]: + async def get_repo(self, owner: str, repo_name: str) -> Optional[Dict[str, Union[str, int]]]: """Returns a Repo's raw JSON from the given owner and repo name.""" result = await self.session.get(REPO_URL.format(owner, repo_name)) if 200 <= result.status <= 299: return await result.json() raise RepositoryNotFound - async def get_repo_issue(self, owner: str, repo_name: str, issue_number: int) -> Dict[str, Union[str, int]]: + async def get_repo_issue(self, owner: str, repo_name: str, issue_number: int) -> Optional[Dict[str, Any]]: """Returns a single issue's JSON from the given owner and repo name.""" result = await self.session.get(REPO_ISSUE_URL.format(owner, repo_name, issue_number)) if 200 <= result.status <= 299: return await result.json() raise IssueNotFound - async def delete_repo(self, owner: str, repo_name: str) -> Optional[str]: + async def delete_repo(self, owner: Optional[str], repo_name: str) -> Optional[str]: """Deletes a Repo from the given owner and repo name.""" result = await self.session.delete(REPO_URL.format(owner, repo_name)) if 204 <= result.status <= 299: return 'Successfully deleted repository.' - if result.status == 403: + if result.status == 403: #type: ignore raise MissingPermissions raise RepositoryNotFound - async def delete_gist(self, gist_id: str) -> Optional[str]: + async def delete_gist(self, gist_id: Union[str, int]) -> Optional[str]: """Deletes a Gist from the given gist id.""" result = await self.session.delete(GIST_URL.format(gist_id)) if result.status == 204: @@ -252,7 +252,7 @@ class http: raise GistNotFound async def get_org(self, org_name: str) -> Dict[str, Union[str, int]]: - """Returns an org's public data in JSON format.""" + """Returns an org's public data in JSON format.""" #type: ignore result = await self.session.get(ORG_URL.format(org_name)) if 200 <= result.status <= 299: return await result.json() diff --git a/setup.py b/setup.py index 0c3ca32..7b06def 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ with open('requirements.txt') as f: requirements = f.read().splitlines() path = Path(__file__).parent / "github" / "__init__.py" -version = re.search(r'\d[.]\d[.]\d',path.read_text()).group() +version = re.search(r'\d[.]\d[.]\d',path.read_text()).group(0) #type: ignore packages = [ 'github',