# Path: modernrpc/core.py
# GENERIC_ALL = ALL = "__all__"
# REQUEST_KEY = settings.MODERNRPC_KWARGS_REQUEST_KEY
# ENTRY_POINT_KEY = settings.MODERNRPC_KWARGS_ENTRY_POINT_KEY
# PROTOCOL_KEY = settings.MODERNRPC_KWARGS_PROTOCOL_KEY
# HANDLER_KEY = settings.MODERNRPC_KWARGS_HANDLER_KEY
#     ALL = GENERIC_ALL
#     JSON_RPC = "__json_rpc"
#     XML_RPC = "__xml_rpc"
# class Protocol(str, Enum):
# class RPCRequestContext:
# class RPCMethod:
# class _RPCRegistry:
#     def __init__(
#         self,
#         request: HttpRequest,
#         # Double quotes will prevent circular import, as this
#         # is the only place RPCHandler is used in core module
#         handler: "RPCHandler",
#         protocol: Protocol,
#         entry_point: str,
#     ):
#     def __init__(self, func: FunctionType):
#     def name(self) -> str:
#     def __repr__(self) -> str:
#     def __str__(self) -> str:
#     def __eq__(self, other) -> bool:
#     def check_permissions(self, request: HttpRequest) -> bool:
#     def execute(
#         self,
#         context: RPCRequestContext,
#         args: Iterable[Any],
#         kwargs: Optional[dict] = None,
#     ) -> Any:
#     def available_for_protocol(self, protocol: Protocol) -> bool:
#     def available_for_entry_point(self, entry_point: str) -> bool:
#     def is_valid_for(self, entry_point: str, protocol: Protocol) -> bool:
#     def accept_kwargs(self) -> bool:
#     def args(self) -> List[str]:
#     def raw_docstring(self) -> str:
#     def html_doc(self) -> str:
#     def args_doc(self) -> OrderedDict:
#     def return_doc(self) -> Dict[str, str]:
#     def __init__(self):
#     def reset(self) -> None:
#     def register_method(self, func: FunctionType) -> str:
#     def total_count(self) -> int:
#     def get_all_method_names(
#         self, entry_point=ALL, protocol: Protocol = Protocol.ALL, sort_methods=False
#     ) -> List[str]:
#     def get_all_methods(
#         self,
#         entry_point: str = ALL,
#         protocol: Protocol = Protocol.ALL,
#         sort_methods=False,
#     ) -> List[RPCMethod]:
#     def get_method(
#         self, name: str, entry_point: str, protocol: Protocol
#     ) -> Optional[RPCMethod]:
# def rpc_method(
#     func=None,
#     name: str = None,
#     entry_point: str = ALL,
#     protocol: Protocol = Protocol.ALL,
# ):
#     def decorated(_func):
# def register_rpc_method(func):
# def get_all_method_names(entry_point=ALL, protocol=Protocol.ALL, sort_methods=False):
# def get_all_methods(entry_point=ALL, protocol=Protocol.ALL, sort_methods=False):
# def get_method(name, entry_point, protocol):
# def reset_registry():
# 
# Path: modernrpc/exceptions.py
# class RPCMethodNotFound(RPCException):
#     """Raised by handlers the RPC method called is not defined for the current entry point and protocol."""
# 
#     def __init__(self, name: str, data: Any = None):
#         err_msg = 'Method not found: "{}"'.format(name)
#         super().__init__(RPC_METHOD_NOT_FOUND, err_msg, data)


import logging
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any, List
from django.http import HttpRequest
from modernrpc.core import (
    registry,
    Protocol,
    RPCRequestContext,
)
from modernrpc.exceptions import (
    RPCMethodNotFound,
)
    from modernrpc.core import RPCMethod
            getattr(request, "content_type", "").lower() in self.valid_content_types()
        )

    @abstractmethod
    def process_request(self, request_body: str, context: RPCRequestContext) -> str:
        """
        Fully process a request. Return the str content ready to be sent as HttpResponse.

        This is the only method the view is supposed to call after choosing the right handler.
        Concrete implementation must perform all work here, according to its protocol specifications.

        Important: This method should delegate concrete procedure execution to process_single_request(). This will
        help to implement multi-request (JSON-RPC batch / XML-RPC system.multicall) features.

        Implementations of this method must ensure no exception is raised from here. All code must be secured
        to return a proper RPC error response on any exception.
        """

    @abstractmethod
    def parse_request(self, request_body: str) -> RequestData:
        """
        Parse the body of incoming request and extract data needed for execution.

        The return-type of this method depends on concrete implementation.

        Must raises RPCException or subclasses on errors
        """

    @abstractmethod
    def process_single_request(

# Path: modernrpc/core.py
# GENERIC_ALL = ALL = "__all__"
# REQUEST_KEY = settings.MODERNRPC_KWARGS_REQUEST_KEY
# ENTRY_POINT_KEY = settings.MODERNRPC_KWARGS_ENTRY_POINT_KEY
# PROTOCOL_KEY = settings.MODERNRPC_KWARGS_PROTOCOL_KEY
# HANDLER_KEY = settings.MODERNRPC_KWARGS_HANDLER_KEY
#     ALL = GENERIC_ALL
#     JSON_RPC = "__json_rpc"
#     XML_RPC = "__xml_rpc"
# class Protocol(str, Enum):
# class RPCRequestContext:
# class RPCMethod:
# class _RPCRegistry:
#     def __init__(
#         self,
#         request: HttpRequest,
#         # Double quotes will prevent circular import, as this
#         # is the only place RPCHandler is used in core module
#         handler: "RPCHandler",
#         protocol: Protocol,
#         entry_point: str,
#     ):
#     def __init__(self, func: FunctionType):
#     def name(self) -> str:
#     def __repr__(self) -> str:
#     def __str__(self) -> str:
#     def __eq__(self, other) -> bool:
#     def check_permissions(self, request: HttpRequest) -> bool:
#     def execute(
#         self,
#         context: RPCRequestContext,
#         args: Iterable[Any],
#         kwargs: Optional[dict] = None,
#     ) -> Any:
#     def available_for_protocol(self, protocol: Protocol) -> bool:
#     def available_for_entry_point(self, entry_point: str) -> bool:
#     def is_valid_for(self, entry_point: str, protocol: Protocol) -> bool:
#     def accept_kwargs(self) -> bool:
#     def args(self) -> List[str]:
#     def raw_docstring(self) -> str:
#     def html_doc(self) -> str:
#     def args_doc(self) -> OrderedDict:
#     def return_doc(self) -> Dict[str, str]:
#     def __init__(self):
#     def reset(self) -> None:
#     def register_method(self, func: FunctionType) -> str:
#     def total_count(self) -> int:
#     def get_all_method_names(
#         self, entry_point=ALL, protocol: Protocol = Protocol.ALL, sort_methods=False
#     ) -> List[str]:
#     def get_all_methods(
#         self,
#         entry_point: str = ALL,
#         protocol: Protocol = Protocol.ALL,
#         sort_methods=False,
#     ) -> List[RPCMethod]:
#     def get_method(
#         self, name: str, entry_point: str, protocol: Protocol
#     ) -> Optional[RPCMethod]:
# def rpc_method(
#     func=None,
#     name: str = None,
#     entry_point: str = ALL,
#     protocol: Protocol = Protocol.ALL,
# ):
#     def decorated(_func):
# def register_rpc_method(func):
# def get_all_method_names(entry_point=ALL, protocol=Protocol.ALL, sort_methods=False):
# def get_all_methods(entry_point=ALL, protocol=Protocol.ALL, sort_methods=False):
# def get_method(name, entry_point, protocol):
# def reset_registry():
# 
# Path: modernrpc/exceptions.py
# class RPCMethodNotFound(RPCException):
#     """Raised by handlers the RPC method called is not defined for the current entry point and protocol."""
# 
#     def __init__(self, name: str, data: Any = None):
#         err_msg = 'Method not found: "{}"'.format(name)
#         super().__init__(RPC_METHOD_NOT_FOUND, err_msg, data)


# Path: modernrpc/handlers/base.py
import logging
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any, List
from django.http import HttpRequest
from modernrpc.core import (
    registry,
    Protocol,
    RPCRequestContext,
)
from modernrpc.exceptions import (
    RPCMethodNotFound,
)
    from modernrpc.core import RPCMethod

            getattr(request, "content_type", "").lower() in self.valid_content_types()
        )

    @abstractmethod
    def process_request(self, request_body: str, context: RPCRequestContext) -> str:
        """
        Fully process a request. Return the str content ready to be sent as HttpResponse.

        This is the only method the view is supposed to call after choosing the right handler.
        Concrete implementation must perform all work here, according to its protocol specifications.

        Important: This method should delegate concrete procedure execution to process_single_request(). This will
        help to implement multi-request (JSON-RPC batch / XML-RPC system.multicall) features.

        Implementations of this method must ensure no exception is raised from here. All code must be secured
        to return a proper RPC error response on any exception.
        """

    @abstractmethod
    def parse_request(self, request_body: str) -> RequestData:
        """
        Parse the body of incoming request and extract data needed for execution.

        The return-type of this method depends on concrete implementation.

        Must raises RPCException or subclasses on errors
        """

    @abstractmethod
    def process_single_request(

        self, request_data: RequestData, context: RPCRequestContext