def check_starting(self): """determine starting date""" if self.options["starting"] and self.options["configdir"] is None: validate.starting(self.options["starting"]) return self.options["starting"] elif self.options["starting"] is None and self.options["configdir"]: return self.parse_configdir() else: try: return self.parse_configdir_file()[0]["end_date"] except: return self.options["starting"]
def parse_configdir_file(self): """determine configdir date""" key_date = [] files = os.listdir(self.options["configdir"]) if files: for onefile in files: if not onefile.startswith('.'): if "_" in onefile: key, end_date = onefile.split("_") validate.starting(end_date) key_date.append({"key_id": key, "end_date": end_date}) else: raise ValueError("Please use --starting to specify a starting date") return key_date