Skip to content

Commit

Permalink
removed dataclass to support older versions of Python.
Browse files Browse the repository at this point in the history
  • Loading branch information
nickdelgrosso committed Dec 29, 2018
1 parent cc600ad commit 7c4dc77
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions leansim/worker.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
from dataclasses import dataclass, field
from typing import Union, Any


@dataclass
class Worker:
todo: int = 0
doing: list = field(default_factory=list, repr=False)
done: int = 0
target: Any = field(default=None, repr=False)
task_duration: int = field(default=1, repr=False)
batch_size: int = field(default=1, repr=False)
max_todo: Union[int, type(None)] = field(default=None, repr=False)
_task_time: int = field(default=0, repr=False)
pull: bool = field(default=False, repr=False)
capacity: int = 1

def __init__(self, todo=0, target=None, task_duration=1, batch_size=1, max_todo=None, pull=False, capacity=1):
self.todo = todo
self.doing = []
self.done = 0
self.target = target
self.task_duration = task_duration
self.batch_size = batch_size
self.max_todo = max_todo
self.pull = pull
self.capacity = capacity


def work(self):
Expand Down

0 comments on commit 7c4dc77

Please sign in to comment.