Module Expr Str ImportFrom alias Import alias Import alias Import alias Import alias Import alias Import alias Import alias FunctionDef arguments args defaults body Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str keyword Str Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore BinOpAdd Str BinOpMult Str Num With Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameStore body Expr Call NameLoad NameLoad keyword NameLoad Expr Call NameLoad Str keyword NameLoad Expr Call NameLoad Str BinOpMult Str Num keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad AttributeLoad NameLoad attr For NameStore NameLoad body If UnaryOpNot Call NameLoad NameLoad NameLoad NameLoad NameLoad body Return Num decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Assign NameStore Call AttributeLoad Str attr Call NameLoad NameLoad TryExcept body Assign TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad AttributeLoad NameLoad attr handlers ExceptHandler type NameLoad name NameStore body Expr Call NameLoad Str NameLoad Expr Call NameLoad NameLoad Raise Return NameLoad Assign NameStore ListLoad Assign NameStore ListLoad Assign NameStore ListLoad Expr Call NameLoad NameLoad NameLoad NameLoad NameLoad Assign NameStore SubscriptLoad Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Index Num With Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameStore body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad Expr Call NameLoad NameLoad keyword NameLoad Assign NameStore Call AttributeLoad Str attr ListLoad SubscriptLoad NameLoad Slice NameLoad Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Slice NameLoad If CompareNotEq NameLoad NameLoad body With Call NameLoad NameLoad Str NameStore body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call NameLoad Str NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Assign NameStore BinOpAdd NameLoad Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareEq NameLoad Num body If NameLoad body Assign NameStore Call NameLoad NameLoad Assign NameStore NameLoad orelse Raise Call NameLoad BinOpAdd BinOpAdd Str NameLoad NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr NameLoad BinOpAdd NameLoad Num If CompareEq NameLoad Num body Raise Call NameLoad BinOpAdd Str NameLoad AugAssignAdd NameStore Call NameLoad NameLoad Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr NameLoad For NameStore Call AttributeLoad NameLoad attr NameLoad body Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr NameLoad If Call NameLoad NameLoad AttributeLoad NameLoad attr body Assign NameStore SubscriptLoad NameLoad Index Str If CompareNotEq SubscriptLoad NameLoad Index Num Str body Expr Call AttributeLoad NameLoad attr NameLoad orelse If Call NameLoad NameLoad AttributeLoad NameLoad attr body Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore ListLoad For NameStore SubscriptLoad NameLoad Index Str body If Call NameLoad NameLoad AttributeLoad NameLoad attr body Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr NameLoad Assign NameStore SubscriptLoad NameLoad Index Str If CompareNotEq SubscriptLoad NameLoad Index Num Str body Expr Call AttributeLoad NameLoad attr NameLoad If CompareNotEq SubscriptLoad NameLoad Index Num Str body Expr Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad orelse If Call NameLoad NameLoad AttributeLoad NameLoad attr body For NameStore SubscriptLoad NameLoad Index Str body Assign NameStore SubscriptLoad Call NameLoad Call AttributeLoad NameLoad attr NameLoad Index Str If CompareNotEq SubscriptLoad NameLoad Index Num Str body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults body Expr Call NameLoad Str NameLoad keyword NameLoad Expr Call NameLoad Str keyword NameLoad If NameLoad body Expr Call NameLoad NameLoad Str NameLoad If NameLoad body Expr Call NameLoad NameLoad Str NameLoad If NameLoad body Expr Call NameLoad NameLoad Str NameLoad Expr Call NameLoad Str BinOpMult Str Num keyword NameLoad Expr Call NameLoad Str keyword NameLoad decorator_list FunctionDef arguments args NameParam defaults body With Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameStore body Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore SubscriptLoad NameLoad Index Num If CompareEq SubscriptLoad NameLoad Index Num AttributeLoad NameLoad attr body Return Call NameLoad SubscriptLoad NameLoad Index Num orelse Return Num decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Call NameLoad BinOpAdd BinOpAdd Str NameLoad Str keyword NameLoad For NameStore NameLoad body Expr Call NameLoad Str NameLoad keyword NameLoad Expr Call NameLoad Str keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Call NameLoad BinOpAdd BinOpAdd Str NameLoad Str keyword NameLoad For NameStore NameLoad body Expr Call NameLoad Str SubscriptLoad NameLoad Index Num keyword NameLoad For NameStore SubscriptLoad NameLoad Index Num body Expr Call NameLoad BinOpAdd Str NameLoad keyword NameLoad Expr Call NameLoad Str keyword NameLoad decorator_list If CompareEq NameLoad Str body Expr Call AttributeLoad NameLoad attr Call NameLoad
N/A N/A "Automatically rewrite modules with a generated 'CONTENTS' section.

In addition to module docstrings that detail the purpose and some intended
usage of a module, it can be useful to have a short inventory of the salient
contents.

The Python built-in function 'help' does a great job of this, e.g.

    FUNCTIONS
        find_insertion_point(module_text)
        find_likely_insertion_point(module_text)

Although Python is highly available, the help pages aren't easily available
in all the contexts that they might be useful, e.g. browsing the code via the
GitHub web interface.

This module aims to improve the availability by inserting comments to roughly
the same effect of the help pages.  This makes the outline highly available in
all contexts.

They are generated as comments rather than docstrings because docstrings will
appear in the help pages.

 __future__ print_function N/A argparse N/A ast N/A cStringIO N/A contextlib N/A os N/A sys N/A tokenize main N/A N/A N/A N/A N/A argparser N/A N/A argparse ArgumentParser N/A N/A N/A argparser add_argument modules type str nargs + N/A N/A N/A argparser add_argument --force-insert action store_true N/A args N/A N/A argparser parse_args N/A block_marker N/A #  N/A = 77 N/A N/A N/A contextlib closing N/A N/A cStringIO StringIO s N/A N/A N/A print block_marker file s N/A N/A print # CONTENTS file s N/A N/A print # N/A - 77 file s N/A contents_signature N/A N/A s getvalue N/A modules N/A sorted N/A args modules N/A m modules N/A N/A N/A N/A process_module m contents_signature args block_marker N/A N/A -1 N/A process_module N/A N/A m contents_signature args block_marker N/A N/A N/A raw N/A N/A join N/A open m N/A N/A N/A N/A start_index end_index N/A find_insertion_point raw contents_signature block_marker N/A args force_insert N/A N/A N/A Exception N/A e N/A N/A N/A print error while processing file:  m N/A N/A print e N/A N/A False N/A classes N/A N/A functions N/A N/A assignments N/A N/A N/A parse_module raw classes functions assignments N/A name N/A N/A N/A N/A os path splitext N/A N/A N/A os path basename m N/A 0 N/A N/A N/A contextlib closing N/A N/A cStringIO StringIO contents N/A N/A N/A N/A contents write contents_signature N/A N/A print_contents contents name classes functions assignments N/A N/A print block_marker file contents N/A new_raw N/A N/A join N/A N/A raw N/A start_index N/A N/A contents getvalue N/A raw N/A end_index N/A N/A new_raw raw N/A N/A N/A open m w f N/A N/A N/A N/A f write new_raw N/A N/A print wrote m N/A True N/A find_insertion_point N/A N/A module_text contents_signature block_marker force N/A N/A N/A block_marker_line N/A block_marker N/A start_index N/A N/A module_text find contents_signature N/A N/A start_index -1 N/A N/A force N/A N/A start_index N/A find_likely_insertion_point module_text N/A end_index start_index N/A N/A N/A Exception N/A N/A couldn't find contents block in file
please insert after imports:
 contents_signature block_marker N/A N/A end_index N/A N/A module_text find block_marker_line N/A start_index 1 N/A N/A end_index -1 N/A N/A N/A Exception N/A contents block is unterminated in file
please terminate with this line:
 block_marker N/A end_index N/A len block_marker_line N/A N/A start_index end_index N/A parse_module N/A N/A s classes functions assignments N/A N/A N/A module N/A N/A ast parse s N/A c N/A N/A ast iter_child_nodes module N/A N/A fields N/A dict N/A N/A ast iter_fields c N/A N/A isinstance c N/A ast FunctionDef N/A N/A name N/A fields N/A name N/A N/A N/A name N/A 0 _ N/A N/A N/A N/A functions append name N/A N/A N/A isinstance c N/A ast ClassDef N/A N/A name N/A fields N/A name N/A members N/A N/A member N/A fields N/A body N/A N/A N/A isinstance member N/A ast FunctionDef N/A N/A member_fields N/A dict N/A N/A ast iter_fields member N/A member_name N/A member_fields N/A name N/A N/A N/A member_name N/A 0 _ N/A N/A N/A N/A members append member_name N/A N/A N/A name N/A 0 _ N/A N/A N/A N/A classes append N/A name members N/A N/A N/A isinstance c N/A ast Assign N/A N/A t N/A fields N/A targets N/A N/A name N/A N/A dict N/A N/A ast iter_fields t N/A id N/A N/A N/A name N/A 0 _ N/A N/A N/A N/A assignments append name N/A print_contents N/A N/A f name classes functions assignments N/A N/A N/A N/A print # name file f N/A N/A print # file f N/A classes N/A N/A N/A print_nested_items_indented f Public Classes classes N/A functions N/A N/A N/A print_items_indented f Public Functions functions N/A assignments N/A N/A N/A print_items_indented f Public Assignments assignments N/A N/A print # N/A - 77 file f N/A N/A print # (this contents block is generated, edits will be lost) file f N/A find_likely_insertion_point N/A N/A module_text N/A N/A N/A N/A N/A contextlib closing N/A N/A cStringIO StringIO module_text text N/A N/A tokens N/A list N/A N/A tokenize generate_tokens N/A text readline N/A first N/A tokens N/A 0 N/A N/A N/A first N/A 0 N/A tokenize STRING N/A N/A N/A len N/A first N/A 4 N/A N/A 0 N/A print_items_indented N/A N/A f description items N/A N/A N/A N/A print N/A N/A #  description : file f N/A i items N/A N/A N/A print #   i file f N/A N/A print # file f N/A print_nested_items_indented N/A N/A f description nested_items N/A N/A N/A N/A print N/A N/A #  description : file f N/A i nested_items N/A N/A N/A print #   N/A i N/A 0 file f N/A j N/A i N/A 1 N/A N/A N/A print N/A #    . j file f N/A N/A print # file f N/A N/A N/A __name__ __main__ N/A N/A N/A N/A sys exit N/A main