<s> import os <EOL> from jinja2 import Environment <EOL> from jinja2 import PackageLoader <EOL> from webcrawler . post_processors import BasePostProcessor <EOL> RESULT_DIR = '<STR_LIT:result>' <EOL> class ExamplePostProcessor ( BasePostProcessor ) : <EOL> def __init__ ( self ) : <EOL> env = Environment ( loader = PackageLoader ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . template = env . get_template ( '<STR_LIT>' ) <EOL> self . result_dir = os . path . dirname ( os . path . abspath ( __file__ ) ) <EOL> self . result_dir = os . path . join ( self . result_dir , RESULT_DIR ) <EOL> self . url_count = <NUM_LIT:0> <EOL> def process ( self , item ) : <EOL> self . url_count += <NUM_LIT:1> <EOL> filename = str ( self . url_count ) + '<STR_LIT>' <EOL> output = self . template . render ( <EOL> page_url = item [ '<STR_LIT>' ] , <EOL> static_assets = item [ '<STR_LIT>' ] <EOL> ) <EOL> with open ( os . path . join ( self . result_dir , filename ) , '<STR_LIT:w>' ) as f : <EOL> f . write ( output ) </s>
