How to use the xonsh.lazyasd.lazyobject function in xonsh

To help you get started, we’ve selected a few xonsh examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xonsh / xonsh / xonsh / platform.py View on Github external
@lazyobject
def PYTHON_VERSION_INFO_BYTES():
    """The python version info tuple in a canonical bytes form."""
    return ".".join(map(str, sys.version_info)).encode()
github xonsh / xonsh / xonsh / pretty.py View on Github external
@lazyobject
def _deferred_type_pprinters():
    dtp = {}
    for_type_by_name('collections', 'defaultdict', _defaultdict_pprint, dtp=dtp)
    for_type_by_name('collections', 'OrderedDict', _ordereddict_pprint, dtp=dtp)
    for_type_by_name('collections', 'deque', _deque_pprint, dtp=dtp)
    for_type_by_name('collections', 'Counter', _counter_pprint, dtp=dtp)
    return dtp
github xonsh / xonsh / xonsh / built_ins.py View on Github external
@lazyobject
def _REDIR_REGEX():
    name = r"(o(?:ut)?|e(?:rr)?|a(?:ll)?|&?\d?)"
    return re.compile("{r}(>?>|<){r}$".format(r=name))
github xonsh / xonsh / xonsh / commands_cache.py View on Github external
@lazyobject
def HG_PREDICTOR_PARSER():
    p = argparse.ArgumentParser("hg", add_help=False)
    p.add_argument("command")
    p.add_argument(
        "-i", "--interactive", action="store_true", default=False, dest="interactive"
    )
    return p
github xonsh / xonsh / xonsh / platform.py View on Github external
@lazyobject
def BASH_COMPLETIONS_DEFAULT():
    """A possibly empty tuple with default paths to Bash completions known for
    the current platform.
    """
    if ON_LINUX or ON_CYGWIN or ON_MSYS:
        bcd = ("/usr/share/bash-completion/bash_completion",)
    elif ON_DARWIN:
        bcd = (
            "/usr/local/share/bash-completion/bash_completion",  # v2.x
            "/usr/local/etc/bash_completion",
        )  # v1.x
    elif ON_WINDOWS and git_for_windows_path():
        bcd = (
            os.path.join(
                git_for_windows_path(), "usr\\share\\bash-completion\\bash_completion"
            ),
github xonsh / xonsh / xonsh / timings.py View on Github external
@lazyobject
def clocku():
    if _HAVE_RESOURCE:

        def clocku():
            """clocku() -> floating point number
            Return the *USER* CPU time in seconds since the start of the
            process."""
            return resource.getrusage(resource.RUSAGE_SELF)[0]

    else:
        clocku = time.perf_counter
    return clocku
github donnemartin / gitsome / xonsh / lexer.py View on Github external
@lazyobject
def token_map():
    """Mapping from ``tokenize`` tokens (or token types) to PLY token types. If
    a simple one-to-one mapping from ``tokenize`` to PLY exists, the lexer will
    look it up here and generate a single PLY token of the given type.
    Otherwise, it will fall back to handling that token using one of the
    handlers in``special_handlers``.
    """
    tm = {}
    # operators
    _op_map = {
        # punctuation
        ",": "COMMA",
        ".": "PERIOD",
        ";": "SEMI",
        ":": "COLON",
        "...": "ELLIPSIS",
github xonsh / xonsh / xonsh / main.py View on Github external
@lazyobject
def parser():
    p = argparse.ArgumentParser(description="xonsh", add_help=False)
    p.add_argument(
        "-h",
        "--help",
        dest="help",
        action="store_true",
        default=False,
        help="show help and exit",
    )
    p.add_argument(
        "-V",
        "--version",
        dest="version",
        action="store_true",
        default=False,
github xonsh / xonsh / xonsh / foreign_shells.py View on Github external
@lazyobject
def FS_EXEC_ALIAS_RE():
    return re.compile(r";|`|\$\(")
github donnemartin / gitsome / xonsh / foreign_shells.py View on Github external
@lazyobject
def FS_EXEC_ALIAS_RE():
    return re.compile(r";|`|\$\(")