mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-13 05:06:53 +03:00
reverse on a a sorted list which was laerady reversed is rather pointless :)
This commit is contained in:
parent
a880bf460a
commit
31bfdbeb1a
|
@ -25,7 +25,7 @@ def list_dir_sorted_by_ctime(dir):
|
||||||
"""Return a list of files sorted by creation time"""
|
"""Return a list of files sorted by creation time"""
|
||||||
filepaths = [os.path.join(dir, file) for file in os.listdir(dir) if not file.startswith('.')]
|
filepaths = [os.path.join(dir, file) for file in os.listdir(dir) if not file.startswith('.')]
|
||||||
return [item[0] for item in sorted([(path, os.path.getctime(path)) for path in filepaths],
|
return [item[0] for item in sorted([(path, os.path.getctime(path)) for path in filepaths],
|
||||||
key=operator.itemgetter(1), reverse=True)]
|
key=operator.itemgetter(1), reverse=False)]
|
||||||
def remove_oldest_files(dir, max_files):
|
def remove_oldest_files(dir, max_files):
|
||||||
"""Remove the oldest files in a directory 'dir', leaving at most 'max_files' remaining.
|
"""Remove the oldest files in a directory 'dir', leaving at most 'max_files' remaining.
|
||||||
We use this to limit the number of resources in the sandbox."""
|
We use this to limit the number of resources in the sandbox."""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user