<commit_before>import { ApolloClient } from 'apollo-client';
import { isEqual } from 'apollo-utilities';
import { invariant } from 'ts-invariant';
import {
  ApolloContextValue,
  parser,
  DocumentType,
  operationName
} from '@apollo/react-common';
import { DocumentNode } from 'graphql';

import { CommonOptions } from '../types';

export abstract class OperationData<TOptions = any> {
  private _isMounted: boolean = true;
  private _options: CommonOptions<TOptions> = {} as CommonOptions<TOptions>;
  private _previousOptions: CommonOptions<TOptions> = {} as CommonOptions<
    TOptions
  >;
  private _context: ApolloContextValue = {};
  private _client: ApolloClient<object> | undefined;

  constructor(options?: CommonOptions<TOptions>, context?: ApolloContextValue) {
    this._options = options || ({} as CommonOptions<TOptions>);
    this._context = context || {};
  }

  get isMounted(): boolean {
    return this._isMounted;
  }

  set isMounted(mounted: boolean) {
    this._isMounted = mounted;
  }

  get options(): CommonOptions<TOptions> {
    return this._options;
  }

  set options(newOptions: CommonOptions<TOptions>) {
    if (!isEqual(this.options, newOptions)) {
      this.previousOptions = this.options;
    }
    this._options = newOptions;
  }

  get previousOptions(): CommonOptions<TOptions> {
    return this._previousOptions;
  }

  set previousOptions(newOptions: CommonOptions<TOptions>) {
    this._previousOptions = newOptions;
  }

  get context(): ApolloContextValue {
    return this._context;
  }

  set context(newContext: ApolloContextValue) {
    this._context = newContext;
  }

  get client(): ApolloClient<object> | undefined {
    return this._client;
  }

  set client(newClient: ApolloClient<object> | undefined) {
    this._client = newClient;
  }

  public abstract execute(...args: any): any;
  public abstract afterExecute(...args: any): () => void;

  protected abstract cleanup(): void;

  protected unmount() {
    this.isMounted = false;
  }

  protected refreshClient() {
    const client =
      (this.options && this.options.client) ||
      (this.context && this.context.client);<commit_msg>Drop getters/setters for simple properties<commit_after>import { ApolloClient } from 'apollo-client';
import { isEqual } from 'apollo-utilities';
import { invariant } from 'ts-invariant';
import {
  ApolloContextValue,
  parser,
  DocumentType,
  operationName
} from '@apollo/react-common';
import { DocumentNode } from 'graphql';

import { CommonOptions } from '../types';

export abstract class OperationData<TOptions = any> {
  public isMounted: boolean = true;
  public previousOptions: CommonOptions<TOptions> = {} as CommonOptions<
    TOptions
  >;
  public context: ApolloContextValue = {};
  public client: ApolloClient<object> | undefined;

  private _options: CommonOptions<TOptions> = {} as CommonOptions<TOptions>;

  constructor(options?: CommonOptions<TOptions>, context?: ApolloContextValue) {
    this._options = options || ({} as CommonOptions<TOptions>);
    this.context = context || {};
  }

  get options(): CommonOptions<TOptions> {
    return this._options;
  }

  set options(newOptions: CommonOptions<TOptions>) {
    if (!isEqual(this.options, newOptions)) {
      this.previousOptions = this.options;
    }
    this._options = newOptions;
  }

  public abstract execute(...args: any): any;
  public abstract afterExecute(...args: any): () => void;

  protected abstract cleanup(): void;

  protected unmount() {
    this.isMounted = false;
  }

  protected refreshClient() {
    const client =
      (this.options && this.options.client) ||
      (this.context && this.context.client);
{'fraction_non_alphanumeric': 0.1246250340878102, 'fraction_numerical': 0.0, 'mean_word_length': 4.045392022008253, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 29, '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': '1774960', 'n_tokens_mistral': 1098, 'n_tokens_neox': 1043, 'n_words': 255}