import os
from datetime import datetime
from .constant_version import ConstantVersion
[docs]class ConvenientVersion(ConstantVersion):
def __init__(self):
super(ConvenientVersion, self).__init__()
self.raw_data_location = ""
[docs]class Now(ConvenientVersion):
def __init__(self, end=None):
super(Now, self).__init__()
now = datetime.now()
self.begin_at = now
self.begin_validity_at = now
self.end_validity_at = end
[docs]class Timespan(ConvenientVersion):
def __init__(self, start, end=None):
super(Timespan, self).__init__()
self.begin_at = start
self.begin_validity_at = start
self.end_validity_at = end
[docs]class FromFile(ConvenientVersion):
def __init__(self, file_path, end=None):
super(FromFile, self).__init__()
timest = os.stat(file_path).st_ctime
self.begin_at = datetime.fromtimestamp(timest)
self.begin_validity_at = datetime.fromtimestamp(timest)
self.end_validity_at = end
[docs]class Versions:
Now = Now
FromFile = FromFile
Timespan = Timespan