<commit_before>
import * as tangojs from 'tangojs-core'
import { DeviceTreeInspector } from './DeviceTreeInspector'

/** @private */
const asRegex = (pattern) => new RegExp(pattern.replace('*', '.*'), 'g')

/**
 * In-memory connector implementation.
 */
export class LocalConnector extends tangojs.Connector {

  /**
   * @param {Object} model
   * @param {DeviceTreeInspector} treeInspector
   */
  constructor (model, inspector) {
    super()
    /** @private */
    this._model = model
    /** @private */
    this._tree = inspector || new DeviceTreeInspector(model)
  }

  /**
   * @param {string} devname
   * @return {Promise<string,Error>}
   */
  get_device_status (devname) {
    return this._tree.getDevice(devname)
      .then(device => device.get_status())
  }

  /**
   * @param {string} devname
   * @return {Promise<DevState,Error>}
   */
  get_device_state (devname) {
    return this._tree.getDevice(devname)
      .then(device => device.get_state())
  }<commit_msg>Compliant with the get-database request on the core<commit_after>
import * as tangojs from 'tangojs-core'
import { DeviceTreeInspector } from './DeviceTreeInspector'

/** @private */
const asRegex = (pattern) => new RegExp(pattern.replace('*', '.*'), 'g')

/**
 * In-memory connector implementation.
 */
export class LocalConnector extends tangojs.Connector {

  /**
   * @param {Object} model
   * @param {DeviceTreeInspector} treeInspector
   */
  constructor (model, inspector) {
    super()
    /** @private */
    this._model = model
    /** @private */
    this._tree = inspector || new DeviceTreeInspector(model)
  }

  /**
   * Database default name 
   * @return {Promise<string,Error>}
   */
  get_database () {
    return Promise.resolve("sys/database/2")
      
  }

  /**
   * @param {string} devname
   * @return {Promise<string,Error>}
   */
  get_device_status (devname) {
    return this._tree.getDevice(devname)
      .then(device => device.get_status())
  }

  /**
   * @param {string} devname
   * @return {Promise<DevState,Error>}
   */
  get_device_state (devname) {
    return this._tree.getDevice(devname)
      .then(device => device.get_state())
  }
{'fraction_non_alphanumeric': 0.15430954587581094, 'fraction_numerical': 0.0004633920296570899, 'mean_word_length': 3.2250489236790605, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 14, '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': '3824331', 'n_tokens_mistral': 706, 'n_tokens_neox': 693, 'n_words': 145}