8423d893d36b125db3ddbe179fad9761cad66d3b
David Blume Upgrade to Python 3

David Blume authored 3 years ago

1) #!/usr/bin/env python3
David Blume first commit; just disconne...

David Blume authored 7 years ago

2) # -*- coding: utf-8 -*-
3) #
4) # "Hello Friends" in Chinese: 朋友你好
5) import os
6) import sys
7) import time
8) from argparse import ArgumentParser
David Blume Compatibility with Python 2.

David Blume authored 7 years ago

9) import counter.counter
10) import sitesize.sitesize
David Blume first commit; just disconne...

David Blume authored 7 years ago

11) 
12) 
David Blume Upgrade to Python 3

David Blume authored 3 years ago

13) def set_v_print(verbose: bool):
David Blume first commit; just disconne...

David Blume authored 7 years ago

14)     """
15)     Defines the function v_print.
16)     It prints if verbose is true, otherwise, it does nothing.
17)     See: http://stackoverflow.com/questions/5980042
18)     :param verbose: A bool to determine if v_print will print its args.
19)     """
20)     global v_print
David Blume Upgrade to Python 3

David Blume authored 3 years ago

21)     v_print = print if verbose else lambda *a, **k: None
David Blume first commit; just disconne...

David Blume authored 7 years ago

22) 
23) 
David Blume Upgrade to Python 3

David Blume authored 3 years ago

24) def main(debug: bool):
David Blume first commit; just disconne...

David Blume authored 7 years ago

25)     start_time = time.time()
26)     localdir = os.path.abspath(os.path.dirname(sys.argv[0]))
David Blume Compatibility with Python 2.

David Blume authored 7 years ago

27)     v_print("Running counter...")
28)     counter.counter.run()
29)     v_print("Running sitesize...")
30)     sitesize.sitesize.run()
David Blume Convert a string to f-string.

David Blume authored 3 years ago

31)     print(f'Done.  That took {time.time() - start_time:1.2f}s.')