def compile(marker):
try:<EOL><INDENT>return _cache[marker]<EOL><DEDENT>except KeyError:<EOL><INDENT>pass<EOL><DEDENT>if not marker.strip():<EOL><INDENT>def marker_fn(environment=None, override=None):<EOL><INDENT>"""<STR_LIT>"""<EOL>return True<EOL><DEDENT><DEDENT>else:<EOL><INDENT>compiled_marker = compile_marker(parse_marker(marker))<EOL>def marker_fn(environment=None, override=None):<EOL><INDENT>"""<STR_LIT>"""<EOL>if override is None:<EOL><INDENT>override = {}<EOL><DEDENT>if environment is None:<EOL><INDENT>environment = default_environment()<EOL><DEDENT>environment.update(override)<EOL>return eval(compiled_marker, environment)<EOL><DEDENT><DEDENT>marker_fn.__doc__ = marker<EOL>_cache[marker] = marker_fn<EOL>return _cache[marker]<EOL>
Return compiled marker as a function accepting an environment dict.