<commit_before>import { ImmutableList } from './core';
import { Diagnostic} from '@openmicrostep/msbuildsystem.shared';

export class Result<T = any> {
  _items: Result.Item[];
  _values: T[] = [];
  _diagnostics: Diagnostic[] = [];

  static toDiagItems(diagnostics: Diagnostic[]) : Result.ItemDiagnostic[] {
    return diagnostics.map((d: Result.ItemDiagnostic) => { d.is = "diagnostic"; return d; });
  }

  static fromDiagnostics<T = any>(diagnostics: Diagnostic[]) : Result<T> {
    return new Result(this.toDiagItems(diagnostics));
  }

  static fromDiagnosticsAndValue<T>(diagnostics: Diagnostic[], value: T) : Result<T> {
    return new Result([...this.toDiagItems(diagnostics), { is: "value", value: value }]);
  }

  static fromValue<T>(value: T) : Result<T> {
    return new Result([{ is: "value", value: value }]);
  }<commit_msg>core: mark Result attribute "internals"<commit_after>import { ImmutableList } from './core';
import { Diagnostic} from '@openmicrostep/msbuildsystem.shared';

export class Result<T = any> {
  /** @internal */ _items: Result.Item[];
  /** @internal */ _values: T[] = [];
  /** @internal */ _diagnostics: Diagnostic[] = [];

  static toDiagItems(diagnostics: Diagnostic[]) : Result.ItemDiagnostic[] {
    return diagnostics.map((d: Result.ItemDiagnostic) => { d.is = "diagnostic"; return d; });
  }

  static fromDiagnostics<T = any>(diagnostics: Diagnostic[]) : Result<T> {
    return new Result(this.toDiagItems(diagnostics));
  }

  static fromDiagnosticsAndValue<T>(diagnostics: Diagnostic[], value: T) : Result<T> {
    return new Result([...this.toDiagItems(diagnostics), { is: "value", value: value }]);
  }

  static fromValue<T>(value: T) : Result<T> {
    return new Result([{ is: "value", value: value }]);
  }
{'fraction_non_alphanumeric': 0.17546848381601363, 'fraction_numerical': 0.0, 'mean_word_length': 4.647435897435898, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, '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': '6862147', 'n_tokens_mistral': 565, 'n_tokens_neox': 549, 'n_words': 129}