Put output format evaluation in config and use StrEnum for it
This commit is contained in:
@@ -154,18 +154,6 @@ def expand_file_list(short_notation):
|
||||
return sorted(file_list)
|
||||
|
||||
|
||||
def output_format_list(outputFormat):
|
||||
format_list = []
|
||||
if 'ort' in outputFormat or 'Rqz.ort' in outputFormat or 'Rqz' in outputFormat:
|
||||
format_list.append('Rqz.ort')
|
||||
if 'ort' in outputFormat or 'Rlt.ort' in outputFormat or 'Rlt' in outputFormat:
|
||||
format_list.append('Rlt.ort')
|
||||
if 'orb' in outputFormat or 'Rqz.orb' in outputFormat or 'Rqz' in outputFormat:
|
||||
format_list.append('Rqz.orb')
|
||||
if 'orb' in outputFormat or 'Rlt.orb' in outputFormat or 'Rlt' in outputFormat:
|
||||
format_list.append('Rlt.orb')
|
||||
return sorted(format_list, reverse=True)
|
||||
|
||||
def command_line_options():
|
||||
clas = commandLineArgs()
|
||||
update_loglevel(clas.verbose)
|
||||
|
||||
@@ -402,9 +402,20 @@ class ReductionConfig(ArgParsable):
|
||||
},
|
||||
)
|
||||
|
||||
class OutputFomatOption(StrEnum):
|
||||
Rqz_ort = "Rqz.ort"
|
||||
Rqz_orb = "Rqz.orb"
|
||||
Rlt_ort = "Rlt.ort"
|
||||
Rlt_orb = "Rlt.orb"
|
||||
ort = "ort"
|
||||
orb = "orb"
|
||||
Rqz = "Rqz"
|
||||
Rlt = "Rlt"
|
||||
|
||||
|
||||
@dataclass
|
||||
class OutputConfig(ArgParsable):
|
||||
outputFormats: List[str] = field(
|
||||
outputFormats: List[OutputFomatOption] = field(
|
||||
default_factory=lambda: ['Rqz.ort'],
|
||||
metadata={
|
||||
'short': 'of',
|
||||
@@ -429,6 +440,22 @@ class OutputConfig(ArgParsable):
|
||||
},
|
||||
)
|
||||
|
||||
def _output_format_list(self, outputFormat):
|
||||
format_list = []
|
||||
if OutputFomatOption.ort in outputFormat or OutputFomatOption.Rqz_ort in outputFormat or OutputFomatOption.Rqz in outputFormat:
|
||||
format_list.append(OutputFomatOption.Rqz_ort)
|
||||
if OutputFomatOption.ort in outputFormat or OutputFomatOption.Rlt_ort in outputFormat or OutputFomatOption.Rlt in outputFormat:
|
||||
format_list.append(OutputFomatOption.Rlt_ort)
|
||||
if OutputFomatOption.orb in outputFormat or OutputFomatOption.Rqz_orb in outputFormat or OutputFomatOption.Rqz in outputFormat:
|
||||
format_list.append(OutputFomatOption.Rqz_orb)
|
||||
if OutputFomatOption.orb in outputFormat or OutputFomatOption.Rlt_orb in outputFormat or OutputFomatOption.Rlt in outputFormat:
|
||||
format_list.append(OutputFomatOption.Rlt_orb)
|
||||
return sorted(format_list, reverse=True)
|
||||
|
||||
def __post_init__(self):
|
||||
self.outputFormats = self._output_format_list(self.outputFormats)
|
||||
|
||||
|
||||
# ===================================
|
||||
|
||||
@dataclass
|
||||
|
||||
Reference in New Issue
Block a user