Handles range rule in postprocess

This commit is contained in:
Rick Ross 2024-01-19 13:42:58 -08:00
parent 693858b383
commit 08b4f63116
1 changed files with 13 additions and 17 deletions

View File

@ -208,11 +208,7 @@ class AFCMUniverseMapFile:
self.process_file(ufilename)
# Perform post-processing
if len(self.mosaic_postprocess) is not 0:
self.postprocessing()
else:
# copy self.cleaned_import_rows list to self.final_rows list
self.final_rows = self.cleaned_import_rows[:]
# Run final steps
self.write_final_file()
@ -222,21 +218,21 @@ class AFCMUniverseMapFile:
def postprocessing(self):
"""
postprocessing Performs actions for any postprocessing rules defined in the voterset map file
structure in the map file:
"postprocess": {
"range": {
"start": 0,
"end": 10000
}
}
"""
# structure in the map file
# "postprocess": {
# "range": {
# "start": 0,
# "end": 10000
# }
# }
# need to figure out how to handle rules in defined order
# get list of keys from "postprocess"
# if "range" exists,
# get "start" and "end" keys
# copy the range from cleaned_import_rows into final_rows
# if no range is defined, this copies the entire list from self.cleaned_import_rows
range = self.mosaic_postprocess.get('range', {})
self.final_rows = self.cleaned_import_rows[range.get('start', None):range.get('end', None)]
return