# Path: nuka/utils.py
# PY3 = sys.version_info[0] == 3
# ARCHIVE_EXTS = ('.gz', '.tar', '.zip')
# LOG = 60
# CHANGED = logging.WARNING + 1
# PROGRESS = logging.WARNING + 2
#     def next(o):
# def default_watcher(delay=5):
#     def watcher(task, process):
# def import_module(name):
# def makedirs(dirname, mod=None, own=None):
# def chmod(dst, mod, recursive=False):
# def chown(dst, own, recursive=False):
# def best_executable():
# def isexecutable(path):
#     def __init__(self, value, alphabet=None, length=16):
#     def iterator(self):
#     def next(self):
# def proto_dumps(data, content_type=u'plain'):
# def proto_dumps_std(data, std, content_type='plain'):
# def proto_dumps_std_threadsafe(data, std):
# def proto_loads_std(std):
# class secret(object):
# 
# Path: nuka/task.py
# class teardown(SetupTask):
#     """remove `remote_dir` from the host"""
# 
#     teardown_cmd = '{0}rm -Rf {1[remote_dir]}'
# 
#     def __init__(self, host):
#         host._cancelled = False
#         super().__init__(host=host)
# 
#     def __class_name__(self):
#         return 'teardown'
# 
#     async def run(self):
#         if not self.host.failed():
#             sudo = self.host.use_sudo and 'sudo ' or ''
#             cmd = self.teardown_cmd.format(sudo, config)
#             await self.host.run_command(cmd, task=self)


import os
import sys
import jinja2
import nuka
from uuid import uuid4
from operator import itemgetter
from collections import defaultdict
from nuka.utils import json
from nuka.task import teardown
    from wsgiref.simple_server import make_server
                        parent=t.uid,
                        rc=sh['rc'],
                    )
                    func['remote_calls'].append(round_dict(tsh))
                    sh_start += tsh.time
            t['funcs'].append(round_dict(func))

    _end = all_tasks[-1]
    _real_end = _end
    i = 1
    while isinstance(_real_end['task'], teardown):
        i += 1
        try:
            _real_end = all_tasks[-i]
        except IndexError:
            _real_end = _end
            break

    for k, v in stats.items():
        v['avg_time'] = v['time'] / v['calls']
        v['avg_remote_time'] = v['remote_time'] / v['calls']
        for kk, vv in v.items():
            if isinstance(vv, float):
                v[kk] = '%.3f' % vv
    stats = sorted(stats.values(),
                   key=itemgetter('remote_time'),
                   reverse=True)

    data = {
        'host': host.name,

# Path: nuka/utils.py
# PY3 = sys.version_info[0] == 3
# ARCHIVE_EXTS = ('.gz', '.tar', '.zip')
# LOG = 60
# CHANGED = logging.WARNING + 1
# PROGRESS = logging.WARNING + 2
#     def next(o):
# def default_watcher(delay=5):
#     def watcher(task, process):
# def import_module(name):
# def makedirs(dirname, mod=None, own=None):
# def chmod(dst, mod, recursive=False):
# def chown(dst, own, recursive=False):
# def best_executable():
# def isexecutable(path):
#     def __init__(self, value, alphabet=None, length=16):
#     def iterator(self):
#     def next(self):
# def proto_dumps(data, content_type=u'plain'):
# def proto_dumps_std(data, std, content_type='plain'):
# def proto_dumps_std_threadsafe(data, std):
# def proto_loads_std(std):
# class secret(object):
# 
# Path: nuka/task.py
# class teardown(SetupTask):
#     """remove `remote_dir` from the host"""
# 
#     teardown_cmd = '{0}rm -Rf {1[remote_dir]}'
# 
#     def __init__(self, host):
#         host._cancelled = False
#         super().__init__(host=host)
# 
#     def __class_name__(self):
#         return 'teardown'
# 
#     async def run(self):
#         if not self.host.failed():
#             sudo = self.host.use_sudo and 'sudo ' or ''
#             cmd = self.teardown_cmd.format(sudo, config)
#             await self.host.run_command(cmd, task=self)


# Path: nuka/reports.py
import os
import sys
import jinja2
import nuka
from uuid import uuid4
from operator import itemgetter
from collections import defaultdict
from nuka.utils import json
from nuka.task import teardown
    from wsgiref.simple_server import make_server

                        parent=t.uid,
                        rc=sh['rc'],
                    )
                    func['remote_calls'].append(round_dict(tsh))
                    sh_start += tsh.time
            t['funcs'].append(round_dict(func))

    _end = all_tasks[-1]
    _real_end = _end
    i = 1
    while isinstance(_real_end['task'], teardown):
        i += 1
        try:
            _real_end = all_tasks[-i]
        except IndexError:
            _real_end = _end
            break

    for k, v in stats.items():
        v['avg_time'] = v['time'] / v['calls']
        v['avg_remote_time'] = v['remote_time'] / v['calls']
        for kk, vv in v.items():
            if isinstance(vv, float):
                v[kk] = '%.3f' % vv
    stats = sorted(stats.values(),
                   key=itemgetter('remote_time'),
                   reverse=True)

    data = {
        'host': host.name,

        'tasks': tasks,