<commit_before>Moment = require 'moment'

ignored_functions=["start","stop","afterConfigUpdate"]

class MewService
    constructor : (@serviceName,@mew,@config)->

    start : (callback)->
        callback()

    ping : (callback)->
        response = {
            status : "NORMAL",
            name : @mew.name,
            time : (new Moment()).format()
        }
        callback(null,response)

    stop : (callback)->
        if callback
            callback()

    afterConfigUpdate : (callback)->
        @mew.logger.debug "configure for service [#{@serviceName}] update complete"
        callback()

    configure : (key,value,callback)->
        if typeof key is 'function'
            callback = key
            return callback(null,@config)
        else
            if key
                if typeof value is 'function'
                    callback = value
                    return callback(null,@config[key])
                else if value
                    @config[key]=value
                else
                    delete @config[key]
                @mew.brain.serviceManager.persistConfig @serviceName,(err)=>
                    if err
                        callback(Err)
                    else
                        try
                            @afterConfigUpdate (err)=>
                                if err
                                    callback(err)
                                else
                                    callback(null,@config)
                        catch ex
                            callback(ex)
            else
                callback("illegal argument")


module.exports=MewService
module.exports.ignored_functions=ignored_functions
<commit_msg>update service.coffee<commit_after>Moment = require 'moment'

ignored_functions=["start","stop","afterConfigUpdate"]

class MewService
    constructor : (@serviceName,@mew,@config)->

    start : (callback)->
        callback()

    ping : (callback)->
        response = {
            status : "NORMAL",
            name : @mew.name,
            time : (new Moment()).format()
        }
        callback(null,response)

    stop : (callback)->
        if callback
            callback()

    afterConfigUpdate : (callback)->
        @mew.logger.debug "configure for service [#{@serviceName}] update complete"
        callback()

    configure : (key,value,callback)->
        if typeof key is 'function'
            callback = key
            return callback(null,@config)
        else
            if key
                if typeof value is 'function'
                    callback = value
                    return callback(null,@config[key])
                else if value
                    @config[key]=value
                else
                    delete @config[key]
                @mew.brain.serviceManager.persistConfig @serviceName,(err)=>
                    if err
                        callback(err)
                    else
                        try
                            @afterConfigUpdate (err)=>
                                if err
                                    callback(err)
                                else
                                    callback(null,@config)
                        catch ex
                            callback(ex)
            else
                callback("illegal argument")


module.exports=MewService
module.exports.ignored_functions=ignored_functions

{'fraction_non_alphanumeric': 0.0875, 'fraction_numerical': 0.0, 'mean_word_length': 1.1875397329942785, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6869753', 'n_tokens_mistral': 810, 'n_tokens_neox': 756, 'n_words': 179}