MCPcopy Index your code
hub / github.com/ronreiter/interactive-tutorials / validate

Method validate

suds/cache.py:243–256  ·  view source on GitHub ↗

Validate that the file has not expired based on the I{duration}. @param fn: The file name. @type fn: str

(self, fn)

Source from the content-addressed store, hash-verified

241 pass
242
243 def validate(self, fn):
244 """
245 Validate that the file has not expired based on the I{duration}.
246 @param fn: The file name.
247 @type fn: str
248 """
249 if self.duration[1] < 1:
250 return
251 created = dt.fromtimestamp(os.path.getctime(fn))
252 d = {self.duration[0]: self.duration[1]}
253 expired = created+timedelta(**d)
254 if expired < dt.now():
255 log.debug('%s expired, deleted', fn)
256 os.remove(fn)
257
258 def clear(self):
259 for fn in os.listdir(self.location):

Callers 1

getfMethod · 0.95

Calls 2

nowMethod · 0.80
removeMethod · 0.80

Tested by

no test coverage detected