diff --git a/flathunt.py b/flathunt.py index 01880c6e..06683810 100644 --- a/flathunt.py +++ b/flathunt.py @@ -86,7 +86,7 @@ def launch_flat_hunt(config, heartbeat: Heartbeat): if config_handle is not None: new_config = Config(filename=config_handle.name, silent=True) - if None in (config.last_modified_time, new_config.last_modified_time): + if config.last_modified_time is None or new_config.last_modified_time is None: logger.warning("Could not compare last modification time of config file." "Keeping the old configuration") elif config.last_modified_time < new_config.last_modified_time: diff --git a/flathunter/config.py b/flathunter/config.py index 34b2f43f..bc110a44 100644 --- a/flathunter/config.py +++ b/flathunter/config.py @@ -108,7 +108,12 @@ def __init__(self, config=None): self.config = config self.__searchers__ = [] self.check_deprecated() - self.last_modified_time: Optional[float] = self.get_last_modified_time(self.config.get("filename")) + if filename := self.config.get("filename"): + self.last_modified_time: Optional[float] = self.get_last_modified_time(filename) + else: + self.last_modified_time: Optional[float] = None + + def __iter__(self): """Emulate dictionary"""