add_mapping_range #1

Merged
eross merged 3 commits from add_mapping_range into master 2024-01-19 21:59:36 +00:00
2 changed files with 17 additions and 19 deletions

View File

@ -124,6 +124,7 @@ 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
@ -138,7 +139,8 @@ 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}, indent=4) "files": self.mosaic_file_list,
"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)
@ -206,11 +208,7 @@ 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()
@ -220,21 +218,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
}
}
""" """
# structure in the map file # need to figure out how to handle rules in defined order
# "postprocess": {
# "range": {
# "start": 0,
# "end": 10000
# }
# }
# if no range is defined, this copies the entire list from self.cleaned_import_rows
# get list of keys from "postprocess" range = self.mosaic_postprocess.get('range', {})
# if "range" exists, self.final_rows = self.cleaned_import_rows[range.get('start', None):range.get('end', None)]
# get "start" and "end" keys
# copy the range from cleaned_import_rows into final_rows
return return

View File

@ -9,7 +9,7 @@ with open('README.md', 'r') as f:
setup( setup(
name='lib_afc_mosaic', name='lib_afc_mosaic',
version='0.1.8', version='0.1.9',
author='', author='',
author_email='', author_email='',
description='', description='',