How to use the jsonrpcserver.methods.validate_args function in jsonrpcserver

To help you get started, we’ve selected a few jsonrpcserver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bcb / jsonrpcserver / tests / test_methods.py View on Github external
def test_validate_positionals():
    validate_args(lambda x: None, 1)
github bcb / jsonrpcserver / tests / test_methods.py View on Github external
def test_validate_object_method():
    class FooClass:
        def foo(self, one, two):
            return "bar"

    validate_args(FooClass().foo, "one", "two")
github bcb / jsonrpcserver / tests / test_methods.py View on Github external
def test_validate_keywords():
    validate_args(lambda **kwargs: None, foo="bar")
github bcb / jsonrpcserver / tests / test_methods.py View on Github external
def test_validate_positionals_not_passed():
    with pytest.raises(InvalidParamsError):
        validate_args(lambda x: None, foo="bar")
github bcb / jsonrpcserver / tests / test_methods.py View on Github external
def test_validate_no_arguments():
    validate_args(lambda: None)
github bcb / jsonrpcserver / jsonrpcserver / dispatcher.py View on Github external
def call(method: Method, *args: Any, **kwargs: Any) -> Any:
    """
    Validates arguments and then calls the method.

    Args:
        method: The method to call.
        *args, **kwargs: Arguments to the method.

    Returns:
        The "result" part of the JSON-RPC response (the return value from the method).
    """
    return validate_args(method, *args, **kwargs)(*args, **kwargs)