<commit_before>class _Provider {
  init (store, mithril, Component) {
    this.store = store;
    this.mithril = mithril;
    const comp = typeof Component === 'function' ? new Component() : Component;
    return comp;
  }
}

export const Provider = new _Provider();


function wrapView (comp, actionMap) {
  const origView = comp.view;
  comp.view = (ctrl, ...args) => {
    const nc = {...ctrl, ...actionMap};
    return origView(nc, ...args);
  };
}

export const connect = (selector, actions) => (Component) => ({
  view (controller, props, children) {
    const {dispatch, getState} = Provider.store;
    let actionMap = {};
    if (typeof actions === 'function') {
      actionMap = actions(dispatch);
    } else if (typeof actions === 'object') {
      const actionKeys = Object.keys(actions);
      for (let k of actionKeys) {
        if (typeof actions[k] === 'function') {
          actionMap[k] = (...factoryArgs) => (...args) => dispatch(actions[k](...factoryArgs, ...args));
        }
      }
    }
    const state = selector(getState());
    const comp = typeof Component === 'function' ? new Component() : Component;
    wrapView(comp, actionMap);
    return Provider.mithril.component(comp, {dispatch, ...state, ...actionMap}, children);
  }
});

export const redrawMiddleware = () => (next) => (action) => {
  next(action);<commit_msg>Fix linting.<commit_after>class _Provider {
  init (store, mithril, Component) {
    this.store = store;
    this.mithril = mithril;
    const comp = typeof Component === 'function' ? new Component() : Component;
    return comp;
  }
}

export const Provider = new _Provider();


function wrapView (comp, actionMap) {
  const origView = comp.view;
  comp.view = (ctrl, ...args) => {
    const nc = {...ctrl, ...actionMap};
    return origView(nc, ...args);
  };
}

const dispatchFactory = (creator, dispatch) => (...factoryArgs) => (...args) => dispatch(creator(...factoryArgs, ...args));

export const connect = (selector, actions) => (Component) => ({
  view (controller, props, children) {
    const {dispatch, getState} = Provider.store;
    let actionMap = {};
    if (typeof actions === 'function') {
      actionMap = actions(dispatch);
    } else if (typeof actions === 'object') {
      const actionKeys = Object.keys(actions);
      let k;
      for (k of actionKeys) {
        if (typeof actions[k] === 'function') {
          actionMap[k] = dispatchFactory(actions[k], dispatch);
        }
      }
    }
    const state = selector(getState());
    const comp = typeof Component === 'function' ? new Component() : Component;
    wrapView(comp, actionMap);
    return Provider.mithril.component(comp, {dispatch, ...state, ...actionMap}, children);
  }
});

export const redrawMiddleware = () => (next) => (action) => {
  next(action);
{'fraction_non_alphanumeric': 0.16952789699570817, 'fraction_numerical': 0.0, 'mean_word_length': 3.0595065312046446, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 20, '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': '2778757', 'n_tokens_mistral': 841, 'n_tokens_neox': 830, 'n_words': 229}