old_contents: import argparse
  import asyncio
  import logging
  import pathlib
  
  import jinja2
  
  from trafaret_config import commandline
  
  
  import aiohttp_jinja2
  from aiohttp import web
  from aiohttpdemo_polls.db import close_pg, init_pg
  from aiohttpdemo_polls.middlewares import setup_middlewares
  from aiohttpdemo_polls.routes import setup_routes
  from aiohttpdemo_polls.utils import TRAFARET
  
  
  def init():
      ap = argparse.ArgumentParser()
      commandline.standard_argparse_options(ap,
                                            default_config='./config/polls.yaml')
      #
      # define your command-line arguments here
      #
      options = ap.parse_args()
  
      config = commandline.config_from_options(options, TRAFARET)
  
      loop = asyncio.get_event_loop()
  
      # setup application and extensions
      app = web.Application(loop=loop)
  
      # load config from yaml file in current dir
      app['config'] = config
  
      # setup Jinja2 template renderer
      aiohttp_jinja2.setup(
          app, loader=jinja2.PackageLoader('aiohttpdemo_polls', 'templates'))
  
      # create connection to the database
      app.on_startup.append(init_pg)
      # shutdown db connection on exit
      app.on_cleanup.append(close_pg)
      # setup views and routes
      setup_routes(app)
      setup_middlewares(app)
  
      return app
  
  
  def main():
      # init logging
      logging.basicConfig(level=logging.DEBUG)
  
      app = init()
      web.run_app(app,
                  host=app['config']['host'],
                  port=app['config']['port'])
  
  
  if __name__ == '__main__':
      main()
  
new_contents: import argparse
  import asyncio
  import logging
  
  import jinja2
  
  from trafaret_config import commandline
  
  
  import aiohttp_jinja2
  from aiohttp import web
  from aiohttpdemo_polls.db import close_pg, init_pg
  from aiohttpdemo_polls.middlewares import setup_middlewares
  from aiohttpdemo_polls.routes import setup_routes
  from aiohttpdemo_polls.utils import TRAFARET
  
  
  def init():
      ap = argparse.ArgumentParser()
      commandline.standard_argparse_options(ap,
                                            default_config='./config/polls.yaml')
      #
      # define your command-line arguments here
      #
      options = ap.parse_args()
  
      config = commandline.config_from_options(options, TRAFARET)
  
      loop = asyncio.get_event_loop()
  
      # setup application and extensions
      app = web.Application(loop=loop)
  
      # load config from yaml file in current dir
      app['config'] = config
  
      # setup Jinja2 template renderer
      aiohttp_jinja2.setup(
          app, loader=jinja2.PackageLoader('aiohttpdemo_polls', 'templates'))
  
      # create connection to the database
      app.on_startup.append(init_pg)
      # shutdown db connection on exit
      app.on_cleanup.append(close_pg)
      # setup views and routes
      setup_routes(app)
      setup_middlewares(app)
  
      return app
  
  
  def main():
      # init logging
      logging.basicConfig(level=logging.DEBUG)
  
      app = init()
      web.run_app(app,
                  host=app['config']['host'],
                  port=app['config']['port'])
  
  
  if __name__ == '__main__':
      main()
  
subject: Drop unused import