Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
class FloorDivExpression(BinaryExpression):
"""
{{ foo // bar }}
"""
class AddExpression(BinaryExpression):
"""
{{ foo + bar }}
"""
class SubExpression(BinaryExpression):
"""
{{ foo - bar }}
"""
class ModExpression(BinaryExpression):
"""
{{ foo % bar }}
"""
class PowExpression(BinaryExpression):
"""
{{ foo ** bar }}
"""
return [self.expr] + list(chain(*self.ops))
def __repr__(self):
return 'CompareExpression(%r, %r)' % (
self.expr,
self.ops
)
class MulExpression(BinaryExpression):
"""
{{ foo * bar }}
"""
class DivExpression(BinaryExpression):
"""
{{ foo / bar }}
"""
class FloorDivExpression(BinaryExpression):
"""
{{ foo // bar }}
"""
class AddExpression(BinaryExpression):
"""
{{ foo + bar }}
"""
def __init__(self, expr, ops, lineno=None, filename=None):
Expression.__init__(self, lineno, filename)
self.expr = expr
self.ops = ops
def get_items(self):
return [self.expr] + list(chain(*self.ops))
def __repr__(self):
return 'CompareExpression(%r, %r)' % (
self.expr,
self.ops
)
class MulExpression(BinaryExpression):
"""
{{ foo * bar }}
"""
class DivExpression(BinaryExpression):
"""
{{ foo / bar }}
"""
class FloorDivExpression(BinaryExpression):
"""
{{ foo // bar }}
"""
)
class MulExpression(BinaryExpression):
"""
{{ foo * bar }}
"""
class DivExpression(BinaryExpression):
"""
{{ foo / bar }}
"""
class FloorDivExpression(BinaryExpression):
"""
{{ foo // bar }}
"""
class AddExpression(BinaryExpression):
"""
{{ foo + bar }}
"""
class SubExpression(BinaryExpression):
"""
{{ foo - bar }}
"""
"""
class DivExpression(BinaryExpression):
"""
{{ foo / bar }}
"""
class FloorDivExpression(BinaryExpression):
"""
{{ foo // bar }}
"""
class AddExpression(BinaryExpression):
"""
{{ foo + bar }}
"""
class SubExpression(BinaryExpression):
"""
{{ foo - bar }}
"""
class ModExpression(BinaryExpression):
"""
{{ foo % bar }}
"""
def init(self, builder):
self.templates = {}
base_templates_path = path.join(path.dirname(__file__), 'templates')
ext_templates_path = [path.join(builder.confdir, dir)
for dir in builder.config.templates_path]
self.templates_path = [base_templates_path] + ext_templates_path
loader = SphinxFileSystemLoader(base_templates_path, ext_templates_path)
if builder.translator is not None:
self.jinja_env = TranslatorEnvironment(loader=loader,
friendly_traceback=False, translator=builder.translator)
else:
self.jinja_env = Environment(loader=loader,
# disable traceback, more likely that something
# in the application is broken than in the templates
friendly_traceback=False)
def format_template(template, **kw):
return jinja.from_string(template, **kw)
def format_template(template, **kw):
return jinja.from_string(template, **kw)
def format_template(template, **kw):
return jinja.from_string(template, **kw)
def format_template(template, **kw):
return jinja.from_string(template, **kw)