MCPcopy Index your code
hub / github.com/RustPython/RustPython / getFilesToDelete

Method getFilesToDelete

Lib/logging/handlers.py:382–418  ·  view source on GitHub ↗

Determine the files to delete when rolling over. More specific than the earlier method, which just used glob.glob().

(self)

Source from the content-addressed store, hash-verified

380 return False
381
382 def getFilesToDelete(self):
383 """
384 Determine the files to delete when rolling over.
385
386 More specific than the earlier method, which just used glob.glob().
387 """
388 dirName, baseName = os.path.split(self.baseFilename)
389 fileNames = os.listdir(dirName)
390 result = []
391 if self.namer is None:
392 prefix = baseName + '.'
393 plen = len(prefix)
394 for fileName in fileNames:
395 if fileName[:plen] == prefix:
396 suffix = fileName[plen:]
397 if self.extMatch.fullmatch(suffix):
398 result.append(os.path.join(dirName, fileName))
399 else:
400 for fileName in fileNames:
401 # Our files could be just about anything after custom naming,
402 # but they should contain the datetime suffix.
403 # Try to find the datetime suffix in the file name and verify
404 # that the file name can be generated by this handler.
405 m = self.extMatch.search(fileName)
406 while m:
407 dfn = self.namer(self.baseFilename + "." + m[0])
408 if os.path.basename(dfn) == fileName:
409 result.append(os.path.join(dirName, fileName))
410 break
411 m = self.extMatch.search(fileName, m.start() + 1)
412
413 if len(result) < self.backupCount:
414 result = []
415 else:
416 result.sort()
417 result = result[:len(result) - self.backupCount]
418 return result
419
420 def doRollover(self):
421 """

Calls 11

lenFunction · 0.85
listdirMethod · 0.80
fullmatchMethod · 0.80
basenameMethod · 0.80
splitMethod · 0.45
appendMethod · 0.45
joinMethod · 0.45
searchMethod · 0.45
namerMethod · 0.45
startMethod · 0.45
sortMethod · 0.45