mirror of
https://github.com/RGBCube/GitHubWrapper
synced 2025-05-30 20:48:12 +00:00
Please pyright and type ignore some stuff
This commit is contained in:
parent
6f41bc8238
commit
404a589e87
8 changed files with 18 additions and 18 deletions
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 _
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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()
|
||||
|
|
2
setup.py
2
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',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue