1
Fork 0
mirror of https://github.com/RGBCube/GitHubWrapper synced 2025-05-31 13:08:12 +00:00
This commit is contained in:
sudosnok 2022-05-01 22:32:53 +01:00
commit 359c483c66
3 changed files with 10 additions and 3 deletions

View file

@ -4,3 +4,6 @@ sphinx:
configuration: docs/conf.py
fail_on_warning: false
builder: html
python:
version: 3.8

View file

@ -59,4 +59,6 @@ html_favicon = './assets/Github-Python.png'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ['_static']
autodoc_mock_imports = ["typing_extensions"]

View file

@ -190,14 +190,16 @@ class GHClient:
@functools.wraps(func)
async def wrapped(self: Self, *args: P.args, **kwargs: P.kwargs) -> Optional[Union[T, User, Repository]]:
if type == 'user':
if obj := self._user_cache.get(kwargs.get('user')):
obj = self._user_cache.get(kwargs.get('user'))
if obj:
return obj
user: User = await func(self, *args, **kwargs) # type: ignore
self._user_cache[kwargs.get("user")] = user
return user
if type == 'repo':
if obj := self._repo_cache.get(kwargs.get('repo')):
obj = self._repo_cache.get(kwargs.get('repo'))
if obj:
return obj
repo: Repository = await func(self, *args, **kwargs) # type: ignore