Blackened files

This commit is contained in:
Joel Collins 2019-11-06 22:07:16 +00:00
parent be5ddb76ae
commit 4e7606aa0c
24 changed files with 200 additions and 120 deletions

View file

@ -10,5 +10,14 @@ __all__ = [
"ThreadTerminationError",
]
from .pool import tasks, states, current_task, update_task_progress, cleanup_tasks, remove_task, update_task_data, taskify
from .pool import (
tasks,
states,
current_task,
update_task_progress,
cleanup_tasks,
remove_task,
update_task_data,
taskify,
)
from .thread import ThreadTerminationError

View file

@ -43,6 +43,7 @@ class TaskMaster:
# Task management
def tasks():
"""
Dictionary of tasks in default taskmaster
@ -62,6 +63,7 @@ def states():
global _default_task_master
return _default_task_master.states
def cleanup_tasks():
global _default_task_master
return _default_task_master.cleanup()
@ -74,6 +76,7 @@ def remove_task(task_id: str):
# Operations on the current task
def current_task():
current_task_thread = threading.current_thread()
if not isinstance(current_task_thread, TaskThread):
@ -97,6 +100,7 @@ def update_task_data(data: dict):
# Main "taskify" functions
def taskify(f):
"""
A decorator that wraps the passed in function

View file

@ -41,7 +41,7 @@ class TaskThread(threading.Thread):
self._return_value = None # Return value
self._start_time = None # Task start time
self._end_time = None # Task end time
# Public state properties
self.progress: int = None # Percent progress of the task
self.data = {} # Dictionary of custom data added during the task