<commit_before>import queryParse from './util/query-parse'
import { Observable } from 'rxjs/Observable'
import 'rxjs/add/operator/do'
import 'rxjs/add/operator/map'

const HORIZON_JWT = '<PASSWORD>'

/** @this Horizon **/
export function authEndpoint(name) {
  const endpointForName = methods => {
    if (methods.hasOwnProperty(name)) {
      return methods[name]
    } else {
      throw new Error(`Unconfigured auth type: ${name}`)
    }
  }
  if (!this._authMethods) {
    return Observable.ajax(`${this._horizonPath}/auth_methods`)
      .map(ajax => ajax.response)
      .do(authMethods => {
        this._authMethods = authMethods
      }).map(endpointForName)
  } else {
    return Observable.of(this._authMethods).map(endpointForName)
  }
}

// Simple shim to make a Map look like local/session storage
export class FakeStorage {
  constructor() { this._storage = new Map() }
  setItem(a, b) { return this._storage.set(a, b) }
  getItem(a) { return this._storage.get(a) }
  removeItem(a) { return this._storage.delete(a) }
}

function getStorage(storeLocally = true) {<commit_msg>fix: use host in auth_methods fetch<commit_after>import queryParse from './util/query-parse'
import { Observable } from 'rxjs/Observable'
import 'rxjs/add/operator/do'
import 'rxjs/add/operator/map'

const HORIZON_JWT = '<PASSWORD>'

/** @this Horizon **/
export function authEndpoint(name) {
  const endpointForName = methods => {
    if (methods.hasOwnProperty(name)) {
      return methods[name]
    } else {
      throw new Error(`Unconfigured auth type: ${name}`)
    }
  }
  if (!this._authMethods) {
    return Observable.ajax(`${this._host}${this._horizonPath}/auth_methods`)
      .map(ajax => ajax.response)
      .do(authMethods => {
        this._authMethods = authMethods
      }).map(endpointForName)
  } else {
    return Observable.of(this._authMethods).map(endpointForName)
  }
}

// Simple shim to make a Map look like local/session storage
export class FakeStorage {
  constructor() { this._storage = new Map() }
  setItem(a, b) { return this._storage.set(a, b) }
  getItem(a) { return this._storage.get(a) }
  removeItem(a) { return this._storage.delete(a) }
}

function getStorage(storeLocally = true) {
{'fraction_non_alphanumeric': 0.13782196113872572, 'fraction_numerical': 0.0, 'mean_word_length': 3.740899357601713, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '1731244', 'n_tokens_mistral': 712, 'n_tokens_neox': 709, 'n_words': 161}