How to use the kibitzr.stash.LazyStash 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 / jinja_transform.py View on Github external
def context(self, content):
        html = LazyHTML(content)
        xml = LazyXML(content)
        return {
            'conf': self.conf,
            'stash': LazyStash(),
            'content': content,
            'lines': content.splitlines(),
            'json': LazyJSON(content),
            'css': html.css,
            'xpath': xml.xpath,
            'env': os.environ,
        }
github kibitzr / kibitzr / kibitzr / fetcher / script.py View on Github external
def fetch_by_python(code, conf):
    logger.info("Fetch using Python script")
    logger.debug(code)
    assert 'content' in code, PYTHON_ERROR
    try:
        # ok, content = False, None
        namespace = {'ok': True}
        context = {
            'conf': conf,
            'stash': LazyStash(),
            'creds': settings().creds,
        }
        exec(code, context, namespace)
        return namespace['ok'], namespace['content']
    except:
        logger.exception("Python fetcher raised an Exception")
        return False, traceback.format_exc()
github kibitzr / kibitzr / kibitzr / notifier / custom.py View on Github external
def __call__(self, report):
        context = dict(
            self.context,
            text=report,  # legacy
            content=report,
            stash=LazyStash(),
        )
        logger.info("Executing Python notifier")
        logger.debug(self.code)
        exec(self.code, context)
github kibitzr / kibitzr / kibitzr / transformer / plain_text.py View on Github external
def python_transform(code, content, conf):
    logger.info("Python transform")
    logger.debug(code)
    assert 'content' in code, PYTHON_ERROR
    try:
        namespace = {'ok': True, 'content': content}
        context = {
            'conf': conf,
            'stash': LazyStash(),
            'creds': settings().creds,
        }
        exec(code, context, namespace)
        return namespace['ok'], six.text_type(namespace['content'])
    except:
        logger.exception("Python transform raised an Exception")
        return False, traceback.format_exc()