# 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




def _get_latest_version(
    query: MutableMapping[str, Any], context: PipelineContext
) -> str:
    pipeline = context[PipelineContext.Keys.PIPELINE]
    realms = pipeline.get(RealmDto, {"platform": query["platform"]})
    return realms["v"]


def _get_default_locale(
    query: MutableMapping[str, Any], context: PipelineContext
) -> str:
    return query["platform"].default_locale



# 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





def _get_latest_version(
    query: MutableMapping[str, Any], context: PipelineContext
) -> str:
    pipeline = context[PipelineContext.Keys.PIPELINE]
    realms = pipeline.get(RealmDto, {"platform": query["platform"]})
    return realms["v"]


def _get_default_locale(
    query: MutableMapping[str, Any], context: PipelineContext
) -> str:
    return query["platform"].default_locale



class APIRequestError(HTTPError):