class Resource(object): def __init__(self, smvApp, fqn): self.dsr = DataSetRepo(smvApp) self.fqn = fqn def __enter__(self): return self.dsr.loadDataSet(self.fqn) def __exit__(self, type, value, traceback): pass
class Resource(object): def __init__(self, smvApp, path, fqn): self.dsr = DataSetRepo(smvApp) self.path = path self.fqn = fqn def __enter__(self): sys.path.insert(1, self.path) return self.dsr.loadDataSet(self.fqn) def __exit__(self, type, value, traceback): sys.path.remove(self.path)
class Resource(object): def __init__(self, smvApp, path, fqn): self.dsr = DataSetRepo(smvApp) self.path = path self.fqn = fqn def __enter__(self): sys.path.insert(1,self.path) return self.dsr.loadDataSet(self.fqn) def __exit__(self, type, value, traceback): sys.path.remove(self.path)
class Resource(object): def __init__(self, smvApp, target_path, fqn): self.smvApp = smvApp self.dsr = DataSetRepo(smvApp) self.orig_path = os.getcwd() self.target_path = target_path self.fqn = fqn def __enter__(self): self.smvApp.setAppDir(self.target_path) return self.dsr.loadDataSet(self.fqn) def __exit__(self, type, value, traceback): self.smvApp.setAppDir(self.orig_path)
def __enter__(self): self.smvApp.setAppDir(self.target_path) dsr = DataSetRepo(self.smvApp) return dsr.loadDataSet(self.fqn)