David Blume commited on 2020-12-30 15:27:29
Showing 1 changed files, with 7 additions and 2 deletions.
| ... | ... |
@@ -12,6 +12,7 @@ import sitesize.sitesize |
| 12 | 12 |
|
| 13 | 13 |
|
| 14 | 14 |
def timeit(f): |
| 15 |
+ """Decorator that prints the duration of the decorated function.""" |
|
| 15 | 16 |
@functools.wraps(f) |
| 16 | 17 |
def wrapper(*args, **kwargs): |
| 17 | 18 |
s = time.time() |
| ... | ... |
@@ -51,15 +52,19 @@ class Coffee: |
| 51 | 52 |
|
| 52 | 53 |
@timeit |
| 53 | 54 |
def main(debug: bool): |
| 54 |
- start_time = time.time() |
|
| 55 | 55 |
script_dir = os.path.abspath(os.path.dirname(sys.argv[0])) |
| 56 |
+ print(f'{sys.argv[0]} is in {script_dir}.')
|
|
| 57 |
+ |
|
| 58 |
+ # Raymond Hettinger's example use of queue.Queue and threading.Thread |
|
| 56 | 59 |
v_print("Running counter...")
|
| 57 | 60 |
counter.counter.run() |
| 61 |
+ |
|
| 62 |
+ # Raymond Hettinger's example use of multiprocessing.pool's ThreadPool |
|
| 58 | 63 |
v_print("Running sitesize...")
|
| 59 | 64 |
sitesize.sitesize.run() |
| 65 |
+ |
|
| 60 | 66 |
cuppa = Coffee(5.00) |
| 61 | 67 |
cuppa.price = cuppa.price - 1.00 |
| 62 |
- print(f'{sys.argv[0]} is in {script_dir}.')
|
|
| 63 | 68 |
|
| 64 | 69 |
|
| 65 | 70 |
if __name__ == '__main__': |
| 66 | 71 |