<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.
"""A wrapper around ssh for common operations on a CrOS-based device"""
from __future__ import absolute_import
import logging
import os
import posixpath
import re
import shutil
import stat
import subprocess
import tempfile
import time

from devil.utils import cmd_helper
from telemetry.util import cmd_util

# Some developers' workflow includes running the Chrome process from
# /usr/local/... instead of the default location. We have to check for both
# paths in order to support this workflow.
_CHROME_PROCESS_REGEX = [re.compile(r'^/opt/google/chrome/chrome '),
                         re.compile(r'^/usr/local/?.*/chrome/chrome ')]

_CHROME_MOUNT_NAMESPACE_PATH = "/run/namespaces/mnt_chrome"

_IGNORE_FILETYPES_FOR_MINIDUMP_PULLS = [
    '.lock',
    '.dat',
]


def RunCmd(args, cwd=None, quiet=False):
  return cmd_util.RunCmd(args, cwd, quiet)


def GetAllCmdOutput(args, cwd=None, quiet=False):
  return cmd_util.GetAllCmdOutput(args, cwd, quiet)


def StartCmd(args, cwd=None, quiet=False):
  return cmd_util.StartCmd(args, cwd, quiet)


def HasSSH():
  return cmd_util.HasSSH()


class LoginException(Exception):
  pass


class KeylessLoginRequiredException(LoginException):
  pass


class DNSFailureException(LoginException):
  pass


def _Unquote(s):
  """Removes any trailing/leading single/double quotes from a string.

  No-ops if the given object is not a string or otherwise does not have a
  .strip() method.
<commit_msg>[telemetry] decode bytes to string after reading from command lines<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.
"""A wrapper around ssh for common operations on a CrOS-based device"""
from __future__ import absolute_import
import logging
import os
import posixpath
import re
import shutil
import stat
import subprocess
import tempfile
import time

from devil.utils import cmd_helper
from telemetry.util import cmd_util

# Some developers' workflow includes running the Chrome process from
# /usr/local/... instead of the default location. We have to check for both
# paths in order to support this workflow.
_CHROME_PROCESS_REGEX = [re.compile(r'^/opt/google/chrome/chrome '),
                         re.compile(r'^/usr/local/?.*/chrome/chrome ')]

_CHROME_MOUNT_NAMESPACE_PATH = "/run/namespaces/mnt_chrome"

_IGNORE_FILETYPES_FOR_MINIDUMP_PULLS = [
    '.lock',
    '.dat',
]


def RunCmd(args, cwd=None, quiet=False):
  return cmd_util.RunCmd(args, cwd, quiet)


def GetAllCmdOutput(args, cwd=None, quiet=False):
  # GetAllCmdOutput returns bytes on Python 3. As the downstream codes are
  # expecting strings, we decode the inpout here.
  stdout, stderr = cmd_util.GetAllCmdOutput(args, cwd, quiet)
  return (stdout.decode('utf-8'), stderr.decode('utf-8'))


def StartCmd(args, cwd=None, quiet=False):
  return cmd_util.StartCmd(args, cwd, quiet)


def HasSSH():
  return cmd_util.HasSSH()


class LoginException(Exception):
  pass


class KeylessLoginRequiredException(LoginException):
  pass


class DNSFailureException(LoginException):
  pass


def _Unquote(s):
  """Removes any trailing/leading single/double quotes from a string.

  No-ops if the given object is not a string or otherwise does not have a
  .strip() method.

{'fraction_non_alphanumeric': 0.08785529715762273, 'fraction_numerical': 0.003158196956646569, 'mean_word_length': 4.435257410296412, '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': '5925653', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1056, 'n_words': 369}