<commit_before># Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import logging
import os
import sys

from telemetry import decorators
from telemetry.core import bitmap
from telemetry.core import exceptions
from telemetry.core import util
from telemetry.core.backends.chrome import inspector_console
from telemetry.core.backends.chrome import inspector_memory
from telemetry.core.backends.chrome import inspector_network
from telemetry.core.backends.chrome import inspector_page
from telemetry.core.backends.chrome import inspector_runtime
from telemetry.core.backends.chrome import inspector_timeline
from telemetry.core.backends.chrome import inspector_websocket
from telemetry.core.backends.chrome import websocket
from telemetry.core.heap import model
from telemetry.timeline import model as timeline_model
from telemetry.timeline import recording_options


class InspectorException(Exception):
  pass


class InspectorBackend(inspector_websocket.InspectorWebsocket):
  def __init__(self, browser_backend, context, timeout=60):
    super(InspectorBackend, self).__init__(self._HandleError)
    self.RegisterDomain('Inspector', self._HandleInspectorDomainNotification)

    self._browser_backend = browser_backend
    self._context = context

    logging.debug('InspectorBackend._Connect() to %s', self.debugger_url)
    try:
      self.Connect(self.debugger_url)
    except (websocket.WebSocketException, util.TimeoutException):
      err_msg = sys.exc_info()[1]
      if not self._browser_backend.IsAppRunning():
        raise exceptions.BrowserGoneException(self.app, err_msg)
      elif not self._browser_backend.HasBrowserFinishedLaunching():
        raise exceptions.BrowserConnectionGoneException(self.app, err_msg)
      else:
        raise exceptions.TabCrashException(self.app, err_msg)

    self._console = inspector_console.InspectorConsole(self)
    self._memory = inspector_memory.InspectorMemory(self)
    self._page = inspector_page.InspectorPage(self, timeout=timeout)
    self._runtime = inspector_runtime.InspectorRuntime(self)
    self._timeline = inspector_timeline.InspectorTimeline(self)<commit_msg>TabCrashException renamed to DevtoolsTargetCrashException.<commit_after># Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import logging
import os
import sys

from telemetry import decorators
from telemetry.core import bitmap
from telemetry.core import exceptions
from telemetry.core import util
from telemetry.core.backends.chrome import inspector_console
from telemetry.core.backends.chrome import inspector_memory
from telemetry.core.backends.chrome import inspector_network
from telemetry.core.backends.chrome import inspector_page
from telemetry.core.backends.chrome import inspector_runtime
from telemetry.core.backends.chrome import inspector_timeline
from telemetry.core.backends.chrome import inspector_websocket
from telemetry.core.backends.chrome import websocket
from telemetry.core.heap import model
from telemetry.timeline import model as timeline_model
from telemetry.timeline import recording_options


class InspectorException(Exception):
  pass


class InspectorBackend(inspector_websocket.InspectorWebsocket):
  def __init__(self, browser_backend, context, timeout=60):
    super(InspectorBackend, self).__init__(self._HandleError)
    self.RegisterDomain('Inspector', self._HandleInspectorDomainNotification)

    self._browser_backend = browser_backend
    self._context = context

    logging.debug('InspectorBackend._Connect() to %s', self.debugger_url)
    try:
      self.Connect(self.debugger_url)
    except (websocket.WebSocketException, util.TimeoutException):
      err_msg = sys.exc_info()[1]
      if not self._browser_backend.IsAppRunning():
        raise exceptions.BrowserGoneException(self.app, err_msg)
      elif not self._browser_backend.HasBrowserFinishedLaunching():
        raise exceptions.BrowserConnectionGoneException(self.app, err_msg)
      else:
        raise exceptions.DevtoolsTargetCrashException(self.app, err_msg)

    self._console = inspector_console.InspectorConsole(self)
    self._memory = inspector_memory.InspectorMemory(self)
    self._page = inspector_page.InspectorPage(self, timeout=timeout)
    self._runtime = inspector_runtime.InspectorRuntime(self)
    self._timeline = inspector_timeline.InspectorTimeline(self)
{'fraction_non_alphanumeric': 0.06818181818181818, 'fraction_numerical': 0.003089143865842895, 'mean_word_length': 5.503586800573888, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6201213', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1200, 'n_words': 306}