def export_tour(tour_steps, name=None, filename="<STR_LIT>", url=None):
if not name:<EOL><INDENT>name = "<STR_LIT:default>"<EOL><DEDENT>if name not in tour_steps:<EOL><INDENT>raise Exception("<STR_LIT>" % name)<EOL><DEDENT>if not filename.endswith('<STR_LIT>'):<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>if not url:<EOL><INDENT>url = "<STR_LIT>"<EOL><DEDENT>tour_type = None<EOL>if "<STR_LIT>" in tour_steps[name][<NUM_LIT:0>]:<EOL><INDENT>tour_type = "<STR_LIT>"<EOL><DEDENT>elif "<STR_LIT>" in tour_steps[name][<NUM_LIT:0>]:<EOL><INDENT>tour_type = "<STR_LIT>"<EOL><DEDENT>elif "<STR_LIT>" in tour_steps[name][<NUM_LIT:0>]:<EOL><INDENT>tour_type = "<STR_LIT>"<EOL><DEDENT>elif "<STR_LIT>" in tour_steps[name][<NUM_LIT:0>]:<EOL><INDENT>tour_type = "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>instructions = (<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>'''<EOL>'''<STR_LIT>''' % (url, url))<EOL>if tour_type == "<STR_LIT>":<EOL><INDENT>jquery_js = constants.JQuery.MIN_JS<EOL>bootstrap_tour_css = constants.BootstrapTour.MIN_CSS<EOL>bootstrap_tour_js = constants.BootstrapTour.MIN_JS<EOL>backdrop_style = style_sheet.bt_backdrop_style<EOL>backdrop_style = backdrop_style.replace('<STR_LIT:\n>', '<STR_LIT>')<EOL>backdrop_style = js_utils.escape_quotes_if_needed(backdrop_style)<EOL>instructions += '<STR_LIT>' % jquery_js<EOL>instructions += '<STR_LIT>'<EOL>instructions += '<STR_LIT>' % bootstrap_tour_css<EOL>instructions += '<STR_LIT>' % backdrop_style<EOL>instructions += '<STR_LIT>' % bootstrap_tour_js<EOL><DEDENT>elif tour_type == "<STR_LIT>":<EOL><INDENT>hopscotch_css = constants.Hopscotch.MIN_CSS<EOL>hopscotch_js = constants.Hopscotch.MIN_JS<EOL>backdrop_style = style_sheet.hops_backdrop_style<EOL>backdrop_style = backdrop_style.replace('<STR_LIT:\n>', '<STR_LIT>')<EOL>backdrop_style = js_utils.escape_quotes_if_needed(backdrop_style)<EOL>instructions += '<STR_LIT>' % hopscotch_css<EOL>instructions += '<STR_LIT>' % backdrop_style<EOL>instructions += '<STR_LIT>' % hopscotch_js<EOL><DEDENT>elif tour_type == "<STR_LIT>":<EOL><INDENT>intro_css = constants.IntroJS.MIN_CSS<EOL>intro_js = constants.IntroJS.MIN_JS<EOL>instructions += '<STR_LIT>' % intro_css<EOL>instructions += '<STR_LIT>' % intro_js<EOL><DEDENT>elif tour_type == "<STR_LIT>":<EOL><INDENT>jquery_js = constants.JQuery.MIN_JS<EOL>shepherd_js = constants.Shepherd.MIN_JS<EOL>sh_theme_arrows_css = constants.Shepherd.THEME_ARROWS_CSS<EOL>sh_theme_arrows_fix_css = constants.Shepherd.THEME_ARR_FIX_CSS<EOL>sh_theme_default_css = constants.Shepherd.THEME_DEFAULT_CSS<EOL>sh_theme_dark_css = constants.Shepherd.THEME_DARK_CSS<EOL>sh_theme_sq_css = constants.Shepherd.THEME_SQ_CSS<EOL>sh_theme_sq_dark_css = constants.Shepherd.THEME_SQ_DK_CSS<EOL>tether_js = constants.Tether.MIN_JS<EOL>spinner_css = constants.Messenger.SPINNER_CSS<EOL>backdrop_style = style_sheet.sh_backdrop_style<EOL>backdrop_style = backdrop_style.replace('<STR_LIT:\n>', '<STR_LIT>')<EOL>backdrop_style = js_utils.escape_quotes_if_needed(backdrop_style)<EOL>instructions += '<STR_LIT>' % spinner_css<EOL>instructions += '<STR_LIT>' % jquery_js<EOL>instructions += '<STR_LIT>' % tether_js<EOL>instructions += '<STR_LIT>'<EOL>instructions += '<STR_LIT>' % sh_theme_arrows_css<EOL>instructions += '<STR_LIT>' % sh_theme_arrows_fix_css<EOL>instructions += '<STR_LIT>' % sh_theme_default_css<EOL>instructions += '<STR_LIT>' % sh_theme_dark_css<EOL>instructions += '<STR_LIT>' % sh_theme_sq_css<EOL>instructions += '<STR_LIT>' % sh_theme_sq_dark_css<EOL>instructions += '<STR_LIT>' % backdrop_style<EOL>instructions += '<STR_LIT>' % shepherd_js<EOL><DEDENT>instructions += '<STR_LIT>'<EOL>for tour_step in tour_steps[name]:<EOL><INDENT>instructions += tour_step<EOL><DEDENT>if tour_type == "<STR_LIT>":<EOL><INDENT>instructions += (<EOL>"""<STR_LIT>""")<EOL><DEDENT>elif tour_type == "<STR_LIT>":<EOL><INDENT>instructions += (<EOL>"""<STR_LIT>""")<EOL><DEDENT>elif tour_type == "<STR_LIT>":<EOL><INDENT>instructions += (<EOL>"""<STR_LIT>""")<EOL><DEDENT>elif tour_type == "<STR_LIT>":<EOL><INDENT>instructions += (<EOL>"""<STR_LIT>""")<EOL><DEDENT>else:<EOL><INDENT>pass<EOL><DEDENT>exported_tours_folder = EXPORTED_TOURS_FOLDER<EOL>if exported_tours_folder.endswith("<STR_LIT:/>"):<EOL><INDENT>exported_tours_folder = exported_tours_folder[:-<NUM_LIT:1>]<EOL><DEDENT>if not os.path.exists(exported_tours_folder):<EOL><INDENT>try:<EOL><INDENT>os.makedirs(exported_tours_folder)<EOL><DEDENT>except Exception:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>import codecs<EOL>file_path = exported_tours_folder + "<STR_LIT:/>" + filename<EOL>out_file = codecs.open(file_path, "<STR_LIT>")<EOL>out_file.writelines(instructions)<EOL>out_file.close()<EOL>print('<STR_LIT>' % file_path)<EOL>
Exports a tour as a JS file.
        It will include necessary resources as well, such as jQuery.
        You'll be able to copy the tour directly into the Console of
        any web browser to play the tour outside of SeleniumBase runs.