# Path: modernrpc/core.py
# def rpc_method(
#     func=None,
#     name: str = None,
#     entry_point: str = ALL,
#     protocol: Protocol = Protocol.ALL,
# ):
#     """
#     Mark a standard python function as RPC method.
# 
#     All arguments are optional
# 
#     :param func: A standard function
#     :param name: Used as RPC method name instead of original function name
#     :param entry_point: Default: ALL. Used to limit usage of the RPC method for a specific set of entry points
#     :param protocol: Default: ALL. Used to limit usage of the RPC method for a specific protocol (JSONRPC or XMLRPC)
#     """
# 
#     def decorated(_func):
#         _func.modernrpc_enabled = True
#         _func.modernrpc_name = name or _func.__name__
#         _func.modernrpc_entry_point = entry_point
#         _func.modernrpc_protocol = protocol
# 
#         return _func
# 
#     # If @rpc_method() is used with parenthesis (with or without argument)
#     if func is None:
#         return decorated
# 
#     # If @rpc_method is used without parenthesis
#     return decorated(func)
# 
# class Protocol(str, Enum):
#     """Define a custom type to use everywhere a protocol (JSON-RPC or XML-RPC) is expected"""
# 
#     ALL = GENERIC_ALL
#     JSON_RPC = "__json_rpc"
#     XML_RPC = "__xml_rpc"


from modernrpc.core import rpc_method, Protocol


@rpc_method(protocol=Protocol.JSON_RPC)
def json_only():
    return "JSON only"



# Path: modernrpc/core.py
# def rpc_method(
#     func=None,
#     name: str = None,
#     entry_point: str = ALL,
#     protocol: Protocol = Protocol.ALL,
# ):
#     """
#     Mark a standard python function as RPC method.
# 
#     All arguments are optional
# 
#     :param func: A standard function
#     :param name: Used as RPC method name instead of original function name
#     :param entry_point: Default: ALL. Used to limit usage of the RPC method for a specific set of entry points
#     :param protocol: Default: ALL. Used to limit usage of the RPC method for a specific protocol (JSONRPC or XMLRPC)
#     """
# 
#     def decorated(_func):
#         _func.modernrpc_enabled = True
#         _func.modernrpc_name = name or _func.__name__
#         _func.modernrpc_entry_point = entry_point
#         _func.modernrpc_protocol = protocol
# 
#         return _func
# 
#     # If @rpc_method() is used with parenthesis (with or without argument)
#     if func is None:
#         return decorated
# 
#     # If @rpc_method is used without parenthesis
#     return decorated(func)
# 
# class Protocol(str, Enum):
#     """Define a custom type to use everywhere a protocol (JSON-RPC or XML-RPC) is expected"""
# 
#     ALL = GENERIC_ALL
#     JSON_RPC = "__json_rpc"
#     XML_RPC = "__xml_rpc"


# Path: tests/testsite/rpc_methods_stub/specific_protocol.py
from modernrpc.core import rpc_method, Protocol



@rpc_method(protocol=Protocol.JSON_RPC)
def json_only():
    return "JSON only"



@rpc_method(protocol=Protocol.XML_RPC)