Mercurial > repos > rv43 > chess_tomo
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test.py Mon Mar 20 17:54:33 2023 +0000 @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 + +import logging + +import sys +import argparse +import numpy as np + +def __main__(): + + # Parse command line arguments + parser = argparse.ArgumentParser( + description='Test') + parser.add_argument('-l', '--log', + type=argparse.FileType('w'), + default=sys.stdout, + help='Log file') + args = parser.parse_args() + + # Set basic log configuration + logging_format = '%(asctime)s : %(levelname)s - %(module)s : %(funcName)s - %(message)s' + log_level = 'INFO' + level = getattr(logging, log_level.upper(), None) + if not isinstance(level, int): + raise ValueError(f'Invalid log_level: {log_level}') + logging.basicConfig(format=logging_format, level=level, force=True, + handlers=[logging.StreamHandler()]) + + logging.info(f'log = {args.log}') + logging.info(f'is log stdout? {args.log is sys.stdout}') + +if __name__ == "__main__": + __main__() +
