def rst_for_module(toc_path):
 f = open((toc_path + u'.rst'), u'w+')
 heading = u':py:mod:`~{}`'.format(toc_path.replace(u'/', u'.'))
 dotted = toc_path.replace(u'/', u'.')
 w(f, heading)
 w(f, (u'=' * len(heading)))
 w(f, u'.. automodule:: {}', dotted)
 w(f, u'    :member-order: bysource')
 return f

def rst_for_module ( toc_path ) : f = open ( ( toc_path + u'.rst' ) , u'w+' ) heading = u':py:mod:`~{}`' . format ( toc_path . replace ( u'/' , u'.' ) ) dotted = toc_path . replace ( u'/' , u'.' ) w ( f , heading ) w ( f , ( u'=' * len ( heading ) ) ) w ( f , u'.. automodule:: {}' , dotted ) w ( f , u'    :member-order: bysource' ) return f
given a toc_path .