mirror of
https://github.com/KrisKennaway/pyapple2disk.git
synced 2024-11-29 14:50:00 +00:00
Add an anomaly message type for collecting interesting or unusual artefacts about a disk structure.
This commit is contained in:
parent
b4ea155b24
commit
8148053965
29
src/apple2disk/anomaly.py
Normal file
29
src/apple2disk/anomaly.py
Normal file
@ -0,0 +1,29 @@
|
||||
import sys
|
||||
|
||||
class AnomalyLevel(object):
|
||||
def __init__(self, level):
|
||||
self.level = level
|
||||
|
||||
def __str__(self):
|
||||
return level
|
||||
|
||||
module = sys.modules[__name__]
|
||||
for level in ['INFO', 'UNUSUAL', 'CORRUPTION']:
|
||||
setattr(module, level, AnomalyLevel(level))
|
||||
|
||||
|
||||
class Anomaly(object):
|
||||
def __init__(self, container, level, details):
|
||||
"""Record of an anomaly found during disk processing.
|
||||
|
||||
Args:
|
||||
container: object that contains the anomaly
|
||||
level: AnomalyLevel
|
||||
details: string description of anomaly (str)
|
||||
"""
|
||||
self.container = container
|
||||
self.level = level
|
||||
self.details = details
|
||||
|
||||
def __str__(self):
|
||||
return '%s anomaly in %s: %s' % (self.level, self.container, self.details)
|
Loading…
Reference in New Issue
Block a user