mirror of
https://github.com/RGBCube/GitHubWrapper
synced 2025-05-19 15:35:08 +00:00
update cache to reflect objects easier
This commit is contained in:
parent
8091515ee9
commit
b551458c03
2 changed files with 51 additions and 72 deletions
|
@ -8,12 +8,12 @@ __all__ = (
|
|||
|
||||
import asyncio
|
||||
import functools
|
||||
from typing import Union, List, Dict
|
||||
from typing import Any, Union, List, Dict
|
||||
|
||||
import aiohttp
|
||||
|
||||
from . import exceptions
|
||||
from .cache import RepoCache, UserCache
|
||||
from .cache import ObjectCache
|
||||
from .http import http
|
||||
from .objects import Gist, Issue, Organization, Repository, User, File
|
||||
|
||||
|
@ -32,9 +32,9 @@ class GHClient:
|
|||
):
|
||||
"""The main client, used to start most use-cases."""
|
||||
self._headers = custom_headers
|
||||
bound = lambda hi, lo, value: max(min(value, hi), lo)
|
||||
self._user_cache = UserCache(bound(50, 0, user_cache_size))
|
||||
self._repo_cache = RepoCache(bound(50, 0, repo_cache_size))
|
||||
|
||||
self._user_cache = ObjectCache[Any, User](user_cache_size)
|
||||
self._repo_cache = ObjectCache[Any, Repository](repo_cache_size)
|
||||
if username and token:
|
||||
self.username = username
|
||||
self.token = token
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue