How to use the lookatme.contrib.file_loader.LineRange function in lookatme

To help you get started, we’ve selected a few lookatme 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 d0c-s4vage / lookatme / lookatme / contrib / file_loader.py View on Github external
loads = lambda data: yaml.safe_load(data)
    dumps = lambda data: yaml.safe_dump(data)


class LineRange(Schema):
    start = fields.Integer(default=0, missing=0)
    end = fields.Integer(default=None, missing=None)


class FileSchema(Schema):
    path = fields.Str()
    relative = fields.Boolean(default=True, missing=True)
    lang = fields.Str(default="auto", missing="auto")
    transform = fields.Str(default=None, missing=None)
    lines = fields.Nested(
        LineRange,
        default=LineRange().dump(LineRange()),
        missing=LineRange().dump(LineRange()),
    )

    class Meta:
        render_module = YamlRender


def transform_data(transform_shell_cmd, input_data):
    """Transform the ``input_data`` using the ``transform_shell_cmd``
    shell command.
    """
    proc = subprocess.Popen(
        transform_shell_cmd,
        shell=True,
        stdout=subprocess.PIPE,
github d0c-s4vage / lookatme / lookatme / contrib / file_loader.py View on Github external
class LineRange(Schema):
    start = fields.Integer(default=0, missing=0)
    end = fields.Integer(default=None, missing=None)


class FileSchema(Schema):
    path = fields.Str()
    relative = fields.Boolean(default=True, missing=True)
    lang = fields.Str(default="auto", missing="auto")
    transform = fields.Str(default=None, missing=None)
    lines = fields.Nested(
        LineRange,
        default=LineRange().dump(LineRange()),
        missing=LineRange().dump(LineRange()),
    )

    class Meta:
        render_module = YamlRender


def transform_data(transform_shell_cmd, input_data):
    """Transform the ``input_data`` using the ``transform_shell_cmd``
    shell command.
    """
    proc = subprocess.Popen(
        transform_shell_cmd,
        shell=True,
        stdout=subprocess.PIPE,
        stderr=subprocess.STDOUT,
        stdin=subprocess.PIPE,
github d0c-s4vage / lookatme / lookatme / contrib / file_loader.py View on Github external
dumps = lambda data: yaml.safe_dump(data)


class LineRange(Schema):
    start = fields.Integer(default=0, missing=0)
    end = fields.Integer(default=None, missing=None)


class FileSchema(Schema):
    path = fields.Str()
    relative = fields.Boolean(default=True, missing=True)
    lang = fields.Str(default="auto", missing="auto")
    transform = fields.Str(default=None, missing=None)
    lines = fields.Nested(
        LineRange,
        default=LineRange().dump(LineRange()),
        missing=LineRange().dump(LineRange()),
    )

    class Meta:
        render_module = YamlRender


def transform_data(transform_shell_cmd, input_data):
    """Transform the ``input_data`` using the ``transform_shell_cmd``
    shell command.
    """
    proc = subprocess.Popen(
        transform_shell_cmd,
        shell=True,
        stdout=subprocess.PIPE,
        stderr=subprocess.STDOUT,