<commit_before>'use strict';

import path from 'path';

/**
 * Base Class
 * @param  {Object} http
 * @return {Class}
 */
export default class {
  /**
   * constructor
   * @param  {Object} http []
   * @return {}      []
   */
  constructor(...args){
    this.init(...args);
  }
  /**
   * init
   * @param  {Object} http []
   * @return {}      []
   */
  init(){
    
  }
  /**
   * before magic method
   * @return {} []
   */
  __before(){

  }
  /**
   * after magic method
   * @return {} []
   */
  __after(){

  }
  /**
   * invoke method, support __before & __after magic methods
   * @param  {String} method []
   * @param  {mixed} data []
   * @return {Promise}     []
   */
  async invoke(method, ...data){
    if (think.isFunction(this.__before)) {
      await think.co.wrap(this.__before).bind(this)(this);
    }
    let result = await think.co.wrap(this[method]).apply(this, data);
    if (think.isFunction(this.__after)) {
      await think.co.wrap(this.__after).bind(this)(this);
    }
    return result;
  }
  /**
   * get current class filename
   * @return {} []
   */
  filename(){
    let filename = this.__filename || __filename;
    return path.basename(filename, '.js');
  }
  /**
   * merge config, support adapter config
   * @param  {} configs []
   * @return {}            []
   */
  mergeConfig(...configs){
    let config = think.extend({}, ...configs);
    if(config.type && config.adapter){
      let adapterConfig = config.adapter[config.type];
      config = think.extend(config, adapterConfig);
    }
    return config;
  }
}<commit_msg>delete adapter config after merge<commit_after>'use strict';

import path from 'path';

/**
 * Base Class
 * @param  {Object} http
 * @return {Class}
 */
export default class {
  /**
   * constructor
   * @param  {Object} http []
   * @return {}      []
   */
  constructor(...args){
    this.init(...args);
  }
  /**
   * init
   * @param  {Object} http []
   * @return {}      []
   */
  init(){
    
  }
  /**
   * before magic method
   * @return {} []
   */
  __before(){

  }
  /**
   * after magic method
   * @return {} []
   */
  __after(){

  }
  /**
   * invoke method, support __before & __after magic methods
   * @param  {String} method []
   * @param  {mixed} data []
   * @return {Promise}     []
   */
  async invoke(method, ...data){
    if (think.isFunction(this.__before)) {
      await think.co.wrap(this.__before).bind(this)(this);
    }
    let result = await think.co.wrap(this[method]).apply(this, data);
    if (think.isFunction(this.__after)) {
      await think.co.wrap(this.__after).bind(this)(this);
    }
    return result;
  }
  /**
   * get current class filename
   * @return {} []
   */
  filename(){
    let filename = this.__filename || __filename;
    return path.basename(filename, '.js');
  }
  /**
   * merge config, support adapter config
   * @param  {} configs []
   * @return {}            []
   */
  mergeConfig(...configs){
    let config = think.extend({}, ...configs);
    if(config.type && config.adapter){
      let adapterConfig = config.adapter[config.type];
      config = think.extend(config, adapterConfig);
      delete config.adapter;
    }
    return config;
  }
}
{'fraction_non_alphanumeric': 0.17766656240225212, 'fraction_numerical': 0.0, 'mean_word_length': 2.2699386503067487, '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': '2592435', 'n_tokens_mistral': 1044, 'n_tokens_neox': 1040, 'n_words': 222}