benchmarkstt.api.jsonrpc module

%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#e7f2fa', 'lineColor': '#2980B9' }}}%% classDiagram SecurityError DefaultMethods MagicMethods ValueError <|-- SecurityError class SecurityError { } class MagicMethods { +load(name, module) +register(name, callback) +serve(config, callback) is_safe_path(path)$ } class DefaultMethods { +version() help(methods)$ }

Make benchmarkstt available through a rudimentary JSON-RPC interface

Warning

Only supported for Python versions 3.6 and above!

class benchmarkstt.api.jsonrpc.DefaultMethods[source]

Bases: object

static help(methods)[source]
static version()[source]

Get the version of benchmarkstt

Return str

BenchmarkSTT version

class benchmarkstt.api.jsonrpc.MagicMethods[source]

Bases: object

static is_safe_path(path)[source]

Determines whether the file or path is within the current working directory

Parameters

path (str|PathLike) --

Returns

bool

load(name, module)[source]

Load all possible callbacks for a given module

Parameters
  • name --

  • module (Module) --

possible_path_args = ['file', 'path']
register(name, callback)[source]

Register a callback as an api call

Parameters
  • name --

  • callback --

serve(config, callback)[source]

Responsible for creating a callback with proper documentation and arguments signature that can be registered as an api call.

Parameters
  • config --

  • callback --

Returns

callable

exception benchmarkstt.api.jsonrpc.SecurityError[source]

Bases: ValueError

Trying to do or access something that isn't allowed

benchmarkstt.api.jsonrpc.get_methods() → jsonrpcserver.methods.Methods[source]

Returns the available JSON-RPC api methods

Returns

jsonrpcserver.methods.Methods