@staticmethod
    def all():
        """
        Iterate over all processes on the system.

        Grabs a list of pids from /proc and iterates over them, skipping any
        processes which have terminated by the time they are reached in the
        iteration. The returned information is therefore not a perfect snapshot
        of system state, but we have no alternative.
        """

        for name in os.listdir("/proc"):
            m = ProcessStat.__entry_re.match(name)

            if m:
                try:
                    yield ProcessStat(int(name))
                except __HOLE__:
                    pass
dataset/ETHPy150Open borg-project/borg/borg/unix/proc.py/ProcessStat.all