# http://www.apache.org/licenses/LICENSE-2.0
# yardstick: this file is copied from rally and slightly modified
##############################################################################
+from __future__ import absolute_import
import re
import jinja2
import jinja2.meta
class TaskTemplate(object):
+
@classmethod
def render(cls, task_template, **kwargs):
"""Render jinja2 task template to Yardstick input task.
# Removing variables that have default values from
# missing. Construction that won't be properly
# check is {% set x = x or 1}
- if re.search(mis.join(["{%\s*set\s+", "\s*=\s*", "[^\w]+"]),
+ if re.search(mis.join([r"{%\s*set\s+", "\s*=\s*", r"[^\w]+"]),
task_template):
return False
# Also check for a default filter which can show up as
# a missing variable
- if re.search(mis + "\s*\|\s*default\(", task_template):
+ if re.search(mis + r"\s*\|\s*default\(", task_template):
return False
return True