<commit_before>class MyNinja
    constructor: (params) ->
        @_dataSourceName = params?.dataSourceName ? 'default'
        @_table = params?.table
        @_primaryKey = params?.primaryKey ? 'id'
        @_validate = params?.validate

    init: ->
        @_mysql = @component 'DataSource.MySQL', @_dataSourceName
        @_validator = @component 'Validator', validate: @_validate
        @_cherries = @component 'Cherries'
        @$ = @component 'QueryBuilder'

    # Bind all methods from MyNinja into the model instance (expect for init() and bind() itself)
    bind: (model) ->
        methodsToBind = ['findById', 'find', 'findAll', 'removeAll', 'removeById', 'remove', 'query', 'updateAll', 'save']
        for methodName in methodsToBind
            ninjaMethod = @[methodName]
            ((ninjaMethod) =>
                model[methodName] = =>
                    return ninjaMethod.apply(@, arguments)
            )(ninjaMethod)

    # Finds a single record using the primary key
    # @param {object} id The record id
    # @param {function} callback Called when the operation is completed (error, result)
    findById: (id, callback) ->
        sql = @$.selectStarFrom(@_table).where(
            @$.equal(@_primaryKey, @$.value(id))
        ).limit(1).build()

        @_mysql.query sql, [], (error, result) ->
            return callback(error) if error<commit_msg>MyNinja DataSource bug fixed.<commit_after>class MyNinja
    constructor: (params) ->
        @_dataSourceName = params?.dataSourceName ? 'default'
        @_table = params?.table
        @_primaryKey = params?.primaryKey ? 'id'
        @_validate = params?.validate

    init: ->
        @_mysql = @component 'DataSource.MySQL'
        @_mysql.setDataSource @_dataSourceName
        @_validator = @component 'Validator', validate: @_validate
        @_cherries = @component 'Cherries'
        @$ = @component 'QueryBuilder'

    # Bind all methods from MyNinja into the model instance (expect for init() and bind() itself)
    bind: (model) ->
        methodsToBind = ['findById', 'find', 'findAll', 'removeAll', 'removeById', 'remove', 'query', 'updateAll', 'save']
        for methodName in methodsToBind
            ninjaMethod = @[methodName]
            ((ninjaMethod) =>
                model[methodName] = =>
                    return ninjaMethod.apply(@, arguments)
            )(ninjaMethod)

    # Finds a single record using the primary key
    # @param {object} id The record id
    # @param {function} callback Called when the operation is completed (error, result)
    findById: (id, callback) ->
        sql = @$.selectStarFrom(@_table).where(
            @$.equal(@_primaryKey, @$.value(id))
        ).limit(1).build()

        @_mysql.query sql, [], (error, result) ->
            return callback(error) if error
{'fraction_non_alphanumeric': 0.1299254526091587, 'fraction_numerical': 0.0007099751508697196, 'mean_word_length': 2.55359394703657, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '3950257', 'n_tokens_mistral': 804, 'n_tokens_neox': 780, 'n_words': 221}