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 and progress logging.
4+
5+ :Author: Martin Kilbinger <martin.kilblinger@cea.fr>
6+
7+ """
8+
9+
10+ import sys
11+
12+
13+ def log_command (argv , name = None , close_no_return = True ):
14+ """Log Command.
15+
16+ Write command with arguments to a file or stdout.
17+ Choose name = 'sys.stdout' or 'sys.stderr' for output on sceen.
18+
19+ MKDEBUG copied from shapepipe:cfis
20+
21+ Parameters
22+ ----------
23+ argv : list
24+ Command line arguments
25+ name : str
26+ Output file name (default: 'log_<command>')
27+ close_no_return : bool
28+ If True (default), close log file. If False, keep log file open
29+ and return file handler
30+
31+ Returns
32+ -------
33+ filehandler
34+ log file handler (if close_no_return is False)
35+
36+ """
37+ if name is None :
38+ name = 'log_' + os .path .basename (argv [0 ])
39+
40+ if name == 'sys.stdout' :
41+ f = sys .stdout
42+ elif name == 'sys.stderr' :
43+ f = sys .stderr
44+ else :
45+ f = open (name , 'w' )
46+
47+ for a in argv :
48+
49+ # Quote argument if special characters
50+ if '[' in a or ']' in a :
51+ a = f'\" { a } \" '
52+
53+ print (a , end = '' , file = f )
54+ print (' ' , end = '' , file = f )
55+
56+ print ('' , file = f )
57+
58+ if not close_no_return :
59+ return f
60+
61+ if name != 'sys.stdout' and name != 'sys.stderr' :
62+ f .close ()
Original file line number Diff line number Diff line change 11coverage
2- nose
2+ isort
3+ jinja2==3.0
4+ numpydoc
35pytest
46pytest-cov
5- pytest-pep8
6- pytest-emoji
7- pytest-flake8
8- wemake-python-styleguide
7+ pytest-pycodestyle
8+ 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
Original file line number Diff line number Diff line change 77# Set the package release version
88major = 0
99minor = 0
10- patch = 0
10+ patch = 1
1111
1212# Set the package details
1313name = 'cs_util'
You can’t perform that action at this time.
0 commit comments