comparison test.py @ 1:07647d52d7d3 draft

planemo upload for repository https://github.com/rolfverberg/galaxytools commit 0814301cace61040b468d4185a9056a1aed4050d-dirty
author rv43
date Mon, 20 Mar 2023 18:06:45 +0000
parents 7cc026583189
children
comparison
equal deleted inserted replaced
0:7cc026583189 1:07647d52d7d3
1 #!/usr/bin/env python3 1 #!/usr/bin/env python3
2
3 import logging
4 2
5 import sys 3 import sys
6 import argparse 4 import argparse
7 import numpy as np
8 5
9 def __main__(): 6 def __main__():
10 7
11 # Parse command line arguments 8 # Parse command line arguments
12 parser = argparse.ArgumentParser( 9 parser = argparse.ArgumentParser(
15 type=argparse.FileType('w'), 12 type=argparse.FileType('w'),
16 default=sys.stdout, 13 default=sys.stdout,
17 help='Log file') 14 help='Log file')
18 args = parser.parse_args() 15 args = parser.parse_args()
19 16
20 # Set basic log configuration 17 print('Hello world')
21 logging_format = '%(asctime)s : %(levelname)s - %(module)s : %(funcName)s - %(message)s'
22 log_level = 'INFO'
23 level = getattr(logging, log_level.upper(), None)
24 if not isinstance(level, int):
25 raise ValueError(f'Invalid log_level: {log_level}')
26 logging.basicConfig(format=logging_format, level=level, force=True,
27 handlers=[logging.StreamHandler()])
28
29 logging.info(f'log = {args.log}')
30 logging.info(f'is log stdout? {args.log is sys.stdout}')
31 18
32 if __name__ == "__main__": 19 if __name__ == "__main__":
33 __main__() 20 __main__()
34 21