def load_rules(root='<STR_LIT>'):
module = __import__(root, fromlist=[root.split('<STR_LIT:.>')[<NUM_LIT:0>]])<EOL>hinting_helpers = fmn.lib.hinting.__dict__.values()<EOL>rules = {}<EOL>for name in dir(module):<EOL><INDENT>obj = getattr(module, name)<EOL>if not callable(obj):<EOL><INDENT>continue<EOL><DEDENT>if obj in hinting_helpers:<EOL><INDENT>continue<EOL><DEDENT>doc = inspect.getdoc(obj)<EOL>if doc and hasattr(doc, '<STR_LIT>'):<EOL><INDENT>doc = doc.decode('<STR_LIT:utf-8>')<EOL><DEDENT>if doc:<EOL><INDENT>title, doc_as_rst = doc.split('<STR_LIT:\n>', <NUM_LIT:1>)<EOL>doc = docutils.examples.html_parts(doc_as_rst)['<STR_LIT:body>']<EOL>soup = bs4.BeautifulSoup(doc, '<STR_LIT>')<EOL>doc_no_links = '<STR_LIT>'.join(map(six.text_type, strip_anchor_tags(soup)))<EOL>doc = markupsafe.Markup(doc)<EOL>doc_no_links = markupsafe.Markup(doc_no_links)<EOL><DEDENT>else:<EOL><INDENT>title = "<STR_LIT>"<EOL>doc = "<STR_LIT>" % (root, name, obj)<EOL>doc_no_links = doc<EOL><DEDENT>rules[name] = {<EOL>'<STR_LIT>': obj,<EOL>'<STR_LIT>': obj.__module__.split('<STR_LIT:.>')[-<NUM_LIT:1>],<EOL>'<STR_LIT:title>': title.strip(),<EOL>'<STR_LIT>': doc.strip(),<EOL>'<STR_LIT>': doc_no_links.strip(),<EOL>'<STR_LIT:args>': inspect.getargspec(obj)[<NUM_LIT:0>],<EOL>'<STR_LIT>': getattr(obj, '<STR_LIT>', {}),<EOL>'<STR_LIT>': getattr(obj, '<STR_LIT>', True),<EOL>'<STR_LIT>': getattr(obj, '<STR_LIT>', None),<EOL>}<EOL><DEDENT>rules = OrderedDict(<EOL>sorted(rules.items(), key=lambda x: x[<NUM_LIT:1>]['<STR_LIT:title>'])<EOL>)<EOL>return {root: rules}<EOL>
Load the big list of allowed callable rules.