def _formatExample(example, substitutions):
 (yield u'**Example:** {}'.format(example.doc))
 (yield u'')
 (yield u'Request')
 (yield u'')
 (yield u'.. sourcecode:: http')
 (yield u'')
 lines = (example.request % substitutions).splitlines()
 lines.insert(1, u'Content-Type: application/json')
 lines.insert(1, (u'Host: api.%(DOMAIN)s' % substitutions))
 for line in lines:
  (yield (u'   ' + line.rstrip()))
 (yield u'')
 (yield u'Response')
 (yield u'')
 (yield u'.. sourcecode:: http')
 (yield u'')
 lines = (example.response % substitutions).splitlines()
 lines.insert(1, u'Content-Type: application/json')
 for line in lines:
  (yield (u'   ' + line.rstrip()))
 (yield u'')

def _formatExample ( example , substitutions ) : ( yield u'**Example:** {}' . format ( example . doc ) ) ( yield u'' ) ( yield u'Request' ) ( yield u'' ) ( yield u'.. sourcecode:: http' ) ( yield u'' ) lines = ( example . request % substitutions ) . splitlines ( ) lines . insert ( 1 , u'Content-Type: application/json' ) lines . insert ( 1 , ( u'Host: api.%(DOMAIN)s' % substitutions ) ) for line in lines : ( yield ( u'   ' + line . rstrip ( ) ) ) ( yield u'' ) ( yield u'Response' ) ( yield u'' ) ( yield u'.. sourcecode:: http' ) ( yield u'' ) lines = ( example . response % substitutions ) . splitlines ( ) lines . insert ( 1 , u'Content-Type: application/json' ) for line in lines : ( yield ( u'   ' + line . rstrip ( ) ) ) ( yield u'' )
generate the rst associated with an http session example .