-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
72 lines (49 loc) · 2.45 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import argparse
import logging
import time
import volumeCalculator
def main():
"""Short description of the function
Detailed Description of this function
Args:
param1 (int): The first parameter.
param2 (:obj:`str`, optional): The second parameter. Defaults to None.
Second line of description should be indented.
*args: Variable length argument list.
**kwargs: Arbitrary keyword arguments.
Returns:
bool: True if successful, False otherwise.
"""
startTime = time.time()
logging.basicConfig(filename="log/Log[{0}].log".format(int(startTime)),
level= logging.DEBUG,
format= "[%(levelname)s] %(asctime)s - %(message)s")
#Log start time
logging.getLogger().info("Started at {0}".format(startTime))
logging.getLogger().info("-------------------Parser Action-----------------------")
#parser Action
parser = argparse.ArgumentParser(description="Calcing the Radius of spheres")
parser.add_argument("radie", metavar="R", type= float, default=[1], nargs='*', help="Radie of the spheres to calulate")
parser.add_argument("--debug",type=bool, nargs='?', const=True, default=False, help="Wanna debug ?")
parser.add_argument("--someString", type = str, default="Some default String", help = "Just a string")
FLAGS, unparsed = parser.parse_known_args()
for r in FLAGS.radie:
print(volumeCalculator.calcSphere(r))
print(FLAGS.debug)
logging.getLogger().info("-------------------Calcing Action-----------------------")
#calc smth could now have more logic
print(volumeCalculator.calcSphere(5))
print(volumeCalculator.calcSphere(0.2))
print(volumeCalculator.calcSphere(-4))
print(volumeCalculator.calcSphere("Test"))
logging.getLogger().info("-------------------All Log Types Action-----------------------")
#Log all types of Levels
logging.getLogger().debug("Am i here ?")
logging.getLogger().info("Next time pls do this")
logging.getLogger().warning("Some problem occured, but its fine")
logging.getLogger().error("Types did not match in ...")
logging.getLogger().critical("ICH BRENNNE")
logging.getLogger().info("-------------------On Program End-----------------------")
logging.getLogger().info("[runTime]: %s" % (time.time()-startTime))
if __name__ == "__main__":
main()