

@classmethod
def which(cls, progname):
    "Looks up a program in the ``PATH``. If the program is not found, raises\n        :class:`CommandNotFound <plumbum.commands.CommandNotFound>`\n\n        :param progname: The program's name. Note that if underscores (``_``) are present\n                         in the name, and the exact name is not found, they will be replaced\n                         in turn by hyphens (``-``) then periods (``.``), and the name will\n                         be looked up again for each alternative\n\n        :returns: A :class:`LocalPath <plumbum.machines.local.LocalPath>`\n        "
    alternatives = [progname]
    if ('_' in progname):
        alternatives.append(progname.replace('_', '-'))
        alternatives.append(progname.replace('_', '.'))
    for pn in alternatives:
        path = cls._which(pn)
        if path:
            return path
    raise CommandNotFound(progname, list(cls.env.path))

dataset/ETHPy150Open tomerfiliba/plumbum/plumbum/machines/local.py LocalMachine.which/original