Utilities¶
Functionality without a better home is kept in pytiger.utils.
pytiger.utils.decorators – decorator functions¶
- class
pytiger.utils.decorators.cached_property(func, name=None)[source]¶New in version 1.0.0.
Decorator that converts a method with a single self argument into a property cached on the instance.
Optional
nameargument allows you to make cached properties of other methods. (e.g. url = cached_property(get_absolute_url, name=’url’) )
pytiger.utils.filesystem – filesystem utilities¶
A collection of useful file system utilities
pytiger.utils.filesystem.get_file_age(filename)[source]¶Returns age of file in seconds
Parameters: filename (str) – file to inspect New in version 1.0.0.
pytiger.utils.filesystem.touch(filename, create_dirs=False, timestamp=None)[source]¶Opens and closes filename, similarly to touch(1). If filename is a nested path and create_dirs is true, all intermediate directories will be created.
Parameters:
- filename (str) – path to the file to touch
- create_dirs (bool) – create all parent directories if necessary
- timestamp (int) – UNIX timestamp for mtime and atime
New in version 1.0.0.