<commit_before>import sys
from types import ModuleType

__ALIASES__ = {"unionfs": ["unionfs_fuse", "unionfs"]}


class CommandAlias(ModuleType):
    """ Module-hack, adapted from plumbum. """
    __all__ = ()
    __package__ = __name__

    def __getattr__(self, command):
        """ Proxy getter for plumbum commands."""
        from plumbum import local
        check = [command]
        if command in __ALIASES__:
            check = __ALIASES__[command]

        for alias_command in check:
            try:
                return local[alias_command]
            except AttributeError:
                pass
        raise AttributeError(command)

    __path__ = []
    __file__ = __file__


cmd = CommandAlias(__name__ + ".cmd", CommandAlias.__doc__)
sys.modules[cmd.__name__] = cmd

del sys
del ModuleType
del CommandAlias
<commit_msg>cmd: adjust PATH & LD_LIBRARY_PATH<commit_after>import sys
from types import ModuleType

__ALIASES__ = {"unionfs": ["unionfs_fuse", "unionfs"]}


class CommandAlias(ModuleType):
    """ Module-hack, adapted from plumbum. """
    __all__ = ()
    __package__ = __name__

    def __getattr__(self, command):
        """ Proxy getter for plumbum commands."""
        from os import getenv
        from plumbum import local
        from benchbuild.settings import CFG
        from benchbuild.utils.path import list_to_path
        from benchbuild.utils.path import path_to_list
        import logging

        log = logging.getLogger("benchbuild")
        check = [command]
        if command in __ALIASES__:
            check = __ALIASES__[command]

        path = path_to_list(getenv("PATH", default=""))
        path = CFG["env"]["binary_path"].value() + path

        libs_path = path_to_list(getenv("LD_LIBRARY_PATH", default=""))
        libs_path = CFG["env"]["binary_ld_library_path"].value() + libs_path

        for alias_command in check:
            try:
                cmd = local[alias_command]
                cmd = cmd.with_env(
                    PATH=list_to_path(path),
                    LD_LIBRARY_PATH=list_to_path(libs_path))
                return cmd
            except AttributeError:
                pass
        raise AttributeError(command)

    __path__ = []
    __file__ = __file__


cmd = CommandAlias(__name__ + ".cmd", CommandAlias.__doc__)
sys.modules[cmd.__name__] = cmd

del sys
del ModuleType
del CommandAlias

{'fraction_non_alphanumeric': 0.09338358458961474, 'fraction_numerical': 0.0, 'mean_word_length': 2.46231884057971, 'pattern_counts': {'":': 2, '<': 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': '941443', 'n_tokens_mistral': 723, 'n_tokens_neox': 695, 'n_words': 173}