1 | """ |
---|
2 | Objects with No values |
---|
3 | """ |
---|
4 | from galaxy.datatypes.metadata import MetadataCollection |
---|
5 | from galaxy.datatypes.registry import Registry |
---|
6 | |
---|
7 | class RecursiveNone: |
---|
8 | def __str__( self ): |
---|
9 | return "None" |
---|
10 | def __repr__( self ): |
---|
11 | return str( self ) |
---|
12 | def __getattr__( self, name ): |
---|
13 | value = RecursiveNone() |
---|
14 | setattr( self, name, value ) |
---|
15 | return value |
---|
16 | def __nonzero__( self ): |
---|
17 | return False |
---|
18 | |
---|
19 | class NoneDataset( RecursiveNone ): |
---|
20 | def __init__( self, datatypes_registry = None, ext = 'data', dbkey = '?' ): |
---|
21 | self.ext = self.extension = ext |
---|
22 | self.dbkey = dbkey |
---|
23 | if datatypes_registry is None: datatypes_registry = Registry() |
---|
24 | self.datatype = datatypes_registry.get_datatype_by_extension( ext ) |
---|
25 | self._metadata = None |
---|
26 | self.metadata = MetadataCollection( self ) |
---|
27 | def __getattr__( self, name ): |
---|
28 | return "None" |
---|
29 | def missing_meta( self ): |
---|
30 | return False |
---|