# Path: cassiopeia/datastores/common.py
#     USE_PYCURL = True
#     USE_PYCURL = False
# class HTTPError(RuntimeError):
#     class HTTPClient(object):
#     class HTTPClient(object):
#     def __init__(self, message, code, response_headers: Dict[str, str] = None):
#         def _execute(curl: Curl, close_connection: bool) -> int:
#         def _get(
#             url: str,
#             headers: Mapping[str, str] = None,
#             rate_limiters: List[RateLimiter] = None,
#             connection: Curl = None,
#         ) -> (int, bytes, dict):
#             def get_response_headers(header_line: bytes) -> None:
#         def get(
#             self,
#             url: str,
#             parameters: MutableMapping[str, Any] = None,
#             headers: Mapping[str, str] = None,
#             rate_limiters: List[RateLimiter] = None,
#             connection: Curl = None,
#             encode_parameters: bool = True,
#         ) -> (Union[dict, list, str, bytes], dict):
#         def new_session(self) -> Curl:
#         def _get(
#             url: str,
#             headers: Mapping[str, str] = None,
#             rate_limiters: List[RateLimiter] = None,
#         ) -> (int, bytes, dict):
#         def get(
#             self,
#             url: str,
#             parameters: MutableMapping[str, Any] = None,
#             headers: Mapping[str, str] = None,
#             rate_limiters: List[RateLimiter] = None,
#             connection: Curl = None,
#             encode_parameters: bool = True,
#         ) -> (Union[dict, list, str, bytes], dict):
#         def new_session(self) -> requests.Session:
# 
# Path: cassiopeia/data.py
# class Platform(Enum):
#     brazil = "BR1"
#     europe_north_east = "EUN1"
#     europe_west = "EUW1"
#     japan = "JP1"
#     korea = "KR"
#     latin_america_north = "LA1"
#     latin_america_south = "LA2"
#     north_america = "NA1"
#     oceania = "OC1"
#     turkey = "TR1"
#     russia = "RU"
# 
#     @property
#     def region(self) -> "Region":
#         return getattr(Region, self.name)
# 
#     @property
#     def default_locale(self) -> str:
#         return DEFAULT_LOCALE[self]
# 
#     @staticmethod
#     def from_region(region):
#         try:
#             return region.platform
#         except AttributeError:
#             return Region(region).platform
# 
#     @property
#     def continent(self):
#         return self.region.continent


import time
import copy
import functools
import collections.abc
from abc import abstractmethod, ABC
from typing import (
    MutableMapping,
    Any,
    Union,
    TypeVar,
    Iterable,
    Type,
    List,
    Tuple,
    Dict,
    Callable,
)
from datapipelines import DataSource, PipelineContext
from merakicommons.ratelimits import FixedWindowRateLimiter, MultiRateLimiter
from ..common import HTTPClient, HTTPError, Curl
from ...data import Platform
from ...dto.staticdata.realm import RealmDto
                    new_handler_instance[strategy], **config
                )

    def _get_rate_limiter(self, platform: Platform, endpoint: str):
        try:
            method_limiter = self._rate_limiters[(platform, endpoint)]
        except KeyError:
            method_limiter = RiotAPIRateLimiter(self._limiting_share)
            self._rate_limiters[(platform, endpoint)] = method_limiter
        app_limiter = self._rate_limiters["application"][platform]
        return app_limiter, method_limiter

    def _adjust_rate_limiters_from_headers(
        self, app_limiter, method_limiter, response_headers
    ):
        # If Riot changes the # of permits allowed in their response headers, change our rate limiters.
        # We are currently ignoring the X-*-Rate-Limit-Count headers and assuming our rate limiter logic agrees.
        if "X-App-Rate-Limit" in response_headers:
            limits = _split_rate_limit_header(response_headers["X-App-Rate-Limit"])
            app_limiter.adjust_rate_limits_if_necessary(limits)
        if "X-Method-Rate-Limit" in response_headers:
            limits = _split_rate_limit_header(response_headers["X-Method-Rate-Limit"])
            method_limiter.adjust_rate_limits_if_necessary(limits)

    def _get(
        self,
        url: str,
        parameters: MutableMapping[str, Any] = None,
        app_limiter: RiotAPIRateLimiter = None,
        method_limiter: RiotAPIRateLimiter = None,

# Path: cassiopeia/datastores/common.py
#     USE_PYCURL = True
#     USE_PYCURL = False
# class HTTPError(RuntimeError):
#     class HTTPClient(object):
#     class HTTPClient(object):
#     def __init__(self, message, code, response_headers: Dict[str, str] = None):
#         def _execute(curl: Curl, close_connection: bool) -> int:
#         def _get(
#             url: str,
#             headers: Mapping[str, str] = None,
#             rate_limiters: List[RateLimiter] = None,
#             connection: Curl = None,
#         ) -> (int, bytes, dict):
#             def get_response_headers(header_line: bytes) -> None:
#         def get(
#             self,
#             url: str,
#             parameters: MutableMapping[str, Any] = None,
#             headers: Mapping[str, str] = None,
#             rate_limiters: List[RateLimiter] = None,
#             connection: Curl = None,
#             encode_parameters: bool = True,
#         ) -> (Union[dict, list, str, bytes], dict):
#         def new_session(self) -> Curl:
#         def _get(
#             url: str,
#             headers: Mapping[str, str] = None,
#             rate_limiters: List[RateLimiter] = None,
#         ) -> (int, bytes, dict):
#         def get(
#             self,
#             url: str,
#             parameters: MutableMapping[str, Any] = None,
#             headers: Mapping[str, str] = None,
#             rate_limiters: List[RateLimiter] = None,
#             connection: Curl = None,
#             encode_parameters: bool = True,
#         ) -> (Union[dict, list, str, bytes], dict):
#         def new_session(self) -> requests.Session:
# 
# Path: cassiopeia/data.py
# class Platform(Enum):
#     brazil = "BR1"
#     europe_north_east = "EUN1"
#     europe_west = "EUW1"
#     japan = "JP1"
#     korea = "KR"
#     latin_america_north = "LA1"
#     latin_america_south = "LA2"
#     north_america = "NA1"
#     oceania = "OC1"
#     turkey = "TR1"
#     russia = "RU"
# 
#     @property
#     def region(self) -> "Region":
#         return getattr(Region, self.name)
# 
#     @property
#     def default_locale(self) -> str:
#         return DEFAULT_LOCALE[self]
# 
#     @staticmethod
#     def from_region(region):
#         try:
#             return region.platform
#         except AttributeError:
#             return Region(region).platform
# 
#     @property
#     def continent(self):
#         return self.region.continent


# Path: cassiopeia/datastores/riotapi/common.py
import time
import copy
import functools
import collections.abc
from abc import abstractmethod, ABC
from typing import (
    MutableMapping,
    Any,
    Union,
    TypeVar,
    Iterable,
    Type,
    List,
    Tuple,
    Dict,
    Callable,
)
from datapipelines import DataSource, PipelineContext
from merakicommons.ratelimits import FixedWindowRateLimiter, MultiRateLimiter
from ..common import HTTPClient, HTTPError, Curl
from ...data import Platform
from ...dto.staticdata.realm import RealmDto

                    new_handler_instance[strategy], **config
                )

    def _get_rate_limiter(self, platform: Platform, endpoint: str):
        try:
            method_limiter = self._rate_limiters[(platform, endpoint)]
        except KeyError:
            method_limiter = RiotAPIRateLimiter(self._limiting_share)
            self._rate_limiters[(platform, endpoint)] = method_limiter
        app_limiter = self._rate_limiters["application"][platform]
        return app_limiter, method_limiter

    def _adjust_rate_limiters_from_headers(
        self, app_limiter, method_limiter, response_headers
    ):
        # If Riot changes the # of permits allowed in their response headers, change our rate limiters.
        # We are currently ignoring the X-*-Rate-Limit-Count headers and assuming our rate limiter logic agrees.
        if "X-App-Rate-Limit" in response_headers:
            limits = _split_rate_limit_header(response_headers["X-App-Rate-Limit"])
            app_limiter.adjust_rate_limits_if_necessary(limits)
        if "X-Method-Rate-Limit" in response_headers:
            limits = _split_rate_limit_header(response_headers["X-Method-Rate-Limit"])
            method_limiter.adjust_rate_limits_if_necessary(limits)

    def _get(
        self,
        url: str,
        parameters: MutableMapping[str, Any] = None,
        app_limiter: RiotAPIRateLimiter = None,
        method_limiter: RiotAPIRateLimiter = None,

        connection: Curl = None,