# Path: async_v20/interface/helpers.py
# def create_request_kwargs(self, endpoint, arguments):
#     """Format arguments to be passed to an aiohttp request"""
# 
#     json = create_body(self, endpoint.request_schema, arguments)
# 
#     headers = header_params(self, endpoint, arguments)
# 
#     url = create_url(self, endpoint, arguments)
# 
#     # yarl doesn't accept int subclass'
#     parameters = query_params(self, endpoint, arguments)
# 
#     request_kwargs = {}
#     for parameter, value in (
#             ('method', endpoint.method),
#             ('url', url),
#             ('headers', headers),
#             ('params', parameters),
#             ('json', json)):
#         if not value:
#             continue
#         else:
#             request_kwargs.update({parameter: value})
# 
#     return request_kwargs
# 
# def construct_arguments(self, sig, *args, **kwargs):
#     """Construct passed arguments into corresponding objects
# 
#     args:
# 
#         signature: -- Signature of api method
#         bound_arguments:
# 
#     Returns:
#         dict with annotation with as keys and annotation instances as values
#         """
# 
#     bound = sig.bind(self, *args, **kwargs)
#     bound.apply_defaults()
# 
#     def yield_annotations():
#         for name, value in bound.arguments.items():
#             annotation = sig.parameters[name].annotation
# 
#             if value == sentinel:
#                 try:
#                     value = self.default_parameters[annotation]
#                 except KeyError:
#                     continue
# 
#                 if issubclass(annotation, SinceTransactionID) \
#                         and too_many_passed_transactions(self):
#                     logging.warning('Too many transactions have passed to use the default '
#                                     '`since_transaction_id` value.')
#                     value = self.default_parameters[LastTransactionID] - ALLOWED_SINCE_TRANSACTION_ID
# 
#             if issubclass(annotation, SinceTransactionID) \
#                     and too_many_passed_transactions(self):
#                 logging.warning(f'The passed `since_transaction_id` value {value} '
#                                 f'is more than {ALLOWED_SINCE_TRANSACTION_ID} transactions ago.')
# 
#             if not annotation == _empty:
#                 yield annotation, create_attribute(annotation, value)
# 
#     return dict(yield_annotations())
# 
# Path: async_v20/interface/parser.py
# async def parse_response(self, response, endpoint, enable_rest, method_name):
#     if endpoint.host in 'REST HEALTH':
#         result = await _rest_response(self, response, endpoint, enable_rest, method_name)
#     else:
#         result = _stream_parser(self, response, endpoint, method_name)
#     return result
# 
# Path: async_v20/definitions/helpers.py
# def create_doc_signature(obj, sig):
#     names = list(sig.parameters.keys())
#     annotations = list(
#         map(lambda x: '' if x.annotation == _empty else ': ' + x.annotation.__name__, sig.parameters.values()))
#     defaults = list(map(lambda x: '' if x.default == _empty else '=' + str(x.default)
#                         if not x.default is sentinel else '= sentinel ', sig.parameters.values()))
#     arguments = ', '.join(''.join(argument) for argument in zip(names, annotations, defaults))
#     return f'{obj.__name__}({arguments})\n{obj.__doc__}'
# 
# Path: async_v20/endpoints/annotations.py
# class SinceTransactionID(TransactionID):
#     """The account changes to get Since LastTransactionID for account_changes() method"""
#     pass
# 
# Path: async_v20/exceptions.py
# class ResponseTimeout(AsyncV20Exception):
#     """The server took to long to respond"""
#     pass


import logging
from functools import wraps
from inspect import signature
from .helpers import create_request_kwargs, construct_arguments
from .parser import parse_response
from ..definitions.helpers import create_doc_signature
from ..endpoints.annotations import SinceTransactionID
from ..exceptions import ResponseTimeout
from asyncio import TimeoutError as AsyncTimeOutError
            if rest and arguments[SinceTransactionID] == self.default_parameters[SinceTransactionID]:
                enable_rest = True

            request_kwargs = create_request_kwargs(self, endpoint, arguments)

            await self._request_limiter()

            if self.debug:
                logger.debug('client.session.request(kwargs=%s)', request_kwargs)
            response = self.session.request(**request_kwargs)

            return await parse_response(self, response, endpoint, enable_rest, method.__name__)


        wrap.__signature__ = sig

        return wrap

    return wrapper


def shortcut(func):
    sig = signature(func)

    @wraps(func)
    def wrap(self, *args, **kwargs):
        return func(self, *args, **kwargs)

    wrap.shortcut = True
    wrap.__signature__ = sig

# Path: async_v20/interface/helpers.py
# def create_request_kwargs(self, endpoint, arguments):
#     """Format arguments to be passed to an aiohttp request"""
# 
#     json = create_body(self, endpoint.request_schema, arguments)
# 
#     headers = header_params(self, endpoint, arguments)
# 
#     url = create_url(self, endpoint, arguments)
# 
#     # yarl doesn't accept int subclass'
#     parameters = query_params(self, endpoint, arguments)
# 
#     request_kwargs = {}
#     for parameter, value in (
#             ('method', endpoint.method),
#             ('url', url),
#             ('headers', headers),
#             ('params', parameters),
#             ('json', json)):
#         if not value:
#             continue
#         else:
#             request_kwargs.update({parameter: value})
# 
#     return request_kwargs
# 
# def construct_arguments(self, sig, *args, **kwargs):
#     """Construct passed arguments into corresponding objects
# 
#     args:
# 
#         signature: -- Signature of api method
#         bound_arguments:
# 
#     Returns:
#         dict with annotation with as keys and annotation instances as values
#         """
# 
#     bound = sig.bind(self, *args, **kwargs)
#     bound.apply_defaults()
# 
#     def yield_annotations():
#         for name, value in bound.arguments.items():
#             annotation = sig.parameters[name].annotation
# 
#             if value == sentinel:
#                 try:
#                     value = self.default_parameters[annotation]
#                 except KeyError:
#                     continue
# 
#                 if issubclass(annotation, SinceTransactionID) \
#                         and too_many_passed_transactions(self):
#                     logging.warning('Too many transactions have passed to use the default '
#                                     '`since_transaction_id` value.')
#                     value = self.default_parameters[LastTransactionID] - ALLOWED_SINCE_TRANSACTION_ID
# 
#             if issubclass(annotation, SinceTransactionID) \
#                     and too_many_passed_transactions(self):
#                 logging.warning(f'The passed `since_transaction_id` value {value} '
#                                 f'is more than {ALLOWED_SINCE_TRANSACTION_ID} transactions ago.')
# 
#             if not annotation == _empty:
#                 yield annotation, create_attribute(annotation, value)
# 
#     return dict(yield_annotations())
# 
# Path: async_v20/interface/parser.py
# async def parse_response(self, response, endpoint, enable_rest, method_name):
#     if endpoint.host in 'REST HEALTH':
#         result = await _rest_response(self, response, endpoint, enable_rest, method_name)
#     else:
#         result = _stream_parser(self, response, endpoint, method_name)
#     return result
# 
# Path: async_v20/definitions/helpers.py
# def create_doc_signature(obj, sig):
#     names = list(sig.parameters.keys())
#     annotations = list(
#         map(lambda x: '' if x.annotation == _empty else ': ' + x.annotation.__name__, sig.parameters.values()))
#     defaults = list(map(lambda x: '' if x.default == _empty else '=' + str(x.default)
#                         if not x.default is sentinel else '= sentinel ', sig.parameters.values()))
#     arguments = ', '.join(''.join(argument) for argument in zip(names, annotations, defaults))
#     return f'{obj.__name__}({arguments})\n{obj.__doc__}'
# 
# Path: async_v20/endpoints/annotations.py
# class SinceTransactionID(TransactionID):
#     """The account changes to get Since LastTransactionID for account_changes() method"""
#     pass
# 
# Path: async_v20/exceptions.py
# class ResponseTimeout(AsyncV20Exception):
#     """The server took to long to respond"""
#     pass


# Path: async_v20/interface/decorators.py
import logging
from functools import wraps
from inspect import signature
from .helpers import create_request_kwargs, construct_arguments
from .parser import parse_response
from ..definitions.helpers import create_doc_signature
from ..endpoints.annotations import SinceTransactionID
from ..exceptions import ResponseTimeout
from asyncio import TimeoutError as AsyncTimeOutError

            if rest and arguments[SinceTransactionID] == self.default_parameters[SinceTransactionID]:
                enable_rest = True

            request_kwargs = create_request_kwargs(self, endpoint, arguments)

            await self._request_limiter()

            if self.debug:
                logger.debug('client.session.request(kwargs=%s)', request_kwargs)
            response = self.session.request(**request_kwargs)

            return await parse_response(self, response, endpoint, enable_rest, method.__name__)


        wrap.__signature__ = sig

        return wrap

    return wrapper


def shortcut(func):
    sig = signature(func)

    @wraps(func)
    def wrap(self, *args, **kwargs):
        return func(self, *args, **kwargs)

    wrap.shortcut = True
    wrap.__signature__ = sig

    wrap.__doc__ = create_doc_signature(wrap, sig)