How to use the kibitzr.transformer.utils.bake_parametrized function in kibitzr

To help you get started, we’ve selected a few kibitzr 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 kibitzr / kibitzr / kibitzr / transformer / plain_text.py View on Github external
def register():
    return {
        'changes': changes_transform_factory,
        'python': bake_parametrized(python_transform, pass_conf=True),
        'bash': bake_parametrized(bash_transform),
        'shell': bake_parametrized(bash_transform),
    }
github kibitzr / kibitzr / kibitzr / transformer / html.py View on Github external
def register():
    """
    Return dictionary of tranform factories
    """
    registry = {
        key: bake_html(key)
        for key in ('css', 'css-all', 'tag', 'text')
    }
    registry['xpath'] = bake_parametrized(xpath_selector, select_all=False)
    registry['xpath-all'] = bake_parametrized(xpath_selector, select_all=True)
    return registry
github kibitzr / kibitzr / kibitzr / transformer / json_transforms.py View on Github external
command = jq(query, _in=text)
        if not command.stderr:
            success, result = True, command.stdout.decode('utf-8')
        else:
            success, result = False, command.stderr.decode('utf-8')
    except sh.ErrorReturnCode as exc:
        logger.exception("jq failure")
        success, result = False, exc.stderr
    logger.debug("jq transform success: %r, content: %r",
                 success, result)
    return success, result


JSON_REGISTRY = {
    'json': wrap_dummy(pretty_json),
    'jq': bake_parametrized(run_jq),
}
github kibitzr / kibitzr / kibitzr / transformer / plain_text.py View on Github external
def register():
    return {
        'changes': changes_transform_factory,
        'python': bake_parametrized(python_transform, pass_conf=True),
        'bash': bake_parametrized(bash_transform),
        'shell': bake_parametrized(bash_transform),
    }
github kibitzr / kibitzr / kibitzr / transformer / xpath.py View on Github external
def register():
    """
    Return dictionary of transform factories
    """
    registry = {
        'xpath': bake_parametrized(xpath_selector, select_all=False),
        'xpath-all': bake_parametrized(xpath_selector, select_all=True)
    }
    return registry