Skip to content

Commit

Permalink
時間を管理する準備
Browse files Browse the repository at this point in the history
  • Loading branch information
itkr committed Sep 1, 2015
1 parent b654c05 commit 0d772d9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion progress_bar.py
Expand Up @@ -4,13 +4,17 @@

import enum

from datetime import datetime


class ProgressBar(object):

def __init__(self, max_num, unit_num=1):
self.max_num = max_num
self.unit_num = unit_num
self.current_num = 0
self.started_at = None
self.finished_at = None

@classmethod
def iteration(cls, iterable, call_back, unit_num=1):
Expand Down Expand Up @@ -45,9 +49,10 @@ def update(self, num):

def start(self):
self.update(0)
self.started_at = datetime.now()

def finish(self):
pass
self.finished_at = datetime.now()

def __enter__(self):
self.start()
Expand Down

0 comments on commit 0d772d9

Please sign in to comment.