Warning
This document is for an old release of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.
Source code for galaxy.util.none_like
"""
Objects with No values
"""
from galaxy.datatypes.registry import Registry
from galaxy.model.metadata import MetadataCollection
[docs]class RecursiveNone:
def __str__(self):
return "None"
def __repr__(self):
return str(self)
def __getattr__(self, name):
value = RecursiveNone()
setattr(self, name, value)
return value
def __nonzero__(self):
return False
[docs]class NoneDataset(RecursiveNone):
[docs] def __init__(self, datatypes_registry=None, ext='data', dbkey='?'):
self.ext = self.extension = ext
self.dbkey = dbkey
if datatypes_registry is None:
# Default Value Required for unit tests
datatypes_registry = Registry()
datatypes_registry.load_datatypes()
self.datatype = datatypes_registry.get_datatype_by_extension(ext)
self._metadata = None
self.metadata = MetadataCollection(self)
def __getattr__(self, name):
return "None"