class Directory: def __init__(self, name, source, destination, sourcebackup=None, destinationbackup=None): self.name = name self.source = source self.destination = destination self.sourcebackup = sourcebackup self.destinationbackup = destinationbackup @classmethod def from_config(cls, section): return cls(section.name.split()[1], section["SourceDirectory"], section["DestinationDirectory"], section.get("SourceBackup"), section.get("DestinationBackup"))