Exemplo n.º 1
0
 def name(self):
     # Cache this
     if hasattr(self, '_name'):
         nm = self._name
     else:
         nm = subset_ops.subset_unique_name(self)
     return nm
Exemplo n.º 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
Exemplo n.º 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