mirror of
https://github.com/RGBCube/GitHubWrapper
synced 2025-06-11 02:12:08 +00:00
'Refactored by Sourcery'
This commit is contained in:
parent
72df282684
commit
e0032900a6
5 changed files with 24 additions and 26 deletions
|
@ -130,11 +130,11 @@ class GHClient:
|
|||
if not self.has_started:
|
||||
raise exceptions.NotStarted
|
||||
if not as_dict:
|
||||
output: List[str] = []
|
||||
for key, value in self.http.session._rates._asdict().items(): # type: ignore
|
||||
output.append(f"{key} : {value}")
|
||||
return [
|
||||
f"{key} : {value}"
|
||||
for key, value in self.http.session._rates._asdict().items()
|
||||
]
|
||||
|
||||
return output
|
||||
|
||||
return self.http.session._rates # type: ignore
|
||||
|
||||
|
@ -188,16 +188,14 @@ class GHClient:
|
|||
@functools.wraps(func)
|
||||
async def wrapped(self: Self, *args: P.args, **kwargs: P.kwargs) -> Optional[Union[T, User, Repository]]:
|
||||
if type == 'user':
|
||||
obj = self._user_cache.get(kwargs.get('user'))
|
||||
if obj:
|
||||
if obj := self._user_cache.get(kwargs.get('user')):
|
||||
return obj
|
||||
|
||||
user: User = await func(self, *args, **kwargs) # type: ignore
|
||||
self._user_cache[kwargs.get("user")] = user
|
||||
return user
|
||||
if type == 'repo':
|
||||
obj = self._repo_cache.get(kwargs.get('repo'))
|
||||
if obj:
|
||||
if obj := self._repo_cache.get(kwargs.get('repo')):
|
||||
return obj
|
||||
|
||||
repo: Repository = await func(self, *args, **kwargs) # type: ignore
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue