<commit_before>#!/usr/bin/env python
# psutil.py

"""psutil is a module providing convenience functions for managing
processes in a portable way by using Python.
"""

import sys
import os
try:
    import pwd, grp
except ImportError:
    pwd = grp = None


# this exception get overriden by the platform specific modules if necessary
class NoSuchProcess(Exception):
    """No process was found for the given parameters."""

class AccessDenied(Exception):
    """Exception raised when permission to perform an action is denied."""


# the linux implementation has the majority of it's functionality
# implemented in python via /proc
if sys.platform.lower().startswith("linux"):
    from _pslinux import *

# the windows implementation requires the _psutil_mswindows C module
elif sys.platform.lower().startswith("win32"):
    from _psmswindows import *

# OS X implementation requires _psutil_osx C module
elif sys.platform.lower().startswith("darwin"):
    from _psosx import *

# BSD implementation requires _psutil_bsd C module
elif sys.platform.lower().startswith("freebsd"):
    from _psbsd import *
else:
    raise ImportError('no os specific module found')

_platform_impl = Impl()


class ProcessInfo(object):
    """Class that allows the process information to be passed
    between external code and psutil.  Used directly by the
    Process class.
    """

    def __init__(self, pid, ppid=None, name=None, path=None, cmdline=None,
                       uid=None, gid=None):
        self.pid = pid
        self.ppid = ppid
        self.name = name
        self.path = path
        self.cmdline = cmdline
        # if we have the cmdline but not the path, figure it out from argv[0]
        if cmdline and not path:
            self.path = os.path.dirname(cmdline[0])
        self.uid = uid
        self.gid = gid
        self.username = None
        self.groupname = None


class Process(object):
    """Represents an OS process."""

    def __init__(self, pid):
        """Create a new Process object, raises NoSuchProcess if the PID does
        not exist, and ValueError if the parameter is not an integer PID."""
        if not isinstance(pid, int):
            raise ValueError("An integer is required")
        if not pid_exists(pid):
            raise NoSuchProcess("No process found with PID %s" % pid)
        self._procinfo = ProcessInfo(pid)
        self.is_proxy = True

    def __str__(self):<commit_msg>Enabled $Id$ keyword for Python and C source code files<commit_after>#!/usr/bin/env python
# psutil.py

"""psutil is a module providing convenience functions for managing
processes in a portable way by using Python.
"""

import sys
import os
try:
    import pwd, grp
except ImportError:
    pwd = grp = None


# this exception get overriden by the platform specific modules if necessary
class NoSuchProcess(Exception):
    """No process was found for the given parameters."""

class AccessDenied(Exception):
    """Exception raised when permission to perform an action is denied."""


# the linux implementation has the majority of it's functionality
# implemented in python via /proc
if sys.platform.lower().startswith("linux"):
    from _pslinux import *

# the windows implementation requires the _psutil_mswindows C module
elif sys.platform.lower().startswith("win32"):
    from _psmswindows import *

# OS X implementation requires _psutil_osx C module
elif sys.platform.lower().startswith("darwin"):
    from _psosx import *

# BSD implementation requires _psutil_bsd C module
elif sys.platform.lower().startswith("freebsd"):
    from _psbsd import *
else:
    raise ImportError('no os specific module found')

_platform_impl = Impl()


class ProcessInfo(object):
    """Class that allows the process information to be passed
    between external code and psutil.  Used directly by the
    Process class.
    """

    def __init__(self, pid, ppid=None, name=None, path=None, cmdline=None,
                       uid=None, gid=None, username=None, groupname=None):
        self.pid = pid
        self.ppid = ppid
        self.name = name
        self.path = path
        self.cmdline = cmdline
        # if we have the cmdline but not the path, figure it out from argv[0]
        if cmdline and not path:
            self.path = os.path.dirname(cmdline[0])
        self.uid = uid
        self.gid = gid
        self.username = username
        self.groupname = groupname


class Process(object):
    """Represents an OS process."""

    def __init__(self, pid):
        """Create a new Process object, raises NoSuchProcess if the PID does
        not exist, and ValueError if the parameter is not an integer PID."""
        if not isinstance(pid, int):
            raise ValueError("An integer is required")
        if not pid_exists(pid):
            raise NoSuchProcess("No process found with PID %s" % pid)
        self._procinfo = ProcessInfo(pid)
        self.is_proxy = True

    def __str__(self):
{'fraction_non_alphanumeric': 0.08589951377633712, 'fraction_numerical': 0.0016207455429497568, 'mean_word_length': 3.0269168026101143, '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': '758137', 'n_tokens_mistral': 1372, 'n_tokens_neox': 1351, 'n_words': 526}