class ChunkType(Enum):
Folder = "FOLD"
Data = "DATA"
@classmethod
def parse(cls, value: Union[str, bytes]) -> ChunkType:
if isinstance(value, bytes):
try:
_ = value.decode("ascii")
except UnicodeDecodeError:
raise ChunkTypeError(value)
value = _
try:
return ChunkType(value)
except ValueError:
raise ChunkTypeError(value)
See: https://github.com/ModernMAK/Relic-Game-Tool/blob/f65a07d6ad744b5ca5407b36fedf64f19502ead8/src/relic/chunky/chunk/header.py#L14-L29
Good candidate is DataClassPackable
Something like EnumStruct to differentiate it from DataStruct
See: https://github.com/ModernMAK/Relic-Game-Tool/blob/f65a07d6ad744b5ca5407b36fedf64f19502ead8/src/relic/chunky/chunk/header.py#L14-L29
Good candidate is DataClassPackable
Something like
EnumStructto differentiate it fromDataStruct