[GRASS-SVN] r69673 - in grass/trunk/lib/python/temporal: . testsuite

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Oct 4 06:12:15 PDT 2016


Author: huhabla
Date: 2016-10-04 06:12:14 -0700 (Tue, 04 Oct 2016)
New Revision: 69673

Modified:
   grass/trunk/lib/python/temporal/abstract_dataset.py
   grass/trunk/lib/python/temporal/abstract_map_dataset.py
   grass/trunk/lib/python/temporal/abstract_space_time_dataset.py
   grass/trunk/lib/python/temporal/aggregation.py
   grass/trunk/lib/python/temporal/base.py
   grass/trunk/lib/python/temporal/c_libraries_interface.py
   grass/trunk/lib/python/temporal/core.py
   grass/trunk/lib/python/temporal/datetime_math.py
   grass/trunk/lib/python/temporal/extract.py
   grass/trunk/lib/python/temporal/factory.py
   grass/trunk/lib/python/temporal/gui_support.py
   grass/trunk/lib/python/temporal/list_stds.py
   grass/trunk/lib/python/temporal/mapcalc.py
   grass/trunk/lib/python/temporal/metadata.py
   grass/trunk/lib/python/temporal/open_stds.py
   grass/trunk/lib/python/temporal/register.py
   grass/trunk/lib/python/temporal/sampling.py
   grass/trunk/lib/python/temporal/space_time_datasets.py
   grass/trunk/lib/python/temporal/spatial_extent.py
   grass/trunk/lib/python/temporal/spatio_temporal_relationships.py
   grass/trunk/lib/python/temporal/stds_export.py
   grass/trunk/lib/python/temporal/stds_import.py
   grass/trunk/lib/python/temporal/temporal_algebra.py
   grass/trunk/lib/python/temporal/temporal_extent.py
   grass/trunk/lib/python/temporal/temporal_granularity.py
   grass/trunk/lib/python/temporal/temporal_raster3d_algebra.py
   grass/trunk/lib/python/temporal/temporal_raster_algebra.py
   grass/trunk/lib/python/temporal/temporal_raster_base_algebra.py
   grass/trunk/lib/python/temporal/temporal_vector_algebra.py
   grass/trunk/lib/python/temporal/testsuite/test_doctests.py
   grass/trunk/lib/python/temporal/univar_statistics.py
Log:
temporal framework: Better Python module import handling


Modified: grass/trunk/lib/python/temporal/abstract_dataset.py
===================================================================
--- grass/trunk/lib/python/temporal/abstract_dataset.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/abstract_dataset.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -11,11 +11,9 @@
 :authors: Soeren Gebbert
 """
 from abc import ABCMeta, abstractmethod
-from .temporal_extent import *
-from .spatial_extent import *
-from .metadata import *
-from .temporal_topology_dataset_connector import *
-from .spatial_topology_dataset_connector import *
+from .core import get_tgis_message_interface, init_dbif, get_enable_mapset_check, get_current_mapset
+from .temporal_topology_dataset_connector import TemporalTopologyDatasetConnector
+from .spatial_topology_dataset_connector import SpatialTopologyDatasetConnector
 
 ###############################################################################
 

Modified: grass/trunk/lib/python/temporal/abstract_map_dataset.py
===================================================================
--- grass/trunk/lib/python/temporal/abstract_map_dataset.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/abstract_map_dataset.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -11,8 +11,16 @@
 :authors: Soeren Gebbert
 """
 from __future__ import print_function
-from .abstract_dataset import *
-from .datetime_math import *
+import gettext
+from grass.exceptions import ImplementationError
+from datetime import datetime
+from abc import ABCMeta, abstractmethod
+from .core import get_tgis_c_library_interface, get_enable_timestamp_write, \
+    get_enable_mapset_check, get_current_mapset, init_dbif
+from .abstract_dataset import AbstractDataset
+from .temporal_extent import RelativeTemporalExtent, AbsoluteTemporalExtent
+from .datetime_math import datetime_to_grass_datetime_string, \
+    increment_datetime_by_string, decrement_datetime_by_string
 
 
 class AbstractMapDataset(AbstractDataset):
@@ -530,7 +538,7 @@
         """Convenient method to set the temporal extent from a temporal extent
            object
 
-           :param temporal_extent: The temporal extent that should be set for
+           :param extent: The temporal extent that should be set for
                                    this object
 
            .. code-block: : python
@@ -722,6 +730,9 @@
            spatial directions.
 
            :param size: The buffer size, using the unit of the grass region
+           :param update: If True perform an immediate database update, otherwise only the
+                          internal variables are set
+           :param dbif: The database interface to be used
 
            .. code-block: : python
 
@@ -749,6 +760,9 @@
            spatial directions.
 
            :param size: The buffer size, using the unit of the grass region
+           :param update: If True perform an immediate database update, otherwise only the
+                          internal variables are set
+           :param dbif: The database interface to be used
 
            .. code-block: : python
 
@@ -770,7 +784,10 @@
             self.spatial_extent.update(dbif)
 
     def check_for_correct_time(self):
-        """Check for correct time"""
+        """Check for correct time
+
+           :return: True in case of success, False otherwise
+        """
         if self.is_time_absolute():
             start, end = self.get_absolute_time()
         else:

Modified: grass/trunk/lib/python/temporal/abstract_space_time_dataset.py
===================================================================
--- grass/trunk/lib/python/temporal/abstract_space_time_dataset.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/abstract_space_time_dataset.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -13,9 +13,20 @@
 from __future__ import print_function
 import sys
 import uuid
-from .abstract_dataset import *
-from .temporal_granularity import *
-from .spatio_temporal_relationships import *
+import os
+import copy
+from datetime import datetime
+import gettext
+from abc import ABCMeta, abstractmethod
+from .core import init_dbif, get_sql_template_path, get_tgis_metadata, get_current_mapset, \
+    get_enable_mapset_check
+from .abstract_dataset import AbstractDataset, AbstractDatasetComparisonKeyStartTime
+from .temporal_granularity import check_granularity_string, compute_absolute_time_granularity,\
+    compute_relative_time_granularity
+from .spatio_temporal_relationships import count_temporal_topology_relationships, \
+    print_spatio_temporal_topology_relationships, SpatioTemporalTopologyBuilder, \
+    create_temporal_relation_sql_where_statement
+from .datetime_math import increment_datetime_by_string
 
 ###############################################################################
 
@@ -1567,7 +1578,6 @@
             return None
 
         if not check_granularity_string(gran, maps[-1].get_temporal_type()):
-            self.msgr.error(_("Wrong granularity format: %s" % (gran)))
             return None
 
         for map in maps:

Modified: grass/trunk/lib/python/temporal/aggregation.py
===================================================================
--- grass/trunk/lib/python/temporal/aggregation.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/aggregation.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -17,13 +17,16 @@
 :author: Soeren Gebbert
 """
 
-from .space_time_datasets import *
+import gettext
+import grass.script as gscript
+from grass.exceptions import CalledModuleError
+from .space_time_datasets import RasterDataset
 from .datetime_math import create_suffix_from_datetime
 from .datetime_math import create_time_suffix
 from .datetime_math import create_numeric_suffic
-import grass.script as gscript
-from grass.exceptions import CalledModuleError
-
+from .core import get_current_mapset, get_tgis_message_interface, init_dbif
+from .spatio_temporal_relationships import SpatioTemporalTopologyBuilder, \
+    create_temporal_relation_sql_where_statement
 ###############################################################################
 
 

Modified: grass/trunk/lib/python/temporal/base.py
===================================================================
--- grass/trunk/lib/python/temporal/base.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/base.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -26,7 +26,8 @@
 """
 from __future__ import print_function
 from datetime import datetime
-from .core import *
+from .core import get_tgis_message_interface, get_tgis_dbmi_paramstyle, \
+    SQLDatabaseInterfaceConnection, init, get_current_mapset
 
 ###############################################################################
 
@@ -376,8 +377,7 @@
         if len(row) > 0:
             self.deserialize(row)
         else:
-            self.msgr.fatal(_("Object <%s> not found in the temporal database")
-                            % self.get_id())
+            self.msgr.fatal(_("Object not found in the temporal database"))
 
         return True
 
@@ -610,6 +610,7 @@
         """
         self.ident = ident
         self.D["id"] = ident
+        name = ""
 
         if ident is not None:
             if ident.find("@") >= 0:

Modified: grass/trunk/lib/python/temporal/c_libraries_interface.py
===================================================================
--- grass/trunk/lib/python/temporal/c_libraries_interface.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/c_libraries_interface.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -12,13 +12,12 @@
 """
 
 from grass.exceptions import FatalError
-import time
-import threading
+import gettext
 import sys
 from multiprocessing import Process, Lock, Pipe
 import logging
 from ctypes import *
-from .core import *
+from datetime import datetime
 import grass.lib.gis as libgis
 import grass.lib.raster as libraster
 import grass.lib.vector as libvector

Modified: grass/trunk/lib/python/temporal/core.py
===================================================================
--- grass/trunk/lib/python/temporal/core.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/core.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -30,6 +30,7 @@
 """
 #import traceback
 import os
+import grass.script as gscript
 # i18N
 import gettext
 gettext.install('grasslibs', os.path.join(os.getenv("GISBASE"), 'locale'))
@@ -40,8 +41,6 @@
     # python3
     long = int
 
-import grass.script as gscript
-from datetime import datetime
 from .c_libraries_interface import *
 from grass.pygrass import messages
 # Import all supported database backends

Modified: grass/trunk/lib/python/temporal/datetime_math.py
===================================================================
--- grass/trunk/lib/python/temporal/datetime_math.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/datetime_math.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -9,7 +9,7 @@
 :authors: Soeren Gebbert
 """
 from datetime import datetime, timedelta
-from .core import *
+from .core import get_tgis_message_interface
 import copy
 
 try:

Modified: grass/trunk/lib/python/temporal/extract.py
===================================================================
--- grass/trunk/lib/python/temporal/extract.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/extract.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -8,10 +8,11 @@
 
 :authors: Soeren Gebbert
 """
-
-from grass.script.utils import get_num_suffix
-from .space_time_datasets import *
-from .open_stds import *
+# i18N
+import gettext
+from .core import get_tgis_message_interface, get_current_mapset, SQLDatabaseInterfaceConnection
+from .abstract_map_dataset import AbstractMapDataset
+from .open_stds import open_old_stds, check_new_stds, open_new_stds
 from .datetime_math import create_suffix_from_datetime
 from .datetime_math import create_time_suffix
 from .datetime_math import create_numeric_suffic

Modified: grass/trunk/lib/python/temporal/factory.py
===================================================================
--- grass/trunk/lib/python/temporal/factory.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/factory.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -17,8 +17,12 @@
 
 :authors: Soeren Gebbert
 """
+# i18N
+import gettext
+from .core import get_tgis_message_interface
+from .space_time_datasets import SpaceTimeRaster3DDataset, SpaceTimeRasterDataset, \
+    SpaceTimeVectorDataset, Raster3DDataset, RasterDataset, VectorDataset
 
-from .space_time_datasets import *
 
 ###############################################################################
 

Modified: grass/trunk/lib/python/temporal/gui_support.py
===================================================================
--- grass/trunk/lib/python/temporal/gui_support.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/gui_support.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -9,9 +9,10 @@
 
 :authors: Soeren Gebbert
 """
-
-from .space_time_datasets import *
-from .factory import *
+# i18N
+import gettext
+from .core import get_available_temporal_mapsets, init_dbif
+from .factory import dataset_factory
 import grass.script as gscript
 
 ###############################################################################
@@ -26,6 +27,7 @@
 
     .. code-block:: python
 
+        >>> import grass.temporalas tgis
         >>> tgis.tlist_grouped('strds')['PERMANENT']
         ['precipitation', 'temperature']
 

Modified: grass/trunk/lib/python/temporal/list_stds.py
===================================================================
--- grass/trunk/lib/python/temporal/list_stds.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/list_stds.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -18,9 +18,13 @@
 :authors: Soeren Gebbert
 """
 from __future__ import print_function
-from .space_time_datasets import *
-from .factory import *
-from .open_stds import *
+# i18N
+import gettext
+from .core import get_tgis_message_interface, get_available_temporal_mapsets, init_dbif
+from .datetime_math import time_delta_to_relative_time
+from .space_time_datasets import RasterDataset
+from .factory import dataset_factory
+from .open_stds import open_old_stds
 
 ###############################################################################
 
@@ -49,18 +53,19 @@
         .. code-block:: python
 
             >>> import grass.temporal as tgis
-            >>> tgis.init()
+            >>> tgis.core.init()
             >>> name = "list_stds_test"
-            >>> sp = tgis.open_new_stds(name=name, type="strds",
-            ... temporaltype="absolute", title="title", descr="descr", semantic="mean", dbif=None, overwrite=True)
+            >>> sp = tgis.open_stds.open_new_stds(name=name, type="strds",
+            ... temporaltype="absolute", title="title", descr="descr",
+            ... semantic="mean", dbif=None, overwrite=True)
             >>> mapset = tgis.get_current_mapset()
-            >>> stds_list = tgis.get_dataset_list("strds", "absolute", columns="name")
+            >>> stds_list = tgis.list_stds.get_dataset_list("strds", "absolute", columns="name")
             >>> rows =  stds_list[mapset]
             >>> for row in rows:
             ...     if row["name"] == name:
             ...         print(True)
             True
-            >>> stds_list = tgis.get_dataset_list("strds", "absolute", columns="name,mapset", where="mapset = '%s'"%(mapset))
+            >>> stds_list = tgis.list_stds.get_dataset_list("strds", "absolute", columns="name,mapset", where="mapset = '%s'"%(mapset))
             >>> rows =  stds_list[mapset]
             >>> for row in rows:
             ...     if row["name"] == name and row["mapset"] == mapset:

Modified: grass/trunk/lib/python/temporal/mapcalc.py
===================================================================
--- grass/trunk/lib/python/temporal/mapcalc.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/mapcalc.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -8,12 +8,16 @@
 
 :authors: Soeren Gebbert
 """
-
-from .space_time_datasets import *
-from .open_stds import *
+# i18N
+import gettext
+import copy
+from datetime import datetime
 from multiprocessing import Process
 import grass.script as gscript
 from grass.exceptions import CalledModuleError
+from .core import SQLDatabaseInterfaceConnection, get_current_mapset, get_tgis_message_interface
+from .open_stds import open_new_stds, open_old_stds, check_new_stds
+from .datetime_math import time_delta_to_relative_time
 
 ############################################################################
 

Modified: grass/trunk/lib/python/temporal/metadata.py
===================================================================
--- grass/trunk/lib/python/temporal/metadata.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/metadata.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -22,7 +22,10 @@
 :authors: Soeren Gebbert
 """
 from __future__ import print_function
-from .base import *
+# i18N
+import gettext
+from .base import SQLDatabaseInterface
+from .core import init
 
 ###############################################################################
 

Modified: grass/trunk/lib/python/temporal/open_stds.py
===================================================================
--- grass/trunk/lib/python/temporal/open_stds.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/open_stds.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -17,9 +17,12 @@
 
 :authors: Soeren Gebbert
 """
+# i18N
+import gettext
+from .core import init_dbif, get_current_mapset, get_tgis_message_interface
+from .factory import dataset_factory
+from .abstract_map_dataset import AbstractMapDataset
 
-from .factory import *
-
 ###############################################################################
 
 

Modified: grass/trunk/lib/python/temporal/register.py
===================================================================
--- grass/trunk/lib/python/temporal/register.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/register.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -16,9 +16,15 @@
 
 :authors: Soeren Gebbert
 """
-
-from .open_stds import *
+# i18N
+import gettext
+from datetime import datetime
 import grass.script as gscript
+from .core import get_tgis_message_interface, init_dbif, get_current_mapset
+from .open_stds import open_old_stds
+from .abstract_map_dataset import AbstractMapDataset
+from .factory import dataset_factory
+from .datetime_math import check_datetime_string, increment_datetime_by_string, string_to_datetime
 
 ###############################################################################
 

Modified: grass/trunk/lib/python/temporal/sampling.py
===================================================================
--- grass/trunk/lib/python/temporal/sampling.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/sampling.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -17,7 +17,11 @@
 :authors: Soeren Gebbert
 """
 from __future__ import print_function
-from .factory import *
+# i18N
+import gettext
+from .core import get_current_mapset, get_tgis_message_interface, SQLDatabaseInterfaceConnection
+from .datetime_math import time_delta_to_relative_time
+from .factory import dataset_factory
 
 
 def sample_stds_by_stds_topology(intype, sampletype, inputs, sampler, header,

Modified: grass/trunk/lib/python/temporal/space_time_datasets.py
===================================================================
--- grass/trunk/lib/python/temporal/space_time_datasets.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/space_time_datasets.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -8,10 +8,25 @@
 
 :authors: Soeren Gebbert
 """
+# i18N
+import gettext
 import getpass
-from .abstract_map_dataset import *
-from .abstract_space_time_dataset import *
+from datetime import datetime
+from .core import get_current_mapset
+from .abstract_map_dataset import AbstractMapDataset
+from .abstract_space_time_dataset import AbstractSpaceTimeDataset
+from .base import Raster3DBase, RasterBase, VectorBase, STR3DSBase, STVDSBase, STRDSBase,\
+    VectorSTDSRegister, Raster3DSTDSRegister, RasterSTDSRegister
+from .metadata import Raster3DMetadata, RasterMetadata, VectorMetadata, STRDSMetadata,\
+    STR3DSMetadata, STVDSMetadata
+from .spatial_extent import RasterSpatialExtent, Raster3DSpatialExtent, VectorSpatialExtent,\
+    STRDSSpatialExtent, STR3DSSpatialExtent, STVDSSpatialExtent
+from .temporal_extent import RasterAbsoluteTime, RasterRelativeTime, Raster3DAbsoluteTime, \
+    Raster3DRelativeTime, VectorAbsoluteTime, VectorRelativeTime, STRDSAbsoluteTime,\
+    STRDSRelativeTime, STR3DSAbsoluteTime, STR3DSRelativeTime, STVDSAbsoluteTime, STVDSRelativeTime
 import grass.script.array as garray
+from .core import init
+from datetime import datetime
 
 ###############################################################################
 
@@ -205,7 +220,7 @@
         self.stds_register = RasterSTDSRegister(ident=ident)
 
     def has_grass_timestamp(self):
-        """Check if a grass file bsased time stamp exists for this map.
+        """Check if a grass file based time stamp exists for this map.
 
            :return: True if success, False on error
         """

Modified: grass/trunk/lib/python/temporal/spatial_extent.py
===================================================================
--- grass/trunk/lib/python/temporal/spatial_extent.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/spatial_extent.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -34,7 +34,11 @@
 :authors: Soeren Gebbert
 """
 from __future__ import print_function
-from .base import *
+# i18N
+import gettext
+from .base import SQLDatabaseInterface
+from .core import init
+from datetime import datetime
 
 
 class SpatialExtent(SQLDatabaseInterface):

Modified: grass/trunk/lib/python/temporal/spatio_temporal_relationships.py
===================================================================
--- grass/trunk/lib/python/temporal/spatio_temporal_relationships.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/spatio_temporal_relationships.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -18,13 +18,15 @@
 :authors: Soeren Gebbert
 """
 from __future__ import print_function
-
-from .abstract_dataset import *
-from .datetime_math import *
+# i18N
+import gettext
+from datetime import datetime
+from .core import init_dbif
+from .abstract_dataset import AbstractDatasetComparisonKeyStartTime
+from .datetime_math import time_delta_to_relative_time_seconds
 import grass.lib.vector as vector
 import grass.lib.rtree as rtree
 import grass.lib.gis as gis
-from ctypes import *
 
 ###############################################################################
 

Modified: grass/trunk/lib/python/temporal/stds_export.py
===================================================================
--- grass/trunk/lib/python/temporal/stds_export.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/stds_export.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -25,16 +25,16 @@
 :authors: Soeren Gebbert
 """
 
+# i18N
+import gettext
 import shutil
 import os
 import tarfile
 import tempfile
 
-from .space_time_datasets import *
-from .factory import *
-from .open_stds import *
 import grass.script as gscript
 from grass.exceptions import CalledModuleError
+from .open_stds import open_old_stds
 
 
 proj_file_name = "proj.txt"

Modified: grass/trunk/lib/python/temporal/stds_import.py
===================================================================
--- grass/trunk/lib/python/temporal/stds_import.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/stds_import.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -29,14 +29,15 @@
 :authors: Soeren Gebbert
 """
 
+# i18N
+import gettext
 import os
 import os.path
 import tarfile
 
-from .space_time_datasets import *
-from .register import *
-from . import factory
-from .factory import *
+from .core import get_current_mapset, get_tgis_message_interface
+from .register import register_maps_in_space_time_dataset
+from .factory import dataset_factory
 import grass.script as gscript
 from grass.exceptions import CalledModuleError
 
@@ -198,7 +199,6 @@
         :param memory: Cache size for raster rows, used in r.in.gdal
     """
 
-    global raise_on_error
     old_state = gscript.raise_on_error
     gscript.set_raise_on_error(True)
 
@@ -308,7 +308,8 @@
 
     try:
         # Make sure the temporal database exists
-        factory.init()
+        from .core import init
+        init()
 
         fs = "|"
         maplist = []
@@ -498,6 +499,6 @@
                                     location=old_env["LOCATION_NAME"],
                                     gisdbase=old_env["GISDBASE"])
             except CalledModuleError:
-                grass.warning(_("Switching to original location failed"))
+                gscript.warning(_("Switching to original location failed"))
 
         gscript.set_raise_on_error(old_state)

Modified: grass/trunk/lib/python/temporal/temporal_algebra.py
===================================================================
--- grass/trunk/lib/python/temporal/temporal_algebra.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/temporal_algebra.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -446,13 +446,25 @@
 except:
     pass
 
+# i18N
+import gettext
 import os
 import copy
+from datetime import datetime
 import grass.pygrass.modules as pymod
-from .space_time_datasets import *
-from .factory import *
-from .open_stds import *
-from .temporal_operator import *
+from .core import init_dbif, get_tgis_message_interface, get_current_mapset,\
+    SQLDatabaseInterfaceConnection
+from .temporal_granularity import compute_common_absolute_time_granularity, \
+    compute_common_relative_time_granularity
+from .abstract_dataset import AbstractDatasetComparisonKeyStartTime
+from .abstract_map_dataset import AbstractMapDataset
+from .space_time_datasets import RasterDataset
+from .factory import dataset_factory
+from .open_stds import open_new_stds, open_old_stds
+from .temporal_operator import TemporalOperatorParser
+from spatio_temporal_relationships import SpatioTemporalTopologyBuilder
+from .datetime_math import time_delta_to_relative_time
+from abstract_space_time_dataset import AbstractSpaceTimeDataset
 
 ##############################################################################
 

Modified: grass/trunk/lib/python/temporal/temporal_extent.py
===================================================================
--- grass/trunk/lib/python/temporal/temporal_extent.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/temporal_extent.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -20,7 +20,11 @@
 :authors: Soeren Gebbert
 """
 from __future__ import print_function
-from .base import *
+# i18N
+import gettext
+from .base import SQLDatabaseInterface
+from .core import init
+from datetime import datetime
 
 ###############################################################################
 

Modified: grass/trunk/lib/python/temporal/temporal_granularity.py
===================================================================
--- grass/trunk/lib/python/temporal/temporal_granularity.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/temporal_granularity.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -17,7 +17,9 @@
 
 :authors: Soeren Gebbert
 """
-from .abstract_dataset import *
+from __future__ import print_function
+# i18N
+import gettext
 from .datetime_math import *
 from functools import reduce
 

Modified: grass/trunk/lib/python/temporal/temporal_raster3d_algebra.py
===================================================================
--- grass/trunk/lib/python/temporal/temporal_raster3d_algebra.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/temporal_raster3d_algebra.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -10,8 +10,22 @@
 :authors: Thomas Leppelt and Soeren Gebbert
 
 """
-from .temporal_raster_base_algebra import *
+from __future__ import print_function
 
+try:
+    import ply.lex as lex
+    import ply.yacc as yacc
+except:
+    pass
+
+# i18N
+import gettext
+from .temporal_raster_base_algebra import TemporalRasterBaseAlgebraParser,\
+    TemporalRasterAlgebraLexer
+import grass.pygrass.modules as pymod
+from .space_time_datasets import Raster3DDataset
+
+
 ###############################################################################
 
 class TemporalRaster3DAlgebraParser(TemporalRasterBaseAlgebraParser):

Modified: grass/trunk/lib/python/temporal/temporal_raster_algebra.py
===================================================================
--- grass/trunk/lib/python/temporal/temporal_raster_algebra.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/temporal_raster_algebra.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -51,9 +51,21 @@
     LexToken(FLOAT,2.45,1,42)
 
 """
+from __future__ import print_function
 
-from .temporal_raster_base_algebra import *
+try:
+    import ply.lex as lex
+    import ply.yacc as yacc
+except:
+    pass
 
+# i18N
+import gettext
+from .temporal_raster_base_algebra import TemporalRasterBaseAlgebraParser,\
+    TemporalRasterAlgebraLexer
+import grass.pygrass.modules as pymod
+from .space_time_datasets import RasterDataset
+
 ###############################################################################
 
 class TemporalRasterAlgebraParser(TemporalRasterBaseAlgebraParser):

Modified: grass/trunk/lib/python/temporal/temporal_raster_base_algebra.py
===================================================================
--- grass/trunk/lib/python/temporal/temporal_raster_base_algebra.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/temporal_raster_base_algebra.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -41,10 +41,25 @@
 
 """
 from __future__ import print_function
+
+try:
+    import ply.lex as lex
+    import ply.yacc as yacc
+except:
+    pass
+
+import copy
 import grass.pygrass.modules as pymod
-from .temporal_operator import *
-from .temporal_algebra import *
+from grass.exceptions import FatalError
+from .temporal_algebra import TemporalAlgebraLexer, TemporalAlgebraParser, GlobalTemporalVar
+from .core import init_dbif
+from .abstract_dataset import AbstractDatasetComparisonKeyStartTime
+from .factory import dataset_factory
+from .open_stds import open_new_stds
+from spatio_temporal_relationships import SpatioTemporalTopologyBuilder
+from .space_time_datasets import Raster3DDataset, RasterDataset
 
+
 ##############################################################################
 
 class TemporalRasterAlgebraLexer(TemporalAlgebraLexer):

Modified: grass/trunk/lib/python/temporal/temporal_vector_algebra.py
===================================================================
--- grass/trunk/lib/python/temporal/temporal_vector_algebra.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/temporal_vector_algebra.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -42,10 +42,24 @@
 
 """
 from __future__ import print_function
+
+try:
+    import ply.lex as lex
+    import ply.yacc as yacc
+except:
+    pass
+
 import grass.pygrass.modules as pygrass
-from .temporal_operator import *
-from .temporal_algebra import *
 
+import copy
+from .temporal_algebra import TemporalAlgebraLexer, TemporalAlgebraParser, GlobalTemporalVar
+from .core import init_dbif, get_current_mapset
+from .abstract_dataset import AbstractDatasetComparisonKeyStartTime
+from .open_stds import open_new_stds
+from spatio_temporal_relationships import SpatioTemporalTopologyBuilder
+from .space_time_datasets import VectorDataset
+
+
 ##############################################################################
 
 class TemporalVectorAlgebraLexer(TemporalAlgebraLexer):

Modified: grass/trunk/lib/python/temporal/testsuite/test_doctests.py
===================================================================
--- grass/trunk/lib/python/temporal/testsuite/test_doctests.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/testsuite/test_doctests.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -25,7 +25,7 @@
     tests.addTests(doctest.DocTestSuite(grass.temporal.abstract_space_time_dataset))
     tests.addTests(doctest.DocTestSuite(grass.temporal.base))
     # Unexpected error here
-    ##tests.addTests(doctest.DocTestSuite(grass.temporal.core))
+    tests.addTests(doctest.DocTestSuite(grass.temporal.core))
     tests.addTests(doctest.DocTestSuite(grass.temporal.datetime_math))
     # Unexpected error here
     ##tests.addTests(doctest.DocTestSuite(grass.temporal.list_stds))

Modified: grass/trunk/lib/python/temporal/univar_statistics.py
===================================================================
--- grass/trunk/lib/python/temporal/univar_statistics.py	2016-10-04 07:19:21 UTC (rev 69672)
+++ grass/trunk/lib/python/temporal/univar_statistics.py	2016-10-04 13:12:14 UTC (rev 69673)
@@ -20,7 +20,9 @@
 """
 from __future__ import print_function
 
-from .open_stds import *
+from .core import SQLDatabaseInterfaceConnection, get_current_mapset
+from .factory import dataset_factory
+from .open_stds import open_old_stds
 import grass.script as gscript
 
 ###############################################################################



More information about the grass-commit mailing list