Sfoglia il codice sorgente

Fix flake8 pep8 errors (#986)

* PEP8: fix E117: over-indented
* PEP8: fix E122: continuation line missing indentation or outdented
* PEP8: fix E123: closing bracket does not match indentation of opening bracket's line
* PEP8: fix E124: closing bracket does not match visual indentation
* PEP8: fix E126: continuation line over-indented for hanging indent
* PEP8: fix E129: visually indented line with same indent as next logical line
* PEP8: fix E201: whitespace after '{'
* PEP8: fix E203: whitespace before ':'
* PEP8: fix E222: multiple spaces after operator
* PEP8: fix E225: missing whitespace around operator
* PEP8: fix E228: missing whitespace around modulo operator
* PEP8: fix E241: multiple spaces after ','
* PEP8: fix E262: inline comment should start with '# '
* PEP8: fix E301: expected 1 blank line, found 0
* PEP8: fix E401: multiple imports on one line
* PEP8: fix E502: the backslash is redundant between brackets
* PEP8: fix E711: comparison to None should be 'if cond is None:'
* PEP8: fix W291: trailing whitespace
* PEP8: fix W391: blank line at end of file
* PEP8: fix E225: missing whitespace around operator
* PEP8: fix E131 continuation line unaligned for hanging indent
* PEP8: reduce list of ignored codes
* sort flake8 ignore codes
* PEP8: fix remaining E117,E712
Markus Neteler 4 anni fa
parent
commit
90634b76e3
100 ha cambiato i file con 1094 aggiunte e 1035 eliminazioni
  1. 14 35
      lib/python/.flake8
  2. 3 2
      lib/python/bandref/reader.py
  3. 8 8
      lib/python/ctypes/ctypesgencore/ctypedescs.py
  4. 2 2
      lib/python/ctypes/ctypesgencore/parser/parsetab.py
  5. 2 2
      lib/python/ctypes/ctypesgencore/parser/preprocessor.py
  6. 10 9
      lib/python/docs/conf.py
  7. 2 0
      lib/python/exceptions/__init__.py
  8. 1 0
      lib/python/gunittest/case.py
  9. 1 0
      lib/python/gunittest/gmodules.py
  10. 1 1
      lib/python/gunittest/gutils.py
  11. 3 3
      lib/python/gunittest/main.py
  12. 4 4
      lib/python/gunittest/multireport.py
  13. 3 3
      lib/python/gunittest/multirunner.py
  14. 7 6
      lib/python/gunittest/reporters.py
  15. 1 0
      lib/python/gunittest/runner.py
  16. 1 0
      lib/python/gunittest/testsuite/test_assertions_vect.py
  17. 4 1
      lib/python/imaging/images2swf.py
  18. 2 1
      lib/python/pydispatch/dispatcher.py
  19. 3 1
      lib/python/pydispatch/saferef.py
  20. 2 1
      lib/python/pydispatch/signal.py
  21. 1 1
      lib/python/pygrass/errors.py
  22. 4 0
      lib/python/pygrass/gis/__init__.py
  23. 6 6
      lib/python/pygrass/gis/region.py
  24. 2 2
      lib/python/pygrass/gis/testsuite/test_pygrass_gis_doctests.py
  25. 3 2
      lib/python/pygrass/messages/__init__.py
  26. 0 1
      lib/python/pygrass/modules/grid/__init__.py
  27. 1 0
      lib/python/pygrass/modules/grid/grid.py
  28. 1 1
      lib/python/pygrass/modules/grid/split.py
  29. 1 0
      lib/python/pygrass/modules/interface/flag.py
  30. 6 4
      lib/python/pygrass/modules/interface/module.py
  31. 6 5
      lib/python/pygrass/modules/interface/parameter.py
  32. 1 1
      lib/python/pygrass/modules/interface/typedict.py
  33. 1 0
      lib/python/pygrass/modules/shortcuts.py
  34. 1 1
      lib/python/pygrass/orderdict.py
  35. 3 0
      lib/python/pygrass/raster/__init__.py
  36. 1 0
      lib/python/pygrass/raster/abstract.py
  37. 1 0
      lib/python/pygrass/raster/category.py
  38. 1 0
      lib/python/pygrass/raster/history.py
  39. 13 13
      lib/python/pygrass/raster/raster_type.py
  40. 1 1
      lib/python/pygrass/raster/rowio.py
  41. 11 10
      lib/python/pygrass/rpc/__init__.py
  42. 4 4
      lib/python/pygrass/rpc/base.py
  43. 1 1
      lib/python/pygrass/rpc/testsuite/test_pygrass_rpc_doctests.py
  44. 0 1
      lib/python/pygrass/shell/__init__.py
  45. 3 2
      lib/python/pygrass/tests/benchmark.py
  46. 1 1
      lib/python/pygrass/testsuite/test_pygrass_doctests.py
  47. 3 3
      lib/python/pygrass/utils.py
  48. 7 5
      lib/python/pygrass/vector/__init__.py
  49. 3 2
      lib/python/pygrass/vector/abstract.py
  50. 4 1
      lib/python/pygrass/vector/basic.py
  51. 4 2
      lib/python/pygrass/vector/find.py
  52. 14 13
      lib/python/pygrass/vector/geometry.py
  53. 7 7
      lib/python/pygrass/vector/sql.py
  54. 6 1
      lib/python/pygrass/vector/table.py
  55. 8 7
      lib/python/pygrass/vector/testsuite/test_geometry.py
  56. 1 1
      lib/python/pygrass/vector/testsuite/test_table.py
  57. 2 2
      lib/python/pygrass/vector/testsuite/test_vector.py
  58. 1 1
      lib/python/pygrass/vector/testsuite/test_vector3d.py
  59. 9 10
      lib/python/pygrass/vector/vector_type.py
  60. 32 32
      lib/python/script/core.py
  61. 2 2
      lib/python/script/raster.py
  62. 7 7
      lib/python/script/setup.py
  63. 35 33
      lib/python/script/task.py
  64. 7 7
      lib/python/script/vector.py
  65. 3 1
      lib/python/temporal/abstract_dataset.py
  66. 11 11
      lib/python/temporal/abstract_map_dataset.py
  67. 8 8
      lib/python/temporal/abstract_space_time_dataset.py
  68. 8 8
      lib/python/temporal/aggregation.py
  69. 18 7
      lib/python/temporal/base.py
  70. 3 3
      lib/python/temporal/c_libraries_interface.py
  71. 41 40
      lib/python/temporal/core.py
  72. 1 1
      lib/python/temporal/datetime_math.py
  73. 1 1
      lib/python/temporal/gui_support.py
  74. 3 3
      lib/python/temporal/list_stds.py
  75. 9 0
      lib/python/temporal/metadata.py
  76. 1 1
      lib/python/temporal/open_stds.py
  77. 4 4
      lib/python/temporal/register.py
  78. 4 0
      lib/python/temporal/space_time_datasets.py
  79. 1 0
      lib/python/temporal/spatial_extent.py
  80. 58 57
      lib/python/temporal/spatio_temporal_relationships.py
  81. 2 2
      lib/python/temporal/stds_export.py
  82. 122 118
      lib/python/temporal/temporal_algebra.py
  83. 5 0
      lib/python/temporal/temporal_extent.py
  84. 23 23
      lib/python/temporal/temporal_granularity.py
  85. 31 31
      lib/python/temporal/temporal_operator.py
  86. 5 7
      lib/python/temporal/temporal_raster3d_algebra.py
  87. 5 7
      lib/python/temporal/temporal_raster_algebra.py
  88. 65 65
      lib/python/temporal/temporal_raster_base_algebra.py
  89. 38 38
      lib/python/temporal/temporal_vector_algebra.py
  90. 55 55
      lib/python/temporal/testsuite/unittests_temporal_algebra.py
  91. 29 29
      lib/python/temporal/testsuite/unittests_temporal_algebra_grs.py
  92. 37 37
      lib/python/temporal/testsuite/unittests_temporal_algebra_mixed_stds.py
  93. 35 38
      lib/python/temporal/testsuite/unittests_temporal_conditionals.py
  94. 49 49
      lib/python/temporal/testsuite/unittests_temporal_raster_algebra.py
  95. 16 16
      lib/python/temporal/testsuite/unittests_temporal_raster_algebra_equal_ts.py
  96. 29 29
      lib/python/temporal/testsuite/unittests_temporal_raster_algebra_grs.py
  97. 17 17
      lib/python/temporal/testsuite/unittests_temporal_raster_algebra_spatial_topology.py
  98. 53 53
      lib/python/temporal/testsuite/unittests_temporal_raster_conditionals.py
  99. 4 4
      lib/python/temporal/testsuite/unittests_temporal_raster_conditionals_complement_else.py
  100. 0 0
      lib/python/temporal/testsuite/unittests_temporal_vector_algebra.py

+ 14 - 35
lib/python/.flake8

@@ -1,56 +1,35 @@
 [flake8]
 ignore =
-    E711, # comparison to None should be 'if cond is None:'
-    E712, # comparison to True should be 'if cond is True:' or 'if cond:'
-    E722, # do not use bare 'except'
-    E741, # ambiguous variable name 'l'
-    F401, # '.reader.BandReferenceReader' imported but unused
-    F403, # 'from ctypes import *' used; unable to detect undefined names
-    F405, # 'RasterRow' may be undefined, or defined from star imports: ctypes, grass.pygrass.raster, grass.pygrass.vector
-    F841, # local variable 't0' is assigned to but never used
-    W605, # invalid escape sequence '\_'
-    E262, # inline comment should start with '# '
-    E265, # block comment should start with '# '
-    E266, # too many leading '#' for block comment
-    F821, # undefined name '_'
-    E502, # the backslash is redundant between brackets
-    W291, # trailing whitespace
-    W292, # no newline at end of file
-    W293, # blank line contains whitespace
-    W391, # blank line at end of file
-    W503, # line break before binary operator
-    W504, # line break after binary operator
-    E117, # over-indented
     E121, # continuation line under-indented for hanging indent
-    E122, # continuation line missing indentation or outdented
-    E123, # closing bracket does not match indentation of opening bracket's line
-    E124, # closing bracket does not match visual indentation
     E125, # continuation line with same indent as next logical line
-    E126, # continuation line over-indented for hanging indent
     E127, # continuation line over-indented for visual indent
     E128, # continuation line under-indented for visual indent
-    E129, # visually indented line with same indent as next logical line
-    E201, # whitespace after '{'
     E202, # whitespace before ')'
-    E203, # whitespace before ':'
     E211, # whitespace before '('
     E221, # multiple spaces before operator
-    E222, # multiple spaces after operator
-    E225, # missing whitespace around operator
     E226, # missing whitespace around arithmetic operator
-    E228, # missing whitespace around modulo operator
     E231, # missing whitespace after ':'
-    E241, # multiple spaces after ','
     E251, # unexpected spaces around keyword / parameter equals
     E261, # at least two spaces before inline comment
+    E265, # block comment should start with '# '
+    E266, # too many leading '#' for block comment
     E271, # multiple spaces after keyword
     E272, # multiple spaces before keyword
-    E501, # line too long (183 > 150 characters)
-    E301, # expected 1 blank line, found 0
     E302, # expected 2 blank lines, found 1
     E303, # too many blank lines (3)
     E305, # expected 2 blank lines after class or function definition, found 1
-    E401, # multiple imports on one line
+    E501, # line too long (183 > 150 characters)
+    E722, # do not use bare 'except'
+    E741, # ambiguous variable name 'l'
+    F401, # '.reader.BandReferenceReader' imported but unused
+    F403, # 'from ctypes import *' used; unable to detect undefined names
+    F405, # 'RasterRow' may be undefined, or defined from star imports: ctypes, grass.pygrass.raster, grass.pygrass.vector
+    F821, # undefined name '_'
+    F841, # local variable 't0' is assigned to but never used
+    W293, # blank line contains whitespace
+    W503, # line break before binary operator
+    W504, # line break after binary operator
+    W605, # invalid escape sequence '\_'
 
 per-file-ignores =
     # C wrappers call libgis.G_gisinit before importing other modules.

+ 3 - 2
lib/python/bandref/reader.py

@@ -12,6 +12,7 @@ class BandReferenceReaderError(Exception):
 
 class BandReferenceReader:
     """Band references reader"""
+
     def __init__(self):
         self._json_files = glob.glob(
             os.path.join(os.environ['GISBASE'], 'etc', 'g.bands', '*.json')
@@ -35,7 +36,7 @@ class BandReferenceReader:
                 raise BandReferenceReaderError(
                     "Unable to parse '{}': {}".format(
                         json_file, e
-                ))
+                    ))
 
             # check if configuration is valid
             self._check_config(config)
@@ -55,7 +56,7 @@ class BandReferenceReader:
                 if item not in items.keys():
                     raise BandReferenceReaderError(
                         "Invalid band definition: <{}> is missing".format(item
-                ))
+                                                                          ))
             if len(items['bands']) < 1:
                 raise BandReferenceReaderError(
                     "Invalid band definition: no bands defined"

+ 8 - 8
lib/python/ctypes/ctypesgencore/ctypedescs.py

@@ -58,16 +58,16 @@ ctypes_type_map = {
 }
 
 ctypes_type_map_python_builtin = {
-    ('int',     True,   2): 'c_longlong',
-    ('int',     False,  2): 'c_ulonglong',
-    ('size_t',  True,   0): 'c_size_t',
+    ('int', True, 2): 'c_longlong',
+    ('int', False, 2): 'c_ulonglong',
+    ('size_t', True, 0): 'c_size_t',
     ('apr_int64_t', True, 0): 'c_int64',
-    ('off64_t', True,   0): 'c_int64',
+    ('off64_t', True, 0): 'c_int64',
     ('apr_uint64_t', True, 0): 'c_uint64',
-    ('wchar_t', True,   0): 'c_wchar',
-    ('ptrdiff_t', True,  0): 'c_ptrdiff_t',  # Requires definition in preamble
-    ('ssize_t', True,   0): 'c_ptrdiff_t',  # Requires definition in preamble
-    ('va_list', True,   0): 'c_void_p',
+    ('wchar_t', True, 0): 'c_wchar',
+    ('ptrdiff_t', True, 0): 'c_ptrdiff_t',  # Requires definition in preamble
+    ('ssize_t', True, 0): 'c_ptrdiff_t',  # Requires definition in preamble
+    ('va_list', True, 0): 'c_void_p',
 }
 
 # This protocol is used for walking type trees.

File diff suppressed because it is too large
+ 2 - 2
lib/python/ctypes/ctypesgencore/parser/parsetab.py


+ 2 - 2
lib/python/ctypes/ctypesgencore/parser/preprocessor.py

@@ -169,7 +169,7 @@ class PreprocessorParser(object):
                               shell=True,
                               universal_newlines=True,
                               stdout=subprocess.PIPE,
-                              stderr=subprocess.PIPE)        
+                              stderr=subprocess.PIPE)
         try:
             ppout, pperr = pp.communicate()
         except UnicodeError:
@@ -178,7 +178,7 @@ class PreprocessorParser(object):
             if sys.platform == 'darwin':
                 pp = subprocess.Popen(cmd,
                                       shell=True,
-                                      universal_newlines=False, #read as binary
+                                      universal_newlines=False,  # read as binary
                                       stdout=subprocess.PIPE,
                                       stderr=subprocess.PIPE)
                 ppout, pperr = pp.communicate()

+ 10 - 9
lib/python/docs/conf.py

@@ -12,7 +12,8 @@
 # All configuration values have a default; values that are commented out
 # serve to show the default.
 
-import sys, os
+import sys
+import os
 from datetime import date
 import string
 from shutil import copy
@@ -34,8 +35,8 @@ sys.path.insert(0, os.path.abspath(os.path.join(os.environ['GISBASE'], 'etc', 'p
 
 from grass.script import core
 
-footer_tmpl = string.Template(\
-r"""
+footer_tmpl = string.Template(
+    r"""
 {% block footer %}<hr class="header">
 <p><a href="../index.html">Help Index</a> | <a href="../topics.html">Topics Index</a> | <a href="../keywords.html">Keywords Index</a> | <a href="../full_index.html">Full Index</a></p>
 <p>&copy; 2003-${year} <a href="http://grass.osgeo.org">GRASS Development Team</a>, GRASS GIS ${grass_version} Reference Manual</p>
@@ -221,14 +222,14 @@ htmlhelp_basename = 'PythonLibdoc'
 # -- Options for LaTeX output ---------------------------------------------
 
 latex_elements = {
-# The paper size ('letterpaper' or 'a4paper').
-'papersize': 'a4paper',
+    # The paper size ('letterpaper' or 'a4paper').
+    'papersize': 'a4paper',
 
-# The font size ('10pt', '11pt' or '12pt').
-'pointsize': '10pt',
+    # The font size ('10pt', '11pt' or '12pt').
+    'pointsize': '10pt',
 
-# Additional stuff for the LaTeX preamble.
-#'preamble': '',
+    # Additional stuff for the LaTeX preamble.
+    #'preamble': '',
 }
 
 # Grouping the document tree into LaTeX files. List of tuples

+ 2 - 0
lib/python/exceptions/__init__.py

@@ -41,6 +41,7 @@ class ScriptError(Exception):
         >>> print(error)
         My error message!
     """
+
     def __init__(self, value):
         self.value = value
 
@@ -62,6 +63,7 @@ class CalledModuleError(subprocess.CalledProcessError):
     :param rc: process returncode
     :param error: errors provided by the module (stderr)
     """
+
     def __init__(self, module, code, returncode, errors=None):
         # CalledProcessError has undocumented constructor
         super(CalledModuleError, self).__init__(returncode, module)

+ 1 - 0
lib/python/gunittest/case.py

@@ -1126,6 +1126,7 @@ class TestCase(unittest.TestCase):
     # but for "integration" tests  (script-like tests with more than one module)
     # it would be better to be able to use this multiple times
     # TODO: enable merging streams?
+
     def assertModule(self, module, msg=None, **kwargs):
         """Run PyGRASS module in controlled way and assert non-zero return code.
 

+ 1 - 0
lib/python/gunittest/gmodules.py

@@ -42,6 +42,7 @@ class SimpleModule(Module):
     >>> colors.outputs.stderr.strip()
     "Color table for raster map <test_a> set to 'rules'"
     """
+
     def __init__(self, cmd, *args, **kargs):
         for banned in ['stdout_', 'stderr_', 'finish_', 'run_']:
             if banned in kargs:

+ 1 - 1
lib/python/gunittest/gutils.py

@@ -28,7 +28,7 @@ def is_map_in_mapset(name, type, mapset=None):
     and it does not care that the map is accessible in other mapset.
 
     :param name: name of the map
-    :param type: data type ('raster', 'raster3d', and 'vector') 
+    :param type: data type ('raster', 'raster3d', and 'vector')
     """
     if not mapset:
         mapset = get_current_mapset()

+ 3 - 3
lib/python/gunittest/main.py

@@ -119,9 +119,9 @@ def discovery():
 # TODO: create a full interface (using grass parser or argparse)
 def main():
     parser = argparse.ArgumentParser(
-    description='Run test files in all testsuite directories starting'
-                ' from the current one'
-                ' (runs on active GRASS session)')
+        description='Run test files in all testsuite directories starting'
+        ' from the current one'
+        ' (runs on active GRASS session)')
     parser.add_argument('--location', dest='location', action='store',
                         help='Name of location where to perform test', required=True)
     parser.add_argument('--location-type', dest='location_type', action='store',

+ 4 - 4
lib/python/gunittest/multireport.py

@@ -125,7 +125,7 @@ def plot_percent_successful(x, xticks, xlabels, successes, filename, style):
 
     step = 5
     ymin = int(min(successes) / step) * step
-    ymax =  int(smax / step) * step
+    ymax = int(smax / step) * step
     percents = range(ymin, ymax + step + 1, step)
     graph.set_yticks(percents)
     graph.set_yticklabels(['%d%%' % p for p in percents])
@@ -293,7 +293,7 @@ def main_page(results, filename, images, captions, title='Test reports',
             '</tr></thead>'
             '<tbody>'
             .format(title=title)
-            )
+        )
         for result in reversed(results):
             # TODO: include name to summary file
             # now using location or test report directory as name
@@ -400,7 +400,7 @@ def main():
             all_results.append(result)
             del result
         except KeyError as e:
-            print('File %s does not have right values (%s)' % (report, e.message)) 
+            print('File %s does not have right values (%s)' % (report, e.message))
 
     locations_main_page = open(os.path.join(output, 'index.html'), 'w')
     locations_main_page.write(
@@ -412,7 +412,7 @@ def main():
         '<th>Successful files</th><th>Successful tests</th>'
         '</tr></thead>'
         '<tbody>'
-        )
+    )
 
     PlotStyle = namedtuple('PlotStyle',
                            ['linestyle', 'linewidth',

+ 3 - 3
lib/python/gunittest/multirunner.py

@@ -71,7 +71,7 @@ def main():
                         dest='location_types',
                     default=[], metavar='TYPE',
                     help='Add repeated values to a list',
-                    )
+                        )
     parser.add_argument('--grassbin', required=True,
                         help='Use file timestamp instead of date in test summary')
     # TODO: rename since every src can be used?
@@ -95,7 +95,7 @@ def main():
     
 
     main_report = args.main_report
-    grasssrc = args.grasssrc  # TODO: can be guessed from dist    
+    grasssrc = args.grasssrc  # TODO: can be guessed from dist
     # TODO: create directory according to date and revision and create reports there
 
     # some predefined variables, name of the GRASS launch script + location/mapset
@@ -107,7 +107,7 @@ def main():
     # we assume that GRASS GIS' start script is available and in the PATH
     # the shell=True is here because of MS Windows? (code taken from wiki)
     startcmd = grass7bin + ' --config path'
-    p = subprocess.Popen(startcmd, shell=True, 
+    p = subprocess.Popen(startcmd, shell=True,
                          stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     out, err = p.communicate()
     if p.returncode != 0:

+ 7 - 6
lib/python/gunittest/reporters.py

@@ -320,6 +320,7 @@ class GrassTestFilesMultiReporter(object):
     which has this attribute using the order in which the reporters were
     provided.
     """
+
     def __init__(self, reporters, forgiving=False):
         self.reporters = reporters
         self.forgiving = forgiving
@@ -606,7 +607,7 @@ class GrassTestFilesHtmlReporter(GrassTestFilesCountingReporter):
                      nsper=percent_to_html(self.file_pass_per),
                      st=self.successes, ft=self.failures + self.errors,
                      total=self.total, pt=pass_per
-                     ))
+                 ))
 
         # this is the second place with this function
         # TODO: provide one implementation
@@ -707,7 +708,7 @@ class GrassTestFilesHtmlReporter(GrassTestFilesCountingReporter):
             .format(
                 m=module,
                 status=returncode_to_success_html_par(returncode),
-                ))
+            ))
 
         # TODO: include optionally hyper link to test suite
         # TODO: file_path is reconstucted in a naive way
@@ -752,7 +753,7 @@ class GrassTestFilesHtmlReporter(GrassTestFilesCountingReporter):
             '<ul>'
             '<li><a href="stdout.html">standard output (stdout)</a></li>'
             '<li><a href="stderr.html">standard error output (stderr)</a></li>'
-            )
+        )
         file_index.write(files_section)
 
         supplementary_files = test_summary.get('supplementary_files', None)
@@ -1045,7 +1046,7 @@ class TestsuiteDirReporter(object):
             '<th>Tests</th><th>Successful</td>'
             '<th>Failed</th><th>Percent successful</th>'
             '</tr></thead><tbody>'
-            )
+        )
         page.write(head)
         page.write(tests_table_head)
         for test_file_name in test_files:
@@ -1160,7 +1161,7 @@ class TestsuiteDirReporter(object):
         head = (
             '<html><body>'
             '<h1>Testsuites results</h1>'
-            )
+        )
         tests_table_head = (
             '<table>'
             '<thead><tr>'
@@ -1171,7 +1172,7 @@ class TestsuiteDirReporter(object):
             '<th>Tests</th><th>Successful</td>'
             '<th>Failed</th><th>Percent successful</th>'
             '</tr></thead><tbody>'
-            )
+        )
         page.write(head)
         page.write(tests_table_head)
 

+ 1 - 0
lib/python/gunittest/runner.py

@@ -23,6 +23,7 @@ __unittest = True
 
 class _WritelnDecorator(object):
     """Used to decorate file-like objects with a handy 'writeln' method"""
+
     def __init__(self,stream):
         self.stream = stream
 

+ 1 - 0
lib/python/gunittest/testsuite/test_assertions_vect.py

@@ -59,6 +59,7 @@ V_UNIVAR_SCHOOLS_EXTENDED = dict(
 class TestVectorInfoAssertions(TestCase):
     """Test assertions of map meta and statistics"""
     # pylint: disable=R0904
+
     def test_assertVectorFitsUnivar(self):
         self.assertVectorFitsUnivar(map='schools', column='CORECAPACI',
                                     reference=V_UNIVAR_SCHOOLS_WIDTH_SUBSET,

+ 4 - 1
lib/python/imaging/images2swf.py

@@ -67,7 +67,9 @@ sources and tools:
 
 """
 
-import os, sys, time
+import os
+import sys
+import time
 import zlib
 
 try:
@@ -511,6 +513,7 @@ class ShowFrameTag(ControlTag):
 
 class SetBackgroundTag(ControlTag):
     """ Set the color in 0-255, or 0-1 (if floats given). """
+
     def __init__(self, *rgb):
         self.tagtype = 9
         if len(rgb) == 1:

+ 2 - 1
lib/python/pydispatch/dispatcher.py

@@ -36,6 +36,7 @@ __version__ = "Revision: 1.1"
 
 class _Parameter:
     """Used to represent default parameter values."""
+
     def __repr__(self):
         return self.__class__.__name__
 
@@ -203,7 +204,7 @@ def disconnect(receiver, signal=Any, sender=Any, weak=True):
     """
     if signal is None:
         raise errors.DispatcherTypeError(
-            'Signal cannot be None (receiver=%r sender=%r)' % (receiver, 
+            'Signal cannot be None (receiver=%r sender=%r)' % (receiver,
                                                                sender)
         )
     if weak: receiver = saferef.safeRef(receiver)

+ 3 - 1
lib/python/pydispatch/saferef.py

@@ -1,7 +1,9 @@
 """Refactored "safe reference" from dispatcher.py"""
 from __future__ import print_function
 
-import weakref, traceback, sys
+import weakref
+import traceback
+import sys
 
 if sys.hexversion >= 0x3000000:
     im_func = '__func__'

+ 2 - 1
lib/python/pydispatch/signal.py

@@ -22,7 +22,7 @@ def _islambda(function):
     >>> _islambda(_islambda)
     False
     """
-    return isinstance(function, type(lambda: None)) and function.__name__== (lambda: None).__name__
+    return isinstance(function, type(lambda: None)) and function.__name__ == (lambda: None).__name__
 
 
 class Signal(object):
@@ -108,6 +108,7 @@ class Signal(object):
     lambda handler: Hello
     """
     # TODO: use the name for debugging
+
     def __init__(self, name):
         """Creates a signal object.
 

+ 1 - 1
lib/python/pygrass/errors.py

@@ -27,7 +27,7 @@ def mapinfo_must_be_set(method):
         if self.c_mapinfo:
             return method(self, *args, **kargs)
         else:
-            raise GrassError(_("The self.c_mapinfo pointer must be "\
+            raise GrassError(_("The self.c_mapinfo pointer must be "
                                  "correctly initiated"))
     return wrapper
 

+ 4 - 0
lib/python/pygrass/gis/__init__.py

@@ -127,6 +127,7 @@ class Gisdbase(object):
 
     ..
     """
+
     def __init__(self, gisdbase=''):
         self.name = gisdbase
 
@@ -198,6 +199,7 @@ class Location(object):
 
     ..
     """
+
     def __init__(self, location='', gisdbase=''):
         self.gisdbase = gisdbase
         self.name = location
@@ -287,6 +289,7 @@ class Mapset(object):
 
     ..
     """
+
     def __init__(self, mapset='', location='', gisdbase=''):
         self.gisdbase = gisdbase
         self.location = location
@@ -393,6 +396,7 @@ class Mapset(object):
 class VisibleMapset(object):
     """VisibleMapset object
     """
+
     def __init__(self, mapset, location='', gisdbase=''):
         self.mapset = mapset
         self.location = Location(location, gisdbase)

+ 6 - 6
lib/python/pygrass/gis/region.py

@@ -15,8 +15,8 @@ from grass.pygrass.errors import GrassError
 from grass.pygrass.shell.conversion import dict2html
 from grass.pygrass.utils import get_mapset_vector, get_mapset_raster
 
-test_vector_name="Region_test_vector"
-test_raster_name="Region_test_raster"
+test_vector_name = "Region_test_vector"
+test_raster_name = "Region_test_raster"
 
 class Region(object):
     """This class is design to easily access and modify GRASS computational
@@ -101,6 +101,7 @@ class Region(object):
 
     ..
     """
+
     def __init__(self, default=False):
         self.c_region = libgis.Cell_head()
         if default:
@@ -274,8 +275,8 @@ class Region(object):
     #----------MAGIC METHODS----------
     def __repr__(self):
         rg = "Region(north=%g, south=%g, east=%g, west=%g, "\
-                    "nsres=%g, ewres=%g, rows=%i, cols=%i, "\
-                    "cells=%i, zone=%i, proj=%i)"
+            "nsres=%g, ewres=%g, rows=%i, cols=%i, "\
+            "cells=%i, zone=%i, proj=%i)"
         return rg % (self.north, self.south, self.east, self.west,
                      self.nsres, self.ewres, self.rows, self.cols,
                      self.cells, self.zone, self.proj)
@@ -629,7 +630,7 @@ if __name__ == "__main__":
 
     utils.create_test_vector_map(test_vector_name)
     run_command("g.region", n=50, s=0, e=60, w=0, res=1)
-    run_command("r.mapcalc", expression="%s = 1"%(test_raster_name),
+    run_command("r.mapcalc", expression="%s = 1" % (test_raster_name),
                              overwrite=True)
     run_command("g.region", n=40, s=0, e=40, w=0, res=2)
 
@@ -642,4 +643,3 @@ if __name__ == "__main__":
     mset = utils.get_mapset_raster(test_raster_name, mapset='')
     if mset:
         run_command("g.remove", flags='f', type='raster', name=test_raster_name)
-

+ 2 - 2
lib/python/pygrass/gis/testsuite/test_pygrass_gis_doctests.py

@@ -37,9 +37,9 @@ def load_tests(loader, tests, ignore):
     utils.create_test_vector_map(gis.test_vector_name)
     utils.create_test_vector_map(gis.region.test_vector_name)
     run_command("g.region", n=50, s=0, e=60, w=0, res=1)
-    run_command("r.mapcalc", expression="%s = 1"%(gis.test_raster_name),
+    run_command("r.mapcalc", expression="%s = 1" % (gis.test_raster_name),
                              overwrite=True)
-    run_command("r.mapcalc", expression="%s = 1"%(gis.region.test_raster_name),
+    run_command("r.mapcalc", expression="%s = 1" % (gis.region.test_raster_name),
                              overwrite=True)
     run_command("g.region", n=40, s=0, e=40, w=0, res=2)
 

+ 3 - 2
lib/python/pygrass/messages/__init__.py

@@ -78,7 +78,7 @@ def message_server(lock, conn):
 
         message = data[1]
         # libgis limitation
-        if isinstance(message,  type(" ")):
+        if isinstance(message, type(" ")):
             if len(message) >= 2000:
                 message = message[:1999]
 
@@ -100,7 +100,7 @@ def message_server(lock, conn):
         elif message_type == "WARNING":
             libgis.G_warning(message)
         elif message_type == "ERROR":
-            libgis.G_important_message("ERROR: %s"%message)
+            libgis.G_important_message("ERROR: %s" % message)
         # This is for testing only
         elif message_type == "FATAL":
             libgis.G_fatal_error(message)
@@ -167,6 +167,7 @@ class Messenger(object):
        grass.exceptions.FatalError: Ohh no no no!
 
     """
+
     def __init__(self, raise_on_error=False):
         self.client_conn = None
         self.server_conn = None

+ 0 - 1
lib/python/pygrass/modules/grid/__init__.py

@@ -1,3 +1,2 @@
 # -*- coding: utf-8 -*-
 from grass.pygrass.modules.grid.grid import GridModule
-

+ 1 - 0
lib/python/pygrass/modules/grid/grid.py

@@ -409,6 +409,7 @@ class GridModule(object):
     ...                  slope='slope', aspect='aspect', overwrite=True)
     >>> grd.run()
     """
+
     def __init__(self, cmd, width=None, height=None, overlap=0, processes=None,
                  split=False, debug=False, region=None, move=None, log=False,
                  start_row=0, start_col=0, out_prefix='', mapset_prefix=None,

+ 1 - 1
lib/python/pygrass/modules/grid/split.py

@@ -81,7 +81,7 @@ def split_region_tiles(region=None, width=100, height=100, overlap=0):
 
 
 def get_overlap_region_tiles(region=None, width=100, height=100, overlap=0):
-    """Get the Bbox of the overlapped region. 
+    """Get the Bbox of the overlapped region.
 
     :param region: a Region object to split
     :type region: Region object

+ 1 - 0
lib/python/pygrass/modules/interface/flag.py

@@ -24,6 +24,7 @@ class Flag(object):
     >>> flag.special
     True
     """
+
     def __init__(self, xflag=None, diz=None):
         self.value = False
         diz = read.element2dict(xflag) if xflag is not None else diz

+ 6 - 4
lib/python/pygrass/modules/interface/module.py

@@ -213,6 +213,7 @@ class ParallelModuleQueue(object):
     0
 
     """
+
     def __init__(self, nprocs=1):
         """Constructor
 
@@ -515,6 +516,7 @@ class Module(object):
     In the Module class we heavily use this language feature to pass arguments
     and keyword arguments to the grass module.
     """
+
     def __init__(self, cmd, *args, **kargs):
         if isinstance(cmd, unicode):
             self.name = str(cmd)
@@ -692,10 +694,10 @@ class Module(object):
             cmd_params=('\n' +  # go to a new line
              # give space under the function name
              (' ' * (len(self.name) + 1))).join([', '.join(
-             # transform each parameter in string
-             [str(param) for param in line if param is not None])
-             # make a list of parameters with only 3 param per line
-             for line in zip_longest(*[iter(self.params_list)] * 3)]),)
+                 # transform each parameter in string
+                 [str(param) for param in line if param is not None])
+                 # make a list of parameters with only 3 param per line
+                 for line in zip_longest(*[iter(self.params_list)] * 3)]),)
         params = '\n'.join([par.__doc__ for par in self.params_list])
         flags = self.flags.__doc__
         return '\n'.join([head, params, DOC['flag_head'], flags, DOC['foot']])

+ 6 - 5
lib/python/pygrass/modules/interface/parameter.py

@@ -111,6 +111,7 @@ class Parameter(object):
 
     ...
     """
+
     def __init__(self, xparameter=None, diz=None):
         self._value = None
         self._rawvalue = None
@@ -272,8 +273,8 @@ class Parameter(object):
             keydescvals = "\n    (%s)" % ', '.join(self.keydescvalues)
         return DOC['param'].format(name=self.name,
                 default=repr(self.default) + ', ' if self.default else '',
-                required='required, ' if self.required else 'optional, ',
-                multi='multi' if self.multiple else '',
-                ptype=self.typedesc, description=self.description,
-                values='\n    Values: {0}'.format(vals)  if vals else '',
-                keydescvalues= keydescvals if self.keydescvalues else '')
+            required='required, ' if self.required else 'optional, ',
+            multi='multi' if self.multiple else '',
+            ptype=self.typedesc, description=self.description,
+            values='\n    Values: {0}'.format(vals)  if vals else '',
+            keydescvalues= keydescvals if self.keydescvalues else '')

+ 1 - 1
lib/python/pygrass/modules/interface/typedict.py

@@ -60,4 +60,4 @@ class TypeDict(OrderedDict):
         for key in self:
             if self.__getattr__(key):
                 key_dict[key] = self.__getattr__(key)
-        return key_dict
+        return key_dict

+ 1 - 0
lib/python/pygrass/modules/shortcuts.py

@@ -47,6 +47,7 @@ class MetaModule(object):
        >>> v.import_
        Module('v.import')
     """
+
     def __init__(self, prefix, cls=None):
         self.prefix = prefix
         self.cls = cls if cls else Module

+ 1 - 1
lib/python/pygrass/orderdict.py

@@ -238,7 +238,7 @@ class OrderedDict(dict):
 
         '''
         if isinstance(other, OrderedDict):
-            return len(self)==len(other) and self.items() == other.items()
+            return len(self) == len(other) and self.items() == other.items()
         return dict.__eq__(self, other)
 
     def __ne__(self, other):

+ 3 - 0
lib/python/pygrass/raster/__init__.py

@@ -135,6 +135,7 @@ class RasterRow(RasterAbstractBase):
         False
 
     """
+
     def __init__(self, name, mapset='', *args, **kargs):
         super(RasterRow, self).__init__(name, mapset, *args, **kargs)
 
@@ -229,6 +230,7 @@ class RasterRowIO(RasterRow):
     """Raster_row_cache_access": The same as "Raster_row_access" but uses
     the ROWIO library for cached row access
     """
+
     def __init__(self, name, *args, **kargs):
         self.rowio = RowIO()
         super(RasterRowIO, self).__init__(name, *args, **kargs)
@@ -308,6 +310,7 @@ class RasterSegment(RasterAbstractBase):
           faster
 
     """
+
     def __init__(self, name, srows=64, scols=64, maxmem=100,
                  *args, **kargs):
         self.segment = Segment(srows, scols, maxmem)

+ 1 - 0
lib/python/pygrass/raster/abstract.py

@@ -258,6 +258,7 @@ class RasterAbstractBase(object):
     * Renaming, deletion, ...
 
     """
+
     def __init__(self, name, mapset="", *aopen, **kwopen):
         """The constructor need at least the name of the map
         *optional* field is the `mapset`.

+ 1 - 0
lib/python/pygrass/raster/category.py

@@ -52,6 +52,7 @@ class Category(list):
     existing Python category class are copied.
 
     """
+
     def __init__(self, name, mapset='', mtype='CELL', *args, **kargs):
         self.name = name
         self.mapset = mapset

+ 1 - 0
lib/python/pygrass/raster/history.py

@@ -14,6 +14,7 @@ from grass.pygrass.utils import decode
 class History(object):
     """History class help to manage all the metadata of a raster map
     """
+
     def __init__(self, name, mapset='', mtype='',
                  creator='', src1='', src2='', keyword='',
                  date='', title=''):

+ 13 - 13
lib/python/pygrass/raster/raster_type.py

@@ -9,20 +9,20 @@ import ctypes
 import numpy as np
 
 ## Private dictionary to convert RASTER_TYPE into type string.
-RTYPE_STR = {libraster.CELL_TYPE:  'CELL',
+RTYPE_STR = {libraster.CELL_TYPE: 'CELL',
              libraster.FCELL_TYPE: 'FCELL',
              libraster.DCELL_TYPE: 'DCELL'}
 
 
-TYPE = {'CELL':  {'grass type':  libraster.CELL_TYPE,
-                  'grass def':   libraster.CELL,
-                  'numpy':       np.int32,
-                  'ctypes':      ctypes.c_int},
-        'FCELL': {'grass type':  libraster.FCELL_TYPE,
-                  'grass def':   libraster.FCELL,
-                  'numpy':       np.float32,
-                  'ctypes':      ctypes.c_float},
-        'DCELL': {'grass type':  libraster.DCELL_TYPE,
-                  'grass def':   libraster.DCELL,
-                  'numpy':       np.float64,
-                  'ctypes':      ctypes.c_double}}
+TYPE = {'CELL': {'grass type': libraster.CELL_TYPE,
+                  'grass def': libraster.CELL,
+                  'numpy': np.int32,
+                  'ctypes': ctypes.c_int},
+        'FCELL': {'grass type': libraster.FCELL_TYPE,
+                  'grass def': libraster.FCELL,
+                  'numpy': np.float32,
+                  'ctypes': ctypes.c_float},
+        'DCELL': {'grass type': libraster.DCELL_TYPE,
+                  'grass def': libraster.DCELL,
+                  'numpy': np.float64,
+                  'ctypes': ctypes.c_double}}

+ 1 - 1
lib/python/pygrass/raster/rowio.py

@@ -36,7 +36,7 @@ def getmaprow_DCELL(fd, buf, row, l):
     return 1
 
 get_row = {
-    'CELL':  CMPFUNC(getmaprow_CELL),
+    'CELL': CMPFUNC(getmaprow_CELL),
     'FCELL': CMPFUNC(getmaprow_FCELL),
     'DCELL': CMPFUNC(getmaprow_DCELL),
 }

+ 11 - 10
lib/python/pygrass/rpc/__init__.py

@@ -56,7 +56,7 @@ def _get_raster_image_as_np(lock, conn, data):
         mapset = utils.get_mapset_raster(name, mapset)
 
         if not mapset:
-            raise ValueError("Unable to find raster map <%s>"%(name))
+            raise ValueError("Unable to find raster map <%s>" % (name))
 
         rast = RasterRow(name, mapset)
 
@@ -71,13 +71,13 @@ def _get_raster_image_as_np(lock, conn, data):
                 if "south" in extent:
                     reg.south = extent["south"]
                 if "east" in extent:
-                    reg.east =  extent["east"]
+                    reg.east = extent["east"]
                 if "west" in extent:
-                    reg.west =  extent["west"]
+                    reg.west = extent["west"]
                 if "rows" in extent:
-                    reg.rows =  extent["rows"]
+                    reg.rows = extent["rows"]
                 if "cols" in extent:
-                    reg.cols =  extent["cols"]
+                    reg.cols = extent["cols"]
                 reg.adjust()
 
             array = raster2numpy_img(name, reg, color)
@@ -103,7 +103,7 @@ def _get_vector_table_as_dict(lock, conn, data):
         mapset = utils.get_mapset_vector(name, mapset)
 
         if not mapset:
-            raise ValueError("Unable to find vector map <%s>"%(name))
+            raise ValueError("Unable to find vector map <%s>" % (name))
 
         layer = VectorTopo(name, mapset)
 
@@ -148,7 +148,7 @@ def _get_vector_features_as_wkb_list(lock, conn, data):
         mapset = utils.get_mapset_vector(name, mapset)
 
         if not mapset:
-            raise ValueError("Unable to find vector map <%s>"%(name))
+            raise ValueError("Unable to find vector map <%s>" % (name))
 
         layer = VectorTopo(name, mapset)
 
@@ -230,13 +230,14 @@ def data_provider_server(lock, conn):
         functions[data[0]](lock, conn, data)
         lock.release()
 
-test_vector_name="data_provider_vector_map"
-test_raster_name="data_provider_raster_map"
+test_vector_name = "data_provider_vector_map"
+test_raster_name = "data_provider_raster_map"
 
 class DataProvider(RPCServerBase):
     """Fast and exit-safe interface to PyGRASS data delivery functions
 
     """
+
     def __init__(self):
         RPCServerBase.__init__(self)
 
@@ -436,7 +437,7 @@ if __name__ == "__main__":
     import doctest
     from grass.pygrass.modules import Module
     Module("g.region", n=40, s=0, e=40, w=0, res=10)
-    Module("r.mapcalc", expression="%s = row() + (10 * col())"%(test_raster_name),
+    Module("r.mapcalc", expression="%s = row() + (10 * col())" % (test_raster_name),
                              overwrite=True)
     utils.create_test_vector_map(test_vector_name)
 

+ 4 - 4
lib/python/pygrass/rpc/base.py

@@ -121,7 +121,7 @@ class RPCServerBase(object):
             time.sleep(0.2)
             self._check_restart_server(caller="Server check thread")
             self.threadLock.acquire()
-            if self.stopThread == True:
+            if self.stopThread is True:
                 self.threadLock.release()
                 return
             self.threadLock.release()
@@ -155,7 +155,7 @@ class RPCServerBase(object):
         self.start_server()
 
         if self.stopped is not True:
-            logging.warning("Needed to restart the libgis server, caller: %s"%(caller))
+            logging.warning("Needed to restart the libgis server, caller: %s" % (caller))
 
         self.threadLock.release()
         self.stopped = False
@@ -167,10 +167,10 @@ class RPCServerBase(object):
 
         try:
             ret = self.client_conn.recv()
-            if isinstance(ret,  FatalError):
+            if isinstance(ret, FatalError):
                 raise ret
             return ret
-        except (EOFError,  IOError,  FatalError) as e:
+        except (EOFError, IOError, FatalError) as e:
             # The pipe was closed by the checker thread because
             # the server process was killed
             raise FatalError("Exception raised: " + str(e) + " Message: " + message)

+ 1 - 1
lib/python/pygrass/rpc/testsuite/test_pygrass_rpc_doctests.py

@@ -35,7 +35,7 @@ def load_tests(loader, tests, ignore):
     from grass.pygrass import utils
     from grass.pygrass.modules import Module
     Module("g.region", n=40, s=0, e=40, w=0, res=10)
-    Module("r.mapcalc", expression="%s = row() + (10 * col())"%(pygrpc.test_raster_name),
+    Module("r.mapcalc", expression="%s = row() + (10 * col())" % (pygrpc.test_raster_name),
                              overwrite=True)
     utils.create_test_vector_map(pygrpc.test_vector_name)
     

+ 0 - 1
lib/python/pygrass/shell/__init__.py

@@ -1,2 +1 @@
 # -*- coding: utf-8 -*-
-

+ 3 - 2
lib/python/pygrass/tests/benchmark.py

@@ -13,10 +13,11 @@ import time
 import collections
 import copy
 import cProfile
-import sys, os
+import sys
+import os
 from jinja2 import Template
 sys.path.append(os.getcwd())
-sys.path.append("%s/.."%(os.getcwd()))
+sys.path.append("%s/.." % (os.getcwd()))
 
 import grass.lib.gis as libgis
 import grass.lib.raster as libraster

+ 1 - 1
lib/python/pygrass/testsuite/test_pygrass_doctests.py

@@ -33,7 +33,7 @@ def load_tests(loader, tests, ignore):
     gutils.create_test_vector_map(gutils.test_vector_name)
 
     run_command("g.region", n=50, s=0, e=60, w=0, res=1)
-    run_command("r.mapcalc", expression="%s = 1"%(gutils.test_raster_name),
+    run_command("r.mapcalc", expression="%s = 1" % (gutils.test_raster_name),
                              overwrite=True)
 
     # for now it is the only place where it works

+ 3 - 3
lib/python/pygrass/utils.py

@@ -14,8 +14,8 @@ from grass.script import utils as grassutils
 from grass.pygrass.errors import GrassError
 
 
-test_vector_name="Utils_test_vector"
-test_raster_name="Utils_test_raster"
+test_vector_name = "Utils_test_vector"
+test_raster_name = "Utils_test_raster"
 
 def looking(obj, filter_string):
     """
@@ -549,7 +549,7 @@ if __name__ == "__main__":
 
     utils.create_test_vector_map(test_vector_name)
     run_command("g.region", n=50, s=0, e=60, w=0, res=1)
-    run_command("r.mapcalc", expression="%s = 1"%(test_raster_name),
+    run_command("r.mapcalc", expression="%s = 1" % (test_raster_name),
                              overwrite=True)
 
     doctest.testmod()

+ 7 - 5
lib/python/pygrass/vector/__init__.py

@@ -58,6 +58,7 @@ class Vector(Info):
         False
 
     """
+
     def __init__(self, name, mapset='', *args, **kwargs):
         # Set map name and mapset
         super(Vector, self).__init__(name, mapset, *args, **kwargs)
@@ -278,6 +279,7 @@ class VectorTopo(Vector):
 
     ..
     """
+
     def __init__(self, name, mapset='', *args, **kwargs):
         super(VectorTopo, self).__init__(name, mapset, *args, **kwargs)
         self._topo_level = 2
@@ -786,8 +788,8 @@ class VectorTopo(Vector):
         supported = ['point', 'line', 'boundary', 'centroid']
 
         if feature_type.lower() not in supported:
-            raise GrassError("Unsupported feature type <%s>, "\
-                             "supported are <%s>"%(feature_type,
+            raise GrassError("Unsupported feature type <%s>, "
+                             "supported are <%s>" % (feature_type,
                                                    ",".join(supported)))
 
         if bbox is None:
@@ -814,9 +816,9 @@ class VectorTopo(Vector):
                                                        ctypes.byref(error))
                 if not barray:
                     if error == -1:
-                        raise GrassError(_("Unable to read line of feature %i"%(f_id)))
+                        raise GrassError(_("Unable to read line of feature %i" % (f_id)))
                     if error == -2:
-                        print("Empty feature %i"%(f_id))
+                        print("Empty feature %i" % (f_id))
                     continue
 
                 ok = libvect.Vect_cat_get(ctypes.byref(line_c), field,
@@ -903,7 +905,7 @@ class VectorTopo(Vector):
                                                        a_id,
                                                        ctypes.byref(size))
                 if not barray:
-                    raise GrassError(_("Unable to read area with id %i"%(a_id)))
+                    raise GrassError(_("Unable to read area with id %i" % (a_id)))
 
                 pcat = None
                 c_ok = libvect.Vect_get_area_cats(self.c_mapinfo, a_id,

+ 3 - 2
lib/python/pygrass/vector/abstract.py

@@ -14,7 +14,7 @@ from grass.pygrass.errors import GrassError, OpenError, must_be_open
 from grass.pygrass.vector.table import DBlinks, Link
 from grass.pygrass.vector.find import PointFinder, BboxFinder, PolygonFinder
 
-test_vector_name="abstract_doctest_map"
+test_vector_name = "abstract_doctest_map"
 
 def is_open(c_mapinfo):
     """Return if the Vector is open"""
@@ -66,6 +66,7 @@ class Info(object):
         >>> test_vect.close()
 
     """
+
     def __init__(self, name, mapset='', *aopen, **kwopen):
         self._name = ''
         self._mapset = ''
@@ -392,7 +393,7 @@ class Info(object):
             self.layer = self.dblinks.by_layer(layer).layer
             self.table = self.dblinks.by_layer(layer).table()
             self.n_lines = self.table.n_rows()
-        self.writeable =  self.mapset == utils.getenv("MAPSET")
+        self.writeable = self.mapset == utils.getenv("MAPSET")
         # Initialize the finder
         self.find = {'by_point': PointFinder(self.c_mapinfo, self.table,
                                              self.writeable),

+ 4 - 1
lib/python/pygrass/vector/basic.py

@@ -38,6 +38,7 @@ class Bbox(object):
 
     ..
     """
+
     def __init__(self, north=0, south=0, east=0, west=0, top=0, bottom=0):
         self.c_bbox = ctypes.pointer(libvect.bound_box())
         self.north = north
@@ -161,6 +162,7 @@ class Bbox(object):
 
 class BoxList(object):
     """Instantiate a BoxList class to create a list of Bounding Box"""
+
     def __init__(self, boxlist=None):
         self.c_boxlist = ctypes.pointer(libvect.boxlist())
         # if set to 0, the list will hold only ids and no boxes
@@ -300,6 +302,7 @@ class BoxList(object):
 class Ilist(object):
     """Instantiate a list of integer using the C GRASS struct ``ilist``,
     the class contains this struct as ``c_ilist`` attribute. """
+
     def __init__(self, integer_list=None):
         self.c_ilist = ctypes.pointer(libvect.struct_ilist())
         if integer_list is not None:
@@ -541,7 +544,7 @@ class CatsList(object):
 
     def __init__(self, c_cat_list=None):
         self.c_cat_list = c_cat_list if c_cat_list \
-                                     else ctypes.pointer(libvect.cat_list())
+            else ctypes.pointer(libvect.cat_list())
 
     def from_string(self, string):
         """Converts string of categories and cat ranges separated by commas

+ 4 - 2
lib/python/pygrass/vector/find.py

@@ -24,8 +24,8 @@ class AbstractFinder(object):
         self.c_mapinfo = c_mapinfo
         self.table = table
         self.writeable = writeable
-        self.vtype = {'point':    libvect.GV_POINT,  # 1
-                      'line':     libvect.GV_LINE,   # 2
+        self.vtype = {'point': libvect.GV_POINT,  # 1
+                      'line': libvect.GV_LINE,   # 2
                       'boundary': libvect.GV_BOUNDARY,  # 3
                       'centroid': libvect.GV_CENTROID,  # 4
                       'all': -1}
@@ -42,6 +42,7 @@ class PointFinder(AbstractFinder):
         of a vector map that are close to a point. The PointFinder class
         is part of a topological vector map object.
     """
+
     def __init__(self, c_mapinfo, table=None, writeable=False):
         """Find geometry feature(s) around a point.
 
@@ -365,6 +366,7 @@ class BboxFinder(AbstractFinder):
     The BboxFinder class is part of a topological vector map object.
 
     """
+
     def __init__(self, c_mapinfo, table=None, writeable=False):
         """Find geometry feature(s)that are insider or intersect
            with a boundingbox.

+ 14 - 13
lib/python/pygrass/vector/geometry.py

@@ -337,14 +337,14 @@ class Geo(object):
     def __del__(self):
         """Take care of the allocated line_pnts and line_cats allocation
         """
-        if self._free_points == True and self.c_points:
+        if self._free_points is True and self.c_points:
             if self.c_points.contents.alloc_points > 0:
                 #print("G_free(points) [%i]"%(self.c_points.contents.alloc_points))
                 libgis.G_free(self.c_points.contents.x)
                 libgis.G_free(self.c_points.contents.y)
                 if self.c_points.contents.z:
                     libgis.G_free(self.c_points.contents.z)
-        if self._free_cats == True and self.c_cats:
+        if self._free_cats is True and self.c_cats:
             if self.c_cats.contents.alloc_cats > 0:
                 #print("G_free(cats) [%i]"%(self.c_cats.contents.alloc_cats))
                 libgis.G_free(self.c_cats.contents.cat)
@@ -1205,6 +1205,7 @@ class Node(object):
        may happen.
 
     """
+
     def __init__(self, v_id, c_mapinfo, **kwords):
         """Construct a Node object
 
@@ -1431,6 +1432,7 @@ class Centroid(Point):
 class Isle(Geo):
     """An Isle is an area contained by another area.
     """
+
     def __init__(self, **kargs):
         super(Isle, self).__init__(**kargs)
         #self.area_id = area_id
@@ -1775,14 +1777,14 @@ class Area(Geo):
 # Define a dictionary to convert the feature type to name and or object
 #
 
-GV_TYPE = {libvect.GV_POINT:    {'label': 'point',    'obj': Point},
-           libvect.GV_LINE:     {'label': 'line',     'obj': Line},
+GV_TYPE = {libvect.GV_POINT: {'label': 'point', 'obj': Point},
+           libvect.GV_LINE: {'label': 'line', 'obj': Line},
            libvect.GV_BOUNDARY: {'label': 'boundary', 'obj': Boundary},
            libvect.GV_CENTROID: {'label': 'centroid', 'obj': Centroid},
-           libvect.GV_FACE:     {'label': 'face',     'obj': None},
-           libvect.GV_KERNEL:   {'label': 'kernel',   'obj': None},
-           libvect.GV_AREA:     {'label': 'area',     'obj': Area},
-           libvect.GV_VOLUME:   {'label': 'volume',   'obj': None}, }
+           libvect.GV_FACE: {'label': 'face', 'obj': None},
+           libvect.GV_KERNEL: {'label': 'kernel', 'obj': None},
+           libvect.GV_AREA: {'label': 'area', 'obj': Area},
+           libvect.GV_VOLUME: {'label': 'volume', 'obj': None}, }
 
 GEOOBJ = {"areas": Area,
           "dblinks": None,
@@ -1815,11 +1817,11 @@ def read_next_line(c_mapinfo, table=None, writeable=False,
 
     # Take care of good memory management
     free_points = False
-    if c_points == None:
+    if c_points is None:
         free_points = True
 
     free_cats = False
-    if c_cats == None:
+    if c_cats is None:
         free_cats = True
 
     c_points = c_points if c_points else ctypes.pointer(libvect.line_pnts())
@@ -1851,11 +1853,11 @@ def read_line(feature_id, c_mapinfo, table=None, writeable=False,
     """
     # Take care of good memory management
     free_points = False
-    if c_points == None:
+    if c_points is None:
         free_points = True
 
     free_cats = False
-    if c_cats == None:
+    if c_cats is None:
         free_cats = True
 
     c_points = c_points if c_points else ctypes.pointer(libvect.line_pnts())
@@ -1882,4 +1884,3 @@ if __name__ == "__main__":
     mset = get_mapset_vector(test_vector_name, mapset='')
     if mset:
         run_command("g.remove", flags='f', type='vector', name=test_vector_name)
-

+ 7 - 7
lib/python/pygrass/vector/sql.py

@@ -18,13 +18,13 @@ DROP_TAB = "DROP TABLE {tname}"
 ADD_COL = "ALTER TABLE {tname} ADD COLUMN {cname} {ctype};"
 DROP_COL = "ALTER TABLE {tname} DROP COLUMN {cname};"
 DROP_COL_SQLITE = ';\n'.join([
-"CREATE TEMPORARY TABLE {tname}_backup({coldef})",
-"INSERT INTO {tname}_backup SELECT {colnames} FROM {tname}",
-"DROP TABLE {tname}",
-"CREATE TABLE {tname}({coldef})",
-"INSERT INTO {tname} SELECT {colnames} FROM {tname}_backup",
-"CREATE UNIQUE INDEX {tname}_cat ON {tname} ({keycol} )",
-"DROP TABLE {tname}_backup",
+    "CREATE TEMPORARY TABLE {tname}_backup({coldef})",
+    "INSERT INTO {tname}_backup SELECT {colnames} FROM {tname}",
+    "DROP TABLE {tname}",
+    "CREATE TABLE {tname}({coldef})",
+    "INSERT INTO {tname} SELECT {colnames} FROM {tname}_backup",
+    "CREATE UNIQUE INDEX {tname}_cat ON {tname} ({keycol} )",
+    "DROP TABLE {tname}_backup",
 ])
 RENAME_COL = "ALTER TABLE {tname} RENAME COLUMN {old_name} TO {new_name};"
 CAST_COL = "ALTER TABLE {tname} ALTER COLUMN {col} SET DATA TYPE {ctype};"

+ 6 - 1
lib/python/pygrass/vector/table.py

@@ -91,6 +91,7 @@ class Filters(object):
     'SELECT cat, area FROM table WHERE area<10000 ORDER BY area LIMIT 10;'
 
     """
+
     def __init__(self, tname):
         self.tname = tname
         self._select = None
@@ -199,6 +200,7 @@ class Columns(object):
     'table_doctest_map'                                   #doctest: +SKIP
 
     """
+
     def __init__(self, tname, connection, key='cat'):
         self.tname = tname
         self.conn = connection
@@ -626,6 +628,7 @@ class Link(object):
     >>> link = Link(c_fieldinfo = ctypes.pointer(libvect.field_info()))
 
     """
+
     def _get_layer(self):
         return self.c_fieldinfo.contents.number
 
@@ -832,6 +835,7 @@ class DBlinks(object):
     >>> cens.close()
 
     """
+
     def __init__(self, c_mapinfo):
         self.c_mapinfo = c_mapinfo
 
@@ -847,7 +851,7 @@ class DBlinks(object):
 
         """
         if isinstance(item, int):
-                return self.by_index(item)
+            return self.by_index(item)
         else:
             return self.by_name(item)
 
@@ -969,6 +973,7 @@ class Table(object):
     Columns([('cat', 'int4'), ...])
 
     """
+
     def _get_name(self):
         """Private method to return the name of table"""
         return self._name

+ 8 - 7
lib/python/pygrass/vector/testsuite/test_geometry.py

@@ -121,7 +121,7 @@ class LineTestCase(TestCase):
             cls.c_mapinfo = None
 
         """Remove the generated vector map, if exist"""
-        cls.runModule("g.remove", flags='f', type='vector', 
+        cls.runModule("g.remove", flags='f', type='vector',
                       name=cls.tmpname)
 
     def test_len(self):
@@ -212,7 +212,7 @@ class NodeTestCase(TestCase):
             cls.c_mapinfo = None
 
         """Remove the generated vector map, if exist"""
-        cls.runModule("g.remove", flags='f', type='vector', 
+        cls.runModule("g.remove", flags='f', type='vector',
                       name=cls.tmpname)
 
     def test_init(self):
@@ -266,7 +266,7 @@ class AreaTestCase(TestCase):
             cls.c_mapinfo = None
 
         """Remove the generated vector map, if exist"""
-        cls.runModule("g.remove", flags='f', type='vector', 
+        cls.runModule("g.remove", flags='f', type='vector',
                       name=cls.tmpname)
 
     def test_init(self):
@@ -360,11 +360,12 @@ class AreaTestCase(TestCase):
         isle = isles[0]
 
         self.assertEqual(isle.area(), 4.0)
-        self.assertEqual(isle.points().to_wkt(), "LINESTRING (1.0000000000000000 1.0000000000000000, "\
-                                                             "3.0000000000000000 1.0000000000000000, "\
-                                                             "3.0000000000000000 3.0000000000000000, "\
-                                                             "1.0000000000000000 3.0000000000000000, "\
+        self.assertEqual(isle.points().to_wkt(), "LINESTRING (1.0000000000000000 1.0000000000000000, "
+                                                             "3.0000000000000000 1.0000000000000000, "
+                                                             "3.0000000000000000 3.0000000000000000, "
+                                                             "1.0000000000000000 3.0000000000000000, "
                                                              "1.0000000000000000 1.0000000000000000)")
+
     def test_isles_2(self):
         """Test centroid access"""
         area = Area(v_id=1, c_mapinfo=self.c_mapinfo)

+ 1 - 1
lib/python/pygrass/vector/testsuite/test_table.py

@@ -22,7 +22,7 @@ if sys.version_info.major >= 3:
     long = int
 
 # dictionary that generate random data
-COL2VALS = {'INT': lambda n:     np.random.randint(9, size=n),
+COL2VALS = {'INT': lambda n: np.random.randint(9, size=n),
             'INTEGER': lambda n: np.random.randint(9, size=n),
             'INTEGER PRIMARY KEY': lambda n: np.arange(1, n+1, dtype=long),
             'REAL': lambda n: np.random.rand(n),

+ 2 - 2
lib/python/pygrass/vector/testsuite/test_vector.py

@@ -32,12 +32,12 @@ class VectorTopoTestCase(TestCase):
             cls.vect.close()
 
         """Remove the generated vector map, if exist"""
-        cls.runModule("g.remove", flags='f', type='vector', 
+        cls.runModule("g.remove", flags='f', type='vector',
                       name=cls.tmpname)
 
     def test_getitem_slice(self):
         """Test that getitem handle correctly the slice starting from 1"""
-        vcoords =  ((10.0, 6.0), (12.0, 6.0))
+        vcoords = ((10.0, 6.0), (12.0, 6.0))
         with VectorTopo(self.tmpname, mode="r") as vect:
             coords = tuple([pnt.coords() for pnt in vect[:3]])
             self.assertTupleEqual(vcoords, coords)

+ 1 - 1
lib/python/pygrass/vector/testsuite/test_vector3d.py

@@ -60,7 +60,7 @@ class VectorTopo3DTestCase(TestCase):
     @classmethod
     def tearDownClass(cls):
         """Remove the generated vector map, if exist"""
-        cls.runModule("g.remove", flags='f', type='vector', 
+        cls.runModule("g.remove", flags='f', type='vector',
                       name=cls.tmpname)
 
 

+ 9 - 10
lib/python/pygrass/vector/vector_type.py

@@ -8,17 +8,16 @@ Created on Wed Jul 18 10:49:26 2012
 import grass.lib.vector as libvect
 from grass.pygrass.vector import geometry as geo
 
-MAPTYPE = {libvect.GV_FORMAT_NATIVE:     "native",
-           libvect.GV_FORMAT_OGR:        "OGR",
+MAPTYPE = {libvect.GV_FORMAT_NATIVE: "native",
+           libvect.GV_FORMAT_OGR: "OGR",
            libvect.GV_FORMAT_OGR_DIRECT: "OGR",
-           libvect.GV_FORMAT_POSTGIS:    "PostGIS"}
+           libvect.GV_FORMAT_POSTGIS: "PostGIS"}
 
-VTYPE = {'point':    libvect.GV_POINT,  # 1
-         'line':     libvect.GV_LINE,   # 2
+VTYPE = {'point': libvect.GV_POINT,  # 1
+         'line': libvect.GV_LINE,   # 2
          'boundary': libvect.GV_BOUNDARY,  # 3
          'centroid': libvect.GV_CENTROID,  # 4
-         'face':     libvect.GV_FACE,  # 5
-         'kernel':   libvect.GV_KERNEL,  # 6
-         'area':     libvect.GV_AREA,  # 7
-         'volume':   libvect.GV_VOLUME}  # 8
-
+         'face': libvect.GV_FACE,  # 5
+         'kernel': libvect.GV_KERNEL,  # 6
+         'area': libvect.GV_AREA,  # 7
+         'volume': libvect.GV_VOLUME}  # 8

+ 32 - 32
lib/python/script/core.py

@@ -51,7 +51,7 @@ class Popen(subprocess.Popen):
         if (sys.platform == 'win32'
             and isinstance(args, list)
             and not kwargs.get('shell', False)
-            and kwargs.get('executable') is None):
+                and kwargs.get('executable') is None):
             cmd = shutil_which(args[0])
             if cmd is None:
                 raise OSError(_("Cannot find the executable {0}")
@@ -385,7 +385,7 @@ def handle_errors(returncode, result, args, kwargs):
         module, code = get_module_and_code(args, kwargs)
         fatal(_("Module {module} ({code}) failed with"
                 " non-zero return code {returncode}").format(
-                module=module, code=code, returncode=returncode))
+            module=module, code=code, returncode=returncode))
     elif handler.lower() == 'exit':
         sys.exit(returncode)
     else:
@@ -1185,7 +1185,7 @@ def region(region3d=False, complete=False, env=None):
 
     s = read_command("g.region", flags=flgs, env=env)
     reg = parse_key_val(s, val_type=float)
-    for k in ['projection', 'zone', 'rows',  'cols',  'cells',
+    for k in ['projection', 'zone', 'rows', 'cols', 'cells',
               'rows3', 'cols3', 'cells3', 'depths']:
         if k not in reg:
             continue
@@ -1250,23 +1250,23 @@ def region_env(region3d=False, flags=None, env=None, **kwargs):
         return ''
     reg = parse_key_val(s)
 
-    kwdata = [('north',     'n'),
-              ('south',     's'),
-              ('east',      'e'),
-              ('west',      'w'),
-              ('cols',      'cols'),
-              ('rows',      'rows'),
+    kwdata = [('north', 'n'),
+              ('south', 's'),
+              ('east', 'e'),
+              ('west', 'w'),
+              ('cols', 'cols'),
+              ('rows', 'rows'),
               ('e-w resol', 'ewres'),
               ('n-s resol', 'nsres')]
     if region3d:
-        kwdata += [('top',        't'),
-                   ('bottom',     'b'),
-                   ('cols3',      'cols3'),
-                   ('rows3',      'rows3'),
-                   ('depths',     'depths'),
+        kwdata += [('top', 't'),
+                   ('bottom', 'b'),
+                   ('cols3', 'cols3'),
+                   ('rows3', 'rows3'),
+                   ('depths', 'depths'),
                    ('e-w resol3', 'ewres3'),
                    ('n-s resol3', 'nsres3'),
-                   ('t-b resol',  'tbres')]
+                   ('t-b resol', 'tbres')]
 
     for wkey, rkey in kwdata:
         grass_region += '%s: %s;' % (wkey, reg[rkey])
@@ -1455,22 +1455,22 @@ def list_grouped(type, pattern=None, check_search_path=True, exclude=None,
 # color parsing
 
 named_colors = {
-    "white":   (1.00, 1.00, 1.00),
-    "black":   (0.00, 0.00, 0.00),
-    "red":     (1.00, 0.00, 0.00),
-    "green":   (0.00, 1.00, 0.00),
-    "blue":    (0.00, 0.00, 1.00),
-    "yellow":  (1.00, 1.00, 0.00),
+    "white": (1.00, 1.00, 1.00),
+    "black": (0.00, 0.00, 0.00),
+    "red": (1.00, 0.00, 0.00),
+    "green": (0.00, 1.00, 0.00),
+    "blue": (0.00, 0.00, 1.00),
+    "yellow": (1.00, 1.00, 0.00),
     "magenta": (1.00, 0.00, 1.00),
-    "cyan":    (0.00, 1.00, 1.00),
-    "aqua":    (0.00, 0.75, 0.75),
-    "grey":    (0.75, 0.75, 0.75),
-    "gray":    (0.75, 0.75, 0.75),
-    "orange":  (1.00, 0.50, 0.00),
-    "brown":   (0.75, 0.50, 0.25),
-    "purple":  (0.50, 0.00, 1.00),
-    "violet":  (0.50, 0.00, 1.00),
-    "indigo":  (0.00, 0.50, 1.00)}
+    "cyan": (0.00, 1.00, 1.00),
+    "aqua": (0.00, 0.75, 0.75),
+    "grey": (0.75, 0.75, 0.75),
+    "gray": (0.75, 0.75, 0.75),
+    "orange": (1.00, 0.50, 0.00),
+    "brown": (0.75, 0.50, 0.25),
+    "purple": (0.50, 0.00, 1.00),
+    "violet": (0.50, 0.00, 1.00),
+    "indigo": (0.00, 0.50, 1.00)}
 
 
 def parse_color(val, dflt=None):
@@ -1761,7 +1761,7 @@ def legal_name(s):
         useful anyway for checking map names and column names.
     """
     if not s or s[0] == '.':
-        warning(_("Illegal filename <%s>. Cannot be 'NULL' or start with " \
+        warning(_("Illegal filename <%s>. Cannot be 'NULL' or start with "
                   "'.'.") % s)
         return False
 
@@ -1771,7 +1771,7 @@ def legal_name(s):
     if illegal:
         illegal = ''.join(sorted(set(illegal)))
         warning(_("Illegal filename <%(s)s>. <%(il)s> not allowed.\n") % {
-        's': s, 'il': illegal})
+            's': s, 'il': illegal})
         return False
 
     return True

+ 2 - 2
lib/python/script/raster.py

@@ -46,7 +46,7 @@ def raster_history(map, overwrite=False, env=None):
     """
     current_mapset = gisenv(env)['MAPSET']
     if find_file(name=map, env=env)['mapset'] == current_mapset:
-        if overwrite == True:
+        if overwrite is True:
             historyfile = tempfile(env=env)
             f = open(historyfile, 'w')
             f.write(os.environ['CMDLINE'])
@@ -58,7 +58,7 @@ def raster_history(map, overwrite=False, env=None):
         return True
 
     warning(_("Unable to write history for <%(map)s>. "
-              "Raster map <%(map)s> not found in current mapset." % { 'map': map, 'map': map}))
+              "Raster map <%(map)s> not found in current mapset." % {'map': map, 'map': map}))
     return False
 
 

+ 7 - 7
lib/python/script/setup.py

@@ -124,13 +124,13 @@ def set_gui_path():
 def init(gisbase, dbase='', location='demolocation', mapset='PERMANENT'):
     """Initialize system variables to run GRASS modules
 
-    This function is for running GRASS GIS without starting it with the 
-    standard script grassXY. No GRASS modules shall be called before 
-    call of this function but any module or user script can be called 
-    afterwards because a GRASS session has been set up. GRASS Python 
-    libraries are usable as well in general but the ones using C 
-    libraries through ``ctypes`` are not (which is caused by library 
-    path not being updated for the current process which is a common 
+    This function is for running GRASS GIS without starting it with the
+    standard script grassXY. No GRASS modules shall be called before
+    call of this function but any module or user script can be called
+    afterwards because a GRASS session has been set up. GRASS Python
+    libraries are usable as well in general but the ones using C
+    libraries through ``ctypes`` are not (which is caused by library
+    path not being updated for the current process which is a common
     operating system limitation).
 
     To create a GRASS session a ``gisrc`` file is created.

+ 35 - 33
lib/python/script/task.py

@@ -55,6 +55,7 @@ class grassTask:
     :param str path: full path
     :param blackList: hide some options in the GUI (dictionary)
     """
+
     def __init__(self, path=None, blackList=None):
         self.path = path
         self.name = _('unknown')
@@ -168,8 +169,8 @@ class grassTask:
                     return p
 
         if raiseError:
-            raise ValueError(_("Parameter element '%(element)s' not found: '%(value)s'") % \
-                { 'element' : element, 'value' : value })
+            raise ValueError(_("Parameter element '%(element)s' not found: '%(value)s'") %
+                {'element': element, 'value': value })
         else:
             return None
 
@@ -202,7 +203,7 @@ class grassTask:
                     desc = p.get('label', '')
                     if not desc:
                         desc = p['description']
-                    errorList.append(_("Parameter '%(name)s' (%(desc)s) is missing.") % \
+                    errorList.append(_("Parameter '%(name)s' (%(desc)s) is missing.") %
                                      {'name': p['name'], 'desc': desc})
 
         return errorList
@@ -288,7 +289,7 @@ class grassTask:
 
         :param opts list of flags and parameters"""
         for opt in opts:
-            if opt[0] ==  '-':  # flag
+            if opt[0] == '-':  # flag
                 self.set_flag(opt.lstrip('-'), True)
             else:  # parameter
                 key, value = opt.split('=', 1)
@@ -306,6 +307,7 @@ class processTask:
 
     :return: grassTask instance
     """
+
     def __init__(self, tree, task=None, blackList=None):
         if task:
             self.task = task
@@ -381,26 +383,26 @@ class processTask:
             else:
                 hidden = False
 
-            self.task.params.append( {
-                "name"           : p.get('name'),
-                "type"           : p.get('type'),
-                "required"       : required,
-                "multiple"       : multiple,
-                "label"          : self._get_node_text(p, 'label'),
-                "description"    : self._get_node_text(p, 'description'),
-                'gisprompt'      : gisprompt,
-                'age'            : age,
-                'element'        : element,
-                'prompt'         : prompt,
-                "guisection"     : self._get_node_text(p, 'guisection'),
-                "guidependency"  : self._get_node_text(p, 'guidependency'),
-                "default"        : self._get_node_text(p, 'default'),
-                "values"         : values,
-                "values_desc"    : values_desc,
-                "value"          : '',
-                "key_desc"       : key_desc,
-                "hidden"         : hidden
-                })
+            self.task.params.append({
+                "name": p.get('name'),
+                "type": p.get('type'),
+                "required": required,
+                "multiple": multiple,
+                "label": self._get_node_text(p, 'label'),
+                "description": self._get_node_text(p, 'description'),
+                'gisprompt': gisprompt,
+                'age': age,
+                'element': element,
+                'prompt': prompt,
+                "guisection": self._get_node_text(p, 'guisection'),
+                "guidependency": self._get_node_text(p, 'guidependency'),
+                "default": self._get_node_text(p, 'default'),
+                "values": values,
+                "values_desc": values_desc,
+                "value": '',
+                "key_desc": key_desc,
+                "hidden": hidden
+            })
 
     def _process_flags(self):
         """Process flags
@@ -418,15 +420,15 @@ class processTask:
             else:
                 suppress_required = False
 
-            self.task.flags.append( {
-                    "name"              : p.get('name'),
-                    "label"             : self._get_node_text(p, 'label'),
-                    "description"       : self._get_node_text(p, 'description'),
-                    "guisection"        : self._get_node_text(p, 'guisection'),
-                    "suppress_required" : suppress_required,
-                    "value"             : False,
-                    "hidden"            : hidden
-                    } )
+            self.task.flags.append({
+                "name": p.get('name'),
+                "label": self._get_node_text(p, 'label'),
+                "description": self._get_node_text(p, 'description'),
+                "guisection": self._get_node_text(p, 'guisection'),
+                "suppress_required": suppress_required,
+                "value": False,
+                "hidden": hidden
+            } )
 
     def _get_node_text(self, node, tag, default=''):
         """Get node text"""

+ 7 - 7
lib/python/script/vector.py

@@ -64,12 +64,12 @@ def vector_db(map, env=None, **kwargs):
             name = ''
 
         result[int(layer)] = {
-            'layer'    : int(layer),
-            'name'     : name,
-            'table'    : f[1],
-            'key'      : f[2],
-            'database' : f[3],
-            'driver'   : f[4] }
+            'layer': int(layer),
+            'name': name,
+            'table': f[1],
+            'key': f[2],
+            'database': f[3],
+            'driver': f[4] }
 
     return result
 
@@ -238,7 +238,7 @@ def vector_db_select(map, layer=1, env=None, **kwargs):
     try:
         key = vector_db(map=map, env=env)[layer]['key']
     except KeyError:
-        error(_('Missing layer %(layer)d in vector map <%(map)s>') % \
+        error(_('Missing layer %(layer)d in vector map <%(map)s>') %
               {'layer': layer, 'map': map})
         return {'columns': [], 'values': {}}
 

+ 3 - 1
lib/python/temporal/abstract_dataset.py

@@ -78,7 +78,7 @@ class AbstractDataset(SpatialTopologyDatasetConnector,
             self.get_number_of_spatial_relations()
         else:
             return self.get_number_of_temporal_relations() + \
-                   self.get_number_of_spatial_relations()
+                self.get_number_of_spatial_relations()
 
         return None
 
@@ -580,6 +580,7 @@ class AbstractDatasetComparisonKeyStartTime(object):
             # Sort the maps in the list by start time
             sorted_map_list = sorted(map_list, key=AbstractDatasetComparisonKeyStartTime)
     """
+
     def __init__(self, obj, *args):
         self.obj = obj
 
@@ -630,6 +631,7 @@ class AbstractDatasetComparisonKeyEndTime(object):
             # Sort the maps in the list by end time
             sorted_map_list = sorted(map_list, key=AbstractDatasetComparisonKeyEndTime)
     """
+
     def __init__(self, obj, *args):
         self.obj = obj
 

+ 11 - 11
lib/python/temporal/abstract_map_dataset.py

@@ -902,8 +902,8 @@ class AbstractMapDataset(AbstractDataset):
         else:
             self.msgr.debug(1, "Unregister %(type)s map <%(map)s> "
                                "from space time datasets" % {
-                               'type': self.get_type(),
-                               'map': self.get_map_id()})
+                                   'type': self.get_type(),
+                                   'map': self.get_map_id()})
 
         if get_enable_mapset_check() is True and self.get_mapset() != get_current_mapset():
             self.msgr.fatal(_("Unable to unregister dataset <%(ds)s> of type "
@@ -921,15 +921,15 @@ class AbstractMapDataset(AbstractDataset):
         # For each stds in which the map is registered
         if datasets is not None:
             for dataset in datasets:
-                    # Create a space time dataset object to remove the map
-                    # from its register
-                    stds = self.get_new_stds_instance(dataset)
-                    stds.metadata.select(dbif)
-                    statement += stds.unregister_map(self, dbif, False)
-                    # Take care to update the space time dataset after
-                    # the map has been unregistered
-                    if update is True and execute is True:
-                        stds.update_from_registered_maps(dbif)
+                # Create a space time dataset object to remove the map
+                # from its register
+                stds = self.get_new_stds_instance(dataset)
+                stds.metadata.select(dbif)
+                statement += stds.unregister_map(self, dbif, False)
+                # Take care to update the space time dataset after
+                # the map has been unregistered
+                if update is True and execute is True:
+                    stds.update_from_registered_maps(dbif)
 
         if execute:
             dbif.execute_transaction(statement)

+ 8 - 8
lib/python/temporal/abstract_space_time_dataset.py

@@ -87,7 +87,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
             :return: The name of the map register table
         """
 
-        uuid_rand = str(uuid.uuid4()).replace("-",  "")
+        uuid_rand = str(uuid.uuid4()).replace("-", "")
 
         table_name = self.get_new_map_instance(None).get_type() + "_map_register_" + uuid_rand
         return table_name
@@ -226,7 +226,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
            """
         # The grass module
 
-        command = "# %s \n"%(str(datetime.today().strftime("%Y-%m-%d %H:%M:%S")))
+        command = "# %s \n" % (str(datetime.today().strftime("%Y-%m-%d %H:%M:%S")))
         command += os.path.basename(sys.argv[0])
 
         # We will wrap the command line to fit into 80 character
@@ -984,8 +984,8 @@ class AbstractSpaceTimeDataset(AbstractDataset):
             start, end = granule.get_temporal_extent_as_tuple()
 
             where = create_temporal_relation_sql_where_statement(
-                    start, end, use_start, use_during, use_overlap,
-                    use_contain, use_equal, use_follows, use_precedes)
+                start, end, use_start, use_during, use_overlap,
+                use_contain, use_equal, use_follows, use_precedes)
 
             maps = self.get_registered_maps_as_objects(
                 where, "start_time", dbif)
@@ -1524,7 +1524,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
                         si=shortcut_identifier,
                         orig=self.band_reference.upper(),
                         esc="ESCAPE '\\'"
-                )
+                    )
             else:
                 where += "band_reference = '{}'".format(
                     self.band_reference
@@ -1579,7 +1579,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
             if order is not None and order != "":
                 sql += " ORDER BY %s" % (order.split(";")[0])
             try:
-                dbif.execute(sql,  mapset=self.base.mapset)
+                dbif.execute(sql, mapset=self.base.mapset)
                 rows = dbif.fetchall(mapset=self.base.mapset)
             except:
                 if connected:
@@ -2110,7 +2110,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
                 sql = "SELECT id FROM " + \
                     stds_register_table + " WHERE id = (%s)"
             try:
-                dbif.execute(sql, (map_id,),  mapset=self.base.mapset)
+                dbif.execute(sql, (map_id,), mapset=self.base.mapset)
                 row = dbif.fetchone(mapset=self.base.mapset)
             except:
                 self.msgr.warning(_("Error in register table request"))
@@ -2456,7 +2456,7 @@ class AbstractSpaceTimeDataset(AbstractDataset):
                 sql = sql.replace("SPACETIME_REGISTER_TABLE",
                                   stds_register_table)
 
-            dbif.execute(sql,  mapset=self.base.mapset)
+            dbif.execute(sql, mapset=self.base.mapset)
             row = dbif.fetchone(mapset=self.base.mapset)
 
             if row is not None:

+ 8 - 8
lib/python/temporal/aggregation.py

@@ -103,7 +103,7 @@ def collect_map_names(sp, dbif, start, end, sampling):
 
 
 def aggregate_raster_maps(inputs, base, start, end, count, method,
-                          register_null, dbif,  offset=0):
+                          register_null, dbif, offset=0):
     """Aggregate a list of raster input maps with r.series
 
        :param inputs: The names of the raster maps to be aggregated
@@ -277,9 +277,9 @@ def aggregate_by_topology(granularity_list, granularity, map_list, topo_list,
 
         if aggregation_list:
             msgr.verbose(_("Aggregating %(len)i raster maps from %(start)s to"
-                           " %(end)s")  %({"len": len(aggregation_list),
+                           " %(end)s")  % ({"len": len(aggregation_list),
                            "start": str(granule.temporal_extent.get_start_time()),
-                           "end": str(granule.temporal_extent.get_end_time())}))
+                               "end": str(granule.temporal_extent.get_end_time())}))
 
             if granule.is_time_absolute() is True and time_suffix == 'gran':
                 suffix = create_suffix_from_datetime(granule.temporal_extent.get_start_time(),
@@ -315,16 +315,16 @@ def aggregate_by_topology(granularity_list, granularity, map_list, topo_list,
                 mod = copy.deepcopy(r_series)
                 mod(file=filename, output=output_name)
                 if len(aggregation_list) > int(file_limit):
-                    msgr.warning(_("The limit of open files (%i) was "\
-                                   "reached (%i). The module r.series will "\
-                                   "be run with flag z, to avoid open "\
-                                   "files limit exceeding."%(int(file_limit),
+                    msgr.warning(_("The limit of open files (%i) was "
+                                   "reached (%i). The module r.series will "
+                                   "be run with flag z, to avoid open "
+                                   "files limit exceeding." % (int(file_limit),
                                                              len(aggregation_list))))
                     mod(flags="z")
                 process_queue.put(mod)
             else:
                 mod = copy.deepcopy(g_copy)
-                mod(raster=[aggregation_list[0],  output_name])
+                mod(raster=[aggregation_list[0], output_name])
                 process_queue.put(mod)
 
     process_queue.wait()

+ 18 - 7
lib/python/temporal/base.py

@@ -238,6 +238,7 @@ class SQLDatabaseInterface(DictSQLSerializer):
             "UPDATE raster SET  creation_time = '2001-01-01 00:00:00'  ,mapset = 'PERMANENT'  ,name = 'soil'  ,creator = 'soeren' WHERE id = 'soil@PERMANENT';\\n"
 
     """
+
     def __init__(self, table=None, ident=None):
         """Constructor of this class
 
@@ -280,11 +281,11 @@ class SQLDatabaseInterface(DictSQLSerializer):
         #print(sql)
 
         if dbif:
-            dbif.execute(sql,   mapset=self.mapset)
+            dbif.execute(sql, mapset=self.mapset)
         else:
             dbif = SQLDatabaseInterfaceConnection()
             dbif.connect()
-            dbif.execute(sql,   mapset=self.mapset)
+            dbif.execute(sql, mapset=self.mapset)
             dbif.close()
 
     def get_is_in_db_statement(self):
@@ -356,9 +357,9 @@ class SQLDatabaseInterface(DictSQLSerializer):
 
         if dbif:
             if len(args) == 0:
-                dbif.execute(sql,  mapset=self.mapset)
+                dbif.execute(sql, mapset=self.mapset)
             else:
-                dbif.execute(sql, args,  mapset=self.mapset)
+                dbif.execute(sql, args, mapset=self.mapset)
             row = dbif.fetchone(mapset=self.mapset)
         else:
             dbif = SQLDatabaseInterfaceConnection()
@@ -697,7 +698,7 @@ class DatasetBase(SQLDatabaseInterface):
             if self.id.find(":") >= 0:
                 # Remove the layer identifier from the id
                 return self.id.split("@")[0].split(":")[0] + "@" + \
-                       self.id.split("@")[1]
+                    self.id.split("@")[1]
             else:
                 return self.id
         else:
@@ -767,8 +768,8 @@ class DatasetBase(SQLDatabaseInterface):
     def print_info(self):
         """Print information about this class in human readable style"""
         #      0123456789012345678901234567890
-        print( " +-------------------- Basic information -------------------------------------+")
-        print( " | Id: ........................ " + str(self.get_id()))
+        print(" +-------------------- Basic information -------------------------------------+")
+        print(" | Id: ........................ " + str(self.get_id()))
         print(" | Name: ...................... " + str(self.get_name()))
         print(" | Mapset: .................... " + str(self.get_mapset()))
         if self.get_layer():
@@ -793,6 +794,7 @@ class DatasetBase(SQLDatabaseInterface):
 
 class RasterBase(DatasetBase):
     """Time stamped raster map base information class"""
+
     def __init__(self, ident=None, name=None, mapset=None, creator=None,
                  creation_time=None, temporal_type=None):
         DatasetBase.__init__(self, "raster_base", ident, name, mapset,
@@ -801,6 +803,7 @@ class RasterBase(DatasetBase):
 
 class Raster3DBase(DatasetBase):
     """Time stamped 3D raster map base information class"""
+
     def __init__(self, ident=None, name=None, mapset=None, creator=None,
                  creation_time=None, temporal_type=None,):
         DatasetBase.__init__(self, "raster3d_base", ident, name,
@@ -810,6 +813,7 @@ class Raster3DBase(DatasetBase):
 
 class VectorBase(DatasetBase):
     """Time stamped vector map base information class"""
+
     def __init__(self, ident=None, name=None, mapset=None, layer=None,
                  creator=None, creation_time=None, temporal_type=None):
         DatasetBase.__init__(self, "vector_base", ident, name, mapset,
@@ -865,6 +869,7 @@ class STDSBase(DatasetBase):
         semantic_type=average
 
     """
+
     def __init__(self, table=None, ident=None, name=None, mapset=None,
                  semantic_type=None, creator=None, ctime=None,
                  ttype=None, mtime=None):
@@ -928,6 +933,7 @@ class STDSBase(DatasetBase):
 
 class STRDSBase(STDSBase):
     """Space time raster dataset base information class"""
+
     def __init__(self, ident=None, name=None, mapset=None,
                  semantic_type=None, creator=None, ctime=None,
                  ttype=None):
@@ -938,6 +944,7 @@ class STRDSBase(STDSBase):
 
 class STR3DSBase(STDSBase):
     """Space time 3D raster dataset base information class"""
+
     def __init__(self, ident=None, name=None, mapset=None,
                  semantic_type=None, creator=None, ctime=None,
                  ttype=None):
@@ -948,6 +955,7 @@ class STR3DSBase(STDSBase):
 
 class STVDSBase(STDSBase):
     """Space time vector dataset base information class"""
+
     def __init__(self, ident=None, name=None, mapset=None,
                  semantic_type=None, creator=None, ctime=None,
                  ttype=None):
@@ -1042,6 +1050,7 @@ class AbstractSTDSRegister(SQLDatabaseInterface):
 
 class RasterSTDSRegister(AbstractSTDSRegister):
     """Time stamped raster map base information class"""
+
     def __init__(self, ident=None, registered_stds=None):
         AbstractSTDSRegister.__init__(self, "raster_stds_register", ident,
                                       registered_stds)
@@ -1049,6 +1058,7 @@ class RasterSTDSRegister(AbstractSTDSRegister):
 
 class Raster3DSTDSRegister(AbstractSTDSRegister):
     """Time stamped 3D raster map base information class"""
+
     def __init__(self, ident=None, registered_stds=None):
         AbstractSTDSRegister.__init__(self, "raster3d_stds_register", ident,
                                       registered_stds)
@@ -1056,6 +1066,7 @@ class Raster3DSTDSRegister(AbstractSTDSRegister):
 
 class VectorSTDSRegister(AbstractSTDSRegister):
     """Time stamped vector map base information class"""
+
     def __init__(self, ident=None, registered_stds=None):
         AbstractSTDSRegister.__init__(self, "vector_stds_register", ident,
                                       registered_stds)

+ 3 - 3
lib/python/temporal/c_libraries_interface.py

@@ -314,8 +314,8 @@ def _available_mapsets(lock, conn, data):
             if permission >= 0 and in_search_path == 1:
                 mapset_list.append(char_list)
 
-            libgis.G_debug(1, "c_library_server._available_mapsets: \n  mapset:  %s\n"\
-                              "  has permission %i\n  in search path: %i"%(char_list,
+            libgis.G_debug(1, "c_library_server._available_mapsets: \n  mapset:  %s\n"
+                              "  has permission %i\n  in search path: %i" % (char_list,
                               permission, in_search_path))
             count += 1
 
@@ -1275,6 +1275,7 @@ class CLibrariesInterface(RPCServerBase):
            >>> gscript.del_temp_region()
 
     """
+
     def __init__(self):
         RPCServerBase.__init__(self)
 
@@ -1723,4 +1724,3 @@ class CLibrariesInterface(RPCServerBase):
 if __name__ == "__main__":
     import doctest
     doctest.testmod()
-

+ 41 - 40
lib/python/temporal/core.py

@@ -63,7 +63,8 @@ def profile_function(func):
     do_profiling = os.getenv("GRASS_TGIS_PROFILE")
 
     if do_profiling == "True" or do_profiling == "1":
-        import cProfile, pstats
+        import cProfile
+        import pstats
         try:
             import StringIO as io
         except ImportError:
@@ -455,20 +456,20 @@ def get_available_temporal_mapsets():
         driver = c_library_interface.get_driver_name(mapset)
         database = c_library_interface.get_database_name(mapset)
 
-        message_interface.debug(1, "get_available_temporal_mapsets: "\
-                                   "\n  mapset %s\n  driver %s\n  database %s"%(mapset,
+        message_interface.debug(1, "get_available_temporal_mapsets: "
+                                   "\n  mapset %s\n  driver %s\n  database %s" % (mapset,
                                    driver, database))
         if driver and database:
             # Check if the temporal sqlite database exists
             # We need to set non-existing databases in case the mapset is the current mapset
             # to create it
-            if (driver == "sqlite" and os.path.exists(database)) or mapset == get_current_mapset() :
-                tgis_mapsets[mapset] = (driver,  database)
+            if (driver == "sqlite" and os.path.exists(database)) or mapset == get_current_mapset():
+                tgis_mapsets[mapset] = (driver, database)
 
             # We need to warn if the connection is defined but the database does not
             # exists
             if driver == "sqlite" and not os.path.exists(database):
-                message_interface.warning("Temporal database connection defined as:\n" + \
+                message_interface.warning("Temporal database connection defined as:\n" +
                                           database + "\nBut database file does not exist.")
     return tgis_mapsets
 
@@ -564,7 +565,7 @@ def init(raise_fatal_error=False, skip_db_version_check=False):
     msgr = get_tgis_message_interface()
     msgr.debug(1, "Initiate the temporal database")
 
-    msgr.debug(1, ("Raise on error id: %s"%str(raise_on_error)))
+    msgr.debug(1, ("Raise on error id: %s" % str(raise_on_error)))
 
     ciface = get_tgis_c_library_interface()
     driver_string = ciface.get_driver_name()
@@ -650,26 +651,26 @@ def init(raise_fatal_error=False, skip_db_version_check=False):
         if dbif.fetchone()[0]:
             db_exists = True
 
-    backup_howto = _("The format of your actual temporal database is not " \
-                     "supported any more.\n" \
-                     "Please create a backup of your temporal database "\
+    backup_howto = _("The format of your actual temporal database is not "
+                     "supported any more.\n"
+                     "Please create a backup of your temporal database "
                      "to avoid lossing data.\nSOLUTION: ")
     if tgis_db_version > 2:
-        backup_howto += _("Run t.upgrade command installed from " \
+        backup_howto += _("Run t.upgrade command installed from "
                           "GRASS Addons in order to upgrade your temporal database.\n")
     else:
-        backup_howto += _("You need to export it by " \
-                          "restoring the GRASS GIS version used for creating this DB."\
-                          "Notes: Use t.rast.export and t.vect.export "\
-                          "to make a backup of your" \
-                          " existing space time datasets. To save the timestamps of" \
-                          " your existing maps and space time datasets, use " \
-                          "t.rast.list, t.vect.list and t.rast3d.list. "\
-                          "You can register the existing time stamped maps easily if"\
-                          " you export columns=id,start_time,end_time into text "\
-                          "files and use t.register to register them again in new" \
-                          " created space time datasets (t.create). After the backup"\
-                          " remove the existing temporal database, a new one will be"\
+        backup_howto += _("You need to export it by "
+                          "restoring the GRASS GIS version used for creating this DB."
+                          "Notes: Use t.rast.export and t.vect.export "
+                          "to make a backup of your"
+                          " existing space time datasets. To save the timestamps of"
+                          " your existing maps and space time datasets, use "
+                          "t.rast.list, t.vect.list and t.rast3d.list. "
+                          "You can register the existing time stamped maps easily if"
+                          " you export columns=id,start_time,end_time into text "
+                          "files and use t.register to register them again in new"
+                          " created space time datasets (t.create). After the backup"
+                          " remove the existing temporal database, a new one will be"
                           " created automatically.\n")
 
     if db_exists is True:
@@ -896,7 +897,7 @@ def upgrade_temporal_database(dbif):
             "upgrade_db_%s_to_%s.sql" % (upgrade_db_from, tgis_db_version)),
             'r').read()
     except FileNotFoundError:
-        msgr.fatal(_("Unsupported TGIS DB upgrade scenario: from version %s to %s") % \
+        msgr.fatal(_("Unsupported TGIS DB upgrade scenario: from version %s to %s") %
                    (upgrade_db_from, tgis_db_version))
 
     drop_views_sql = open(
@@ -904,7 +905,7 @@ def upgrade_temporal_database(dbif):
         'r').read()
 
     msgr.message(
-        _("Upgrading temporal database <%s> from version %s to %s...") % \
+        _("Upgrading temporal database <%s> from version %s to %s...") %
         (tgis_database_string, upgrade_db_from, tgis_db_version))
     # Drop views
     dbif.execute_transaction(drop_views_sql)
@@ -951,7 +952,7 @@ class SQLDatabaseInterfaceConnection(object):
         self.unique_connections = {}
 
         for mapset in self.tgis_mapsets.keys():
-            driver,  dbstring = self.tgis_mapsets[mapset]
+            driver, dbstring = self.tgis_mapsets[mapset]
 
             if dbstring not in self.unique_connections.keys():
                 self.unique_connections[dbstring] = DBConnection(backend=driver,
@@ -961,14 +962,14 @@ class SQLDatabaseInterfaceConnection(object):
 
         self.msgr = get_tgis_message_interface()
 
-    def get_dbmi(self,  mapset=None):
+    def get_dbmi(self, mapset=None):
         if mapset is None:
             mapset = self.current_mapset
 
         mapset = decode(mapset)
         return self.connections[mapset].dbmi
 
-    def rollback(self,  mapset=None):
+    def rollback(self, mapset=None):
         """
             Roll back the last transaction. This must be called
             in case a new query should be performed after a db error.
@@ -984,7 +985,7 @@ class SQLDatabaseInterfaceConnection(object):
            Supported backends are sqlite3 and postgresql
         """
         for mapset in self.tgis_mapsets.keys():
-            driver,  dbstring = self.tgis_mapsets[mapset]
+            driver, dbstring = self.tgis_mapsets[mapset]
             conn = self.connections[mapset]
             if conn.is_connected() is False:
                 conn.connect(dbstring)
@@ -1049,7 +1050,7 @@ class SQLDatabaseInterfaceConnection(object):
 
         return self.connections[mapset].check_table(table_name)
 
-    def execute(self,  statement,  args=None,  mapset=None):
+    def execute(self, statement, args=None, mapset=None):
         """
 
         :param mapset: The mapset of the abstract dataset or temporal
@@ -1064,9 +1065,9 @@ class SQLDatabaseInterfaceConnection(object):
             self.msgr.fatal(_("Unable to execute sql statement. " +
                               self._create_mapset_error_message(mapset)))
 
-        return self.connections[mapset].execute(statement,  args)
+        return self.connections[mapset].execute(statement, args)
 
-    def fetchone(self,  mapset=None):
+    def fetchone(self, mapset=None):
         if mapset is None:
             mapset = self.current_mapset
 
@@ -1077,7 +1078,7 @@ class SQLDatabaseInterfaceConnection(object):
 
         return self.connections[mapset].fetchone()
 
-    def fetchall(self,  mapset=None):
+    def fetchall(self, mapset=None):
         if mapset is None:
             mapset = self.current_mapset
 
@@ -1111,7 +1112,7 @@ class SQLDatabaseInterfaceConnection(object):
         return("You have no permission to "
                "access mapset <%(mapset)s>, or "
                "mapset <%(mapset)s> has no temporal database. "
-               "Accessible mapsets are: <%(mapsets)s>" % \
+               "Accessible mapsets are: <%(mapsets)s>" %
                {"mapset": decode(mapset),
                 "mapsets":','.join(self.tgis_mapsets.keys())})
 
@@ -1154,9 +1155,9 @@ class DBConnection(object):
         self.dbstring = dbstring
 
         self.msgr = get_tgis_message_interface()
-        self.msgr.debug(1, "DBConnection constructor:"\
-                           "\n  backend: %s"\
-                           "\n  dbstring: %s"%(backend, self.dbstring))
+        self.msgr.debug(1, "DBConnection constructor:"
+                           "\n  backend: %s"
+                           "\n  dbstring: %s" % (backend, self.dbstring))
 
     def __del__(self):
         if self.connected is True:
@@ -1176,7 +1177,7 @@ class DBConnection(object):
             if self.connected:
                 self.connection.rollback()
 
-    def connect(self,  dbstring=None):
+    def connect(self, dbstring=None):
         """Connect to the DBMI to execute SQL statements
 
             Supported backends are sqlite3 and postgresql
@@ -1349,7 +1350,7 @@ class DBConnection(object):
 
         return table_exists
 
-    def execute(self, statement,  args=None):
+    def execute(self, statement, args=None):
         """Execute a SQL statement
 
            :param statement: The executable SQL statement or SQL script
@@ -1360,7 +1361,7 @@ class DBConnection(object):
             connected = True
         try:
             if args:
-                self.cursor.execute(statement,  args)
+                self.cursor.execute(statement, args)
             else:
                 self.cursor.execute(statement)
         except:

+ 1 - 1
lib/python/temporal/datetime_math.py

@@ -911,7 +911,7 @@ suffix_units = {"years": "%Y",
                 "minute": "%Y_%m_%d_%H_%M"}
 
 
-def create_suffix_from_datetime(start_time,  granularity):
+def create_suffix_from_datetime(start_time, granularity):
     """Create a datetime string based on a datetime object and a provided
        granularity that can be used as suffix for map names.
 

+ 1 - 1
lib/python/temporal/gui_support.py

@@ -107,7 +107,7 @@ def tlist(type, dbif=None):
             sql += " WHERE mapset = '%s'" % (mapset)
             sql += " ORDER BY id"
 
-            dbif.execute(sql,  mapset=mapset)
+            dbif.execute(sql, mapset=mapset)
             rows = dbif.fetchall(mapset=mapset)
 
             # Append the ids of the space time datasets

+ 3 - 3
lib/python/temporal/list_stds.py

@@ -103,7 +103,7 @@ def get_dataset_list(type, temporal_type, columns=None, where=None,
         if order:
             sql += " ORDER BY " + order
 
-        dbif.execute(sql,  mapset=mapset)
+        dbif.execute(sql, mapset=mapset)
         rows = dbif.fetchall(mapset=mapset)
 
         if rows:
@@ -260,8 +260,8 @@ def list_maps_of_stds(type, input, columns, order, where, separator,
             if where:
                 err += " or where condition is wrong"
             gscript.fatal(_(err) % {
-                            'sp': sp.get_new_map_instance(None).get_type(),
-                            'i': sp.get_id()})
+                'sp': sp.get_new_map_instance(None).get_type(),
+                'i': sp.get_id()})
 
         if rows:
             if method == "comma":

+ 9 - 0
lib/python/temporal/metadata.py

@@ -75,6 +75,7 @@ class RasterMetadataBase(SQLDatabaseInterface):
             max=100.0
 
     """
+
     def __init__(self, table=None, ident=None, datatype=None, cols=None,
                  rows=None, number_of_cells=None, nsres=None, ewres=None,
                  min=None, max=None):
@@ -315,6 +316,7 @@ class RasterMetadata(RasterMetadataBase):
             max=100.0
 
     """
+
     def __init__(self, ident=None, datatype=None,
                  cols=None, rows=None, number_of_cells=None, nsres=None,
                  ewres=None, min=None, max=None, band_reference=None):
@@ -423,6 +425,7 @@ class Raster3DMetadata(RasterMetadataBase):
             tbres=0.1
 
     """
+
     def __init__(self, ident=None, datatype=None,
                  cols=None, rows=None, depths=None, number_of_cells=None,
                  nsres=None, ewres=None, tbres=None, min=None, max=None):
@@ -561,6 +564,7 @@ class VectorMetadata(SQLDatabaseInterface):
             volumes=12
 
     """
+
     def __init__(self, ident=None, is_3d=False, number_of_points=None,
                  number_of_lines=None, number_of_boundaries=None,
                  number_of_centroids=None, number_of_faces=None,
@@ -852,6 +856,7 @@ class STDSMetadataBase(SQLDatabaseInterface):
             number_of_maps=None
 
     """
+
     def __init__(self, table=None, ident=None, title=None, description=None,
                  command=None):
 
@@ -1044,6 +1049,7 @@ class STDSRasterMetadataBase(STDSMetadataBase):
             max_max=None
 
     """
+
     def __init__(self, table=None, ident=None, title=None, description=None,
                  aggregation_type=None):
 
@@ -1275,6 +1281,7 @@ class STRDSMetadata(STDSRasterMetadataBase):
             raster_register=None
 
     """
+
     def __init__(self, ident=None, raster_register=None, title=None,
                  description=None):
 
@@ -1387,6 +1394,7 @@ class STR3DSMetadata(STDSRasterMetadataBase):
             raster3d_register=None
 
         """
+
     def __init__(self, ident=None, raster3d_register=None, title=None,
                  description=None):
 
@@ -1531,6 +1539,7 @@ class STVDSMetadata(STDSMetadataBase):
             volumes=None
 
     """
+
     def __init__(self, ident=None, vector_register=None, title=None,
                  description=None):
 

+ 1 - 1
lib/python/temporal/open_stds.py

@@ -120,7 +120,7 @@ def check_new_stds(name, type, dbif=None, overwrite=False):
             msgr.fatal(_("Illegal dataset name <{}>. "
                          "Character '.' not allowed.").format(name))
         sp = dataset_factory("strds", id)
-    elif type == "str3ds" or type == "raster3d" or type == "rast3d "or type == "raster_3d":
+    elif type == "str3ds" or type == "raster3d" or type == "rast3d " or type == "raster_3d":
         sp = dataset_factory("str3ds", id)
     elif type == "stvds" or type == "vect" or type == "vector":
         sp = dataset_factory("stvds", id)

+ 4 - 4
lib/python/temporal/register.py

@@ -488,7 +488,7 @@ def assign_valid_time_to_map(ttype, map, start, end, unit, increment=None,
 
 ##############################################################################
 
-def register_map_object_list(type,  map_list, output_stds,
+def register_map_object_list(type, map_list, output_stds,
                              delete_empty=False, unit=None, dbif=None):
     """Register a list of AbstractMapDataset objects in the temporal database
        and optional in a space time dataset.
@@ -504,7 +504,7 @@ def register_map_object_list(type,  map_list, output_stds,
     import grass.pygrass.modules as pymod
     import copy
 
-    dbif,  connected = init_dbif(dbif)
+    dbif, connected = init_dbif(dbif)
 
     filename = gscript.tempfile(True)
     file = open(filename, 'w')
@@ -526,11 +526,11 @@ def register_map_object_list(type,  map_list, output_stds,
                     empty_maps.append(map_layer)
                     continue
 
-        start,  end = map_layer.get_temporal_extent_as_tuple()
+        start, end = map_layer.get_temporal_extent_as_tuple()
         id = map_layer.get_id()
         if not end:
             end = start
-        string = "%s|%s|%s\n" % (id,  str(start),  str(end))
+        string = "%s|%s|%s\n" % (id, str(start), str(end))
         file.write(string)
     file.close()
 

+ 4 - 0
lib/python/temporal/space_time_datasets.py

@@ -134,6 +134,7 @@ class RasterDataset(AbstractMapDataset):
             >>> gs.del_temp_region()
 
     """
+
     def __init__(self, ident):
         AbstractMapDataset.__init__(self)
         self.reset(ident)
@@ -524,6 +525,7 @@ class Raster3DDataset(AbstractMapDataset):
             >>> gs.del_temp_region()
 
     """
+
     def __init__(self, ident):
         AbstractMapDataset.__init__(self)
         self.reset(ident)
@@ -867,6 +869,7 @@ class VectorDataset(AbstractMapDataset):
             >>> gs.del_temp_region()
 
     """
+
     def __init__(self, ident):
         AbstractMapDataset.__init__(self)
         self.reset(ident)
@@ -1103,6 +1106,7 @@ class SpaceTimeRasterDataset(AbstractSpaceTimeDataset):
 
         ...
     """
+
     def __init__(self, ident):
         AbstractSpaceTimeDataset.__init__(self, ident)
 

+ 1 - 0
lib/python/temporal/spatial_extent.py

@@ -84,6 +84,7 @@ class SpatialExtent(SQLDatabaseInterface):
             bottom=-20.0
 
     """
+
     def __init__(self, table=None, ident=None, north=None, south=None,
                  east=None, west=None, top=None, bottom=None, proj="XY"):
 

+ 58 - 57
lib/python/temporal/spatio_temporal_relationships.py

@@ -357,6 +357,7 @@ class SpatioTemporalTopologyBuilder(object):
             ('OVERLAPPED', (datetime.datetime(2000, 1, 1, 0, 0, 2), datetime.datetime(2000, 1, 1, 0, 0, 4)))
 
     """
+
     def __init__(self):
         self._reset()
         # 0001-01-01 00:00:00
@@ -594,104 +595,104 @@ def set_temoral_relationship(A, B, relation):
     if relation == "equal" or relation == "equals":
         if A != B:
             if not B.get_equal() or \
-            (B.get_equal() and \
+                (B.get_equal() and
             A not in B.get_equal()):
                 B.append_equal(A)
             if not A.get_equal() or \
-            (A.get_equal() and \
+                (A.get_equal() and
             B not in A.get_equal()):
                 A.append_equal(B)
     elif relation == "follows":
         if not B.get_follows() or \
-            (B.get_follows() and \
-            A not in B.get_follows()):
+            (B.get_follows() and
+                A not in B.get_follows()):
             B.append_follows(A)
         if not A.get_precedes() or \
             (A.get_precedes() and
-            B not in A.get_precedes()):
+                B not in A.get_precedes()):
             A.append_precedes(B)
     elif relation == "precedes":
         if not B.get_precedes() or \
-            (B.get_precedes() and \
-            A not in B.get_precedes()):
+            (B.get_precedes() and
+                A not in B.get_precedes()):
             B.append_precedes(A)
         if not A.get_follows() or \
-            (A.get_follows() and \
-            B not in A.get_follows()):
+            (A.get_follows() and
+                B not in A.get_follows()):
             A.append_follows(B)
     elif relation == "during" or relation == "starts" or \
             relation == "finishes":
         if not B.get_during() or \
-            (B.get_during() and \
-            A not in B.get_during()):
+            (B.get_during() and
+                A not in B.get_during()):
             B.append_during(A)
         if not A.get_contains() or \
-            (A.get_contains() and \
-            B not in A.get_contains()):
+            (A.get_contains() and
+                B not in A.get_contains()):
             A.append_contains(B)
         if relation == "starts":
             if not B.get_starts() or \
-            (B.get_starts() and \
+                (B.get_starts() and
             A not in B.get_starts()):
                 B.append_starts(A)
             if not A.get_started() or \
-            (A.get_started() and \
+                (A.get_started() and
             B not in A.get_started()):
                 A.append_started(B)
         if relation == "finishes":
             if not B.get_finishes() or \
-            (B.get_finishes() and \
+                (B.get_finishes() and
             A not in B.get_finishes()):
                 B.append_finishes(A)
             if not A.get_finished() or \
-            (A.get_finished() and \
+                (A.get_finished() and
             B not in A.get_finished()):
                 A.append_finished(B)
     elif relation == "contains" or relation == "started" or \
             relation == "finished":
         if not B.get_contains() or \
-            (B.get_contains() and \
-            A not in B.get_contains()):
+            (B.get_contains() and
+                A not in B.get_contains()):
             B.append_contains(A)
         if not A.get_during() or \
-            (A.get_during() and \
-            B not in A.get_during()):
+            (A.get_during() and
+                B not in A.get_during()):
             A.append_during(B)
         if relation == "started":
             if not B.get_started() or \
-            (B.get_started() and \
+                (B.get_started() and
             A not in B.get_started()):
                 B.append_started(A)
             if not A.get_starts() or \
-            (A.get_starts() and \
+                (A.get_starts() and
             B not in A.get_starts()):
                 A.append_starts(B)
         if relation == "finished":
             if not B.get_finished() or \
-            (B.get_finished() and \
+                (B.get_finished() and
             A not in B.get_finished()):
                 B.append_finished(A)
             if not A.get_finishes() or \
-            (A.get_finishes() and \
+                (A.get_finishes() and
             B not in A.get_finishes()):
                 A.append_finishes(B)
     elif relation == "overlaps":
         if not B.get_overlaps() or \
-            (B.get_overlaps() and \
-            A not in B.get_overlaps()):
+            (B.get_overlaps() and
+                A not in B.get_overlaps()):
             B.append_overlaps(A)
         if not A.get_overlapped() or \
-            (A.get_overlapped() and \
-            B not in A.get_overlapped()):
+            (A.get_overlapped() and
+                B not in A.get_overlapped()):
             A.append_overlapped(B)
     elif relation == "overlapped":
         if not B.get_overlapped() or \
-            (B.get_overlapped() and \
-            A not in B.get_overlapped()):
+            (B.get_overlapped() and
+                A not in B.get_overlapped()):
             B.append_overlapped(A)
         if not A.get_overlaps() or \
-            (A.get_overlaps() and \
-            B not in A.get_overlaps()):
+            (A.get_overlaps() and
+                B not in A.get_overlaps()):
             A.append_overlaps(B)
 
 ###############################################################################
@@ -701,66 +702,66 @@ def set_spatial_relationship(A, B, relation):
     if relation == "equivalent":
         if A != B:
             if not B.get_equivalent() or \
-            (B.get_equivalent() and \
+                (B.get_equivalent() and
             A not in B.get_equivalent()):
                 B.append_equivalent(A)
             if not A.get_equivalent() or \
-            (A.get_equivalent() and \
+                (A.get_equivalent() and
             B not in A.get_equivalent()):
                 A.append_equivalent(B)
     elif relation == "overlap":
         if not B.get_overlap() or \
-            (B.get_overlap() and \
-            A not in B.get_overlap()):
+            (B.get_overlap() and
+                A not in B.get_overlap()):
             B.append_overlap(A)
         if not A.get_overlap() or \
             (A.get_overlap() and
-            B not in A.get_overlap()):
+                B not in A.get_overlap()):
             A.append_overlap(B)
     elif relation == "meet":
         if not B.get_meet() or \
-            (B.get_meet() and \
-            A not in B.get_meet()):
+            (B.get_meet() and
+                A not in B.get_meet()):
             B.append_meet(A)
         if not A.get_meet() or \
             (A.get_meet() and
-            B not in A.get_meet()):
+                B not in A.get_meet()):
             A.append_meet(B)
     elif relation == "contain":
         if not B.get_contain() or \
-            (B.get_contain() and \
-            A not in B.get_contain()):
+            (B.get_contain() and
+                A not in B.get_contain()):
             B.append_contain(A)
         if not A.get_in() or \
-            (A.get_in() and \
-            B not in A.get_in()):
+            (A.get_in() and
+                B not in A.get_in()):
             A.append_in(B)
     elif relation == "in":
         if not B.get_in() or \
-            (B.get_in() and \
-            A not in B.get_in()):
+            (B.get_in() and
+                A not in B.get_in()):
             B.append_in(A)
         if not A.get_contain() or \
-            (A.get_contain() and \
-            B not in A.get_contain()):
+            (A.get_contain() and
+                B not in A.get_contain()):
             A.append_contain(B)
     elif relation == "cover":
         if not B.get_cover() or \
-            (B.get_cover() and \
-            A not in B.get_cover()):
+            (B.get_cover() and
+                A not in B.get_cover()):
             B.append_cover(A)
         if not A.get_covered() or \
-            (A.get_covered() and \
-            B not in A.get_covered()):
+            (A.get_covered() and
+                B not in A.get_covered()):
             A.append_covered(B)
     elif relation == "covered":
         if not B.get_covered() or \
-            (B.get_covered() and \
-            A not in B.get_covered()):
+            (B.get_covered() and
+                A not in B.get_covered()):
             B.append_covered(A)
         if not A.get_cover() or \
-            (A.get_cover() and \
-            B not in A.get_cover()):
+            (A.get_cover() and
+                B not in A.get_cover()):
             A.append_cover(B)
 
 ###############################################################################

+ 2 - 2
lib/python/temporal/stds_export.py

@@ -399,13 +399,13 @@ def export_stds(input, output, compression, directory, where, format_="pack",
     read_file.write("Files:\n")
     if type_ == "strds":
         if format_ == "GTiff":
-                                # 123456789012345678901234567890
+            # 123456789012345678901234567890
             read_file.write("       *.tif  -- GeoTIFF raster files\n")
             read_file.write("     *.color  -- GRASS GIS raster color rules\n")
         elif format_ == "pack":
             read_file.write("      *.pack  -- GRASS raster files packed with r.pack\n")
     elif type_ == "stvds":
-                                # 123456789012345678901234567890
+        # 123456789012345678901234567890
         if format_ == "GML":
             read_file.write("       *.xml  -- Vector GML files\n")
         else:

+ 122 - 118
lib/python/temporal/temporal_algebra.py

@@ -481,66 +481,66 @@ class TemporalAlgebraLexer(object):
     # Functions that defines an if condition, temporal buffering, snapping and
     # selection of maps with temporal extent.
     conditional_functions = {
-        'if'    : 'IF',
+        'if': 'IF',
         'buff_t': 'BUFF_T',
-        'tsnap'  : 'TSNAP',
-        'tshift' : 'TSHIFT',
-        'tmap' : 'TMAP',
-        'merge' : 'MERGE',
-        'strds' : 'STRDS',
-        'str3ds' : 'STR3DS',
-        'stvds' : 'STVDS',
+        'tsnap': 'TSNAP',
+        'tshift': 'TSHIFT',
+        'tmap': 'TMAP',
+        'merge': 'MERGE',
+        'strds': 'STRDS',
+        'str3ds': 'STR3DS',
+        'stvds': 'STVDS',
     }
 
     # Variables with date and time strings
     datetime_functions = {
-        'start_time'     : 'START_TIME',     # start time as HH::MM:SS
-        'start_date'     : 'START_DATE',     # start date as yyyy-mm-DD
-        'start_datetime' : 'START_DATETIME', # start datetime as yyyy-mm-DD HH:MM:SS
-        'end_time'       : 'END_TIME',       # end time as HH:MM:SS
-        'end_date'       : 'END_DATE',       # end date as yyyy-mm-DD
-        'end_datetime'   : 'END_DATETIME',   # end datetime as  yyyy-mm-DD HH:MM:SS
+        'start_time': 'START_TIME',     # start time as HH::MM:SS
+        'start_date': 'START_DATE',     # start date as yyyy-mm-DD
+        'start_datetime': 'START_DATETIME', # start datetime as yyyy-mm-DD HH:MM:SS
+        'end_time': 'END_TIME',       # end time as HH:MM:SS
+        'end_date': 'END_DATE',       # end date as yyyy-mm-DD
+        'end_datetime': 'END_DATETIME',   # end datetime as  yyyy-mm-DD HH:MM:SS
     }
 
     # Time functions
     time_functions = {
-        'td'          : 'TD',            # The size of the current
-                                         # sample time interval in days and
-                                         # fraction of days for absolute time,
-                                         # and in relative units in case of relative time.
+        'td': 'TD',            # The size of the current
+        # sample time interval in days and
+        # fraction of days for absolute time,
+        # and in relative units in case of relative time.
         #'start_td'    : 'START_TD',     # The time difference between the start
-                                         # time of the sample space time raster
-                                         # dataset and the start time of the
-                                         # current sample interval or instance.
-                                         # The time is measured in days and
-                                         # fraction of days for absolute time,
-                                         # and in relative units in case of relative time.
+        # time of the sample space time raster
+        # dataset and the start time of the
+        # current sample interval or instance.
+        # The time is measured in days and
+        # fraction of days for absolute time,
+        # and in relative units in case of relative time.
         #'end_td'      : 'END_TD',       # The time difference between the
-                                         # start time of the sample
-                                         # space time raster dataset and the
-                                         # end time of the current sample interval.
-                                         # The time is measured in days and
-                                         # fraction of days for absolute time,
-                                         # and in relative units in case of relative time.
-                                         # The end_time() will be represented by null() in case of a time instance.
-        'start_doy'   : 'START_DOY',     # Day of year (doy) from the start time [1 - 366]
-        'start_dow'   : 'START_DOW',     # Day of week (dow) from the start time [1 - 7], the start of the week is Monday == 1
-        'start_year'  : 'START_YEAR',    # The year of the start time [0 - 9999]
-        'start_month' : 'START_MONTH',   # The month of the start time [1 - 12]
-        'start_week'  : 'START_WEEK',    # Week of year of the start time [1 - 54]
-        'start_day'   : 'START_DAY',     # Day of month from the start time [1 - 31]
-        'start_hour'  : 'START_HOUR',    # The hour of the start time [0 - 23]
+        # start time of the sample
+        # space time raster dataset and the
+        # end time of the current sample interval.
+        # The time is measured in days and
+        # fraction of days for absolute time,
+        # and in relative units in case of relative time.
+        # The end_time() will be represented by null() in case of a time instance.
+        'start_doy': 'START_DOY',     # Day of year (doy) from the start time [1 - 366]
+        'start_dow': 'START_DOW',     # Day of week (dow) from the start time [1 - 7], the start of the week is Monday == 1
+        'start_year': 'START_YEAR',    # The year of the start time [0 - 9999]
+        'start_month': 'START_MONTH',   # The month of the start time [1 - 12]
+        'start_week': 'START_WEEK',    # Week of year of the start time [1 - 54]
+        'start_day': 'START_DAY',     # Day of month from the start time [1 - 31]
+        'start_hour': 'START_HOUR',    # The hour of the start time [0 - 23]
         'start_minute': 'START_MINUTE',  # The minute of the start time [0 - 59]
         'start_second': 'START_SECOND',  # The second of the start time [0 - 59]
-        'end_doy'     : 'END_DOY',       # Day of year (doy) from the end time [1 - 366]
-        'end_dow'     : 'END_DOW',       # Day of week (dow) from the end time [1 - 7], the start of the week is Monday == 1
-        'end_year'    : 'END_YEAR',      # The year of the end time [0 - 9999]
-        'end_month'   : 'END_MONTH',     # The month of the end time [1 - 12]
-        'end_week'    : 'END_WEEK',      # Week of year of the end time [1 - 54]
-        'end_day'     : 'END_DAY',       # Day of month from the start time [1 - 31]
-        'end_hour'    : 'END_HOUR',      # The hour of the end time [0 - 23]
-        'end_minute'  : 'END_MINUTE',    # The minute of the end time [0 - 59]
-        'end_second'  : 'END_SECOND',    # The second of the end time [0 - 59]
+        'end_doy': 'END_DOY',       # Day of year (doy) from the end time [1 - 366]
+        'end_dow': 'END_DOW',       # Day of week (dow) from the end time [1 - 7], the start of the week is Monday == 1
+        'end_year': 'END_YEAR',      # The year of the end time [0 - 9999]
+        'end_month': 'END_MONTH',     # The month of the end time [1 - 12]
+        'end_week': 'END_WEEK',      # Week of year of the end time [1 - 54]
+        'end_day': 'END_DAY',       # Day of month from the start time [1 - 31]
+        'end_hour': 'END_HOUR',      # The hour of the end time [0 - 23]
+        'end_minute': 'END_MINUTE',    # The minute of the end time [0 - 59]
+        'end_second': 'END_SECOND',    # The second of the end time [0 - 59]
     }
 
     # This is the list of token names.
@@ -611,6 +611,8 @@ class TemporalAlgebraLexer(object):
 
 
     # Read date string and convert it into a date object
+
+
     def t_DATE(self, t):
         r'"\d\d\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])"'
         # t.value = int(t.value)
@@ -634,6 +636,7 @@ class TemporalAlgebraLexer(object):
         t.value = int(t.value)
         return t
     # Read in a list of maps.
+
     def  t_LIST(self, t):
         r'[\[][.]*[\]]'
         t.value = list(t.value)
@@ -698,6 +701,7 @@ class GlobalTemporalVar(object):
         But also boolean values, time differences and relation operators for comparison in
         if-statements can be stored in this class.
     """
+
     def __init__(self):
         self.tfunc        = None
         self.compop       = None
@@ -708,13 +712,13 @@ class GlobalTemporalVar(object):
         self.td           = None
 
     def get_type(self):
-        if self.tfunc != None and self.compop != None and self.value != None:
+        if self.tfunc is not None and self.compop is not None and self.value is not None:
             return("global")
-        elif self.boolean != None:
+        elif self.boolean is not None:
             return("boolean")
-        elif self.relationop != None and self.topology != []:
+        elif self.relationop is not None and self.topology != []:
             return("operator")
-        elif self.td != None:
+        elif self.td is not None:
             return("timediff")
 
     def get_type_value(self):
@@ -754,9 +758,9 @@ class TemporalAlgebraParser(object):
 
     # Setting equal precedence level for select and hash operations.
     precedence = (
-        ('left', 'T_SELECT_OPERATOR', 'T_SELECT', 'T_NOT_SELECT',  'T_HASH_OPERATOR',  'HASH'), # 1
-        ('left', 'AND', 'OR', 'T_COMP_OPERATOR'), #2
-        )
+        ('left', 'T_SELECT_OPERATOR', 'T_SELECT', 'T_NOT_SELECT', 'T_HASH_OPERATOR', 'HASH'), # 1
+        ('left', 'AND', 'OR', 'T_COMP_OPERATOR'),  # 2
+    )
 
     def __init__(self, pid=None, run=True, debug=False, spatial=False,
                  register_null=False, dry_run=False, nprocs=1, time_suffix=None):
@@ -788,7 +792,7 @@ class TemporalAlgebraParser(object):
         self.time_suffix = time_suffix
 
         # Topology lists
-        self.temporal_topology_list = ["EQUAL", "FOLLOWS", "PRECEDES", "OVERLAPS", "OVERLAPPED", \
+        self.temporal_topology_list = ["EQUAL", "FOLLOWS", "PRECEDES", "OVERLAPS", "OVERLAPPED",
                                        "DURING", "STARTS", "FINISHES", "CONTAINS", "STARTED", "FINISHED"]
         self.spatial_topology_list = ["EQUIVALENT", "COVER", "OVERLAP", "IN", "CONTAIN", "MEET"]
 
@@ -796,7 +800,7 @@ class TemporalAlgebraParser(object):
         if self.dbif.connected:
             self.dbif.close()
 
-    def setup_common_granularity(self,  expression,  stdstype = 'strds',  lexer = None):
+    def setup_common_granularity(self, expression, stdstype = 'strds', lexer = None):
         """Configure the temporal algebra to use the common granularity of all
              space time datasets in the expression to generate the map lists.
 
@@ -847,7 +851,7 @@ class TemporalAlgebraParser(object):
                 if tokens[count - 2] == "MAP" or tokens[count - 2] == "TMAP":
                     ignore = True
 
-            if tok.type == "NAME" and ignore == False:
+            if tok.type == "NAME" and ignore is False:
                 name_list.append(tok.value)
             count += 1
 
@@ -857,7 +861,7 @@ class TemporalAlgebraParser(object):
         dbif, connected = init_dbif(self.dbif)
 
         for name in name_list:
-            stds = open_old_stds(name,  stdstype,  dbif)
+            stds = open_old_stds(name, stdstype, dbif)
             # We need valid temporal topology
             if stds.check_temporal_topology() is False:
                 self.msgr.error(_("All input space time datasets must have a valid temporal topology."))
@@ -883,7 +887,7 @@ class TemporalAlgebraParser(object):
         return True
 
     def parse(self, expression, stdstype='strds',
-              maptype='rast',  mapclass=RasterDataset,
+              maptype='rast', mapclass=RasterDataset,
               basename=None, overwrite=False):
         """Parse the algebra expression and run the computation
 
@@ -917,11 +921,11 @@ class TemporalAlgebraParser(object):
             same object for map name generation in multiple threads.
         """
         self.count += 1
-        if self.pid != None:
+        if self.pid is not None:
             pid = self.pid
         else:
             pid = os.getpid()
-        name = "tmp_map_name_%i_%i"%(pid, self.count)
+        name = "tmp_map_name_%i_%i" % (pid, self.count)
         self.names[name] = name
         return name
 
@@ -993,19 +997,19 @@ class TemporalAlgebraParser(object):
             # Calculate spatial extent for different overlay operations.
             if bool_op == 'and':
                 overlay_ext = mapA.spatial_intersection(mapB)
-                if overlay_ext != None:
+                if overlay_ext is not None:
                     mapA.set_spatial_extent(overlay_ext)
                 else:
                     returncode = 0
             elif bool_op in ['or', 'xor']:
                 overlay_ext = mapA.spatial_union(mapB)
-                if overlay_ext != None:
+                if overlay_ext is not None:
                     mapA.set_spatial_extent(overlay_ext)
                 else:
                     returncode = 0
             elif bool_op == 'disor':
                 overlay_ext = mapA.spatial_disjoint_union(mapB)
-                if overlay_ext != None:
+                if overlay_ext is not None:
                     mapA.set_spatial_extent(overlay_ext)
                 else:
                     returncode = 0
@@ -1013,25 +1017,25 @@ class TemporalAlgebraParser(object):
             # Calculate temporal extent for different temporal operators.
             if temp_op == 'i':
                 temp_ext = mapA.temporal_intersection(mapB)
-                if temp_ext != None:
+                if temp_ext is not None:
                     mapA.set_temporal_extent(temp_ext)
                 else:
                     returncode = 0
             elif temp_op == 'u':
                 temp_ext = mapA.temporal_union(mapB)
-                if temp_ext != None:
+                if temp_ext is not None:
                     mapA.set_temporal_extent(temp_ext)
                 else:
                     returncode = 0
             elif temp_op == 'd':
                 temp_ext = mapA.temporal_disjoint_union(mapB)
-                if temp_ext != None:
+                if temp_ext is not None:
                     mapA.set_temporal_extent(temp_ext)
                 else:
                     returncode = 0
             elif temp_op == 'r':
                 temp_ext = mapB.get_temporal_extent()
-                if temp_ext != None:
+                if temp_ext is not None:
                     mapA.set_temporal_extent(temp_ext)
                 else:
                     returncode = 0
@@ -1061,7 +1065,7 @@ class TemporalAlgebraParser(object):
             tbrelations = map_i.get_temporal_relations()
             # Generate an intermediate map for the result map list.
             map_new = self.generate_new_map(base_map=map_i, bool_op='and',
-                                            copy=True,  rename=True)
+                                            copy=True, rename=True)
             # Combine temporal and spatial extents of intermediate map with related maps.
             for topo in topolist:
                 if topo in tbrelations.keys():
@@ -1070,7 +1074,7 @@ class TemporalAlgebraParser(object):
                             if temporal == 'r':
                                 # Generate an intermediate map for the result map list.
                                 map_new = self.generate_new_map(base_map=map_i, bool_op='and',
-                                                                copy=True,  rename=True)
+                                                                copy=True, rename=True)
                             # Create overlaid map extent.
                             returncode = self.overlay_map_extent(map_new, map_j, 'and',
                                                                  temp_op=temporal)
@@ -1116,12 +1120,12 @@ class TemporalAlgebraParser(object):
 
         if self.removable_maps:
             for map in self.removable_maps.values():
-                    map_names[map.get_type()].append(map.get_name())
+                map_names[map.get_type()].append(map.get_name())
 
         for key in map_names.keys():
             if map_names[key]:
-                self.msgr.message(_("Removing un-needed or empty %s maps"%(key)))
-                self._remove_maps(map_names[key],  key)
+                self.msgr.message(_("Removing un-needed or empty %s maps" % (key)))
+                self._remove_maps(map_names[key], key)
 
     def _remove_maps(self,
                      namelist,
@@ -1235,7 +1239,7 @@ class TemporalAlgebraParser(object):
         for map in maplist:
             map.uid = self.generate_map_name()
             if self.debug:
-                print(map.get_name(), map.uid,  map.get_temporal_extent_as_tuple())
+                print(map.get_name(), map.uid, map.get_temporal_extent_as_tuple())
 
         return(maplist)
 
@@ -1302,7 +1306,7 @@ class TemporalAlgebraParser(object):
         :raises: This method will raise a syntax error in case the topology name is unknown
         """
         temporal_topo_list = []
-        spatial_topo_list= []
+        spatial_topo_list = []
         # Check if given temporal relation are valid.
         for topo in topolist:
             if topo.upper() not in self.temporal_topology_list and topo.upper() not in self.spatial_topology_list:
@@ -1484,7 +1488,7 @@ class TemporalAlgebraParser(object):
         tb = SpatioTemporalTopologyBuilder()
         if len(spatial_topo_list) > 0:
             # Dictionary with different spatial variables used for topology builder.
-            spatialdict = {'strds' : '2D', 'stvds' : '2D', 'str3ds' : '3D'}
+            spatialdict = {'strds': '2D', 'stvds': '2D', 'str3ds': '3D'}
             tb.build(maplistA, maplistB, spatial=spatialdict[self.stdstype])
         else:
             tb.build(maplistA, maplistB)
@@ -1636,7 +1640,7 @@ class TemporalAlgebraParser(object):
         p.parse(operator, optype)
         p.relations = [rel.upper() for rel in p.relations]
 
-        return(p.relations, p.temporal, p.function,  p.aggregate)
+        return(p.relations, p.temporal, p.function, p.aggregate)
 
     def perform_temporal_selection(self,
                                    maplistA,
@@ -1784,7 +1788,7 @@ class TemporalAlgebraParser(object):
         # Create temporal topology for maplistA to maplistB.
         tb = SpatioTemporalTopologyBuilder()
         # Dictionary with different spatial variables used for topology builder.
-        spatialdict = {'strds' : '2D', 'stvds' : '2D', 'str3ds' : '3D'}
+        spatialdict = {'strds': '2D', 'stvds': '2D', 'str3ds': '3D'}
         # Build spatial temporal topology for maplistB to maplistB.
         if self.spatial:
             tb.build(maplistA, maplistB, spatial = spatialdict[self.stdstype])
@@ -1815,12 +1819,12 @@ class TemporalAlgebraParser(object):
                             newextent = map_i.get_temporal_extent()
                         elif toperator == "r":
                             newextent = relationmap.get_temporal_extent()
-                        if newextent != None:
+                        if newextent is not None:
                             start = newextent.get_start_time()
                             end = newextent.get_end_time()
                             #print(map_i.get_id() + ' - start: ' + str(start) + ' end: ' + str(end))
                             # Track changes in temporal extents of maps.
-                            if map_start != start or map_end != end :
+                            if map_start != start or map_end != end:
                                 unchanged = False
                             if map_i.is_time_absolute():
                                 map_i.set_absolute_time(start, end)
@@ -1832,9 +1836,9 @@ class TemporalAlgebraParser(object):
                     if self.debug:
                         print('Topologic relation: ' + topo.upper() + ' not found.')
                     resultdict[map_i.get_id()] = map_i
-            if unchanged == True:
+            if unchanged is True:
                 if self.debug:
-                    print('Leave temporal extend of result map: ' +  map_i.get_map_id() + ' unchanged.')
+                    print('Leave temporal extend of result map: ' + map_i.get_map_id() + ' unchanged.')
 
         resultlist = resultdict.values()
         # Sort list of maps chronological.
@@ -1879,14 +1883,14 @@ class TemporalAlgebraParser(object):
               2000-01-01 00:00:00
 
         """
-        tvardict = {"START_DOY" : None, "START_DOW" : None, "START_YEAR" : None,
-            "START_MONTH" : None, "START_WEEK" : None, "START_DAY" : None,
-            "START_HOUR" : None, "START_MINUTE" : None, "START_SECOND" : None,
-            "END_DOY" : None, "END_DOW" : None, "END_YEAR" : None,
-            "END_MONTH" : None, "END_WEEK" : None, "END_DAY" : None,
-            "END_HOUR" : None, "END_MINUTE" : None, "END_SECOND" : None,
-            "START_DATE" : None, "START_DATETIME" : None, "START_TIME" : None,
-            "END_DATE" : None, "END_DATETIME" : None, "END_TIME" : None}
+        tvardict = {"START_DOY": None, "START_DOW": None, "START_YEAR": None,
+            "START_MONTH": None, "START_WEEK": None, "START_DAY": None,
+            "START_HOUR": None, "START_MINUTE": None, "START_SECOND": None,
+            "END_DOY": None, "END_DOW": None, "END_YEAR": None,
+            "END_MONTH": None, "END_WEEK": None, "END_DAY": None,
+            "END_HOUR": None, "END_MINUTE": None, "END_SECOND": None,
+            "START_DATE": None, "START_DATETIME": None, "START_TIME": None,
+            "END_DATE": None, "END_DATETIME": None, "END_TIME": None}
 
         # Compute temporal function only for maps with absolute time reference.
         if map.is_time_absolute:
@@ -1989,7 +1993,7 @@ class TemporalAlgebraParser(object):
                 map_i.condition_value = boolname
         return(maplist)
 
-    def eval_map_list(self, maplist ,thenlist, topolist=["EQUAL"]):
+    def eval_map_list(self, maplist,thenlist, topolist=["EQUAL"]):
         """ This function transfers boolean values from temporal expression
              from one map list to another by their topology. These boolean
              values are added to the maps as condition_value.
@@ -2015,7 +2019,7 @@ class TemporalAlgebraParser(object):
 
         return(resultlist)
 
-    def build_condition_list(self, tvarexpr, thenlist,  topolist=["EQUAL"]):
+    def build_condition_list(self, tvarexpr, thenlist, topolist=["EQUAL"]):
         """ This function evaluates temporal variable expressions of a conditional
              expression in two steps.
              At first it combines stepwise the single conditions by their relations with LALR.
@@ -2051,7 +2055,7 @@ class TemporalAlgebraParser(object):
         # of conditions.
 
         # Check if the input expression is a valid single global variable.
-        if isinstance(tvarexpr, GlobalTemporalVar) and tvarexpr.get_type() == "global" :
+        if isinstance(tvarexpr, GlobalTemporalVar) and tvarexpr.get_type() == "global":
             # Use method eval_global_var to evaluate expression.
             resultlist = self.eval_global_var(tvarexpr, thenlist)
         # Check if a given list is a list of maps.
@@ -2063,9 +2067,9 @@ class TemporalAlgebraParser(object):
             #self.msgr.fatal("Condition list is not complete. Elements missing")
             for iter in range(len(tvarexpr)):
                 expr = tvarexpr[iter]
-                operator = tvarexpr[iter +1]
-                relexpr = tvarexpr[iter +2]
-                if all([issubclass(type(ele), list) for ele in [expr,  relexpr]]):
+                operator = tvarexpr[iter + 1]
+                relexpr = tvarexpr[iter + 2]
+                if all([issubclass(type(ele), list) for ele in [expr, relexpr]]):
                     resultlist = self.build_spatio_temporal_topology_list(expr, relexpr)
             # Loop through the list, search for map lists or global variables.
             for expr in tvarexpr:
@@ -2208,7 +2212,7 @@ class TemporalAlgebraParser(object):
                             if maps_stds_type != self.stdstype:
                                 self.msgr.warning(_("The resulting space time dataset type <%(a)s> is "
                                                     "different from the requested type <%(b)s>"
-                                                    %({"a":maps_stds_type,  "b":self.stdstype})))
+                                                    % ({"a":maps_stds_type, "b":self.stdstype})))
                         else:
                             map_type_2 = map_i.get_type()
                             if map_type != map_type_2:
@@ -2241,9 +2245,9 @@ class TemporalAlgebraParser(object):
 
                             map_result = map_i.get_new_instance(newident + "@" + self.mapset)
 
-                            if map_result.map_exists() and self.overwrite == False:
+                            if map_result.map_exists() and self.overwrite is False:
                                 self.msgr.fatal("Error raster maps with basename %s exist. "
-                                                "Use --o flag to overwrite existing file"%map_i.get_id())
+                                                "Use --o flag to overwrite existing file" % map_i.get_id())
 
                             map_result.set_temporal_extent(map_i.get_temporal_extent())
                             map_result.set_spatial_extent(map_i.get_spatial_extent())
@@ -2308,7 +2312,7 @@ class TemporalAlgebraParser(object):
                             elif map_i.is_in_db(dbif) and self.overwrite is False:
                                 # Raise error if map exists and no overwrite flag is given.
                                 self.msgr.fatal("Error map %s exist in temporal database. "
-                                                "Use overwrite flag."%map_i.get_map_id())
+                                                "Use overwrite flag." % map_i.get_map_id())
                             else:
                                 # Insert map into temporal database.
                                 if self.dry_run is False:
@@ -2319,7 +2323,7 @@ class TemporalAlgebraParser(object):
                             success = resultstds.register_map(map_i, dbif)
                             if not success:
                                 self.msgr.warning("Unabe to register map layers "
-                                                  "in STDS %s"%(t[1]))
+                                                  "in STDS %s" % (t[1]))
 
                     if self.dry_run is False:
                         resultstds.update_from_registered_maps(dbif)
@@ -2330,7 +2334,7 @@ class TemporalAlgebraParser(object):
 
                 elif num == 0:
                     self.msgr.warning("Empty result space time dataset. "
-                                      "No map has been registered in %s"%(t[1]))
+                                      "No map has been registered in %s" % (t[1]))
                     # Open connection to temporal database.
                     # Create result space time dataset.
                     if self.dry_run is False:
@@ -2376,7 +2380,7 @@ class TemporalAlgebraParser(object):
         else:
             t[0] = t[3]
             if self.debug:
-                print("Opening STRDS: ",  t[0])
+                print("Opening STRDS: ", t[0])
 
     def p_expr_str3ds_function(self, t):
         # Explicitly specify a space time raster dataset
@@ -2389,7 +2393,7 @@ class TemporalAlgebraParser(object):
         else:
             t[0] = t[3]
             if self.debug:
-                print("Opening STR3DS: ",  t[0])
+                print("Opening STR3DS: ", t[0])
 
     def p_expr_stvds_function(self, t):
         # Explicitly specify a space time vector dataset
@@ -2403,7 +2407,7 @@ class TemporalAlgebraParser(object):
         else:
             t[0] = t[3]
             if self.debug:
-                print("Opening STVDS: ",  t[0])
+                print("Opening STVDS: ", t[0])
 
     def p_expr_tmap_function(self, t):
         # Add a single map.
@@ -2426,7 +2430,7 @@ class TemporalAlgebraParser(object):
                 # Create empty map dataset.
                 map_i = dataset_factory(self.maptype, id_input)
                 # Check for occurrence of space time dataset.
-                if map_i.map_exists() == False:
+                if map_i.map_exists() is False:
                     raise FatalError(_("%s map <%s> not found in GRASS spatial database") %
                                       (map_i.get_type(), id_input))
                 else:
@@ -2438,10 +2442,10 @@ class TemporalAlgebraParser(object):
             # Return map object.
             t[0] = [map_i]
         else:
-            t[0] = "tmap(",  t[3] , ")"
+            t[0] = "tmap(", t[3], ")"
 
         if self.debug:
-            print("tmap(", t[3] , ")")
+            print("tmap(", t[3], ")")
 
     def p_expr_tmerge_function(self, t):
         # Merge two maplists of same STDS type into a result map list.
@@ -2482,7 +2486,7 @@ class TemporalAlgebraParser(object):
             # Return map list.
             t[0] = resultlist
         else:
-            t[0] = "merge(",  t[3], ",", t[5], ")"
+            t[0] = "merge(", t[3], ",", t[5], ")"
 
         if self.debug:
             print("merge(", t[3], ",", t[5], ")")
@@ -2652,7 +2656,7 @@ class TemporalAlgebraParser(object):
             t[0] = resultlist
 
         if self.debug:
-                print(t[1], t[3], t[5], t[6])
+            print(t[1], t[3], t[5], t[6])
 
     def p_t_var_expr_time(self, t):
         # Examples:
@@ -2689,7 +2693,7 @@ class TemporalAlgebraParser(object):
             t[0] = resultlist
 
         if self.debug:
-            print(t[1], t[3],  t[5], t[6])
+            print(t[1], t[3], t[5], t[6])
 
     def p_t_var_expr_comp(self, t):
         """
@@ -2725,7 +2729,7 @@ class TemporalAlgebraParser(object):
             tvarexprA  = t[1]
             tvarexprB  = t[3]
             # Evaluate temporal comparison operator.
-            relations, temporal, function, aggregate = self.eval_toperator(t[2],  optype='boolean')
+            relations, temporal, function, aggregate = self.eval_toperator(t[2], optype='boolean')
             # Build conditional values based on topological relationships.
             complist = self.build_spatio_temporal_topology_list(tvarexprA, tvarexprB, topolist=relations,
                                                                 compare_bool=True, compop=function[0], aggregate=aggregate)
@@ -2763,7 +2767,7 @@ class TemporalAlgebraParser(object):
             t[0] = t[1] + "*"
 
         if self.debug:
-            print(str(t[1]),  "* = ", t[1], t[2], t[3])
+            print(str(t[1]), "* = ", t[1], t[2], t[3])
 
     def p_expr_t_not_select(self, t):
         # Temporal equal selection
@@ -2812,7 +2816,7 @@ class TemporalAlgebraParser(object):
             maplistA = self.check_stds(t[1])
             maplistB = self.check_stds(t[3])
             # Evaluate temporal operator.
-            operators  = self.eval_toperator(t[2],  optype='select')
+            operators  = self.eval_toperator(t[2], optype='select')
             # Check for negative selection.
             if operators[2] == "!:":
                 negation = True
@@ -2869,7 +2873,7 @@ class TemporalAlgebraParser(object):
             thenlist     = self.check_stds(t[7])
             # Get temporal conditional statement.
             tvarexpr     = t[5]
-            topolist     = self.eval_toperator(t[3],  optype='relation')[0]
+            topolist     = self.eval_toperator(t[3], optype='relation')[0]
             thencond     = self.build_condition_list(tvarexpr, thenlist, topolist)
             thenresult   = self.eval_condition_list(thencond)
             # Clear the map and conditional values of the map list.
@@ -2880,7 +2884,7 @@ class TemporalAlgebraParser(object):
             t[0] = t[7] + "*"
 
         if self.debug:
-            print("result* = ", "if ", str(t[3]),  "condition", str(t[5]), " then ", str(t[7]))
+            print("result* = ", "if ", str(t[3]), "condition", str(t[5]), " then ", str(t[7]))
 
     def p_expr_condition_elif(self, t):
         # Examples
@@ -2932,7 +2936,7 @@ class TemporalAlgebraParser(object):
             elselist     = self.check_stds(t[9])
             # Get temporal conditional statement.
             tvarexpr     = t[5]
-            topolist     = self.eval_toperator(t[3],  optype='relation')[0]
+            topolist     = self.eval_toperator(t[3], optype='relation')[0]
             thencond     = self.build_condition_list(tvarexpr, thenlist, topolist)
             thenresult   = self.eval_condition_list(thencond)
             elsecond     = self.build_condition_list(tvarexpr, elselist, topolist)
@@ -3034,7 +3038,7 @@ class TemporalAlgebraParser(object):
 
         if self.debug:
             if len(t) == 10:
-                print(str(t[3]) + "* = tshift(", str(t[3]), "," , '"', str(t[6]), str(t[7]), '"', ")")
+                print(str(t[3]) + "* = tshift(", str(t[3]), ",", '"', str(t[6]), str(t[7]), '"', ")")
             elif len(t) == 7:
                 print(str(t[3]) + "* = tshift(", str(t[3]), ",", str(t[5]), ")")
 

+ 5 - 0
lib/python/temporal/temporal_extent.py

@@ -75,6 +75,7 @@ class TemporalExtent(SQLDatabaseInterface):
         end_time='1'
 
     """
+
     def __init__(self, table=None, ident=None, start_time=None, end_time=None):
 
         SQLDatabaseInterface.__init__(self, table, ident)
@@ -1047,6 +1048,7 @@ class AbsoluteTemporalExtent(TemporalExtent):
 
         start_time and end_time must be of type datetime
     """
+
     def __init__(self, table=None, ident=None, start_time=None, end_time=None):
 
         TemporalExtent.__init__(
@@ -1123,6 +1125,7 @@ class STDSAbsoluteTime(AbsoluteTemporalExtent):
             map_time=interval
 
     """
+
     def __init__(self, table=None, ident=None, start_time=None, end_time=None,
                  granularity=None, map_time=None):
         AbsoluteTemporalExtent.__init__(
@@ -1246,6 +1249,7 @@ class RelativeTemporalExtent(TemporalExtent):
             unit=years
 
     """
+
     def __init__(self, table=None, ident=None, start_time=None, end_time=None,
                  unit=None):
 
@@ -1372,6 +1376,7 @@ class STDSRelativeTime(RelativeTemporalExtent):
             map_time=interval
 
     """
+
     def __init__(self, table=None, ident=None, start_time=None, end_time=None,
                  unit=None, granularity=None, map_time=None):
         RelativeTemporalExtent.__init__(

+ 23 - 23
lib/python/temporal/temporal_granularity.py

@@ -686,7 +686,7 @@ def compute_common_absolute_time_granularity(gran_list,
 
     num, granule = common_granule.split()
 
-    if granule in ["seconds",  "second"]:
+    if granule in ["seconds", "second"]:
         # If the start seconds are different between the start dates
         # set the granularity to one second
         for start_time in start_date_list:
@@ -694,12 +694,12 @@ def compute_common_absolute_time_granularity(gran_list,
                 return "1 second"
         # Make sure the granule does not exceed the hierarchy limit
         if int(num) > 60:
-            if int(num)%60 == 0:
+            if int(num) % 60 == 0:
                 return "60 seconds"
             else:
                 return "1 second"
 
-    if granule in ["minutes",  "minute"]:
+    if granule in ["minutes", "minute"]:
         # If the start minutes are different between the start dates
         # set the granularity to one minute
         for start_time in start_date_list:
@@ -707,12 +707,12 @@ def compute_common_absolute_time_granularity(gran_list,
                 return "1 minute"
         # Make sure the granule does not exceed the hierarchy limit
         if int(num) > 60:
-            if int(num)%60 == 0:
+            if int(num) % 60 == 0:
                 return "60 minutes"
             else:
                 return "1 minute"
 
-    if granule in ["hours",  "hour"]:
+    if granule in ["hours", "hour"]:
         # If the start hours are different between the start dates
         # set the granularity to one hour
         for start_time in start_date_list:
@@ -720,12 +720,12 @@ def compute_common_absolute_time_granularity(gran_list,
                 return "1 hour"
         # Make sure the granule does not exceed the hierarchy limit
         if int(num) > 24:
-            if int(num)%24 == 0:
+            if int(num) % 24 == 0:
                 return "24 hours"
             else:
                 return "1 hour"
 
-    if granule in ["days",  "day"]:
+    if granule in ["days", "day"]:
         # If the start days are different between the start dates
         # set the granularity to one day
         for start_time in start_date_list:
@@ -733,12 +733,12 @@ def compute_common_absolute_time_granularity(gran_list,
                 return "1 day"
         # Make sure the granule does not exceed the hierarchy limit
         if int(num) > 365:
-            if int(num)%365 == 0:
+            if int(num) % 365 == 0:
                 return "365 days"
             else:
                 return "1 day"
 
-    if granule in ["months",  "month"]:
+    if granule in ["months", "month"]:
         # If the start months are different between the start dates
         # set the granularity to one month
         for start_time in start_date_list:
@@ -746,7 +746,7 @@ def compute_common_absolute_time_granularity(gran_list,
                 return "1 month"
         # Make sure the granule does not exceed the hierarchy limit
         if int(num) > 12:
-            if int(num)%12 == 0:
+            if int(num) % 12 == 0:
                 return "12 months"
             else:
                 return "1 month"
@@ -855,9 +855,9 @@ def compute_common_absolute_time_granularity_simple(gran_list):
         if not check_granularity_string(entry, "absolute"):
             return False
 
-        num,  gran = entry.split()
+        num, gran = entry.split()
 
-        if gran in ["seconds",  "second"]:
+        if gran in ["seconds", "second"]:
             has_seconds = True
             if min_gran > 0:
                 min_gran = 0
@@ -866,7 +866,7 @@ def compute_common_absolute_time_granularity_simple(gran_list):
 
             seconds.append(int(num))
 
-        if gran in ["minutes",  "minute"]:
+        if gran in ["minutes", "minute"]:
             has_minutes = True
             if min_gran > 1:
                 min_gran = 1
@@ -875,7 +875,7 @@ def compute_common_absolute_time_granularity_simple(gran_list):
 
             minutes.append(int(num))
 
-        if gran in ["hours",  "hour"]:
+        if gran in ["hours", "hour"]:
             has_hours = True
             if min_gran > 2:
                 min_gran = 2
@@ -884,7 +884,7 @@ def compute_common_absolute_time_granularity_simple(gran_list):
 
             hours.append(int(num))
 
-        if gran in ["days",  "day"]:
+        if gran in ["days", "day"]:
             has_days = True
             if min_gran > 3:
                 min_gran = 3
@@ -893,7 +893,7 @@ def compute_common_absolute_time_granularity_simple(gran_list):
 
             days.append(int(num))
 
-        if gran in ["months",  "month"]:
+        if gran in ["months", "month"]:
             has_months = True
             if min_gran > 4:
                 min_gran = 4
@@ -902,7 +902,7 @@ def compute_common_absolute_time_granularity_simple(gran_list):
 
             months.append(int(num))
 
-        if gran in ["years",  "year"]:
+        if gran in ["years", "year"]:
             has_years = True
             if min_gran > 5:
                 min_gran = 5
@@ -936,7 +936,7 @@ def compute_common_absolute_time_granularity_simple(gran_list):
         gran = "second"
         if num > 1:
             gran += "s"
-        return "%i %s"%(num,  gran)
+        return "%i %s" % (num, gran)
 
     elif has_minutes:
         if has_hours:
@@ -959,7 +959,7 @@ def compute_common_absolute_time_granularity_simple(gran_list):
         gran = "minute"
         if num > 1:
             gran += "s"
-        return "%i %s"%(num,  gran)
+        return "%i %s" % (num, gran)
 
     elif has_hours:
         if has_days:
@@ -979,7 +979,7 @@ def compute_common_absolute_time_granularity_simple(gran_list):
         gran = "hour"
         if num > 1:
             gran += "s"
-        return "%i %s"%(num,  gran)
+        return "%i %s" % (num, gran)
 
     elif has_days:
         if has_months:
@@ -996,7 +996,7 @@ def compute_common_absolute_time_granularity_simple(gran_list):
         gran = "day"
         if num > 1:
             gran += "s"
-        return "%i %s"%(num,  gran)
+        return "%i %s" % (num, gran)
 
     elif has_months:
         if has_years:
@@ -1006,14 +1006,14 @@ def compute_common_absolute_time_granularity_simple(gran_list):
         gran = "month"
         if num > 1:
             gran += "s"
-        return "%i %s"%(num,  gran)
+        return "%i %s" % (num, gran)
 
     elif has_years:
         num = gcd_list(years)
         gran = "year"
         if num > 1:
             gran += "s"
-        return "%i %s"%(num,  gran)
+        return "%i %s" % (num, gran)
 
 #######################################################################
 

+ 31 - 31
lib/python/temporal/temporal_operator.py

@@ -153,26 +153,26 @@ class TemporalOperatorLexer(object):
     # Functions that defines topological relations.
     relations = {
         # temporal relations
-        'equal'      : "EQUAL",
-        'follows'    : "FOLLOWS",
-        'precedes'   : "PRECEDES",
-        'overlaps'   : "OVERLAPS",
-        'overlapped' : "OVERLAPPED",
-        'during'     : "DURING",
-        'starts'     : "STARTS",
-        'finishes'   : "FINISHES",
-        'contains'   : "CONTAINS",
-        'started'    : "STARTED",
-        'finished'   : "FINISHED",
-        'over'       : "OVER",
+        'equal': "EQUAL",
+        'follows': "FOLLOWS",
+        'precedes': "PRECEDES",
+        'overlaps': "OVERLAPS",
+        'overlapped': "OVERLAPPED",
+        'during': "DURING",
+        'starts': "STARTS",
+        'finishes': "FINISHES",
+        'contains': "CONTAINS",
+        'started': "STARTED",
+        'finished': "FINISHED",
+        'over': "OVER",
         # spatial relations
-        'equivalent' : "EQUIVALENT",
-        'cover'      : "COVER",
-        'overlap'    : "OVERLAP",
-        'in'         : "IN",
-        'contain'    : "CONTAIN",
-        'meet'       : "MEET"
-        }
+        'equivalent': "EQUIVALENT",
+        'cover': "COVER",
+        'overlap': "OVERLAP",
+        'in': "IN",
+        'contain': "CONTAIN",
+        'meet': "MEET"
+    }
 
     # This is the list of token names.
     tokens = (
@@ -314,14 +314,14 @@ class TemporalOperatorParser(object):
         self.optype = optype
 
         if optype not in self.optype_list:
-            raise SyntaxError("Unknown optype %s, must be one of %s"%(self.optype, str(self.optype_list)))
+            raise SyntaxError("Unknown optype %s, must be one of %s" % (self.optype, str(self.optype_list)))
         self.expression = expression
         self.parser.parse(expression)
 
     # Error rule for syntax errors.
     def p_error(self, t):
         raise SyntaxError("Unexpected syntax error in expression"
-                          " \"%s\" at position %i near %s"%(self.expression,
+                          " \"%s\" at position %i near %s" % (self.expression,
                                                             t.lexpos,
                                                             t.value))
 
@@ -337,7 +337,7 @@ class TemporalOperatorParser(object):
         """
         # Check for correct type.
         if not self.optype == 'relation':
-            raise SyntaxError("Wrong optype \"%s\" must be \"relation\""%self.optype)
+            raise SyntaxError("Wrong optype \"%s\" must be \"relation\"" % self.optype)
         else:
             # Set three operator components.
             if isinstance(t[2], list):
@@ -359,7 +359,7 @@ class TemporalOperatorParser(object):
                  | CLPAREN AND AND COMMA relationlist CRPAREN
         """
         if not self.optype == 'boolean':
-            raise SyntaxError("Wrong optype \"%s\" must be \"boolean\""%self.optype)
+            raise SyntaxError("Wrong optype \"%s\" must be \"boolean\"" % self.optype)
         else:
             # Set three operator components.
             if isinstance(t[5], list):
@@ -386,7 +386,7 @@ class TemporalOperatorParser(object):
                  | CLPAREN AND AND COMMA relationlist COMMA AND CRPAREN
         """
         if not self.optype == 'boolean':
-            raise SyntaxError("Wrong optype \"%s\" must be \"boolean\""%self.optype)
+            raise SyntaxError("Wrong optype \"%s\" must be \"boolean\"" % self.optype)
         else:
             # Set three operator components.
             if isinstance(t[5], list):
@@ -409,7 +409,7 @@ class TemporalOperatorParser(object):
                  | CLPAREN AND AND COMMA relationlist COMMA temporal CRPAREN
         """
         if not self.optype == 'boolean':
-            raise SyntaxError("Wrong optype \"%s\" must be \"boolean\""%self.optype)
+            raise SyntaxError("Wrong optype \"%s\" must be \"boolean\"" % self.optype)
         else:
             # Set three operator components.
             if isinstance(t[5], list):
@@ -436,7 +436,7 @@ class TemporalOperatorParser(object):
                  | CLPAREN AND AND COMMA relationlist COMMA AND COMMA temporal CRPAREN
         """
         if not self.optype == 'boolean':
-            raise SyntaxError("Wrong optype \"%s\" must be \"relation\""%self.optype)
+            raise SyntaxError("Wrong optype \"%s\" must be \"relation\"" % self.optype)
         else:
             # Set three operator components.
             if isinstance(t[5], list):
@@ -462,7 +462,7 @@ class TemporalOperatorParser(object):
                  | CLPAREN select COMMA relationlist COMMA temporal CRPAREN
         """
         if not self.optype == 'select':
-            raise SyntaxError("Wrong optype \"%s\" must be \"select\""%self.optype)
+            raise SyntaxError("Wrong optype \"%s\" must be \"select\"" % self.optype)
         else:
             if len(t) == 4:
                 # Set three operator components.
@@ -498,7 +498,7 @@ class TemporalOperatorParser(object):
                  | CLPAREN HASH COMMA relationlist COMMA temporal CRPAREN
         """
         if not self.optype == 'hash':
-            raise SyntaxError("Wrong optype \"%s\" must be \"hash\""%self.optype)
+            raise SyntaxError("Wrong optype \"%s\" must be \"hash\"" % self.optype)
         else:
             if len(t) == 4:
                 # Set three operator components.
@@ -534,7 +534,7 @@ class TemporalOperatorParser(object):
                  | CLPAREN arithmetic COMMA relationlist COMMA temporal CRPAREN
         """
         if not self.optype == 'raster':
-            raise SyntaxError("Wrong optype \"%s\" must be \"raster\""%self.optype)
+            raise SyntaxError("Wrong optype \"%s\" must be \"raster\"" % self.optype)
         else:
             if len(t) == 4:
                 # Set three operator components.
@@ -570,7 +570,7 @@ class TemporalOperatorParser(object):
                  | CLPAREN overlay COMMA relationlist COMMA temporal CRPAREN
         """
         if not self.optype == 'overlay':
-            raise SyntaxError("Wrong optype \"%s\" must be \"overlay\""%self.optype)
+            raise SyntaxError("Wrong optype \"%s\" must be \"overlay\"" % self.optype)
         else:
             if len(t) == 4:
                 # Set three operator components.
@@ -636,7 +636,7 @@ class TemporalOperatorParser(object):
             rel_list = rel_list + t[3]
         else:
             rel_list.append(t[3])
-        t[0] =  rel_list
+        t[0] = rel_list
 
     def p_temporal_operator(self, t):
         # The list of relations.

+ 5 - 7
lib/python/temporal/temporal_raster3d_algebra.py

@@ -51,7 +51,7 @@ class TemporalRaster3DAlgebraParser(TemporalRasterBaseAlgebraParser):
                 break
 
             if tok.type == "STVDS" or tok.type == "STRDS" or tok.type == "STR3DS":
-                raise SyntaxError("Syntax error near '%s'" %(tok.type))
+                raise SyntaxError("Syntax error near '%s'" % (tok.type))
 
         self.lexer = TemporalRasterAlgebraLexer()
         self.lexer.build()
@@ -120,13 +120,13 @@ class TemporalRaster3DAlgebraParser(TemporalRasterBaseAlgebraParser):
                     map_new.set_temporal_extent(map_i_t_extent)
                     # Create r.mapcalc expression string for the operation.
                     if "cmd_list" in dir(map_new) and len(t) == 5:
-                        cmdstring = "%s" %(map_new.cmd_list)
+                        cmdstring = "%s" % (map_new.cmd_list)
                     elif "cmd_list" not in dir(map_new) and len(t) == 5:
-                        cmdstring = "%s" %(map_n.get_id())
+                        cmdstring = "%s" % (map_n.get_id())
                     elif "cmd_list" in dir(map_new) and len(t) in (9,11):
-                        cmdstring = "%s[%s,%s,%s]" %(map_new.cmd_list, row_neighbor, col_neighbor, depth_neighbor)
+                        cmdstring = "%s[%s,%s,%s]" % (map_new.cmd_list, row_neighbor, col_neighbor, depth_neighbor)
                     elif "cmd_list" not in dir(map_new) and len(t) in (9,11):
-                        cmdstring = "%s[%s,%s,%s]" %(map_n.get_id(), row_neighbor, col_neighbor, depth_neighbor)
+                        cmdstring = "%s[%s,%s,%s]" % (map_n.get_id(), row_neighbor, col_neighbor, depth_neighbor)
                     # Set new command list for map.
                     map_new.cmd_list = cmdstring
                     # Append map with updated command list to result list.
@@ -139,5 +139,3 @@ class TemporalRaster3DAlgebraParser(TemporalRasterBaseAlgebraParser):
 if __name__ == "__main__":
     import doctest
     doctest.testmod()
-
-

+ 5 - 7
lib/python/temporal/temporal_raster_algebra.py

@@ -95,7 +95,7 @@ class TemporalRasterAlgebraParser(TemporalRasterBaseAlgebraParser):
                 break
 
             if tok.type == "STVDS" or tok.type == "STRDS" or tok.type == "STR3DS":
-                raise SyntaxError("Syntax error near '%s'" %(tok.type))
+                raise SyntaxError("Syntax error near '%s'" % (tok.type))
 
         self.lexer = TemporalRasterAlgebraLexer()
         self.lexer.build()
@@ -162,13 +162,13 @@ class TemporalRasterAlgebraParser(TemporalRasterBaseAlgebraParser):
                     map_new.set_temporal_extent(map_i_t_extent)
                     # Create r.mapcalc expression string for the operation.
                     if "cmd_list" in dir(map_new) and len(t) == 5:
-                        cmdstring = "%s" %(map_new.cmd_list)
+                        cmdstring = "%s" % (map_new.cmd_list)
                     elif "cmd_list" not in dir(map_new) and len(t) == 5:
-                        cmdstring = "%s" %(map_n.get_id())
+                        cmdstring = "%s" % (map_n.get_id())
                     elif "cmd_list" in dir(map_new) and len(t) in (7, 9):
-                        cmdstring = "%s[%s,%s]" %(map_new.cmd_list, row_neigbour, col_neigbour)
+                        cmdstring = "%s[%s,%s]" % (map_new.cmd_list, row_neigbour, col_neigbour)
                     elif "cmd_list" not in dir(map_new) and len(t) in (7, 9):
-                        cmdstring = "%s[%s,%s]" %(map_n.get_id(), row_neigbour, col_neigbour)
+                        cmdstring = "%s[%s,%s]" % (map_n.get_id(), row_neigbour, col_neigbour)
                     # Set new command list for map.
                     map_new.cmd_list = cmdstring
                     # Append map with updated command list to result list.
@@ -181,5 +181,3 @@ class TemporalRasterAlgebraParser(TemporalRasterBaseAlgebraParser):
 if __name__ == "__main__":
     import doctest
     doctest.testmod()
-
-

+ 65 - 65
lib/python/temporal/temporal_raster_base_algebra.py

@@ -75,26 +75,26 @@ class TemporalRasterAlgebraLexer(TemporalAlgebraLexer):
 
     # Supported r.mapcalc functions.
     mapcalc_functions = {
-        'exp'     : 'EXP',
-        'log'     : 'LOG',
-        'sqrt'    : 'SQRT',
-        'abs'     : 'ABS',
-        'cos'     : 'COS',
-        'acos'    : 'ACOS',
-        'sin'     : 'SIN',
-        'asin'    : 'ASIN',
-        'tan'     : 'TAN',
-        'double'  : 'DOUBLE',
-        'float'   : 'FLOATEXP',
-        'int'     : 'INTEXP',
-        'isnull'  : 'ISNULL',
+        'exp': 'EXP',
+        'log': 'LOG',
+        'sqrt': 'SQRT',
+        'abs': 'ABS',
+        'cos': 'COS',
+        'acos': 'ACOS',
+        'sin': 'SIN',
+        'asin': 'ASIN',
+        'tan': 'TAN',
+        'double': 'DOUBLE',
+        'float': 'FLOATEXP',
+        'int': 'INTEXP',
+        'isnull': 'ISNULL',
         'isntnull': 'ISNTNULL',
-        'null'    : 'NULL',
-        'exist'   : 'EXIST',
+        'null': 'NULL',
+        'exist': 'EXIST',
     }
 
     # Functions that defines single maps with time stamp and without temporal extent.
-    map_functions = {'map' : 'MAP'}
+    map_functions = {'map': 'MAP'}
 
     # This is the list of token names.
     raster_tokens = (
@@ -154,7 +154,7 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
     # Setting equal precedence level for select and hash operations.
     precedence = (
         ('left', 'T_SELECT_OPERATOR', 'T_SELECT', 'T_NOT_SELECT'), # 1
-        ('left', 'ADD', 'SUB', 'T_ARITH2_OPERATOR',  'T_HASH_OPERATOR',  'HASH'), #2
+        ('left', 'ADD', 'SUB', 'T_ARITH2_OPERATOR', 'T_HASH_OPERATOR', 'HASH'),  # 2
         ('left', 'AND', 'OR', 'T_COMP_OPERATOR', 'MOD', 'DIV', 'MULT',
          'T_ARITH1_OPERATOR'))
 
@@ -257,7 +257,7 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
         # Build spatio-temporal topology
         if len(spatial_topo_list) > 0:
             # Dictionary with different spatial variables used for topology builder.
-            spatialdict = {'strds' : '2D', 'stvds' : '2D', 'str3ds' : '3D'}
+            spatialdict = {'strds': '2D', 'stvds': '2D', 'str3ds': '3D'}
             tb.build(maplistA, maplistB, spatial=spatialdict[self.stdstype])
         else:
             tb.build(maplistA, maplistB)
@@ -271,7 +271,7 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
             elif compare_cmd:
                 self.compare_cmd_value(map_i, compop, aggregate, temporal_topo_list, spatial_topo_list, convert)
             elif operator_cmd:
-                self.operator_cmd_value(map_i,  compop, temporal_topo_list, spatial_topo_list)
+                self.operator_cmd_value(map_i, compop, temporal_topo_list, spatial_topo_list)
 
             temporal_relations = map_i.get_temporal_relations()
             spatial_relations = map_i.get_spatial_relations()
@@ -334,18 +334,18 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
         if cmd_type == 'condition':
             conditionsub = sub_cmdstring(map_i)
             conclusionsub = sub_cmdstring(relmap)
-            cmdstring = "if(%s, %s)" %(conditionsub, conclusionsub)
+            cmdstring = "if(%s, %s)" % (conditionsub, conclusionsub)
         elif cmd_type == 'conclusion':
             thensub = sub_cmdstring(map_i)
             elsesub = sub_cmdstring(relmap)
-            cmdstring = "%s, %s" %(thensub, elsesub)
+            cmdstring = "%s, %s" % (thensub, elsesub)
         elif cmd_type == 'operator':
             leftsub = sub_cmdstring(map_i)
             rightsub = sub_cmdstring(relmap)
-            if operator == None:
+            if operator is None:
                 self.msgr.fatal("Error: Can't build command string for map %s, operator is missing"
-                    %(map_i.get_map_id()))
-            cmdstring = "(%s %s %s)" %(leftsub, operator, rightsub)
+                    % (map_i.get_map_id()))
+            cmdstring = "(%s %s %s)" % (leftsub, operator, rightsub)
         return(cmdstring)
 
     def compare_cmd_value(self, map_i, compop, aggregate,
@@ -416,7 +416,7 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
 
             return(cmd_value_str)
 
-    def operator_cmd_value(self,  map_i, operator,
+    def operator_cmd_value(self, map_i, operator,
                           temporal_topo_list = ["EQUAL"],
                           spatial_topo_list = []):
         """ Function to evaluate two map lists by given arithmetic operator.
@@ -456,8 +456,8 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
         print("map command string", cmdstring)
         return(cmdstring)
 
-    def set_temporal_extent_list(self, maplist, topolist=["EQUAL"], temporal='l' ,
-                                 cmd_bool=False, cmd_type=None,  operator=None):
+    def set_temporal_extent_list(self, maplist, topolist=["EQUAL"], temporal='l',
+                                 cmd_bool=False, cmd_type=None, operator=None):
         """ Change temporal extent of map list based on temporal relations to
         other map list and given temporal operator.
 
@@ -530,7 +530,7 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
 
         return(resultlist)
 
-    def build_condition_cmd_list(self, iflist, thenlist,  elselist=None,
+    def build_condition_cmd_list(self, iflist, thenlist, elselist=None,
                                  condition_topolist=["EQUAL"],
                                  conclusion_topolist=["EQUAL"],
                                  temporal='l', null=False):
@@ -560,7 +560,7 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
                                                                           conclusion_topolist)
             conclusionlist = self.set_temporal_extent_list(conclusiontopolist,
                                                            topolist=conclusion_topolist,
-                                                           temporal=temporal ,
+                                                           temporal=temporal,
                                                            cmd_bool=True,
                                                            cmd_type="conclusion")
         # Check if any conclusion is a numeric statements.
@@ -582,7 +582,7 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
             # Check if only direct conclusion is a numeric statements.
             elif all([isinstance(thenlist, str), isinstance(elselist, list)]):
                 listinput = elselist
-                numinput =  thenlist
+                numinput = thenlist
                 for map_i in listinput:
                     # Create r.mapcalc expression string for the operation.
                     cmdstring = self.build_command_string(numinput,
@@ -599,7 +599,7 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
             conclusionlist = thenlist
         # Use the conclusion map or string to merge it with the condition and
         # return maplist.
-        if isinstance(conclusionlist,  str):
+        if isinstance(conclusionlist, str):
             resultlist = []
             for map_i in iflist:
                 # Create r.mapcalc expression string for the operation.
@@ -611,7 +611,7 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
                 # Append map to result map list.
                 resultlist.append(map_i)
             return(resultlist)
-        elif isinstance(conclusionlist,  list):
+        elif isinstance(conclusionlist, list):
             # Build result command map list between conditions and conclusions.
             print("build_condition_cmd_list", condition_topolist)
             conditiontopolist = self.build_spatio_temporal_topology_list(iflist,
@@ -676,7 +676,7 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
                         new_map = Raster3DDataset(newident)
                     if new_map.map_exists() and self.overwrite is False:
                         self.msgr.fatal("Error maps with basename %s exist. "
-                                        "Use --o flag to overwrite existing file"%newident)
+                                        "Use --o flag to overwrite existing file" % newident)
 
                 # The second loop creates the resulting raster maps
                 count = 0
@@ -738,7 +738,7 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
                             process_queue.put(m)
 
                     else:
-                        self.msgr.error(_("Error computing map <%s>"%map_i.get_id()))
+                        self.msgr.error(_("Error computing map <%s>" % map_i.get_id()))
                     count += 1
 
                 if self.dry_run is False:
@@ -782,7 +782,7 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
                     elif map_i.is_in_db(dbif) and self.overwrite is False:
                         # Raise error if map exists and no overwrite flag is given.
                         self.msgr.fatal("Error raster map %s exist in temporal database. "
-                                        "Use overwrite flag."%map_i.get_map_id())
+                                        "Use overwrite flag." % map_i.get_map_id())
                     else:
                         # Insert map into temporal database.
                         if self.dry_run is False:
@@ -824,14 +824,14 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
                 # Create empty map dataset.
                 map_i = dataset_factory(self.maptype, id_input)
                 # Check for occurrence of space time dataset.
-                if map_i.map_exists() == False:
+                if map_i.map_exists() is False:
                     raise FatalError(_("%s map <%s> not found in GRASS spatial database") %
                         (map_i.get_type(), id_input))
                 else:
                     # Select dataset entry from database.
                     map_i.select(dbif=self.dbif)
                     # Create command list for map object.
-                    cmdstring = "(%s)" %(map_i.get_map_id())
+                    cmdstring = "(%s)" % (map_i.get_map_id())
                     map_i.cmd_list = cmdstring
             # Return map object.
             t[0] = cmdstring
@@ -952,9 +952,9 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
                 mapinput = map_i.get_id()
                 # Create r.mapcalc expression string for the operation.
                 if "cmd_list" in dir(map_i):
-                    cmdstring = "(%s %s %s)" %(map_i.cmd_list, t[2], t[3])
+                    cmdstring = "(%s %s %s)" % (map_i.cmd_list, t[2], t[3])
                 else:
-                    cmdstring = "(%s %s %s)" %(mapinput, t[2], t[3])
+                    cmdstring = "(%s %s %s)" % (mapinput, t[2], t[3])
                 # Conditional append of module command.
                 map_i.cmd_list = cmdstring
                 # Append map to result map list.
@@ -1003,9 +1003,9 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
                 mapinput = map_i.get_id()
                 # Create r.mapcalc expression string for the operation.
                 if "cmd_list" in dir(map_i):
-                    cmdstring = "(%s %s %s)" %(t[1], t[2], map_i.cmd_list)
+                    cmdstring = "(%s %s %s)" % (t[1], t[2], map_i.cmd_list)
                 else:
-                    cmdstring = "(%s %s %s)" %(t[1], t[2], mapinput)
+                    cmdstring = "(%s %s %s)" % (t[1], t[2], mapinput)
                 # Conditional append of module command.
                 map_i.cmd_list = cmdstring
                 # Append map to result map list.
@@ -1117,9 +1117,9 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
                 mapinput = map_i.get_id()
                 # Create r.mapcalc expression string for the operation.
                 if "cmd_list" in dir(map_i):
-                    cmdstring = "(%s %s %s)" %(map_i.cmd_list, t[2], t[3])
+                    cmdstring = "(%s %s %s)" % (map_i.cmd_list, t[2], t[3])
                 else:
-                    cmdstring = "(%s %s %s)" %(mapinput, t[2], t[3])
+                    cmdstring = "(%s %s %s)" % (mapinput, t[2], t[3])
                 # Conditional append of module command.
                 map_i.cmd_list = cmdstring
                 # Append map to result map list.
@@ -1159,9 +1159,9 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
                 mapinput = map_i.get_id()
                 # Create r.mapcalc expression string for the operation.
                 if "cmd_list" in dir(map_i):
-                    cmdstring = "(%s %s %s)" %(t[1], t[2], map_i.cmd_list)
+                    cmdstring = "(%s %s %s)" % (t[1], t[2], map_i.cmd_list)
                 else:
-                    cmdstring = "(%s %s %s)" %(t[1], t[2], mapinput)
+                    cmdstring = "(%s %s %s)" % (t[1], t[2], mapinput)
                 # Conditional append of module command.
                 map_i.cmd_list = cmdstring
                 # Append map to result map list.
@@ -1256,7 +1256,7 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
                   | number MULT number
                   | number MOD number
         """
-        numstring = "(%s %s %s)" %(t[1], t[2], t[3])
+        numstring = "(%s %s %s)" % (t[1], t[2], t[3])
 
         t[0] = numstring
 
@@ -1300,9 +1300,9 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
             for map_i in maplist:
                 # Create r.mapcalc expression string for the operation.
                 if "cmd_list" in dir(map_i):
-                    cmdstring = "%s(%s)" %(t[1].lower(), map_i.cmd_list)
+                    cmdstring = "%s(%s)" % (t[1].lower(), map_i.cmd_list)
                 else:
-                    cmdstring = "%s(%s)" %(t[1].lower(), map_i.get_id())
+                    cmdstring = "%s(%s)" % (t[1].lower(), map_i.get_id())
                 # Set new command list for map.
                 map_i.cmd_list = cmdstring
                 # Append map with updated command list to result list.
@@ -1323,7 +1323,7 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
         mapstring = t[3]
 
         if self.run:
-            cmdstring = "%s(%s)" %(t[1].lower(), mapstring)
+            cmdstring = "%s(%s)" % (t[1].lower(), mapstring)
 
             t[0] = cmdstring
 
@@ -1344,9 +1344,9 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
             for map_i in maplist:
                 # Create r.mapcalc expression string for the operation.
                 if "cmd_list" in dir(map_i):
-                    cmdstring = "%s(%s)" %(t[1].lower(), map_i.cmd_list)
+                    cmdstring = "%s(%s)" % (t[1].lower(), map_i.cmd_list)
                 else:
-                    cmdstring = "%s(%s)" %(t[1].lower(), map_i.get_id())
+                    cmdstring = "%s(%s)" % (t[1].lower(), map_i.get_id())
                 # Set new command list for map.
                 map_i.cmd_list = cmdstring
                 # Append map with updated command list to result list.
@@ -1372,9 +1372,9 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
             for map_i in maplist:
                 # Create r.mapcalc expression string for the operation.
                 if "cmd_list" in dir(map_i):
-                    cmdstring = "!isnull(%s)" %(map_i.cmd_list)
+                    cmdstring = "!isnull(%s)" % (map_i.cmd_list)
                 else:
-                    cmdstring = "!isnull(%s)" %(map_i.get_id())
+                    cmdstring = "!isnull(%s)" % (map_i.get_id())
                 # Set new command list for map.
                 map_i.cmd_list = cmdstring
                 # Append map with updated command list to result list.
@@ -1400,9 +1400,9 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
             for map_i in maplist:
                 # Create r.mapcalc expression string for the operation.
                 if "cmd_list" in dir(map_i):
-                    cmdstring = "%s %s %s" %(map_i.cmd_list, t[2], t[3])
+                    cmdstring = "%s %s %s" % (map_i.cmd_list, t[2], t[3])
                 else:
-                    cmdstring = "%s %s %s" %(map_i.get_id(), t[2], t[3])
+                    cmdstring = "%s %s %s" % (map_i.get_id(), t[2], t[3])
                 # Set new command list for map.
                 map_i.cmd_list = cmdstring
                 # Append map with updated command list to result list.
@@ -1428,9 +1428,9 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
             for map_i in maplist:
                 # Create r.mapcalc expression string for the operation.
                 if "cmd_list" in dir(map_i):
-                    cmdstring = "%s" %(map_i.cmd_list)
+                    cmdstring = "%s" % (map_i.cmd_list)
                 else:
-                    cmdstring = "%s" %(map_i.get_id())
+                    cmdstring = "%s" % (map_i.get_id())
                 # Set new command list for map.
                 map_i.cmd_list = cmdstring
                 # Append map with updated command list to result list.
@@ -1569,7 +1569,7 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
              | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA stds RPAREN
              | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA expr RPAREN
         """
-        relations, temporal, function,  aggregation = self.eval_toperator(t[3],
+        relations, temporal, function, aggregation = self.eval_toperator(t[3],
                                                                           optype='relation')
         ifmaplist = self.check_stds(t[5])
         thenmaplist = self.check_stds(t[7])
@@ -1646,7 +1646,7 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
             numelse = t[9] + t[10] + t[11]
         numthen = str(numthen)
         numelse = str(numelse)
-        print(numthen + " " +numelse )
+        print(numthen + " " + numelse )
         # Create conditional command map list.
         resultlist = self.build_condition_cmd_list(ifmaplist,
                                                    numthen,
@@ -1686,10 +1686,10 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
         ifmaplist = self.check_stds(t[3])
         # Select input for r.mapcalc expression based on length of PLY object.
         if len(t) == 9:
-            if isinstance(t[5],  int):
+            if isinstance(t[5], int):
                 theninput = str(t[5])
                 elseinput = self.check_stds(t[7])
-            elif isinstance(t[7],  int):
+            elif isinstance(t[7], int):
                 theninput = self.check_stds(t[5])
                 elseinput = str(t[7])
         elif len(t) == 11:
@@ -1736,14 +1736,14 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
              | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA expr   COMMA  number RPAREN
              | IF LPAREN T_REL_OPERATOR COMMA ts_var_expr COMMA expr   COMMA  NULL   LPAREN RPAREN RPAREN
         """
-        relations, temporal, function,  aggregation = self.eval_toperator(t[3], optype='relation')
+        relations, temporal, function, aggregation = self.eval_toperator(t[3], optype='relation')
         ifmaplist = self.check_stds(t[5])
         # Select input for r.mapcalc expression based on length of PLY object.
         if len(t) == 11:
-            if isinstance(t[7],  int):
+            if isinstance(t[7], int):
                 theninput = str(t[7])
                 elseinput = self.check_stds(t[9])
-            elif isinstance(t[9],  int):
+            elif isinstance(t[9], int):
                 theninput = self.check_stds(t[7])
                 elseinput = str(t[9])
         elif len(t) == 13:
@@ -1864,7 +1864,7 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
                         n_maps = obj.td
                 mapinput = map_i.get_id()
                 # Create r.mapcalc expression string for the operation.
-                cmdstring = "(%s)" %(n_maps)
+                cmdstring = "(%s)" % (n_maps)
                 # Append module command.
                 map_i.cmd_list = cmdstring
                 # Append map to result map list.

+ 38 - 38
lib/python/temporal/temporal_vector_algebra.py

@@ -70,10 +70,10 @@ class TemporalVectorAlgebraLexer(TemporalAlgebraLexer):
 
     # Buffer functions from v.buffer
     vector_buff_functions = {
-       'buff_p'  : 'BUFF_POINT',
-       'buff_l'   : 'BUFF_LINE',
-       'buff_a'   : 'BUFF_AREA',
-       }
+       'buff_p': 'BUFF_POINT',
+       'buff_l': 'BUFF_LINE',
+       'buff_a': 'BUFF_AREA',
+    }
 
     # This is the list of token names.
     vector_tokens = (
@@ -120,10 +120,10 @@ class TemporalVectorAlgebraParser(TemporalAlgebraParser):
 
     # Setting equal precedence level for select and hash operations.
     precedence = (
-        ('left', 'T_SELECT_OPERATOR', 'T_SELECT', 'T_NOT_SELECT',  'T_HASH_OPERATOR',  'HASH'), # 1
+        ('left', 'T_SELECT_OPERATOR', 'T_SELECT', 'T_NOT_SELECT', 'T_HASH_OPERATOR', 'HASH'), # 1
         ('left', 'AND', 'OR', 'T_COMP_OPERATOR', 'T_OVERLAY_OPERATOR', 'DISOR', \
-          'NOT', 'XOR'), #2
-        )
+          'NOT', 'XOR'),  # 2
+    )
 
     def __init__(self, pid=None, run=False, debug=True, spatial = False):
         TemporalAlgebraParser.__init__(self, pid, run, debug, spatial)
@@ -146,7 +146,7 @@ class TemporalVectorAlgebraParser(TemporalAlgebraParser):
                 break
 
             if tok.type == "STVDS" or tok.type == "STRDS" or tok.type == "STR3DS":
-                raise SyntaxError("Syntax error near '%s'" %(tok.type))
+                raise SyntaxError("Syntax error near '%s'" % (tok.type))
 
         self.lexer = TemporalVectorAlgebraLexer()
         self.lexer.build()
@@ -193,15 +193,15 @@ class TemporalVectorAlgebraParser(TemporalAlgebraParser):
           :return: List of maps from maplistA that fulfil the topological relationships
                   to maplistB specified in topolist.
         """
-        topologylist = ["EQUAL", "FOLLOWS", "PRECEDES", "OVERLAPS", "OVERLAPPED", \
-                        "DURING", "STARTS", "FINISHES", "CONTAINS", "STARTED", \
+        topologylist = ["EQUAL", "FOLLOWS", "PRECEDES", "OVERLAPS", "OVERLAPPED",
+                        "DURING", "STARTS", "FINISHES", "CONTAINS", "STARTED",
                         "FINISHED"]
-        complementdict = {"EQUAL": "EQUAL", "FOLLOWS" : "PRECEDES",
-                          "PRECEDES" : "FOLLOWS", "OVERLAPS" : "OVERLAPPED",
-                          "OVERLAPPED" : "OVERLAPS", "DURING" : "CONTAINS",
-                          "CONTAINS" : "DURING", "STARTS" : "STARTED",
-                          "STARTED" : "STARTS", "FINISHES" : "FINISHED",
-                          "FINISHED" : "FINISHES"}
+        complementdict = {"EQUAL": "EQUAL", "FOLLOWS": "PRECEDES",
+                          "PRECEDES": "FOLLOWS", "OVERLAPS": "OVERLAPPED",
+                          "OVERLAPPED": "OVERLAPS", "DURING": "CONTAINS",
+                          "CONTAINS": "DURING", "STARTS": "STARTED",
+                          "STARTED": "STARTS", "FINISHES": "FINISHED",
+                          "FINISHED": "FINISHES"}
         resultdict = {}
         # Check if given temporal relation are valid.
         for topo in topolist:
@@ -211,7 +211,7 @@ class TemporalVectorAlgebraParser(TemporalAlgebraParser):
         # Create temporal topology for maplistA to maplistB.
         tb = SpatioTemporalTopologyBuilder()
         # Dictionary with different spatial variables used for topology builder.
-        spatialdict = {'strds' : '2D', 'stvds' : '2D', 'str3ds' : '3D'}
+        spatialdict = {'strds': '2D', 'stvds': '2D', 'str3ds': '3D'}
         # Build spatial temporal topology
         if self.spatial:
             tb.build(maplistA, maplistB, spatial = spatialdict[self.stdstype])
@@ -223,13 +223,13 @@ class TemporalVectorAlgebraParser(TemporalAlgebraParser):
             tbrelations = map_i.get_temporal_relations()
             # Check for boolean parameters for further calculations.
             if assign_val:
-                self.assign_bool_value(map_i,  tbrelations,  topolist)
+                self.assign_bool_value(map_i, tbrelations, topolist)
             elif compare_bool:
-                self.compare_bool_value(map_i,  tbrelations, compop, aggregate, topolist)
+                self.compare_bool_value(map_i, tbrelations, compop, aggregate, topolist)
             elif compare_cmd:
-                self.compare_cmd_value(map_i,  tbrelations, compop, aggregate, topolist, convert)
+                self.compare_cmd_value(map_i, tbrelations, compop, aggregate, topolist, convert)
             elif overlay_cmd:
-                self.overlay_cmd_value(map_i,  tbrelations, compop, topolist)
+                self.overlay_cmd_value(map_i, tbrelations, compop, topolist)
 
             for topo in topolist:
                 if topo.upper() in tbrelations.keys():
@@ -250,7 +250,7 @@ class TemporalVectorAlgebraParser(TemporalAlgebraParser):
 
         return(resultlist)
 
-    def overlay_cmd_value(self,  map_i, tbrelations, function, topolist = ["EQUAL"]):
+    def overlay_cmd_value(self, map_i, tbrelations, function, topolist = ["EQUAL"]):
         """ Function to evaluate two map lists by given overlay operator.
 
           :param map_i: Map object with temporal extent.
@@ -264,7 +264,7 @@ class TemporalVectorAlgebraParser(TemporalAlgebraParser):
         # Build comandlist list with elements from related maps and given relation operator.
         resultlist = []
         # Define overlay operation dictionary.
-        overlaydict = {"&":"and",  "|":"or",  "^":"xor",  "~":"not", "+":"disor"}
+        overlaydict = {"&":"and", "|":"or", "^":"xor", "~":"not", "+":"disor"}
         operator = overlaydict[function]
         # Set first input for overlay module.
         mapainput = map_i.get_id()
@@ -281,7 +281,7 @@ class TemporalVectorAlgebraParser(TemporalAlgebraParser):
                     # Generate an intermediate name
                     name = self.generate_map_name()
                     # Put it into the removalbe map list
-                    self.removable_maps[name] = VectorDataset(name + "@%s"%(self.mapset))
+                    self.removable_maps[name] = VectorDataset(name + "@%s" % (self.mapset))
                     map_i.set_id(name + "@" + self.mapset)
                     # Set second input for overlay module.
                     mapbinput = relationmap.get_id()
@@ -330,7 +330,7 @@ class TemporalVectorAlgebraParser(TemporalAlgebraParser):
             tbrelations = map_i.get_temporal_relations()
             # Generate an intermediate map for the result map list.
             map_new = self.generate_new_map(base_map=map_i, bool_op = 'and',
-                                                                        copy = True,  rename = False,
+                                                                        copy = True, rename = False,
                                                                         remove = True)
             # Combine temporal and spatial extents of intermediate map with related maps.
             for topo in topolist:
@@ -339,10 +339,10 @@ class TemporalVectorAlgebraParser(TemporalAlgebraParser):
                         if temporal == 'r':
                             # Generate an intermediate map for the result map list.
                             map_new = self.generate_new_map(base_map=map_i, bool_op = 'and',
-                                                                                        copy = True,  rename = False,
+                                                                                        copy = True, rename = False,
                                                                                         remove = True)
                         # Create overlaid map extent.
-                        returncode = self.overlay_map_extent(map_new, map_j, 'and', \
+                        returncode = self.overlay_map_extent(map_new, map_j, 'and',
                                                                 temp_op = temporal)
                         # Stop the loop if no temporal or spatial relationship exist.
                         if returncode == 0:
@@ -384,10 +384,10 @@ class TemporalVectorAlgebraParser(TemporalAlgebraParser):
                     # Check if resultmap names exist in GRASS database.
                     vectorname = self.basename + "_" + str(i).zfill(leadzero)
                     vectormap = VectorDataset(vectorname + "@" + get_current_mapset())
-                    if vectormap.map_exists() and self.overwrite == False:
+                    if vectormap.map_exists() and self.overwrite is False:
                         self.msgr.fatal(_("Error vector maps with basename %s exist. "
-                                          "Use --o flag to overwrite existing file") \
-                                          %(vectorname))
+                                          "Use --o flag to overwrite existing file")
+                                          % (vectorname))
                 for map_i in t[3]:
                     if "cmd_list" in dir(map_i):
                         # Execute command list.
@@ -419,7 +419,7 @@ class TemporalVectorAlgebraParser(TemporalAlgebraParser):
 
                             if cmd.popen.returncode != 0:
                                 self.msgr.fatal(_("Error starting %s : \n%s")
-                                                  %(cmd.get_bash(),
+                                                  % (cmd.get_bash(),
                                                   cmd.popen.stderr))
                             mapname = cmd.outputs['output'].value
                             if mapname.find("@") >= 0:
@@ -458,7 +458,7 @@ class TemporalVectorAlgebraParser(TemporalAlgebraParser):
                             if map_test.map_exists() and self.overwrite is False:
                                 self.msgr.fatal("Error raster maps with basename %s exist. "
                                                 "Use --o flag to overwrite existing file"
-                                                %(mapname))
+                                                % (mapname))
 
                             map_result.set_temporal_extent(map_i.get_temporal_extent())
                             map_result.set_spatial_extent(map_i.get_spatial_extent())
@@ -469,7 +469,7 @@ class TemporalVectorAlgebraParser(TemporalAlgebraParser):
 
                             # Copy the map
                             m = copy.deepcopy(self.m_copy)
-                            m.inputs["vector"].value = map_i.get_id(),  newident
+                            m.inputs["vector"].value = map_i.get_id(), newident
                             m.flags["overwrite"].value = self.overwrite
                             m.run()
                         else:
@@ -489,11 +489,11 @@ class TemporalVectorAlgebraParser(TemporalAlgebraParser):
                             if map_i.is_in_db(dbif=dbif) and self.overwrite:
                                 # Update map in temporal database.
                                 map_i.update_all(dbif=dbif)
-                            elif map_i.is_in_db(dbif=dbif) and self.overwrite == False:
+                            elif map_i.is_in_db(dbif=dbif) and self.overwrite is False:
                                 # Raise error if map exists and no overwrite flag is given.
                                 self.msgr.fatal(_("Error vector map %s exist in temporal database. "
-                                                  "Use overwrite flag.  : \n%s") \
-                                                  %(map_i.get_map_id(), cmd.popen.stderr))
+                                                  "Use overwrite flag.  : \n%s")
+                                                  % (map_i.get_map_id(), cmd.popen.stderr))
                             else:
                                 # Insert map into temporal database.
                                 map_i.insert(dbif=dbif)
@@ -563,7 +563,7 @@ class TemporalVectorAlgebraParser(TemporalAlgebraParser):
             # Check input stds and operator.
             maplistA = self.check_stds(t[1])
             maplistB = self.check_stds(t[3])
-            relations, temporal, function,  aggregate = self.eval_toperator(t[2],  optype = 'overlay')
+            relations, temporal, function, aggregate = self.eval_toperator(t[2], optype = 'overlay')
             # Build command list for related maps.
             complist = self.build_spatio_temporal_topology_list(maplistA, maplistB, topolist = relations,
                                                                 compop = function, overlay_cmd = True)
@@ -590,7 +590,7 @@ class TemporalVectorAlgebraParser(TemporalAlgebraParser):
             for map_i in bufflist:
                 # Generate an intermediate name for the result map list.
                 map_new = self.generate_new_map(base_map=map_i, bool_op=None,
-                                                copy=True,  remove = True)
+                                                copy=True, remove = True)
                 # Change spatial extent based on buffer size.
                 map_new.spatial_buffer(float(t[5]))
                 # Check buff type.

+ 55 - 55
lib/python/temporal/testsuite/unittests_temporal_algebra.py

@@ -55,7 +55,7 @@ class TestTemporalAlgebra(TestCase):
                                                  start="2001-01-02", increment="2 day", interval=True)
         tgis.register_maps_in_space_time_dataset(type="raster", name="D", maps="d1,d2,d3",
                                                  start="2001-01-03", increment="1 day", interval=True)
-        tgis.register_maps_in_space_time_dataset(type="raster", name=None,  maps="singletmap",
+        tgis.register_maps_in_space_time_dataset(type="raster", name=None, maps="singletmap",
                                                  start="2001-01-03", end="2001-01-04")
 
     def tearDown(self):
@@ -71,7 +71,7 @@ class TestTemporalAlgebra(TestCase):
     def test_temporal_select1(self):
         """Testing the temporal select operator with equal relations. """
         ta = tgis.TemporalAlgebraParser(run=True, debug=True)
-        ta.parse(expression="R = A : A",  stdstype = 'strds', basename="r", overwrite=True)
+        ta.parse(expression="R = A : A", stdstype = 'strds', basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         self.assertTrue(D.is_in_db())
@@ -82,13 +82,13 @@ class TestTemporalAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_select2(self):
         """Testing the temporal select operator with equal relations. """
         ta = tgis.TemporalAlgebraParser(run=True, debug=True)
-        ta.parse(expression="R = A : D",  stdstype = 'strds', basename="r", overwrite=True)
+        ta.parse(expression="R = A : D", stdstype = 'strds', basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         self.assertTrue(D.is_in_db())
@@ -99,13 +99,13 @@ class TestTemporalAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 3))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_select3(self):
         """Testing the temporal select operator with equal relations. """
         ta = tgis.TemporalAlgebraParser(run=True, debug=True)
-        ta.parse(expression="R = A !: D",  stdstype = 'strds', basename="r", overwrite=True)
+        ta.parse(expression="R = A !: D", stdstype = 'strds', basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         self.assertTrue(D.is_in_db())
@@ -116,13 +116,13 @@ class TestTemporalAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 3))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_select_operators1(self):
         """Testing the temporal select operator. Including temporal relations. """
         ta = tgis.TemporalAlgebraParser(run=True, debug=True)
-        ta.parse(expression="R = A {:,during} C",  stdstype = 'strds', basename="r", overwrite=True)
+        ta.parse(expression="R = A {:,during} C", stdstype = 'strds', basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         self.assertTrue(D.is_in_db())
@@ -133,13 +133,13 @@ class TestTemporalAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 2))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_select_operators2(self):
         """Testing the temporal select operator. Including temporal relations. """
         ta = tgis.TemporalAlgebraParser(run=True, debug=True)
-        ta.parse(expression="R = A {:,equal|during} C",  stdstype = 'strds', basename="r", overwrite=True)
+        ta.parse(expression="R = A {:,equal|during} C", stdstype = 'strds', basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         self.assertTrue(D.is_in_db())
@@ -150,14 +150,14 @@ class TestTemporalAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 2))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_select_operators3(self):
         """Testing the temporal select operator. Including temporal relations
             and negation operation. """
         ta = tgis.TemporalAlgebraParser(run=True, debug=True)
-        ta.parse(expression="R = A {!:,during} C",  stdstype = 'strds', basename="r", overwrite=True)
+        ta.parse(expression="R = A {!:,during} C", stdstype = 'strds', basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         self.assertTrue(D.is_in_db())
@@ -168,14 +168,14 @@ class TestTemporalAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_select_operators4(self):
         """Testing the temporal select operator. Including temporal relations and
             temporal operators. """
         ta = tgis.TemporalAlgebraParser(run=True, debug=True)
-        ta.parse(expression="R = A {:,during,d} C",  stdstype = 'strds', basename="r", overwrite=True)
+        ta.parse(expression="R = A {:,during,d} C", stdstype = 'strds', basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         self.assertTrue(D.is_in_db())
@@ -191,14 +191,14 @@ class TestTemporalAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 2))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual( D.check_temporal_topology(),  False)
-        self.assertEqual(D.get_granularity(),  u'2 days')
+        self.assertEqual(D.check_temporal_topology(), False)
+        self.assertEqual(D.get_granularity(), u'2 days')
 
     def test_temporal_select_operators5(self):
         """Testing the temporal select operator. Including temporal relations and
             temporal operators. """
         ta = tgis.TemporalAlgebraParser(run=True, debug=True)
-        ta.parse(expression="R = C {:,contains} A",  stdstype = 'strds', basename="r", overwrite=True)
+        ta.parse(expression="R = C {:,contains} A", stdstype = 'strds', basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         self.assertTrue(D.is_in_db())
@@ -214,13 +214,13 @@ class TestTemporalAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 2))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'2 days')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'2 days')
 
     def test_temporal_extent1(self):
         """Testing the temporal extent operators. """
         ta = tgis.TemporalAlgebraParser(run=True, debug=True)
-        ta.parse(expression="R = A {:,during,r} C",  stdstype = 'strds', basename="r", overwrite=True)
+        ta.parse(expression="R = A {:,during,r} C", stdstype = 'strds', basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         self.assertTrue(D.is_in_db())
@@ -232,13 +232,13 @@ class TestTemporalAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 2))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual( D.check_temporal_topology(),  False)
-        self.assertEqual(D.get_granularity(),  u'2 days')
+        self.assertEqual(D.check_temporal_topology(), False)
+        self.assertEqual(D.get_granularity(), u'2 days')
 
     def test_temporal_extent2(self):
         """Testing the temporal extent operators. """
         ta = tgis.TemporalAlgebraParser(run=True, debug=True)
-        ta.parse(expression="R = A {:,during,d} C",  stdstype = 'strds', basename="r", overwrite=True)
+        ta.parse(expression="R = A {:,during,d} C", stdstype = 'strds', basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         self.assertTrue(D.is_in_db())
@@ -250,13 +250,13 @@ class TestTemporalAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 2))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual( D.check_temporal_topology(),  False)
-        self.assertEqual(D.get_granularity(),  u'2 days')
+        self.assertEqual(D.check_temporal_topology(), False)
+        self.assertEqual(D.get_granularity(), u'2 days')
 
     def test_temporal_extent3(self):
         """Testing the temporal extent operators. """
         ta = tgis.TemporalAlgebraParser(run=True, debug=True)
-        ta.parse(expression="R = A {:,during,u} C",  stdstype = 'strds', basename="r", overwrite=True)
+        ta.parse(expression="R = A {:,during,u} C", stdstype = 'strds', basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         self.assertTrue(D.is_in_db())
@@ -272,13 +272,13 @@ class TestTemporalAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 2))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual( D.check_temporal_topology(),  False)
-        self.assertEqual(D.get_granularity(),  u'2 days')
+        self.assertEqual(D.check_temporal_topology(), False)
+        self.assertEqual(D.get_granularity(), u'2 days')
 
     def test_temporal_hash1(self):
         """Testing the hash function in conditional statement. """
         ta = tgis.TemporalAlgebraParser(run=True, debug=True)
-        ta.parse(expression="R = if(A # D == 1, A)",  stdstype = 'strds', basename="r", overwrite=True)
+        ta.parse(expression="R = if(A # D == 1, A)", stdstype = 'strds', basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         self.assertTrue(D.is_in_db())
@@ -290,13 +290,13 @@ class TestTemporalAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 3))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_hash_operator1(self):
         """Testing the hash operator function in conditional statement. """
         ta = tgis.TemporalAlgebraParser(run=True, debug=True)
-        ta.parse(expression="R = if(A {#,during} C == 1, A)",  stdstype = 'strds',
+        ta.parse(expression="R = if(A {#,during} C == 1, A)", stdstype = 'strds',
                                        basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
@@ -309,8 +309,8 @@ class TestTemporalAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 2))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_hash_operator2(self):
         """Testing the hash operator function in conditional statement. """
@@ -328,13 +328,13 @@ class TestTemporalAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 2))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_tmap_function1(self):
         """Testing the tmap function. """
         ta = tgis.TemporalAlgebraParser(run=True, debug=True)
-        ta.parse(expression='R = tmap(singletmap)',  stdstype = 'strds', basename="r", overwrite=True)
+        ta.parse(expression='R = tmap(singletmap)', stdstype = 'strds', basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         self.assertTrue(D.is_in_db())
@@ -346,13 +346,13 @@ class TestTemporalAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 3))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_tmap_function2(self):
         """Testing the tmap function. """
         ta = tgis.TemporalAlgebraParser(run=True, debug=True)
-        ta.parse(expression='R = A : tmap(singletmap)',  stdstype = 'strds', basename="r", overwrite=True)
+        ta.parse(expression='R = A : tmap(singletmap)', stdstype = 'strds', basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         self.assertTrue(D.is_in_db())
@@ -364,13 +364,13 @@ class TestTemporalAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 3))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_merge_function1(self):
         """Testing the merge function. """
         ta = tgis.TemporalAlgebraParser(run=True, debug=True)
-        ta.parse(expression='R = merge(A,D)',  stdstype = 'strds', basename="r", overwrite=True)
+        ta.parse(expression='R = merge(A,D)', stdstype = 'strds', basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         self.assertTrue(D.is_in_db())
@@ -382,13 +382,13 @@ class TestTemporalAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 6))
-        self.assertEqual( D.check_temporal_topology(),  False)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), False)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_merge_function2(self):
         """Testing the merge function. """
         ta = tgis.TemporalAlgebraParser(run=True, debug=True)
-        ta.parse(expression='R = merge(A, B {!:,contains} A)',  stdstype = 'strds', basename="r", overwrite=True)
+        ta.parse(expression='R = merge(A, B {!:,contains} A)', stdstype = 'strds', basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         self.assertTrue(D.is_in_db())
@@ -400,8 +400,8 @@ class TestTemporalAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
 class TestTemporalAlgebraDryRun(TestCase):
 
@@ -443,7 +443,7 @@ class TestTemporalAlgebraDryRun(TestCase):
                                                  start="2001-01-02", increment="2 day", interval=True)
         tgis.register_maps_in_space_time_dataset(type="raster", name="D", maps="d1,d2,d3",
                                                  start="2001-01-03", increment="1 day", interval=True)
-        tgis.register_maps_in_space_time_dataset(type="raster", name=None,  maps="singletmap",
+        tgis.register_maps_in_space_time_dataset(type="raster", name=None, maps="singletmap",
                                                  start="2001-01-03", end="2001-01-04")
 
     @classmethod

+ 29 - 29
lib/python/temporal/testsuite/unittests_temporal_algebra_grs.py

@@ -61,7 +61,7 @@ class TestTemporalAlgebraGranularity(TestCase):
                                                  start="2001-03-01", increment="31 days", interval=True)
         tgis.register_maps_in_space_time_dataset(type="raster", name="D", maps="d3",
                                                  start="2001-05-01", increment="31 days", interval=True)
-        tgis.register_maps_in_space_time_dataset(type="raster", name=None,  maps="singletmap", 
+        tgis.register_maps_in_space_time_dataset(type="raster", name=None, maps="singletmap",
                                                 start="2001-01-03", end="2001-01-04")
 
     def tearDown(self):
@@ -99,13 +99,13 @@ class TestTemporalAlgebraGranularity(TestCase):
         D = tgis.open_old_stds("R", type="strds")
 
         self.assertEqual(D.metadata.get_number_of_maps(), 6)
-        self.assertEqual(D.metadata.get_min_min(), 1) 
-        self.assertEqual(D.metadata.get_max_max(), 6) 
+        self.assertEqual(D.metadata.get_min_min(), 1)
+        self.assertEqual(D.metadata.get_max_max(), 6)
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 7, 1))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 month')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 month')
        
     def test_common_granularity_2(self):
         """Testing the common granularity function year to month samping. """
@@ -118,13 +118,13 @@ class TestTemporalAlgebraGranularity(TestCase):
         D = tgis.open_old_stds("R", type="strds")
 
         self.assertEqual(D.metadata.get_number_of_maps(), 6)
-        self.assertEqual(D.metadata.get_min_min(), 1) 
-        self.assertEqual(D.metadata.get_max_max(), 6) 
+        self.assertEqual(D.metadata.get_min_min(), 1)
+        self.assertEqual(D.metadata.get_max_max(), 6)
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 7, 1))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 month')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 month')
        
 
     def test_common_granularity_3(self):
@@ -138,13 +138,13 @@ class TestTemporalAlgebraGranularity(TestCase):
         D = tgis.open_old_stds("R", type="strds")
 
         self.assertEqual(D.metadata.get_number_of_maps(), 3)
-        self.assertEqual(D.metadata.get_min_min(), 1) 
-        self.assertEqual(D.metadata.get_max_max(), 5) 
+        self.assertEqual(D.metadata.get_min_min(), 1)
+        self.assertEqual(D.metadata.get_max_max(), 5)
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 6, 1))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 month')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 month')
        
 
     def test_common_granularity_4(self):
@@ -158,13 +158,13 @@ class TestTemporalAlgebraGranularity(TestCase):
         D = tgis.open_old_stds("R", type="strds")
 
         self.assertEqual(D.metadata.get_number_of_maps(), 3)
-        self.assertEqual(D.metadata.get_min_min(), 9) 
-        self.assertEqual(D.metadata.get_max_max(), 9) 
+        self.assertEqual(D.metadata.get_min_min(), 9)
+        self.assertEqual(D.metadata.get_max_max(), 9)
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 6, 1))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 month')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 month')
        
     def test_common_granularity_4(self):
         """Testing the common granularity function year to month with gaps. """
@@ -177,13 +177,13 @@ class TestTemporalAlgebraGranularity(TestCase):
         D = tgis.open_old_stds("R", type="strds")
 
         self.assertEqual(D.metadata.get_number_of_maps(), 3)
-        self.assertEqual(D.metadata.get_min_min(), 9) 
-        self.assertEqual(D.metadata.get_max_max(), 9) 
+        self.assertEqual(D.metadata.get_min_min(), 9)
+        self.assertEqual(D.metadata.get_max_max(), 9)
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 6, 1))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 month')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 month')
        
     def test_common_granularity_5(self):
         """Testing the common granularity function year to month with gaps. """
@@ -196,13 +196,13 @@ class TestTemporalAlgebraGranularity(TestCase):
         D = tgis.open_old_stds("R", type="strds")
 
         self.assertEqual(D.metadata.get_number_of_maps(), 3)
-        self.assertEqual(D.metadata.get_min_min(), 1) 
-        self.assertEqual(D.metadata.get_max_max(), 5) 
+        self.assertEqual(D.metadata.get_min_min(), 1)
+        self.assertEqual(D.metadata.get_max_max(), 5)
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 6, 1))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 month')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 month')
          
     def test_common_granularity_6(self):
         """Testing the common granularity function year to month with gaps. """
@@ -215,13 +215,13 @@ class TestTemporalAlgebraGranularity(TestCase):
         D = tgis.open_old_stds("R", type="strds")
 
         self.assertEqual(D.metadata.get_number_of_maps(), 2)
-        self.assertEqual(D.metadata.get_min_min(), 3) 
-        self.assertEqual(D.metadata.get_max_max(), 5) 
+        self.assertEqual(D.metadata.get_min_min(), 3)
+        self.assertEqual(D.metadata.get_max_max(), 5)
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 3, 1))
         self.assertEqual(end, datetime.datetime(2001, 6, 1))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 month')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 month')
        
 
 

+ 37 - 37
lib/python/temporal/testsuite/unittests_temporal_algebra_mixed_stds.py

@@ -45,7 +45,7 @@ class TestTemporalAlgebraMixedDatasets(TestCase):
         tgis.register_maps_in_space_time_dataset(type="raster", name="B", maps="b1,b2",
                                                  start="2001-01-01", increment="2 day", interval=True)
 
-        cls.runModule("v.random", overwrite=True, quiet=True, npoints=20, seed=3,  output='c1')
+        cls.runModule("v.random", overwrite=True, quiet=True, npoints=20, seed=3, output='c1')
 
         tgis.open_new_stds(name="C", type="stvds", temporaltype="absolute",
                            title="B", descr="C", semantic="field", overwrite=True)
@@ -71,13 +71,13 @@ class TestTemporalAlgebraMixedDatasets(TestCase):
         D = tgis.open_old_stds("R", type="str3ds")
         D.select()
         self.assertEqual(D.metadata.get_number_of_maps(), 2)
-        self.assertEqual(D.metadata.get_min_min(), 2) 
-        self.assertEqual(D.metadata.get_max_max(), 3) 
+        self.assertEqual(D.metadata.get_min_min(), 2)
+        self.assertEqual(D.metadata.get_max_max(), 3)
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 2))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
         ta = tgis.TemporalAlgebraParser(run=True, debug=True, dry_run=True)
         pc = ta.parse(expression="R = A {:,during} stvds(C)",
@@ -98,13 +98,13 @@ class TestTemporalAlgebraMixedDatasets(TestCase):
         D = tgis.open_old_stds("R", type="str3ds")
         D.select()
         self.assertEqual(D.metadata.get_number_of_maps(), 2)
-        self.assertEqual(D.metadata.get_min_min(), 2) 
-        self.assertEqual(D.metadata.get_max_max(), 3) 
+        self.assertEqual(D.metadata.get_min_min(), 2)
+        self.assertEqual(D.metadata.get_max_max(), 3)
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 2))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
         ta = tgis.TemporalAlgebraParser(run=True, debug=True,
                                         dry_run=True)
@@ -118,7 +118,7 @@ class TestTemporalAlgebraMixedDatasets(TestCase):
         self.assertEqual(pc["STDS"]["stdstype"], "str3ds")
 
     def test_temporal_select_operators3(self):
-        """Testing the temporal select operator. Including temporal relations 
+        """Testing the temporal select operator. Including temporal relations
             and negation operation. """
         ta = tgis.TemporalAlgebraParser(run=True, debug=True)
         ta.parse(expression="R = A {!:,during} stvds(C)",
@@ -127,19 +127,19 @@ class TestTemporalAlgebraMixedDatasets(TestCase):
         D = tgis.open_old_stds("R", type="str3ds")
         D.select()
         self.assertEqual(D.metadata.get_number_of_maps(), 2)
-        self.assertEqual(D.metadata.get_min_min(), 1) 
-        self.assertEqual(D.metadata.get_max_max(), 4) 
+        self.assertEqual(D.metadata.get_min_min(), 1)
+        self.assertEqual(D.metadata.get_max_max(), 4)
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_select_operators4(self):
-        """Testing the temporal select operator. Including temporal relations and 
+        """Testing the temporal select operator. Including temporal relations and
             temporal operators. """
         ta = tgis.TemporalAlgebraParser(run=True, debug=True)
-        ta.parse(expression="V = C {:,contains} str3ds(A)",  
+        ta.parse(expression="V = C {:,contains} str3ds(A)",
                  stdstype='stvds', basename="r", overwrite=True)
 
         D = tgis.open_old_stds("V", type="stvds")
@@ -148,14 +148,14 @@ class TestTemporalAlgebraMixedDatasets(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 2))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'2 days')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'2 days')
 
     def test_temporal_select_operators5(self):
-        """Testing the temporal select operator. Including temporal relations and 
+        """Testing the temporal select operator. Including temporal relations and
             temporal operators. """
         ta = tgis.TemporalAlgebraParser(run=True, debug=True)
-        ta.parse(expression="R = A {:,during} strds(B)",  
+        ta.parse(expression="R = A {:,during} strds(B)",
                  stdstype='str3ds', basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="str3ds")
@@ -164,59 +164,59 @@ class TestTemporalAlgebraMixedDatasets(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_hash_operator1(self):
         """Testing the hash operator function in conditional statement. """
         ta = tgis.TemporalAlgebraParser(run=True, debug=True)
-        ta.parse(expression="R = if(A {#,during} stvds(C) == 1, A)",  
+        ta.parse(expression="R = if(A {#,during} stvds(C) == 1, A)",
                  stdstype='str3ds', basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="str3ds")
         D.select()
         self.assertEqual(D.metadata.get_number_of_maps(), 2)
-        self.assertEqual(D.metadata.get_min_min(), 2) 
-        self.assertEqual(D.metadata.get_max_max(), 3) 
+        self.assertEqual(D.metadata.get_min_min(), 2)
+        self.assertEqual(D.metadata.get_max_max(), 3)
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 2))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_hash_operator2(self):
         """Testing the hash operator function in conditional statement. """
         ta = tgis.TemporalAlgebraParser(run=True, debug=True)
-        ta.parse(expression="R = if({during}, stvds(C) {#,contains} A == 2, A)",  
+        ta.parse(expression="R = if({during}, stvds(C) {#,contains} A == 2, A)",
                  stdstype='str3ds', basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="str3ds")
         D.select()
         self.assertEqual(D.metadata.get_number_of_maps(), 2)
-        self.assertEqual(D.metadata.get_min_min(), 2) 
-        self.assertEqual(D.metadata.get_max_max(), 3) 
+        self.assertEqual(D.metadata.get_min_min(), 2)
+        self.assertEqual(D.metadata.get_max_max(), 3)
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 2))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual(D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_different_stds_handling1(self):
         """Testing the handling of different stds types as output. """
         ta = tgis.TemporalAlgebraParser(run=True, debug=True)
-        ta.parse(expression="R = if({during}, stvds(C) {#,contains} str3ds(A) == 2, str3ds(A))",  
+        ta.parse(expression="R = if({during}, stvds(C) {#,contains} str3ds(A) == 2, str3ds(A))",
                  stdstype='strds', basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="str3ds")
         D.select()
         self.assertEqual(D.metadata.get_number_of_maps(), 2)
-        self.assertEqual(D.metadata.get_min_min(), 2) 
-        self.assertEqual(D.metadata.get_max_max(), 3) 
+        self.assertEqual(D.metadata.get_min_min(), 2)
+        self.assertEqual(D.metadata.get_max_max(), 3)
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 2))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual(D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_different_stds_handling2(self):
         """Testing the handling of different stds types as output. """

+ 35 - 38
lib/python/temporal/testsuite/unittests_temporal_conditionals.py

@@ -62,7 +62,7 @@ class TestTemporalConditionals(TestCase):
                                                  start="2001-01-03", increment="1 day", interval=True)
         tgis.register_maps_in_space_time_dataset(type="raster", name="E", maps="e1,e2,e3",
                                                  start="2000-12-31", increment="2 day", interval=True)
-        tgis.register_maps_in_space_time_dataset(type="raster", name=None,  maps="singletmap",
+        tgis.register_maps_in_space_time_dataset(type="raster", name=None, maps="singletmap",
                                                 start="2001-01-03", end="2001-01-04")
 
     def tearDown(self):
@@ -88,8 +88,8 @@ class TestTemporalConditionals(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 3))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_condition_2(self):
         """Testing the temporal select operator with equal relations. """
@@ -104,8 +104,8 @@ class TestTemporalConditionals(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_condition_3(self):
         """Testing the temporal select operator with equal relations. """
@@ -120,8 +120,8 @@ class TestTemporalConditionals(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_condition_4(self):
         """Testing the temporal select operator with equal relations. """
@@ -136,8 +136,8 @@ class TestTemporalConditionals(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 3))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_condition_5(self):
         """Testing the temporal select operator with equal relations. """
@@ -152,8 +152,8 @@ class TestTemporalConditionals(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 3))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_condition_6(self):
         """Testing the temporal select operator with equal relations. """
@@ -169,8 +169,8 @@ class TestTemporalConditionals(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 2))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_condition_7(self):
         """Testing the temporal select operator with equal relations. """
@@ -186,8 +186,8 @@ class TestTemporalConditionals(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'2 days')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'2 days')
 
     def test_temporal_condition_8(self):
         """Testing the temporal select operator with equal relations. """
@@ -203,8 +203,8 @@ class TestTemporalConditionals(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'2 days')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'2 days')
 
     def test_temporal_condition_9(self):
         """Testing the temporal select operator with equal relations. """
@@ -220,8 +220,8 @@ class TestTemporalConditionals(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 3))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'2 days')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'2 days')
 
     def test_temporal_condition_10(self):
         """Testing the temporal select operator with equal relations. """
@@ -237,8 +237,8 @@ class TestTemporalConditionals(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2000, 12, 31))
         self.assertEqual(end, datetime.datetime(2001, 1, 6))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'2 days')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'2 days')
 
     def test_temporal_condition_11(self):
         """Testing the temporal select operator with equal relations. """
@@ -254,8 +254,8 @@ class TestTemporalConditionals(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2000, 12, 31))
         self.assertEqual(end, datetime.datetime(2001, 1, 2))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'2 days')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'2 days')
 
     def test_temporal_condition_12(self):
         """Testing the temporal select operator with equal relations. """
@@ -271,8 +271,8 @@ class TestTemporalConditionals(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2000, 12, 31))
         self.assertEqual(end, datetime.datetime(2001, 1, 2))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'2 days')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'2 days')
 
     def test_temporal_conditional_13(self):
         """Testing the hash operator function in conditional statement. """
@@ -289,8 +289,8 @@ class TestTemporalConditionals(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_condition_else_1(self):
         """Testing the temporal select operator with equal relations. """
@@ -306,8 +306,8 @@ class TestTemporalConditionals(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_condition_else_2(self):
         """Testing the temporal select operator with equal relations. """
@@ -323,8 +323,8 @@ class TestTemporalConditionals(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 3))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_condition_else_3(self):
         """Testing the temporal select operator with equal relations. """
@@ -340,8 +340,8 @@ class TestTemporalConditionals(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 3))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_condition_else_4(self):
         """Testing the temporal select operator with equal relations. """
@@ -359,11 +359,8 @@ class TestTemporalConditionals(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2000, 12, 31))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  False)
-        self.assertEqual(D.get_granularity(),  u'2 days')
+        self.assertEqual(D.check_temporal_topology(), False)
+        self.assertEqual(D.get_granularity(), u'2 days')
 
 if __name__ == '__main__':
     test()
-
-
-

+ 49 - 49
lib/python/temporal/testsuite/unittests_temporal_raster_algebra.py

@@ -54,7 +54,7 @@ class TestTemporalRasterAlgebra(TestCase):
                                                  start="2001-01-02", increment="2 day", interval=True)
         tgis.register_maps_in_space_time_dataset(type="raster", name="D", maps="d1,d2,d3",
                                                  start="2001-01-03", increment="1 day", interval=True)
-        tgis.register_maps_in_space_time_dataset(type="raster", name=None,  maps="singletmap",
+        tgis.register_maps_in_space_time_dataset(type="raster", name=None, maps="singletmap",
                                                 start="2001-01-03", end="2001-01-04")
 
     def tearDown(self):
@@ -71,7 +71,7 @@ class TestTemporalRasterAlgebra(TestCase):
     def test_temporal_extent1(self):
         """Testing the temporal extent operators. """
         ta = tgis.TemporalRasterAlgebraParser(run=True, debug=True)
-        ta.parse(expression="R = A {:,during,r} C",   basename="r", overwrite=True)
+        ta.parse(expression="R = A {:,during,r} C", basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         D.select()
@@ -81,8 +81,8 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 2))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual( D.check_temporal_topology(),  False)
-        self.assertEqual(D.get_granularity(),  u'2 days')
+        self.assertEqual(D.check_temporal_topology(), False)
+        self.assertEqual(D.get_granularity(), u'2 days')
 
         ta = tgis.TemporalRasterAlgebraParser(run=True, debug=True, dry_run=True)
         pc = ta.parse(expression="R = A {:,during,r} C", basename="r", overwrite=True)
@@ -109,8 +109,8 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_simple_arith_hash_1(self):
         """Simple arithmetic test including the hash operator using the granularity option
@@ -141,7 +141,7 @@ class TestTemporalRasterAlgebra(TestCase):
         maps = D.get_registered_maps_as_objects()
         count = 1
         for map in maps:
-            map_name = "r_2001_01_0%i"%count
+            map_name = "r_2001_01_0%i" % count
             self.assertEqual(map.get_name(), map_name)
             count += 1
 
@@ -183,7 +183,7 @@ class TestTemporalRasterAlgebra(TestCase):
         #r_2001_01_04T00_00_00
         count = 1
         for map in maps:
-            map_name = "r_2001_01_0%iT00_00_00"%count
+            map_name = "r_2001_01_0%iT00_00_00" % count
             self.assertEqual(map.get_name(), map_name)
             count += 1
 
@@ -347,7 +347,7 @@ class TestTemporalRasterAlgebra(TestCase):
 
         """
         tra = tgis.TemporalRasterAlgebraParser(run=True, debug=True)
-        tra.parse(expression='R = if(start_date(A) < "2001-01-03" && A#A == 1, A{+, starts,l}C, A{+, finishes,l}C)', \
+        tra.parse(expression='R = if(start_date(A) < "2001-01-03" && A#A == 1, A{+, starts,l}C, A{+, finishes,l}C)',
                   basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
@@ -546,8 +546,8 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 3))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_tmap_function2(self):
         """Testing the tmap function. """
@@ -563,8 +563,8 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 3))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_map_function1(self):
         """Testing the map function. """
@@ -580,8 +580,8 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_map_function2(self):
         """Testing the map function. """
@@ -597,8 +597,8 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_select(self):
         """Testing the temporal select operator. """
@@ -613,8 +613,8 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_select(self):
         """Testing the temporal select operator. """
@@ -629,8 +629,8 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 3))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_select_operators1(self):
         """Testing the temporal select operator. Including temporal relations. """
@@ -645,8 +645,8 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 3))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_select_operators2(self):
         """Testing the temporal select operator. Including temporal relations. """
@@ -661,8 +661,8 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_select_operators3(self):
         """Testing the temporal select operator. Including temporal relations and
@@ -678,8 +678,8 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  False)
-        self.assertEqual(D.get_granularity(),  u'2 days')
+        self.assertEqual(D.check_temporal_topology(), False)
+        self.assertEqual(D.get_granularity(), u'2 days')
 
     def test_temporal_select_operators4(self):
         """Testing the temporal select operator. Including temporal relations and
@@ -700,8 +700,8 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 2))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual( D.check_temporal_topology(),  False)
-        self.assertEqual(D.get_granularity(),  u'2 days')
+        self.assertEqual(D.check_temporal_topology(), False)
+        self.assertEqual(D.get_granularity(), u'2 days')
 
     def test_temporal_hash_operator1(self):
         """Testing the temporal hash operator in the raster algebra. """
@@ -716,8 +716,8 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 3))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_hash_operator2(self):
         """Testing the temporal hash operator in the raster algebra. """
@@ -732,8 +732,8 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 3))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_temporal_hash_operator3(self):
         """Testing the temporal hash operator in the raster algebra. """
@@ -748,8 +748,8 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 2))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'2 days')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'2 days')
 
     def test_temporal_hash_operator4(self):
         """Testing the temporal hash operator in the raster algebra. """
@@ -764,8 +764,8 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 2))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'2 days')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'2 days')
 
     def test_raster_arithmetic_relation_1(self):
         """Arithmetic test with temporal intersection"""
@@ -780,8 +780,8 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'2 days')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'2 days')
 
     def test_raster_arithmetic_relation_2(self):
         """Arithmetic test with temporal intersection"""
@@ -796,8 +796,8 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'2 days')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'2 days')
 
     def test_raster_arithmetic_relation_3(self):
         """Arithmetic test with temporal intersection"""
@@ -812,8 +812,8 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'2 days')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'2 days')
 
     def test_raster_arithmetic_relation_4(self):
         """Arithmetic test with temporal intersection"""
@@ -828,8 +828,8 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_raster_arithmetic_relation_5(self):
         """Complex arithmetic test with temporal intersection"""
@@ -844,8 +844,8 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 3))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_capacity_1(self):
         """Arithmetic test with temporal intersection"""
@@ -861,8 +861,8 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
         tra = tgis.TemporalRasterAlgebraParser(run=True, debug=True, dry_run=True)
         pc = tra.parse(expression=expr, basename="r", overwrite=True)

+ 16 - 16
lib/python/temporal/testsuite/unittests_temporal_raster_algebra_equal_ts.py

@@ -36,7 +36,7 @@ class TestTemporalRasterAlgebraImplicitAggregation(TestCase):
 
         tgis.register_maps_in_space_time_dataset(type="raster", name="A", maps="a1,a2,a3,a4",
                                                  start="2001-01-01", interval=False)
-        tgis.register_maps_in_space_time_dataset(type="raster", name=None,  maps="singletmap",
+        tgis.register_maps_in_space_time_dataset(type="raster", name=None, maps="singletmap",
                                                 start="2001-01-01")
 
     def tearDown(self):
@@ -64,7 +64,7 @@ class TestTemporalRasterAlgebraImplicitAggregation(TestCase):
 
         """
         ta = tgis.TemporalRasterAlgebraParser(run=True, debug=True)
-        ta.parse(expression="R = A + A",   basename="r", overwrite=True)
+        ta.parse(expression="R = A + A", basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         D.select()
@@ -74,8 +74,8 @@ class TestTemporalRasterAlgebraImplicitAggregation(TestCase):
         self.assertEqual(D.metadata.get_max_max(), 14)
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
-        self.assertEqual( D.check_temporal_topology(),  False)
-        self.assertEqual(D.get_granularity(),  None)
+        self.assertEqual(D.check_temporal_topology(), False)
+        self.assertEqual(D.get_granularity(), None)
 
     def test_complex_operator(self):
         """Test implicit aggregation
@@ -91,7 +91,7 @@ class TestTemporalRasterAlgebraImplicitAggregation(TestCase):
 
         """
         ta = tgis.TemporalRasterAlgebraParser(run=True, debug=True)
-        ta.parse(expression="R = A {+, equal,l} A",   basename="r", overwrite=True)
+        ta.parse(expression="R = A {+, equal,l} A", basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         D.select()
@@ -101,8 +101,8 @@ class TestTemporalRasterAlgebraImplicitAggregation(TestCase):
         self.assertEqual(D.metadata.get_max_max(), 14)
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
-        self.assertEqual( D.check_temporal_topology(),  False)
-        self.assertEqual(D.get_granularity(),  None)
+        self.assertEqual(D.check_temporal_topology(), False)
+        self.assertEqual(D.get_granularity(), None)
 
     def test_single_map_complex_operator(self):
         """Test implicit aggregation
@@ -118,7 +118,7 @@ class TestTemporalRasterAlgebraImplicitAggregation(TestCase):
 
         """
         ta = tgis.TemporalRasterAlgebraParser(run=True, debug=True)
-        ta.parse(expression="R = tmap(singletmap) {+, equal,l} A",   basename="r", overwrite=True)
+        ta.parse(expression="R = tmap(singletmap) {+, equal,l} A", basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         D.select()
@@ -128,8 +128,8 @@ class TestTemporalRasterAlgebraImplicitAggregation(TestCase):
         self.assertEqual(D.metadata.get_max_max(), 110)
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  None)
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), None)
 
     def test_single_map_simple_operator(self):
         """Test implicit aggregation
@@ -145,7 +145,7 @@ class TestTemporalRasterAlgebraImplicitAggregation(TestCase):
 
         """
         ta = tgis.TemporalRasterAlgebraParser(run=True, debug=True)
-        ta.parse(expression="R = tmap(singletmap) + A",   basename="r", overwrite=True)
+        ta.parse(expression="R = tmap(singletmap) + A", basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         D.select()
@@ -155,8 +155,8 @@ class TestTemporalRasterAlgebraImplicitAggregation(TestCase):
         self.assertEqual(D.metadata.get_max_max(), 110)
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  None)
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), None)
 
     def test_single_map_complex_operator_right_ts(self):
         """Test implicit aggregation
@@ -173,7 +173,7 @@ class TestTemporalRasterAlgebraImplicitAggregation(TestCase):
 
         """
         ta = tgis.TemporalRasterAlgebraParser(run=True, debug=True)
-        ta.parse(expression="R = tmap(singletmap) {+, equal,r} A",   basename="r", overwrite=True)
+        ta.parse(expression="R = tmap(singletmap) {+, equal,r} A", basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         D.select()
@@ -183,8 +183,8 @@ class TestTemporalRasterAlgebraImplicitAggregation(TestCase):
         self.assertEqual(D.metadata.get_max_max(), 110)
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
-        self.assertEqual( D.check_temporal_topology(),  False)
-        self.assertEqual(D.get_granularity(),  None)
+        self.assertEqual(D.check_temporal_topology(), False)
+        self.assertEqual(D.get_granularity(), None)
 
 
 if __name__ == '__main__':

+ 29 - 29
lib/python/temporal/testsuite/unittests_temporal_raster_algebra_grs.py

@@ -60,9 +60,9 @@ class TestTemporalRasterAlgebra(TestCase):
                                                  start="2001-03-01", increment="5 days", interval=True)
         tgis.register_maps_in_space_time_dataset(type="raster", name="D", maps="d3",
                                                  start="2001-05-01", increment="5 days", interval=True)
-        tgis.register_maps_in_space_time_dataset(type="raster", name=None,  maps="singletmap", 
+        tgis.register_maps_in_space_time_dataset(type="raster", name=None, maps="singletmap",
                                                 start="2001-03-01", end="2001-04-01")
-        tgis.register_maps_in_space_time_dataset(type="raster", name=None,  maps="nullmap",
+        tgis.register_maps_in_space_time_dataset(type="raster", name=None, maps="nullmap",
                                                 start="2001-01-01", end="2001-07-01")
         
     def tearDown(self):
@@ -72,7 +72,7 @@ class TestTemporalRasterAlgebra(TestCase):
     @classmethod
     def tearDownClass(cls):
         return
-        """Remove the temporary region 
+        """Remove the temporary region
         """
         cls.runModule("t.remove", flags="rf", inputs="A,B,C,D", quiet=True)
         cls.runModule("t.unregister", maps="singletmap", quiet=True)
@@ -82,7 +82,7 @@ class TestTemporalRasterAlgebra(TestCase):
         """Simple arithmetik test"""
         tra = tgis.TemporalRasterAlgebraParser(run = True, debug = True)
         expr = "R = if(C == 9,  A - 1)"
-        ret = tra.setup_common_granularity(expression=expr,  lexer = tgis.TemporalRasterAlgebraLexer())
+        ret = tra.setup_common_granularity(expression=expr, lexer = tgis.TemporalRasterAlgebraLexer())
         self.assertEqual(ret, True)
         
         tra.parse(expression=expr, basename="r", overwrite=True)
@@ -95,11 +95,11 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 7, 1))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 month')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 month')
 
         tra = tgis.TemporalRasterAlgebraParser(run=True, debug=True, dry_run=True)
-        tra.setup_common_granularity(expression=expr,  lexer = tgis.TemporalRasterAlgebraLexer())
+        tra.setup_common_granularity(expression=expr, lexer = tgis.TemporalRasterAlgebraLexer())
         pc = tra.parse(expression=expr, basename="r", overwrite=True)
 
         self.assertEqual(len(pc["register"]), 6)
@@ -113,7 +113,7 @@ class TestTemporalRasterAlgebra(TestCase):
         """Simple arithmetik test"""
         tra = tgis.TemporalRasterAlgebraParser(run = True, debug = True)
         expr = "R = A + B + C"
-        ret = tra.setup_common_granularity(expression=expr,  lexer = tgis.TemporalRasterAlgebraLexer())
+        ret = tra.setup_common_granularity(expression=expr, lexer = tgis.TemporalRasterAlgebraLexer())
         self.assertEqual(ret, True)
 
         tra.parse(expression=expr, basename="r", overwrite=True)
@@ -126,11 +126,11 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 7, 1))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 month')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 month')
 
         tra = tgis.TemporalRasterAlgebraParser(run=True, debug=True, dry_run=True)
-        tra.setup_common_granularity(expression=expr,  lexer = tgis.TemporalRasterAlgebraLexer())
+        tra.setup_common_granularity(expression=expr, lexer = tgis.TemporalRasterAlgebraLexer())
         pc = tra.parse(expression=expr, basename="r", overwrite=True)
 
         self.assertEqual(len(pc["register"]), 6)
@@ -158,11 +158,11 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, None)
         self.assertEqual(end, None)
-        self.assertEqual( D.check_temporal_topology(),  False)
-        self.assertEqual(D.get_granularity(),  None)
+        self.assertEqual(D.check_temporal_topology(), False)
+        self.assertEqual(D.get_granularity(), None)
 
         tra = tgis.TemporalRasterAlgebraParser(run=True, debug=True, dry_run=True)
-        tra.setup_common_granularity(expression=expr,  lexer = tgis.TemporalRasterAlgebraLexer())
+        tra.setup_common_granularity(expression=expr, lexer = tgis.TemporalRasterAlgebraLexer())
         pc = tra.parse(expression=expr, basename="r", overwrite=True)
 
         print(pc)
@@ -176,7 +176,7 @@ class TestTemporalRasterAlgebra(TestCase):
         """Simple arithmetik test"""
         tra = tgis.TemporalRasterAlgebraParser(run = True, debug = True)
         expr = "R = if(D == 11,  A - 1, A + 1)"
-        ret = tra.setup_common_granularity(expression=expr,  lexer = tgis.TemporalRasterAlgebraLexer())
+        ret = tra.setup_common_granularity(expression=expr, lexer = tgis.TemporalRasterAlgebraLexer())
         self.assertEqual(ret, True)
 
         tra.parse(expression=expr, basename="r", overwrite=True)
@@ -189,8 +189,8 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 5, 6))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_simple_arith_hash_1(self):
         """Simple arithmetic test including the hash operator"""
@@ -224,7 +224,7 @@ class TestTemporalRasterAlgebra(TestCase):
         """Simple arithmetic test"""
         tra = tgis.TemporalRasterAlgebraParser(run = True, debug = True)
         expr = 'R = A + td(A:D)'
-        ret = tra.setup_common_granularity(expression=expr,  lexer = tgis.TemporalRasterAlgebraLexer())
+        ret = tra.setup_common_granularity(expression=expr, lexer = tgis.TemporalRasterAlgebraLexer())
         self.assertEqual(ret, True)
 
         tra.parse(expression=expr, basename="r", overwrite=True)
@@ -237,14 +237,14 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 5, 6))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 day')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 day')
 
     def test_simple_arith_if_1(self):
         """Simple arithmetic test with if condition"""
         tra = tgis.TemporalRasterAlgebraParser(run = True, debug = True)
         expr = 'R = if(start_date(A) >= "2001-02-01", A + A)'
-        ret = tra.setup_common_granularity(expression=expr,  lexer = tgis.TemporalRasterAlgebraLexer())
+        ret = tra.setup_common_granularity(expression=expr, lexer = tgis.TemporalRasterAlgebraLexer())
         self.assertEqual(ret, True)
 
         tra.parse(expression=expr, basename="r", overwrite=True)
@@ -262,7 +262,7 @@ class TestTemporalRasterAlgebra(TestCase):
         """Simple arithmetic test with if condition"""
         tra = tgis.TemporalRasterAlgebraParser(run = True, debug = True)
         expr = 'R = if(A#A == 1, A - A)'
-        ret = tra.setup_common_granularity(expression=expr,  lexer = tgis.TemporalRasterAlgebraLexer())
+        ret = tra.setup_common_granularity(expression=expr, lexer = tgis.TemporalRasterAlgebraLexer())
         self.assertEqual(ret, True)
 
         tra.parse(expression=expr, basename="r", overwrite=True)
@@ -280,7 +280,7 @@ class TestTemporalRasterAlgebra(TestCase):
         """Complex arithmetic test with if condition"""
         tra = tgis.TemporalRasterAlgebraParser(run = True, debug = True)
         expr = 'R = if(start_date(A) < "2001-03-01" && A#A == 1, A+C, A-C)'
-        ret = tra.setup_common_granularity(expression=expr,  lexer = tgis.TemporalRasterAlgebraLexer())
+        ret = tra.setup_common_granularity(expression=expr, lexer = tgis.TemporalRasterAlgebraLexer())
         self.assertEqual(ret, True)
 
         tra.parse(expression=expr, basename="r", overwrite=True)
@@ -297,8 +297,8 @@ class TestTemporalRasterAlgebra(TestCase):
     def test_temporal_neighbors(self):
         """Simple temporal neighborhood computation test"""
         tra = tgis.TemporalRasterAlgebraParser(run = True, debug = True)
-        expr ='R = (A[0,0,-1] : D) + (A[0,0,1] : D)'
-        ret = tra.setup_common_granularity(expression=expr,  lexer = tgis.TemporalRasterAlgebraLexer())
+        expr = 'R = (A[0,0,-1] : D) + (A[0,0,1] : D)'
+        ret = tra.setup_common_granularity(expression=expr, lexer = tgis.TemporalRasterAlgebraLexer())
         self.assertEqual(ret, True)
 
         tra.parse(expression=expr, basename="r", overwrite=True)
@@ -316,7 +316,7 @@ class TestTemporalRasterAlgebra(TestCase):
         """Test STDS + single map without timestamp"""
         tra = tgis.TemporalRasterAlgebraParser(run = True, debug = True)
         expr = "R = A + map(singletmap)"
-        ret = tra.setup_common_granularity(expression=expr,  lexer = tgis.TemporalRasterAlgebraLexer())
+        ret = tra.setup_common_granularity(expression=expr, lexer = tgis.TemporalRasterAlgebraLexer())
         self.assertEqual(ret, True)
 
         tra.parse(expression=expr, basename="r", overwrite=True)
@@ -334,7 +334,7 @@ class TestTemporalRasterAlgebra(TestCase):
         """Test STDS + single map with and without timestamp"""
         tra = tgis.TemporalRasterAlgebraParser(run = True, debug = True)
         expr = "R = tmap(singletmap) + A + map(singletmap)"
-        ret = tra.setup_common_granularity(expression=expr,  lexer = tgis.TemporalRasterAlgebraLexer())
+        ret = tra.setup_common_granularity(expression=expr, lexer = tgis.TemporalRasterAlgebraLexer())
         self.assertEqual(ret, True)
 
         tra.parse(expression=expr, basename="r", overwrite=True)
@@ -347,8 +347,8 @@ class TestTemporalRasterAlgebra(TestCase):
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 3, 1))
         self.assertEqual(end, datetime.datetime(2001, 4, 1))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  u'1 month')
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), u'1 month')
 
 
 if __name__ == '__main__':

+ 17 - 17
lib/python/temporal/testsuite/unittests_temporal_raster_algebra_spatial_topology.py

@@ -52,7 +52,7 @@ class TestTemporalRasterAlgebraSpatialTopology(TestCase):
         tgis.register_maps_in_space_time_dataset(type="raster", name="B", maps="b1,b2,b3,b4",
                                                  start="2001-01-01", interval=False)
 
-        tgis.register_maps_in_space_time_dataset(type="raster", name=None,  maps="singletmap",
+        tgis.register_maps_in_space_time_dataset(type="raster", name=None, maps="singletmap",
                                                  start="2001-01-01")
 
     def tearDown(self):
@@ -84,7 +84,7 @@ class TestTemporalRasterAlgebraSpatialTopology(TestCase):
 
         """
         ta = tgis.TemporalRasterAlgebraParser(run=True, debug=True, spatial=True)
-        ta.parse(expression="R = A {+,equal|equivalent,l} B",   basename="r", overwrite=True)
+        ta.parse(expression="R = A {+,equal|equivalent,l} B", basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         D.select()
@@ -94,8 +94,8 @@ class TestTemporalRasterAlgebraSpatialTopology(TestCase):
         self.assertEqual(D.metadata.get_max_max(), 8)
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
-        self.assertEqual( D.check_temporal_topology(),  False)
-        self.assertEqual(D.get_granularity(),  None)
+        self.assertEqual(D.check_temporal_topology(), False)
+        self.assertEqual(D.get_granularity(), None)
 
     def test_equal_overlap_sum(self):
         """Spatial topology distinction with equal timestamps
@@ -114,7 +114,7 @@ class TestTemporalRasterAlgebraSpatialTopology(TestCase):
 
         """
         ta = tgis.TemporalRasterAlgebraParser(run=True, debug=True, spatial=True)
-        ta.parse(expression="R = A {+,equal|overlap,l} B",   basename="r", overwrite=True)
+        ta.parse(expression="R = A {+,equal|overlap,l} B", basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         D.select()
@@ -124,8 +124,8 @@ class TestTemporalRasterAlgebraSpatialTopology(TestCase):
         self.assertEqual(D.metadata.get_max_max(), 6)
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
-        self.assertEqual( D.check_temporal_topology(),  False)
-        self.assertEqual(D.get_granularity(),  None)
+        self.assertEqual(D.check_temporal_topology(), False)
+        self.assertEqual(D.get_granularity(), None)
 
     def test_equal_overlap_sum_with_null(self):
         """Spatial topology distinction with equal timestamps
@@ -154,8 +154,8 @@ class TestTemporalRasterAlgebraSpatialTopology(TestCase):
         self.assertEqual(D.metadata.get_max_max(), 6)
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
-        self.assertEqual( D.check_temporal_topology(),  False)
-        self.assertEqual(D.get_granularity(),  None)
+        self.assertEqual(D.check_temporal_topology(), False)
+        self.assertEqual(D.get_granularity(), None)
 
     def test_equal_contain_sum(self):
         """Spatial topology distinction with equal timestamps
@@ -171,7 +171,7 @@ class TestTemporalRasterAlgebraSpatialTopology(TestCase):
 
         """
         ta = tgis.TemporalRasterAlgebraParser(run=True, debug=True, spatial=True)
-        ta.parse(expression="R = A {+,equal|contain,l} B",   basename="r", overwrite=True)
+        ta.parse(expression="R = A {+,equal|contain,l} B", basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         D.select()
@@ -181,8 +181,8 @@ class TestTemporalRasterAlgebraSpatialTopology(TestCase):
         self.assertEqual(D.metadata.get_max_max(), 5)
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
-        self.assertEqual( D.check_temporal_topology(),  True)
-        self.assertEqual(D.get_granularity(),  None)
+        self.assertEqual(D.check_temporal_topology(), True)
+        self.assertEqual(D.get_granularity(), None)
 
     def test_equal_equivalent_contain_sum(self):
         """Spatial topology distinction with equal timestamps
@@ -202,7 +202,7 @@ class TestTemporalRasterAlgebraSpatialTopology(TestCase):
 
         """
         ta = tgis.TemporalRasterAlgebraParser(run=True, debug=True, spatial=True)
-        ta.parse(expression="R = A {+,equal|equivalent|contain,l} B",   basename="r", overwrite=True)
+        ta.parse(expression="R = A {+,equal|equivalent|contain,l} B", basename="r", overwrite=True)
 
         D = tgis.open_old_stds("R", type="strds")
         D.select()
@@ -212,8 +212,8 @@ class TestTemporalRasterAlgebraSpatialTopology(TestCase):
         self.assertEqual(D.metadata.get_max_max(), 8)
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
-        self.assertEqual( D.check_temporal_topology(),  False)
-        self.assertEqual(D.get_granularity(),  None)
+        self.assertEqual(D.check_temporal_topology(), False)
+        self.assertEqual(D.get_granularity(), None)
 
     def test_equal_equivalent_compare(self):
         """Test implicit aggregation
@@ -243,8 +243,8 @@ class TestTemporalRasterAlgebraSpatialTopology(TestCase):
         self.assertEqual(D.metadata.get_max_max(), 8)
         start, end = D.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
-        self.assertEqual( D.check_temporal_topology(),  False)
-        self.assertEqual(D.get_granularity(),  None)
+        self.assertEqual(D.check_temporal_topology(), False)
+        self.assertEqual(D.get_granularity(), None)
 
 
 if __name__ == '__main__':

+ 53 - 53
lib/python/temporal/testsuite/unittests_temporal_raster_conditionals.py

@@ -79,8 +79,8 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
     def test_temporal_conditional_1(self):
         """Testing the conditional time dimension bug, that uses the time
@@ -95,10 +95,10 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         self.assertEqual(R.metadata.get_min_min(), 16)
         self.assertEqual(R.metadata.get_max_max(), 18)
         start, end = R.get_absolute_time()
-        self.assertEqual(start, datetime.datetime(2001, 1,  3))
+        self.assertEqual(start, datetime.datetime(2001, 1, 3))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
     def test_temporal_conditional_relation_1(self):
         """Testing the conditional time dimension bug, that uses the time
@@ -115,8 +115,8 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( R.check_temporal_topology(),  False)
-        self.assertEqual(R.get_granularity(),  u'2 days')
+        self.assertEqual(R.check_temporal_topology(), False)
+        self.assertEqual(R.get_granularity(), u'2 days')
 
     def test_spatial_conditional_1(self):
         """Testing the spatial conditionals combined by AND/OR operators.
@@ -132,8 +132,8 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
     def test_spatial_conditional_2(self):
         """Testing the spatial conditionals combined by AND/OR operators.
@@ -149,8 +149,8 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 2))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
     def test_spatial_conditional_3(self):
         """Testing the spatial conditionals combined by AND/OR operators.
@@ -166,8 +166,8 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 3))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
     def test_spatial_conditional_4(self):
         """Testing the spatial conditionals combined by AND/OR operators.
@@ -183,8 +183,8 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
     def test_spatial_conditional_5(self):
         """Testing the spatial conditionals combined by AND/OR operators.
@@ -200,8 +200,8 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'2 days')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'2 days')
 
     def test_spatial_conditional_relation_1(self):
         """Testing the spatial conditionals combined by AND/OR operators.
@@ -217,8 +217,8 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 3))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
     def test_spatial_conditional_relation_2(self):
         """Testing the spatial conditionals with numeric conclusions"""
@@ -233,8 +233,8 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
     def test_spatial_conditional_numeric_relation_1(self):
         """Testing the spatial conditionals with numeric conclusions"""
@@ -249,8 +249,8 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
     def test_spatial_conditional_numeric_relation_2(self):
         """Testing the spatial conditionals combined by AND/OR operators.
@@ -266,8 +266,8 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
     def test_spatial_conditional_numeric_1(self):
         """Testing the spatial conditionals with numeric conclusions"""
@@ -282,8 +282,8 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
     def test_spatial_conditional_numeric_2(self):
         """Testing the spatial conditionals with numeric conclusions"""
@@ -298,8 +298,8 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
     def test_spatial_conditional_numeric_3(self):
         """Testing the spatial conditionals with numeric conclusions"""
@@ -314,8 +314,8 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
     def test_spatial_conditional_numeric_4(self):
         """Testing the spatial conditionals with numeric conclusions"""
@@ -330,8 +330,8 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 3))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
     def test_spatiotemporal_conditional_1(self):
         """Testing the spatial conditionals with numeric conclusions"""
@@ -346,8 +346,8 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
     def test_spatiotemporal_conditional_2(self):
         """Testing the spatial conditionals with numeric conclusions"""
@@ -362,8 +362,8 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
     def test_spatiotemporal_conditional_relation_1(self):
         """Testing the spatial conditionals with numeric conclusions"""
@@ -378,8 +378,8 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 3))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
     def test_spatiotemporal_conditional_relation_2(self):
         """Testing the spatial conditionals with numeric conclusions"""
@@ -394,8 +394,8 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
     def test_spatiotemporal_conditional_numeric_relation_1(self):
         """Testing the spatial conditionals with numeric conclusions"""
@@ -410,8 +410,8 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
     def test_spatiotemporal_conditional_numeric_relation_2(self):
         """Testing the spatial conditionals combined by AND/OR operators.
@@ -427,8 +427,8 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
     def test_spatiotemporal_conditional_numeric_1(self):
         """Testing the spatial conditionals with numeric conclusions"""
@@ -443,8 +443,8 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
     def test_spatiotemporal_conditional_numeric_2(self):
         """Testing the spatial conditionals with numeric conclusions"""
@@ -459,8 +459,8 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
     def test_spatiotemporal_conditional_numeric_3(self):
         """Testing the spatial conditionals with numeric conclusions"""
@@ -475,8 +475,8 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 5))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
     def test_spatiotemporal_conditional_numeric_4(self):
         """Testing the spatial conditionals with numeric conclusions"""
@@ -491,8 +491,8 @@ class TestTemporalRasterAlgebraConditionals(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 2))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
 
 if __name__ == '__main__':

+ 4 - 4
lib/python/temporal/testsuite/unittests_temporal_raster_conditionals_complement_else.py

@@ -83,8 +83,8 @@ class TestTemporalRasterAlgebraConditionalComplements(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 7))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
     def test_temporal_conditional_complement_right_side_timestamps(self):
         """Test the conditional expression that evaluate if then else statements
@@ -119,8 +119,8 @@ class TestTemporalRasterAlgebraConditionalComplements(TestCase):
         start, end = R.get_absolute_time()
         self.assertEqual(start, datetime.datetime(2001, 1, 1))
         self.assertEqual(end, datetime.datetime(2001, 1, 7))
-        self.assertEqual( R.check_temporal_topology(),  True)
-        self.assertEqual(R.get_granularity(),  u'1 day')
+        self.assertEqual(R.check_temporal_topology(), True)
+        self.assertEqual(R.get_granularity(), u'1 day')
 
 
 if __name__ == '__main__':

+ 0 - 0
lib/python/temporal/testsuite/unittests_temporal_vector_algebra.py


Some files were not shown because too many files changed in this diff