<commit_before># Copyright 2014 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 re
import socket
import struct
import subprocess

from telemetry.core import forwarders
from telemetry.core import platform
from telemetry.core import util
from telemetry.core.backends import adb_commands
from telemetry.util import support_binaries

util.AddDirToPythonPath(util.GetChromiumSrcDir(), 'build', 'android')
try:
  from pylib import forwarder  # pylint: disable=F0401
  from pylib.device import device_errors  # pylint: disable=F0401
except Exception:
  forwarder = None


class AndroidForwarderFactory(forwarders.ForwarderFactory):

  def __init__(self, adb, use_rndis):
    super(AndroidForwarderFactory, self).__init__()
    self._adb = adb
    self._rndis_configurator = None
    if use_rndis:
      self._rndis_configurator = AndroidRndisConfigurator(self._adb)

  def Create(self, port_pairs):
    if self._rndis_configurator:<commit_msg>[Telemetry] We should never catch Exception.<commit_after># Copyright 2014 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 re
import socket
import struct
import subprocess

from telemetry.core import forwarders
from telemetry.core import platform
from telemetry.core import util
from telemetry.core.backends import adb_commands
from telemetry.util import support_binaries

util.AddDirToPythonPath(util.GetChromiumSrcDir(), 'build', 'android')
try:
  from pylib import forwarder  # pylint: disable=F0401
  from pylib.device import device_errors  # pylint: disable=F0401
except ImportError:
  forwarder = None


class AndroidForwarderFactory(forwarders.ForwarderFactory):

  def __init__(self, adb, use_rndis):
    super(AndroidForwarderFactory, self).__init__()
    self._adb = adb
    self._rndis_configurator = None
    if use_rndis:
      self._rndis_configurator = AndroidRndisConfigurator(self._adb)

  def Create(self, port_pairs):
    if self._rndis_configurator:
{'fraction_non_alphanumeric': 0.0651270207852194, 'fraction_numerical': 0.011085450346420323, 'mean_word_length': 5.135977337110481, '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': '5104321', 'n_tokens_mistral': 688, 'n_tokens_neox': 652, 'n_words': 206}