<commit_before>##
## DISTRESS Messaging wrapper
##
import json

def add( NumBlocks, Expires="infinity", Removable=False ):
    assert( type(NumBlocks) is int )
    assert( NumBlocks > 0 )
    if not Expires in ["infinity", "inf"]: assert( Expires > 0 )
    assert( type(Removable) is bool )
    return json.dumps( { 'msg' : 'add', 
                         'expires' : Expires, 
                         'removable' : Removable,
                         'numblocks' : NumBlocks } )

def addblock( Key, Value ):
    return json.dumps( { 'key' : Key,
                         'val' : Value } )


def del( Oid, Key ):
    return json.dumps( { 'msg' : 'del', 
                         'key' : Key,
                         'oid' : Oid } )

def get( Key ):
    return json.dumps( { 'msg' : 'get', 'key' : Key } )


##
## Decode the messages from the Server.  
##
def decode( Msg ): return json.loads( Msg )<commit_msg>Update distress_cmsg.py<commit_after>##
## DISTRESS Messaging wrapper
##
import json

def add( NumBlocks, Expires="infinity", Removable=False ):
    assert( type(NumBlocks) is int )
    assert( NumBlocks > 0 )
    if not Expires in ["infinity", "inf"]: assert( Expires > 0 )
    assert( type(Removable) is bool )
    return json.dumps( { 'msg' : 'add', 
                         'expires' : Expires, 
                         'removable' : Removable,
                         'numblocks' : NumBlocks } )

def addblock( Key, Value ):
    return json.dumps( { 'key' : Key,
                         'val' : Value } )


def delete( Oid, Key ):
    return json.dumps( { 'msg' : 'del', 
                         'key' : Key,
                         'oid' : Oid } )

def get( Key ):
    return json.dumps( { 'msg' : 'get', 'key' : Key } )


##
## Decode the messages from the Server.  
##
def decode( Msg ): return json.loads( Msg )
{'fraction_non_alphanumeric': 0.14192495921696574, 'fraction_numerical': 0.002175095160413268, 'mean_word_length': 1.835130970724191, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2095733', 'n_tokens_mistral': 605, 'n_tokens_neox': 576, 'n_words': 169}