[GRASS-dev] Python indentation?
Markus Neteler
neteler at osgeo.org
Tue Sep 20 17:01:42 EDT 2011
Hi,
using python's
-t Issue a warning when a source file mixes tabs and spaces
for indentation in a way
that makes it depend on the worth of a tab expressed in
spaces. Issue an error
when the option is given twice.
I get some warnings in the GRASS code:
cd lib/python/
for i in `ls *.py` ; do python -tt $i ; done
File "array.py", line 34
reg = grass.region()
^
TabError: inconsistent use of tabs and spaces in indentation
File "core.py", line 49
if shell == None:
^
TabError: inconsistent use of tabs and spaces in indentation
File "db.py", line 48
fatal(_("Unable to describe table <%s>") % table)
^
TabError: inconsistent use of tabs and spaces in indentation
Traceback (most recent call last):
File "__init__.py", line 1, in <module>
from core import *
File "/home/neteler/grass70/lib/python/core.py", line 49
if shell == None:
^
TabError: inconsistent use of tabs and spaces in indentation
File "raster3d.py", line 60
kv[k] = float_or_null(kv[k])
^
TabError: inconsistent use of tabs and spaces in indentation
File "raster.py", line 79
kv[k] = float_or_null(kv[k])
^
TabError: inconsistent use of tabs and spaces in indentation
File "setup.py", line 51
path = dir + os.pathsep + path
^
TabError: inconsistent use of tabs and spaces in indentation
Traceback (most recent call last):
File "task.py", line 29, in <module>
import xml.etree.ElementTree as etree
File "/usr/lib64/python2.6/xml/etree/ElementTree.py", line 758, in <module>
_escape = re.compile(eval(r'u"[&<>\"\u0080-\uffff]+"'))
File "/usr/lib64/python2.6/re.py", line 190, in compile
return _compile(pattern, flags)
File "/usr/lib64/python2.6/re.py", line 243, in _compile
p = sre_compile.compile(pattern, flags)
File "/usr/lib64/python2.6/sre_compile.py", line 510, in compile
code = _code(p, flags)
File "/usr/lib64/python2.6/sre_compile.py", line 495, in _code
_compile(code, p.data, flags)
File "/usr/lib64/python2.6/sre_compile.py", line 88, in _compile
_compile(code, av[2], flags)
File "/usr/lib64/python2.6/sre_compile.py", line 63, in _compile
_compile_charset(av, flags, code, fixup)
File "/usr/lib64/python2.6/sre_compile.py", line 189, in _compile_charset
for op, av in _optimize_charset(charset, fixup):
File "/usr/lib64/python2.6/sre_compile.py", line 232, in _optimize_charset
return _optimize_unicode(charset, fixup)
File "/usr/lib64/python2.6/sre_compile.py", line 309, in _optimize_unicode
import array
File "/home/neteler/grass70/lib/python/array.py", line 34
reg = grass.region()
^
TabError: inconsistent use of tabs and spaces in indentation
File "tgis_abstract_datasets.py", line 70
"""Select temporal dataset entry from database and fill up the
internal structure"""
^
TabError: inconsistent use of tabs and spaces in indentation
File "tgis_base.py", line 35
sql_database_interface.__init__(self, table, ident)
^
TabError: inconsistent use of tabs and spaces in indentation
File "tgis_core.py", line 116
"""Convert the internal dictionary into a string of semicolon
separated SQL statements
^
TabError: inconsistent use of tabs and spaces in indentation
File "tgis_metadata.py", line 31
sql_database_interface.__init__(self, table, ident)
^
TabError: inconsistent use of tabs and spaces in indentation
File "tgis_space_time_datasets.py", line 40
self.reset(ident)
^
TabError: inconsistent use of tabs and spaces in indentation
File "tgis_spatial_extent.py", line 29
sql_database_interface.__init__(self, table, ident)
^
TabError: inconsistent use of tabs and spaces in indentation
File "tgis_temporal_extent.py", line 31
sql_database_interface.__init__(self, table, ident)
^
TabError: inconsistent use of tabs and spaces in indentation
File "vector.py", line 53
f = l.split(';')
^
TabError: inconsistent use of tabs and spaces in indentation
Would it make sense to re-indent the code with:
tools/reindent.py ? Or do we need to modify that first (how)
?
Markus
More information about the grass-dev
mailing list