From d7a599192d3d8eaaa8f3008881850de255ab7c0b Mon Sep 17 00:00:00 2001 From: cnavacch Date: Fri, 28 Feb 2020 16:26:55 +0100 Subject: [PATCH] fixed dictionary overwrite error --- src/geopathfinder/file_naming.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/geopathfinder/file_naming.py b/src/geopathfinder/file_naming.py index ebe73a7..de6f348 100644 --- a/src/geopathfinder/file_naming.py +++ b/src/geopathfinder/file_naming.py @@ -305,17 +305,21 @@ def __build_map(self, fields, fields_def): else: elem = fields[name] + fn_part_kwargs = dict() if 'delim' not in keys: - keys['delimiter'] = self.delimiter + fn_part_kwargs['delimiter'] = self.delimiter else: - keys['delimiter'] = keys['delim'] - del keys['delim'] + fn_part_kwargs['delimiter'] = keys['delim'] if 'pad' not in keys: - keys['pad'] = self.pad + fn_part_kwargs['pad'] = self.pad if 'len' in keys: - keys['length'] = keys['len'] - del keys['len'] - smart_fn_part = SmartFilenamePart(elem, **keys) + fn_part_kwargs['length'] = keys['len'] + if 'decoder' in keys: + fn_part_kwargs['decoder'] = keys['decoder'] + if 'encoder' in keys: + fn_part_kwargs['encoder'] = keys['encoder'] + + smart_fn_part = SmartFilenamePart(elem, **fn_part_kwargs) fn_map[name] = smart_fn_part return fn_map