Compare commits
No commits in common. "08b4f631165a04fbe743c81214ab3b3c6578a3d7" and "18b6bee0a08902221c2146f51d7dc7a6cc6c6437" have entirely different histories.
08b4f63116
...
18b6bee0a0
|
|
@ -124,7 +124,6 @@ class AFCMUniverseMapFile:
|
||||||
self.mosaic_head = map_dict.get('mosaic', {})
|
self.mosaic_head = map_dict.get('mosaic', {})
|
||||||
self.metadata = map_dict.get('metadata', {})
|
self.metadata = map_dict.get('metadata', {})
|
||||||
self.mosaic_file_list = map_dict.get('files', {})
|
self.mosaic_file_list = map_dict.get('files', {})
|
||||||
self.mosaic_postprocess = map_dict.get('postprocess', {})
|
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
@ -139,8 +138,7 @@ class AFCMUniverseMapFile:
|
||||||
|
|
||||||
output_object = json.dumps({"mosaic": self.mosaic_head,
|
output_object = json.dumps({"mosaic": self.mosaic_head,
|
||||||
"metadata": self.metadata,
|
"metadata": self.metadata,
|
||||||
"files": self.mosaic_file_list,
|
"files": self.mosaic_file_list}, indent=4)
|
||||||
"postprocess": self.mosaic_postprocess}, indent=4)
|
|
||||||
|
|
||||||
with open(filename, 'w', encoding="UTF-8") as outfile:
|
with open(filename, 'w', encoding="UTF-8") as outfile:
|
||||||
outfile.write(output_object)
|
outfile.write(output_object)
|
||||||
|
|
@ -208,7 +206,11 @@ class AFCMUniverseMapFile:
|
||||||
self.process_file(ufilename)
|
self.process_file(ufilename)
|
||||||
|
|
||||||
# Perform post-processing
|
# Perform post-processing
|
||||||
|
if len(self.mosaic_postprocess) is not 0:
|
||||||
self.postprocessing()
|
self.postprocessing()
|
||||||
|
else:
|
||||||
|
# copy self.cleaned_import_rows list to self.final_rows list
|
||||||
|
self.final_rows = self.cleaned_import_rows[:]
|
||||||
|
|
||||||
# Run final steps
|
# Run final steps
|
||||||
self.write_final_file()
|
self.write_final_file()
|
||||||
|
|
@ -218,21 +220,21 @@ class AFCMUniverseMapFile:
|
||||||
def postprocessing(self):
|
def postprocessing(self):
|
||||||
"""
|
"""
|
||||||
postprocessing Performs actions for any postprocessing rules defined in the voterset map file
|
postprocessing Performs actions for any postprocessing rules defined in the voterset map file
|
||||||
|
|
||||||
structure in the map file:
|
|
||||||
"postprocess": {
|
|
||||||
"range": {
|
|
||||||
"start": 0,
|
|
||||||
"end": 10000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# need to figure out how to handle rules in defined order
|
# structure in the map file
|
||||||
|
# "postprocess": {
|
||||||
|
# "range": {
|
||||||
|
# "start": 0,
|
||||||
|
# "end": 10000
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
|
||||||
# if no range is defined, this copies the entire list from self.cleaned_import_rows
|
|
||||||
range = self.mosaic_postprocess.get('range', {})
|
# get list of keys from "postprocess"
|
||||||
self.final_rows = self.cleaned_import_rows[range.get('start', None):range.get('end', None)]
|
# if "range" exists,
|
||||||
|
# get "start" and "end" keys
|
||||||
|
# copy the range from cleaned_import_rows into final_rows
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue