<s> import warnings <EOL> import string , keyword <EOL> from elements import * <EOL> from core import ArgParser <EOL> def creepy10_base ( ) : <EOL> """<STR_LIT>""" <EOL> class Base ( ArgDialect ) : <EOL> kw_arg = KeywordArg ( token = '<STR_LIT:=>' ) <EOL> quoted_arg = QuotedArg ( token = '<STR_LIT>' ) <EOL> spaces = WhiteSpace ( ) <EOL> def __init__ ( self ) : <EOL> self . kw_arg . child_elements = [ self . spaces ] <EOL> self . quoted_arg . child_elements = [ ] <EOL> self . spaces . child_elements = [ ] <EOL> @ property <EOL> def top_elements ( self ) : <EOL> return [ self . quoted_arg , self . kw_arg , self . spaces ] <EOL> return Base <EOL> def creepy20_base ( ) : <EOL> """<STR_LIT>""" <EOL> Creepy10Base = creepy10_base ( ) <EOL> class Base ( Creepy10Base ) : <EOL> list_arg = ListArg ( token = [ '<STR_LIT:[>' , '<STR_LIT:]>' ] ) <EOL> explicit_list_arg = ExplicitListArg ( token = [ '<STR_LIT:[>' , '<STR_LIT:]>' ] ) <EOL> def __init__ ( self ) : <EOL> super ( Base , self ) . __init__ ( ) <EOL> self . kw_arg . child_elements = [ self . explicit_list_arg , self . spaces ] <EOL> self . list_arg . child_elements = [ self . spaces ] <EOL> self . explicit_list_arg . child_elements = [ self . spaces ] <EOL> @ property <EOL> def top_elements ( self ) : <EOL> return [ self . quoted_arg , self . kw_arg , self . list_arg , self . spaces ] <EOL> return Base <EOL> class ArgDialect ( object ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> parse_args = ArgParser ( dialect = creepy10_base ( ) , key_func = string . lower , <EOL> illegal_keys = keyword . kwlist + [ '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT:body>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> """<STR_LIT>""" <EOL> def create_dialect ( dialect_base , ** kw_args ) : <EOL> """<STR_LIT>""" <EOL> if '<STR_LIT>' in kw_args : <EOL> warnings . warn ( """<STR_LIT>""" ) <EOL> kw_args . setdefault ( '<STR_LIT>' , kw_args . pop ( '<STR_LIT>' ) ) <EOL> return dialect_base ( ** kw_args ) <EOL> def creole10_base ( wiki_links_base_url = '<STR_LIT>' , wiki_links_space_char = '<STR_LIT:_>' , <EOL> interwiki_links_base_urls = { } , <EOL> no_wiki_monospace = True , <EOL> wiki_links_class_func = None , external_links_class = None , <EOL> wiki_links_path_func = None , interwiki_links_path_funcs = { } , <EOL> interwiki_links_class_funcs = { } , interwiki_links_space_chars = { } , <EOL> blog_style_endings = False , <EOL> disable_external_content = False , <EOL> custom_markup = [ ] , <EOL> simple_markup = [ ( '<STR_LIT>' , '<STR_LIT>' ) , ( '<STR_LIT>' , '<STR_LIT>' ) ] , <EOL> add_heading_ids = False <EOL> ) : <EOL> """<STR_LIT>""" <EOL> if isinstance ( wiki_links_base_url , ( list , tuple ) ) : <EOL> wiki_links_base_url , embed_base_url = wiki_links_base_url <EOL> else : <EOL> embed_base_url = wiki_links_base_url <EOL> if isinstance ( wiki_links_path_func , ( list , tuple ) ) : <EOL> wiki_links_path_func , embed_path_func = wiki_links_path_func <EOL> else : <EOL> embed_path_func = wiki_links_path_func <EOL> if isinstance ( wiki_links_space_char , ( list , tuple ) ) : <EOL> wiki_links_space_char , embed_space_char = wiki_links_space_char <EOL> else : <EOL> embed_space_char = wiki_links_space_char <EOL> embed_interwiki_base_urls = { } <EOL> for k , v in interwiki_links_base_urls . items ( ) : <EOL> if isinstance ( v , ( list , tuple ) ) : <EOL> interwiki_links_base_urls [ k ] , embed_interwiki_base_urls [ k ] = v <EOL> else : <EOL> embed_interwiki_base_urls [ k ] = v <EOL> embed_interwiki_path_funcs = { } <EOL> for k , v in interwiki_links_path_funcs . items ( ) : <EOL> if isinstance ( v , ( list , tuple ) ) : <EOL> interwiki_links_path_funcs [ k ] , embed_interwiki_path_funcs [ k ] = v <EOL> else : <EOL> embed_interwiki_path_funcs [ k ] = v <EOL> embed_interwiki_space_chars = { } <EOL> for k , v in interwiki_links_space_chars . items ( ) : <EOL> if isinstance ( v , ( list , tuple ) ) : <EOL> interwiki_links_space_chars [ k ] , embed_interwiki_space_chars [ k ] = v <EOL> else : <EOL> embed_interwiki_space_chars [ k ] = v <EOL> id_prefix = add_heading_ids is True and '<STR_LIT:!>' or add_heading_ids <EOL> if id_prefix is False : <EOL> fragment_pattern = None <EOL> else : <EOL> fragment_pattern = '<STR_LIT:#>' + re . escape ( id_prefix ) + r'<STR_LIT>' <EOL> class Base ( Dialect ) : <EOL> br = LineBreak ( '<STR_LIT>' , r'<STR_LIT:\\>' , blog_style = blog_style_endings ) <EOL> headings = Heading ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , '<STR_LIT:=>' , id_prefix = id_prefix ) <EOL> no_wiki = NoWikiElement ( no_wiki_monospace and '<STR_LIT:code>' or '<STR_LIT>' , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> simple_element = SimpleElement ( token_dict = dict ( simple_markup ) ) <EOL> hr = HrElement ( ) <EOL> blank_line = BlankLine ( ) <EOL> p = Paragraph ( '<STR_LIT:p>' ) <EOL> pre = PreBlock ( '<STR_LIT>' , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> raw_link = RawLink ( '<STR_LIT:a>' ) <EOL> link = AnchorElement ( '<STR_LIT:a>' , ( '<STR_LIT>' , '<STR_LIT>' ) , delimiter = '<STR_LIT:|>' , interwiki_delimiter = '<STR_LIT::>' , <EOL> base_urls = interwiki_links_base_urls , <EOL> links_funcs = interwiki_links_path_funcs , <EOL> interwiki_class_funcs = interwiki_links_class_funcs , <EOL> default_space_char = wiki_links_space_char , <EOL> space_chars = interwiki_links_space_chars , <EOL> base_url = wiki_links_base_url , <EOL> space_char = wiki_links_space_char , class_func = wiki_links_class_func , <EOL> path_func = wiki_links_path_func , fragment_pattern = fragment_pattern , <EOL> external_links_class = external_links_class ) <EOL> img = ImageElement ( '<STR_LIT>' , ( '<STR_LIT>' , '<STR_LIT>' ) , delimiter = '<STR_LIT:|>' , interwiki_delimiter = '<STR_LIT::>' , <EOL> base_urls = embed_interwiki_base_urls , <EOL> links_funcs = embed_interwiki_path_funcs , <EOL> interwiki_class_funcs = interwiki_links_class_funcs , <EOL> default_space_char = embed_space_char , <EOL> space_chars = embed_interwiki_space_chars , <EOL> base_url = embed_base_url , <EOL> space_char = embed_space_char , class_func = wiki_links_class_func , <EOL> path_func = embed_path_func , fragment_pattern = fragment_pattern , <EOL> disable_external = disable_external_content ) <EOL> td = TableCell ( '<STR_LIT>' , '<STR_LIT:|>' ) <EOL> th = TableCell ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> tr = TableRow ( '<STR_LIT>' , '<STR_LIT:|>' ) <EOL> table = Table ( '<STR_LIT>' , '<STR_LIT:|>' ) <EOL> li = ListItem ( '<STR_LIT>' , list_tokens = '<STR_LIT>' ) <EOL> ol = List ( '<STR_LIT>' , '<STR_LIT:#>' , stop_tokens = '<STR_LIT:*>' ) <EOL> ul = List ( '<STR_LIT>' , '<STR_LIT:*>' , stop_tokens = '<STR_LIT:#>' ) <EOL> nested_ol = NestedList ( '<STR_LIT>' , '<STR_LIT:#>' ) <EOL> nested_ul = NestedList ( '<STR_LIT>' , '<STR_LIT:*>' ) <EOL> custom_elements = [ CustomElement ( reg_exp , func ) for reg_exp , func in custom_markup ] <EOL> def __init__ ( self ) : <EOL> self . link . child_elements = [ self . simple_element ] <EOL> self . simple_element . child_elements = [ self . simple_element ] <EOL> self . headings . child_elements = self . inline_elements <EOL> self . p . child_elements = self . inline_elements <EOL> self . td . child_elements = [ self . br , self . raw_link , self . simple_element ] <EOL> self . th . child_elements = [ self . br , self . raw_link , self . simple_element ] <EOL> self . tr . child_elements = [ self . no_wiki , self . img , self . link , self . custom_elements , self . th , self . td ] <EOL> self . table . child_elements = [ self . tr ] <EOL> self . ol . child_elements = [ self . li ] <EOL> self . ul . child_elements = [ self . li ] <EOL> self . nested_ol . child_elements = [ self . li ] <EOL> self . nested_ul . child_elements = [ self . li ] <EOL> self . li . child_elements = [ ( self . nested_ol , self . nested_ul ) ] + self . inline_elements <EOL> @ property <EOL> def inline_elements ( self ) : <EOL> return [ self . no_wiki , self . img , self . link ] + self . custom_elements + [ self . br , self . raw_link , self . simple_element ] <EOL> @ property <EOL> def block_elements ( self ) : <EOL> return [ self . pre , self . blank_line , self . table , self . headings , <EOL> self . hr , self . ul , self . ol , self . p ] <EOL> """<STR_LIT>""" <EOL> return Base <EOL> def creole11_base ( macro_func = None , <EOL> indent_class = None , <EOL> indent_style = '<STR_LIT>' , <EOL> simple_markup = [ ( '<STR_LIT>' , '<STR_LIT>' ) , ( '<STR_LIT>' , '<STR_LIT>' ) , ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , ( '<STR_LIT>' , '<STR_LIT:u>' ) , ( '<STR_LIT>' , '<STR_LIT:code>' ) ] , <EOL> non_bodied_macros = { } , <EOL> bodied_macros = { } , <EOL> argument_parser = parse_args , <EOL> ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> Creole10Base = creole10_base ( simple_markup = simple_markup , ** kwargs ) <EOL> class Base ( Creole10Base ) : <EOL> indented = IndentedBlock ( '<STR_LIT>' , '<STR_LIT:>>' , class_ = indent_class , style = indent_style ) <EOL> dd = DefinitionDef ( '<STR_LIT>' , '<STR_LIT::>' ) <EOL> dt = DefinitionTerm ( '<STR_LIT>' , '<STR_LIT:;>' , stop_token = '<STR_LIT::>' ) <EOL> dl = List ( '<STR_LIT>' , '<STR_LIT:;>' , stop_tokens = '<STR_LIT>' ) <EOL> macro = Macro ( '<STR_LIT>' , ( '<STR_LIT>' , '<STR_LIT>' ) , func = macro_func , macros = non_bodied_macros , <EOL> arg_parser = argument_parser ) <EOL> bodiedmacro = BodiedMacro ( '<STR_LIT>' , ( '<STR_LIT>' , '<STR_LIT>' ) , func = macro_func , <EOL> macros = bodied_macros , arg_parser = argument_parser ) <EOL> bodied_block_macro = BodiedBlockMacro ( '<STR_LIT>' , ( '<STR_LIT>' , '<STR_LIT>' ) , func = macro_func , <EOL> macros = bodied_macros , arg_parser = argument_parser ) <EOL> def __init__ ( self ) : <EOL> super ( Base , self ) . __init__ ( ) <EOL> self . tr . child_elements [ <NUM_LIT:0> ] = ( self . no_wiki , self . bodiedmacro , self . macro ) <EOL> self . dd . child_elements = self . custom_elements + [ self . br , self . raw_link , self . simple_element ] <EOL> self . dt . child_elements = self . custom_elements + [ self . br , self . raw_link , self . simple_element ] <EOL> self . dl . child_elements = [ ( self . no_wiki , self . bodiedmacro , self . macro ) , self . img , self . link , self . dt , self . dd ] <EOL> self . indented . child_elements = self . block_elements <EOL> self . bodiedmacro . dialect = self <EOL> self . bodied_block_macro . dialect = self <EOL> @ property <EOL> def inline_elements ( self ) : <EOL> return [ ( self . no_wiki , self . bodiedmacro , self . macro ) , self . img , <EOL> self . link ] + self . custom_elements + [ self . br , self . raw_link , <EOL> self . simple_element ] <EOL> @ property <EOL> def block_elements ( self ) : <EOL> return [ ( self . bodied_block_macro , self . pre ) , self . blank_line , self . table , self . headings , <EOL> self . hr , self . indented , self . dl , self . ul , self . ol , self . p ] <EOL> return Base <EOL> class Dialect ( object ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def _test ( ) : <EOL> import doctest <EOL> doctest . testmod ( ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> _test ( ) </s>
