<commit_before>import { observable, computed, action } from 'mobx';
import { readonly } from 'core-decorators';

export default class ModelApi {

  @readonly requestsInProgress = observable.map();

  @readonly requestCounts = observable({
    read: 0,
    create: 0,
    update: 0,
    delete: 0,
    modify: 0,
  });

  @observable errors = {};

  @computed get isPending() {
    return this.requestsInProgress.size > 0;
  }

  @computed get isDeleted() {
    return this.requestCounts.delete > 0;
  }

  @computed get isPendingInitialFetch() {
    return this.isPending && !this.hasBeenFetched;
  }

  @computed get isFetchInProgress() {
    return Boolean(this.requestsInProgress.get('read'));
  }

  @computed get hasBeenFetched() {
    return Boolean(
      this.requestCounts.read > 0
    );
  }

  @computed get isFetchedOrFetching() {
    return Boolean(this.isFetchInProgress || this.hasBeenFetched);<commit_msg>add method for resonding to updates<commit_after>import { observable, computed, action } from 'mobx';
import { readonly } from 'core-decorators';

export default class ModelApi {

  @readonly requestsInProgress = observable.map();

  @readonly requestCounts = observable({
    read: 0,
    create: 0,
    update: 0,
    delete: 0,
    modify: 0,
  });

  @observable errors = {};

  @computed get isPending() {
    return this.requestsInProgress.size > 0;
  }

  @computed get isDeleted() {
    return this.requestCounts.delete > 0;
  }

  @computed get isPendingInitialFetch() {
    return this.isPending && !this.hasBeenFetched;
  }

  @computed get isFetchInProgress() {
    return Boolean(this.requestsInProgress.get('read'));
  }
  
  @computed get isWriteInProgress() {
    return Boolean(
      this.requestsInProgress.get('put') ||
        this.requestsInProgress.get('post') ||
        this.requestsInProgress.get('patch')
    );
  }

  @computed get hasBeenFetched() {
    return Boolean(
      this.requestCounts.read > 0
    );
  }

  @computed get isFetchedOrFetching() {
    return Boolean(this.isFetchInProgress || this.hasBeenFetched);
{'fraction_non_alphanumeric': 0.12065637065637065, 'fraction_numerical': 0.007722007722007722, 'mean_word_length': 3.448497854077253, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '2451577', 'n_tokens_mistral': 691, 'n_tokens_neox': 658, 'n_words': 148}