Compare commits

..

4 Commits

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.metadata = map_dict.get('metadata', {})
self.mosaic_file_list = map_dict.get('files', {})
self.mosaic_postprocess = map_dict.get('postprocess', {})
return None
@ -138,7 +139,8 @@ class AFCMUniverseMapFile:
output_object = json.dumps({"mosaic": self.mosaic_head,
"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:
outfile.write(output_object)
@ -206,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()
@ -220,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

View File

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