Loading noche/noche.py +10 −27 Original line number Diff line number Diff line Loading @@ -120,7 +120,7 @@ class Noche: val, comment = value, None val = self._parse(val) log.debug(f"{k:<11}: initializing with: {val} / {comment}") log.info(f"{k:<11}: initializing with: {val} / {comment}") self.header[k] = val, comment # Filling the header dict with format info too. self._header_dict[k] = (val, typ, fmt, comment) Loading Loading @@ -148,15 +148,14 @@ class Noche: # default val (_) and comment( __) are not used. _, typ, fmt, __ = self._header_dict[k.lower()] val = self._parse(val) #val = self._parse(val) if typ.strip() == "float": with custom_float(): if val: val = header_round(val, int(fmt)) elif val == 0.0: val = header_round(val, int(fmt)) else: if val == None: val = None self.header[k] = val Loading Loading @@ -654,7 +653,9 @@ class Noche: except AttributeError as e: pass if not val: if val == "": val = None elif val == None: val = None else: try: Loading @@ -676,21 +677,3 @@ class Noche: return val def _parse2(self, val, typ, fmt): type_mapping = { "bool": bool, "float": float, "int": int, "str": str, } if typ in type_mapping: the_type = type_mapping[typ.strip()] val = the_type(val) if typ.strip() == "float": val = header_round(val, fmt) else: log.error(f"Not supported type: {typ}") return val tests/test_core.py +2 −1 Original line number Diff line number Diff line Loading @@ -118,6 +118,7 @@ class TestNoche(unittest.TestCase): """ pass # Popolamento dinamico della classe TestNoche con i metodi di test for obs_name, file_path in TEST_FILES: test_func = create_test_for_file(obs_name, file_path) Loading Loading
noche/noche.py +10 −27 Original line number Diff line number Diff line Loading @@ -120,7 +120,7 @@ class Noche: val, comment = value, None val = self._parse(val) log.debug(f"{k:<11}: initializing with: {val} / {comment}") log.info(f"{k:<11}: initializing with: {val} / {comment}") self.header[k] = val, comment # Filling the header dict with format info too. self._header_dict[k] = (val, typ, fmt, comment) Loading Loading @@ -148,15 +148,14 @@ class Noche: # default val (_) and comment( __) are not used. _, typ, fmt, __ = self._header_dict[k.lower()] val = self._parse(val) #val = self._parse(val) if typ.strip() == "float": with custom_float(): if val: val = header_round(val, int(fmt)) elif val == 0.0: val = header_round(val, int(fmt)) else: if val == None: val = None self.header[k] = val Loading Loading @@ -654,7 +653,9 @@ class Noche: except AttributeError as e: pass if not val: if val == "": val = None elif val == None: val = None else: try: Loading @@ -676,21 +677,3 @@ class Noche: return val def _parse2(self, val, typ, fmt): type_mapping = { "bool": bool, "float": float, "int": int, "str": str, } if typ in type_mapping: the_type = type_mapping[typ.strip()] val = the_type(val) if typ.strip() == "float": val = header_round(val, fmt) else: log.error(f"Not supported type: {typ}") return val
tests/test_core.py +2 −1 Original line number Diff line number Diff line Loading @@ -118,6 +118,7 @@ class TestNoche(unittest.TestCase): """ pass # Popolamento dinamico della classe TestNoche con i metodi di test for obs_name, file_path in TEST_FILES: test_func = create_test_for_file(obs_name, file_path) Loading