<commit_before># =============================================================================
# json_rpc.py
#
# This file implements the JSON-RPC frontent.
#
# December 2015
#
# Copyright (c) 2015 by cisco Systems, Inc.
# All rights reserved.
# =============================================================================

import json
from collections import OrderedDict
from twisted.internet import defer

def attach(sdata):
    """
    Create a JSON-RPC object and attach to the session
    """
    JsonRpc(sdata)

class JsonRpcException(Exception):
    pass

api_fns = {}

class JsonRpc(object):
    """
    Object that understands the JSON-RPC protocol
    """

    # Decorator to build up a dict containing all of the API functions for
    # convenient access by user-defined scripts.
    def api_fn(fn):
        api_fns[fn.__name__] = fn
        return fn

    #
    # The public API of the remote server, all return a 'deferred'.
    #

    # Version Inspection

    @api_fn
    def get_version(self):
        return self._request("get_version")

    # Access Operations

    @api_fn
    def get(self, path):
        return self._request("get", path=path)

    @api_fn
    def get_children(self, path):
        return self._request("get_children", path=path)

    @api_fn
    def get_parent(self, path_:
        return self_request("get_parent", path=path)

    @api_fn
    def set(self, path, value):
        return self._request("set", path=path, value=value)

    @api_fn
    def delete(self, path):
        return self._request("delete", path=path)

    @api_fn
    def replace(self, path):
        return self._request("replace", path=path)

    # Config Operations

    @api_fn<commit_msg>Typo in 'get_parent' API method<commit_after># =============================================================================
# json_rpc.py
#
# This file implements the JSON-RPC frontent.
#
# December 2015
#
# Copyright (c) 2015 by cisco Systems, Inc.
# All rights reserved.
# =============================================================================

import json
from collections import OrderedDict
from twisted.internet import defer

def attach(sdata):
    """
    Create a JSON-RPC object and attach to the session
    """
    JsonRpc(sdata)

class JsonRpcException(Exception):
    pass

api_fns = {}

class JsonRpc(object):
    """
    Object that understands the JSON-RPC protocol
    """

    # Decorator to build up a dict containing all of the API functions for
    # convenient access by user-defined scripts.
    def api_fn(fn):
        api_fns[fn.__name__] = fn
        return fn

    #
    # The public API of the remote server, all return a 'deferred'.
    #

    # Version Inspection

    @api_fn
    def get_version(self):
        return self._request("get_version")

    # Access Operations

    @api_fn
    def get(self, path):
        return self._request("get", path=path)

    @api_fn
    def get_children(self, path):
        return self._request("get_children", path=path)

    @api_fn
    def get_parent(self, path_:
        return self._request("get_parent", path=path)

    @api_fn
    def set(self, path, value):
        return self._request("set", path=path, value=value)

    @api_fn
    def delete(self, path):
        return self._request("delete", path=path)

    @api_fn
    def replace(self, path):
        return self._request("replace", path=path)

    # Config Operations

    @api_fn
{'fraction_non_alphanumeric': 0.18062445287423404, 'fraction_numerical': 0.0046688065363291505, 'mean_word_length': 3.1907090464547676, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4012485', 'n_tokens_mistral': 1022, 'n_tokens_neox': 959, 'n_words': 293}