def as_partition(self, **kwargs): '''Return a PartitionName based on this name''' from .partition import name_class_from_format_name format = kwargs.get('format','db') nc = name_class_from_format_name(format) return nc(**dict(self.dict.items() + kwargs.items()))
def new_subclass(cls, name, object_number): from partition import identity_class_from_format_name, name_class_from_format_name nc = name_class_from_format_name(name.format) ic = identity_class_from_format_name(name.format) nname = nc(**name.dict) return ic(nname, object_number)
def promote(self, name): '''Promote to a PartitionName by combining with a bundle Name''' from partition import name_class_from_format_name cls = name_class_from_format_name(self.format) return cls(**dict(name.dict.items() + self.dict.items() ))