Commit 08cc2a10f58bc6c9f1868a5c349d4af9b8e543c3
1 parent
9bde7753
Replace compact csv header writing that is not supported on Python 2.3 by a more explicit syntax.
Showing
4 changed files
with
16 additions
and
22 deletions
cscripts/__init__.py.in
| ... | ... | @@ -50,20 +50,6 @@ if cur_version > req_version: |
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | # Import |
| 53 | -#from @PYTHON_RELATIVE_IMPORT@cscaldb import cscaldb | |
| 54 | -#from @PYTHON_RELATIVE_IMPORT@csinfo import csinfo | |
| 55 | -#from @PYTHON_RELATIVE_IMPORT@cslightcrv import cslightcrv | |
| 56 | -#from @PYTHON_RELATIVE_IMPORT@csmodelinfo import csmodelinfo | |
| 57 | -#from @PYTHON_RELATIVE_IMPORT@csmodelmerge import csmodelmerge | |
| 58 | -#from @PYTHON_RELATIVE_IMPORT@csobs2caldb import csobs2caldb | |
| 59 | -#from @PYTHON_RELATIVE_IMPORT@csobsdef import csobsdef | |
| 60 | -#from @PYTHON_RELATIVE_IMPORT@csobsinfo import csobsinfo | |
| 61 | -#from @PYTHON_RELATIVE_IMPORT@cspull import cspull | |
| 62 | -#from @PYTHON_RELATIVE_IMPORT@csresmap import csresmap | |
| 63 | -#from @PYTHON_RELATIVE_IMPORT@cssens import cssens | |
| 64 | -#from @PYTHON_RELATIVE_IMPORT@csspec import csspec | |
| 65 | -#from @PYTHON_RELATIVE_IMPORT@cstsdist import cstsdist | |
| 66 | -#from @PYTHON_RELATIVE_IMPORT@cstsmapmerge import cstsmapmerge | |
| 67 | 53 | import cscaldb |
| 68 | 54 | import csinfo |
| 69 | 55 | import cslightcrv |
| ... | ... | @@ -80,10 +66,6 @@ import cstsdist |
| 80 | 66 | import cstsmapmerge |
| 81 | 67 | import obsutils |
| 82 | 68 | if cur_version > req_version: |
| 83 | - #from @PYTHON_RELATIVE_IMPORT@csfindobs import csfindobs | |
| 84 | - #from @PYTHON_RELATIVE_IMPORT@csiactcopy import csiactcopy | |
| 85 | - #from @PYTHON_RELATIVE_IMPORT@csiactdata import csiactdata | |
| 86 | - #from @PYTHON_RELATIVE_IMPORT@csiactobs import csiactobs | |
| 87 | 69 | import csfindobs |
| 88 | 70 | import csiactcopy |
| 89 | 71 | import csiactdata | ... | ... |
cscripts/cspull.py
| ... | ... | @@ -321,7 +321,11 @@ class cspull(ctools.cscript): |
| 321 | 321 | if seed == 0: |
| 322 | 322 | file = open(self.m_outfile.url(), 'w') |
| 323 | 323 | writer = csv.DictWriter(file, result['colnames']) |
| 324 | - writer.writerow(dict((_,_) for _ in result['colnames'])) | |
| 324 | + headers = {} | |
| 325 | + for n in result['colnames']: | |
| 326 | + headers[n] = n | |
| 327 | + writer.writerow(headers) | |
| 328 | + #writer.writerow(dict((_,_) for _ in result['colnames'])) | |
| 325 | 329 | else: |
| 326 | 330 | file = open(self.m_outfile.url(), 'a') |
| 327 | 331 | writer = csv.DictWriter(file, result['colnames']) | ... | ... |
cscripts/cssens.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # This script computes the CTA sensitivity. |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2011-2015 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2011-2016 Juergen Knoedlseder | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -251,7 +251,11 @@ class cssens(ctools.cscript): |
| 251 | 251 | if ieng == 0: |
| 252 | 252 | f = open(self.m_outfile.url(), 'w') |
| 253 | 253 | writer = csv.DictWriter(f, colnames) |
| 254 | - writer.writerow(dict((_,_) for _ in colnames)) | |
| 254 | + headers = {} | |
| 255 | + for n in colnames: | |
| 256 | + headers[n] = n | |
| 257 | + writer.writerow(headers) | |
| 258 | + #writer.writerow(dict((_,_) for _ in colnames)) | |
| 255 | 259 | writer.writerow(result) |
| 256 | 260 | f.close() |
| 257 | 261 | else: | ... | ... |
cscripts/cstsdist.py
| ... | ... | @@ -251,7 +251,11 @@ class cstsdist(ctools.cscript): |
| 251 | 251 | if seed == 0: |
| 252 | 252 | file = open(self.m_outfile.url(), 'w') |
| 253 | 253 | writer = csv.DictWriter(file, result['colnames']) |
| 254 | - writer.writerow(dict((_,_) for _ in result['colnames'])) | |
| 254 | + headers = {} | |
| 255 | + for n in result['colnames']: | |
| 256 | + headers[n] = n | |
| 257 | + writer.writerow(headers) | |
| 258 | + #writer.writerow(dict((_,_) for _ in result['colnames'])) | |
| 255 | 259 | else: |
| 256 | 260 | file = open(self.m_outfile.url(), 'a') |
| 257 | 261 | writer = csv.DictWriter(file, result['colnames']) | ... | ... |