mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 07:26:29 +00:00
Allow serialization of Sectors class
This commit is contained in:
parent
b537f2d987
commit
f43e2480a5
2 changed files with 11 additions and 0 deletions
|
@ -149,3 +149,13 @@ class Sectors(object):
|
||||||
raise UnitError('Cannot take modulus of sectors with different sector sizes')
|
raise UnitError('Cannot take modulus of sectors with different sector sizes')
|
||||||
self.bytes %= other.bytes
|
self.bytes %= other.bytes
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
def __getstate__(self):
|
||||||
|
return {'__class__': self.__module__ + '.' + self.__class__.__name__,
|
||||||
|
'sector_size': self.sector_size,
|
||||||
|
'bytes': self.bytes,
|
||||||
|
}
|
||||||
|
|
||||||
|
def __setstate__(self, state):
|
||||||
|
self.sector_size = state['sector_size']
|
||||||
|
self.bytes = state['bytes']
|
||||||
|
|
|
@ -21,6 +21,7 @@ supported_classes = ['bootstrapvz.base.manifest.Manifest',
|
||||||
'bootstrapvz.base.fs.partitions.single.SinglePartition',
|
'bootstrapvz.base.fs.partitions.single.SinglePartition',
|
||||||
'bootstrapvz.base.fs.partitions.unformatted.UnformattedPartition',
|
'bootstrapvz.base.fs.partitions.unformatted.UnformattedPartition',
|
||||||
'bootstrapvz.common.bytes.Bytes',
|
'bootstrapvz.common.bytes.Bytes',
|
||||||
|
'bootstrapvz.common.sectors.Sectors',
|
||||||
]
|
]
|
||||||
|
|
||||||
supported_exceptions = ['bootstrapvz.common.exceptions.ManifestError',
|
supported_exceptions = ['bootstrapvz.common.exceptions.ManifestError',
|
||||||
|
|
Loading…
Add table
Reference in a new issue