File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ """LOGGING.
2+
3+ :Description: This script contains utility methods for job execution
4+ and progress logging.
5+
6+ :Author: Martin Kilbinger
7+
8+ :Author: Martin Kilbinge <martin.kilblinger@cea.fr>
9+
10+ """
11+
12+
13+ import sys
14+
15+
16+ def log_command (argv , name = None , close_no_return = True ):
17+ """Log Command.
18+
19+ Write command with arguments to a file or stdout.
20+ Choose name = 'sys.stdout' or 'sys.stderr' for output on sceen.
21+
22+ MKDEBUG copied from shapepipe:cfis
23+
24+ Parameters
25+ ----------
26+ argv : list
27+ Command line arguments
28+ name : str
29+ Output file name (default: 'log_<command>')
30+ close_no_return : bool
31+ If True (default), close log file. If False, keep log file open
32+ and return file handler
33+
34+ Returns
35+ -------
36+ filehandler
37+ log file handler (if close_no_return is False)
38+
39+ """
40+ if name is None :
41+ name = 'log_' + os .path .basename (argv [0 ])
42+
43+ if name == 'sys.stdout' :
44+ f = sys .stdout
45+ elif name == 'sys.stderr' :
46+ f = sys .stderr
47+ else :
48+ f = open (name , 'w' )
49+
50+ for a in argv :
51+
52+ # Quote argument if special characters
53+ if '[' in a or ']' in a :
54+ a = f'\" { a } \" '
55+
56+ print (a , end = '' , file = f )
57+ print (' ' , end = '' , file = f )
58+
59+ print ('' , file = f )
60+
61+ if not close_no_return :
62+ return f
63+
64+ if name != 'sys.stdout' and name != 'sys.stderr' :
65+ f .close ()
Original file line number Diff line number Diff line change 11coverage
2- nose
2+ isort
3+ numpydoc
34pytest
45pytest-cov
5- pytest-pep8
6- pytest-emoji
7- pytest-flake8
8- wemake-python-styleguide
6+ pytest-pycodestyle
7+ pytest-pydocstyle
Original file line number Diff line number Diff line change 1+ astropy
2+ datetime
13importlib_metadata
24numpy
3- astropy
45matplotlib
56pycodestyle == 2.9.0
67vos
7- datetime
Original file line number Diff line number Diff line change @@ -22,9 +22,9 @@ testpaths =
2222 scripts
2323addopts =
2424 --verbose
25- --emoji
26- --flake8
2725 --cov =cs_util
2826 --cov-report =term
2927 --cov-report =xml
3028 --junitxml =pytest.xml
29+ # --emoji
30+ # --flake8
You can’t perform that action at this time.
0 commit comments