예제 #1
0
 def name(self):
     # Cache this
     if hasattr(self, '_name'):
         nm = self._name
     else:
         nm = subset_ops.subset_unique_name(self)
     return nm
예제 #2
0
    def __new__(cls, cfg, column_set, name=None, description=None):
        """Returns the identical subset if the columns are identical.

        This is basically a pythonized factory. See here:
        http://codesnipers.com/?q=python-flyweights
        """
        columns = list(column_set)
        columns.sort()
        subset_id = subset_ops.subset_unique_name(columns)
        obj = Subset._cache.get(subset_id, None)
        if not obj:
            obj = object.__new__(cls)
            Subset._cache[subset_id] = obj
            obj.init(subset_id, cfg, column_set, columns)

        return obj
예제 #3
0
    def __new__(cls, cfg, column_set, name=None, description=None):
        """Returns the identical subset if the columns are identical.

        This is basically a pythonized factory. See here:
        http://codesnipers.com/?q=python-flyweights
        """
        columns = list(column_set)
        columns.sort()
        subset_id = subset_ops.subset_unique_name(columns)
        obj = Subset._cache.get(subset_id, None)
        if not obj:
            obj = object.__new__(cls)
            Subset._cache[subset_id] = obj
            obj.init(subset_id, cfg, column_set, columns)

        return obj