from __future__ import absolute_import

import json

from tornado import web
from tornado import gen
from tornado import httpclient

from ..views import BaseHandler
from ..api.workers import ListWorkers


class WorkerView(BaseHandler):
    @web.authenticated
    @gen.coroutine
    def get(self, name):
        refresh = self.get_argument('refresh', default=False, type=bool)

        if refresh:
            yield ListWorkers.update_workers(app=self.application, workername=name)

        worker = ListWorkers.worker_cache.get(name)

        if worker is None:
            raise web.HTTPError(404, "Unknown worker '%s'" % name)

        self.render("worker.html", worker=dict(worker, name=name))

@@ -37,21 +37,8 @@
 rt%0A%0A
-import json%0A%0A
 from
@@ -84,39 +84,8 @@
  gen
-%0Afrom tornado import httpclient
 %0A%0Afr

Remove unused imports