Best Python code snippet using tempest_python
base.tmpl.py
Source:base.tmpl.py
...30 __M_caller = context.caller_stack._push_frame()31 try:32 __M_locals = __M_dict_builtin(pageargs=pageargs)33 _import_ns = {}34 _mako_get_namespace(context, u'header')._populate(_import_ns, [u'*'])35 _mako_get_namespace(context, u'base')._populate(_import_ns, [u'*'])36 _mako_get_namespace(context, u'footer')._populate(_import_ns, [u'*'])37 lang = _import_ns.get('lang', context.get('lang', UNDEFINED))38 def extra_head():39 return render_extra_head(context._locals(__M_locals))40 body_end = _import_ns.get('body_end', context.get('body_end', UNDEFINED))41 template_hooks = _import_ns.get('template_hooks', context.get('template_hooks', UNDEFINED))42 footer = _mako_get_namespace(context, 'footer')43 messages = _import_ns.get('messages', context.get('messages', UNDEFINED))44 set_locale = _import_ns.get('set_locale', context.get('set_locale', UNDEFINED))45 def content():46 return render_content(context._locals(__M_locals))47 header = _mako_get_namespace(context, 'header')48 base = _mako_get_namespace(context, 'base')49 def extra_js():50 return render_extra_js(context._locals(__M_locals))51 __M_writer = context.writer()52 __M_writer(u'\n')53 __M_writer(u'\n')54 __M_writer(u'\n')55 __M_writer(u'\n')56 __M_writer(unicode(set_locale(lang)))57 __M_writer(u'\n')58 __M_writer(unicode(base.html_headstart()))59 __M_writer(u'\n')60 if 'parent' not in context._data or not hasattr(context._data['parent'], 'extra_head'):61 context['self'].extra_head(**pageargs)62 63 __M_writer(u'\n')64 __M_writer(unicode(template_hooks['extra_head']()))65 __M_writer(u'\n</head>\n<body>\n<a href="#content" class="sr-only sr-only-focusable">')66 __M_writer(unicode(messages("Skip to main content")))67 __M_writer(u'</a>\n <div id="container">\n ')68 __M_writer(unicode(header.html_header()))69 __M_writer(u'\n <main id="content">\n ')70 if 'parent' not in context._data or not hasattr(context._data['parent'], 'content'):71 context['self'].content(**pageargs)72 73 __M_writer(u'\n </main>\n ')74 __M_writer(unicode(footer.html_footer()))75 __M_writer(u'\n </div>\n ')76 __M_writer(unicode(base.late_load_js()))77 __M_writer(u'\n ')78 if 'parent' not in context._data or not hasattr(context._data['parent'], 'extra_js'):79 context['self'].extra_js(**pageargs)80 81 __M_writer(u'\n ')82 __M_writer(unicode(body_end))83 __M_writer(u'\n ')84 __M_writer(unicode(template_hooks['body_end']()))85 __M_writer(u'\n</body>\n</html>\n')86 return ''87 finally:88 context.caller_stack._pop_frame()89def render_content(context,**pageargs):90 __M_caller = context.caller_stack._push_frame()91 try:92 _import_ns = {}93 _mako_get_namespace(context, u'header')._populate(_import_ns, [u'*'])94 _mako_get_namespace(context, u'base')._populate(_import_ns, [u'*'])95 _mako_get_namespace(context, u'footer')._populate(_import_ns, [u'*'])96 def content():97 return render_content(context)98 __M_writer = context.writer()99 return ''100 finally:101 context.caller_stack._pop_frame()102def render_extra_head(context,**pageargs):103 __M_caller = context.caller_stack._push_frame()104 try:105 _import_ns = {}106 _mako_get_namespace(context, u'header')._populate(_import_ns, [u'*'])107 _mako_get_namespace(context, u'base')._populate(_import_ns, [u'*'])108 _mako_get_namespace(context, u'footer')._populate(_import_ns, [u'*'])109 def extra_head():110 return render_extra_head(context)111 __M_writer = context.writer()112 __M_writer(u'\n')113 return ''114 finally:115 context.caller_stack._pop_frame()116def render_extra_js(context,**pageargs):117 __M_caller = context.caller_stack._push_frame()118 try:119 _import_ns = {}120 _mako_get_namespace(context, u'header')._populate(_import_ns, [u'*'])121 _mako_get_namespace(context, u'base')._populate(_import_ns, [u'*'])122 _mako_get_namespace(context, u'footer')._populate(_import_ns, [u'*'])123 def extra_js():124 return render_extra_js(context)125 __M_writer = context.writer()126 return ''127 finally:128 context.caller_stack._pop_frame()129"""130__M_BEGIN_METADATA131{"source_encoding": "utf-8", "line_map": {"131": 23, "146": 131, "23": 3, "26": 2, "29": 5, "32": 4, "35": 0, "58": 2, "59": 3, "60": 4, "61": 5, "62": 6, "63": 6, "64": 7, "65": 7, "70": 10, "71": 11, "72": 11, "73": 14, "74": 14, "75": 16, "76": 16, "81": 18, "82": 20, "83": 20, "84": 22, "85": 22, "90": 23, "91": 24, "92": 24, "93": 25, "94": 25, "100": 18, "115": 8, "125": 8}, "uri": "base.tmpl", "filename": "themes/ariel17/templates/base.tmpl"}132__M_END_METADATA...
__init__.py
Source:__init__.py
...47PopulatedDict = Dict[str, Any]48def _noop_callback(arg: Arg) -> Arg:49 """Simply returns the argument."""50 return arg51def _populate(52 attr: str, callback: Callable[[Any], Any] = _noop_callback53) -> PopulatedDict:54 """55 Create a dict for all locales pointing to the appropriate attribute.56 Fallback to `defaults`.57 """58 return {59 locale.__name__.split(".")[-1]: callback(getattr(locale, attr))60 if hasattr(locale, attr)61 else callback(getattr(defaults, attr))62 for locale in _ALL_LOCALES63 }64# Regex to find the pronunciation65pronunciation: Dict[str, Pattern[str]] = _populate("pronunciation", callback=re.compile)66# Regex to find the gender67gender: Dict[str, Pattern[str]] = _populate("gender", callback=re.compile)68# Float number separator69float_separator: Dict[str, str] = _populate("float_separator")70# Thousads separator71thousands_separator: Dict[str, str] = _populate("thousands_separator")72# Markers for sections that contain interesting text to analyse.73section_patterns: Dict[str, Tuple[str, ...]] = _populate("section_patterns")74sublist_patterns: Dict[str, Tuple[str, ...]] = _populate("sublist_patterns")75section_level: Dict[str, int] = _populate("section_level")76section_sublevels: Dict[str, Tuple[int, ...]] = _populate("section_sublevels")77head_sections: Dict[str, Tuple[str, ...]] = _populate("head_sections")78etyl_section: Dict[str, Tuple[str]] = _populate("etyl_section")79sections: Dict[str, Tuple[str, ...]] = _populate("sections")80# Some definitions are not good to keep (plural, gender, ... )81definitions_to_ignore: Dict[str, Tuple[str, ...]] = _populate("definitions_to_ignore")82# But some words need to be kept even if they would have been skipped by definitions_to_ignore83words_to_keep: Dict[str, Tuple[str, ...]] = _populate("words_to_keep")84# Templates replacements: wikicode -> text conversion85# Templates to ignore: the text will be deleted.86templates_ignored: Dict[str, Tuple[str, ...]] = _populate("templates_ignored")87# Templates that will be completed/replaced using italic style.88# Ex: {{absol}} -> <i>(Absolument)</i>89# Ex: {{absol|fr}} -> <i>(Absolument)</i>90# Ex: {{absol|fr|123}} -> <i>(Absolument)</i>91# Ex: {{absol|fr|123|...}} -> <i>(Absolument)</i>92templates_italic: Dict[str, Dict[str, str]] = _populate("templates_italic")93# Templates more complex to manage. More work is needed.94# The code on the right will be passed to a function that will execute it.95# It is possible to use any Python function and ones defined in user_functions.py.96#97# Available arguments:98# - *tpl* (string) containing the template name.99# - *parts* (list of strings) containing the all parts of the template.100#101# Example with the complete template "{{comparatif de|bien|fr|adv}}":102# - *tpl* will contain the string "comparatif de".103# - *parts* will contain the list ["comparatif de", "bien", "fr", "adv"].104#105# You can access to *tpl* and *parts* to apply changes and get the result wanted.106#107# Available functions are documented into that HTML file:108# html/wikidict/user_functions.html109templates_multi: Dict[str, Dict[str, str]] = _populate("templates_multi")110# Templates that will be completed/replaced using custom style.111templates_other: Dict[str, Dict[str, str]] = _populate("templates_other")112# When a template is not handled by any previous template handlers,113# this method will be called with *parts* as argument.114last_template_handler = _populate("last_template_handler")115# The full release description on GitHub:116# https://github.com/BoboTiG/ebook-reader-dict/releases/tag/$LOCALE117release_description: Dict[str, str] = _populate("release_description")118# Dictionary name that will be printed below each definition...
populate_menus.py
Source:populate_menus.py
1import os.path2menu = ix.application.get_main_menu()3menu.run_file("./file/_populate.py")4menu.run_file("./edit/_populate.py")5menu.run_file("./create/_populate.py")6menu.run_file("./tools/_populate.py")7menu.run_file("./animate/_populate.py")8menu.run_file("./image/_populate.py")9menu.run_file("./windows/_populate.py")10menu.run_file("./layout/_populate.py")11menu.run_file("./help/_populate.py")...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!