Esempio n. 1
0
 def __init__(self, comparator, location, signals=None, **kwargs):
     """
     Initialize the storage object with the location (stream
     object) where the data will be stored.  Requires access to the
     object that will be doing the comparisons (comparator), to
     determine the file extension and the fields of the output.
     """
     import sys
     _base_storage.__init__(self, comparator)
     if isinstance(location, basestring):
         self.cout = open(location, 'wt')
     elif location is None:
         self.cout = sys.stdout
     else:
         self.cout = location
     self._load_signals(signals or '.')
Esempio n. 2
0
    def __init__(self, comparator, location, signals=None, restrict=False, skip=False, **kwargs):
        """
        Initialize the storage object with the location where the data
        is stored.

        @param location  storage location: file[:table] (created as needed)
        @param signals   the directory where the signals are located
        @param restrict  if True, only include signals already stored in the database;
                         if False, signals will be added to the database
        @param skip      if True, pairs() will only return uncompleted calculations
        """
        _base_storage.__init__(self, comparator)
        if location is None:
            raise ValueError("must specify a database file")
        locparts = location.split(':')
        self.location = locparts[0]
        if len(locparts) > 1:
            self.table_name = locparts[1]
        else:
            self.table_name = type(comparator).__name__
        self.restrict = restrict
        self.skip = skip
        self._load_signals(signals or '.')