Changeset 343:2258c2a6dbae


Ignore:
Timestamp:
04/09/11 11:08:08 (12 years ago)
Author:
Jeremy Thurgood <firxen@…>
Branch:
default
Phase:
public
Message:

Cache get_files() stuff to avoid unnecessary filesystem operations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • skaapsteker/data.py

    r205 r343  
    3434
    3535
     36DIR_LISTS = {}
     37
    3638def get_files(folder):
    3739    """Return a sorted list of files in the given directory, with the directory stripped"""
    38     return sorted(os.listdir(filepath(folder)))
     40    if folder not in DIR_LISTS:
     41        DIR_LISTS[folder] = sorted(os.listdir(filepath(folder)))
     42    return DIR_LISTS[folder]
    3943
    4044
Note: See TracChangeset for help on using the changeset viewer.