Mercurial > repos > rv43 > chess_tomo
comparison test.py @ 0:7cc026583189 draft
planemo upload for repository https://github.com/rolfverberg/galaxytools commit 0814301cace61040b468d4185a9056a1aed4050d
| author | rv43 |
|---|---|
| date | Mon, 20 Mar 2023 17:54:33 +0000 |
| parents | |
| children | 07647d52d7d3 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:7cc026583189 |
|---|---|
| 1 #!/usr/bin/env python3 | |
| 2 | |
| 3 import logging | |
| 4 | |
| 5 import sys | |
| 6 import argparse | |
| 7 import numpy as np | |
| 8 | |
| 9 def __main__(): | |
| 10 | |
| 11 # Parse command line arguments | |
| 12 parser = argparse.ArgumentParser( | |
| 13 description='Test') | |
| 14 parser.add_argument('-l', '--log', | |
| 15 type=argparse.FileType('w'), | |
| 16 default=sys.stdout, | |
| 17 help='Log file') | |
| 18 args = parser.parse_args() | |
| 19 | |
| 20 # Set basic log configuration | |
| 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 | |
| 32 if __name__ == "__main__": | |
| 33 __main__() | |
| 34 |
