How to use the litecli.encodingutils.text_type function in litecli

To help you get started, we’ve selected a few litecli 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 dbcli / litecli / litecli / packages / filepaths.py View on Github external
def suggest_path(root_dir):
    """List all files and subdirectories in a directory.

    If the directory is not specified, suggest root directory,
    user directory, current and parent directory.

    :param root_dir: string: directory to list
    :return: list

    """
    if not root_dir:
        return map(text_type, [os.path.abspath(os.sep), "~", os.curdir, os.pardir])

    if "~" in root_dir:
        root_dir = text_type(os.path.expanduser(root_dir))

    if not os.path.exists(root_dir):
        root_dir, _ = os.path.split(root_dir)

    return list_path(root_dir)
github dbcli / litecli / litecli / packages / filepaths.py View on Github external
def suggest_path(root_dir):
    """List all files and subdirectories in a directory.

    If the directory is not specified, suggest root directory,
    user directory, current and parent directory.

    :param root_dir: string: directory to list
    :return: list

    """
    if not root_dir:
        return map(text_type, [os.path.abspath(os.sep), "~", os.curdir, os.pardir])

    if "~" in root_dir:
        root_dir = text_type(os.path.expanduser(root_dir))

    if not os.path.exists(root_dir):
        root_dir, _ = os.path.split(root_dir)

    return list_path(root_dir)
github dbcli / litecli / litecli / main.py View on Github external
return text_type

                column_types = [get_col_type(col) for col in cur.description]

            if max_width is not None:
                cur = list(cur)

            formatted = self.formatter.format_output(
                cur,
                headers,
                format_name="vertical" if expanded else None,
                column_types=column_types,
                **output_kwargs
            )

            if isinstance(formatted, (text_type)):
                formatted = formatted.splitlines()
            formatted = iter(formatted)

            first_line = next(formatted)
            formatted = itertools.chain([first_line], formatted)

            if (
                not expanded
                and max_width
                and headers
                and cur
                and len(first_line) > max_width
            ):
                formatted = self.formatter.format_output(
                    cur,
                    headers,
github dbcli / litecli / litecli / main.py View on Github external
def get_col_type(col):
                    # col_type = FIELD_TYPES.get(col[1], text_type)
                    # return col_type if type(col_type) is type else text_type
                    return text_type