/usr/lib/python2.6/site-packages/oslo_utils
Edit: /usr/lib/python2.6/site-packages/oslo_utils/fileutils.pyc (2985B)
Ñò
zDVc @ sÄ d d k Z d d k Z d d k Z d d k Z d d k Z d d k Z d d k l Z e i e ƒ Z
e i e i Be i
BZ e d „ Z e i d „ Z e i e d „ ƒ Z d d d d „ Z d S( iÿÿÿÿN( t excutilsc C sd y t i | | ƒ WnI t j
o= } | i t i j o t i i | ƒ p ‚ q[ q` ‚ n Xd S( s• Create a directory (and any ancestor directories required)
:param path: Directory to create
:param mode: Directory creation permissions
N( t ost makedirst OSErrort errnot EEXISTt patht isdir( R t modet exc( ( s8 /tmp/pip-build-lt8jXN/oslo.utils/oslo_utils/fileutils.pyt ensure_tree s c C sD y | | ƒ Wn/ t j
o# } | i t i j o ‚ q@ n Xd S( s Delete a file, but ignore file not found error.
:param path: File to delete
:param remove: Optional function to remove passed path
N( R R t ENOENT( R t removet e( ( s8 /tmp/pip-build-lt8jXN/oslo.utils/oslo_utils/fileutils.pyt delete_if_exists- s
c c sK y d VWn; t j
o/ t i ƒ i i ƒ z | | ƒ Wd QXn Xd S( sË Protect code that wants to operate on PATH atomically.
Any exception will cause PATH to be removed.
:param path: File to work with
:param remove: Optional function to remove passed path
N( t ExceptionR t save_and_reraise_exceptiont __exit__t __enter__( R R ( ( s8 /tmp/pip-build-lt8jXN/oslo.utils/oslo_utils/fileutils.pyt remove_path_on_error; s
t t tmpc C sb | o t | ƒ n t i d | d | d | ƒ \ } } z t i | | ƒ Wd t i | ƒ X| S( s5 Create temporary file or use existing file.
This util is needed for creating temporary file with
specified content, suffix and prefix. If path is not None,
it will be used for writing content. If the path doesn't
exist it'll be created.
:param content: content for temporary file.
:param path: same as parameter 'dir' for mkstemp
:param suffix: same as parameter 'suffix' for mkstemp
:param prefix: same as parameter 'prefix' for mkstemp
For example: it can be used in database tests for creating
configuration files.
t suffixt dirt prefixN( R
t tempfilet mkstempR t writet close( t contentR R R t fd( ( s8 /tmp/pip-build-lt8jXN/oslo.utils/oslo_utils/fileutils.pyt write_to_tempfileK s $( t
contextlibR t loggingR t statR t
oslo_utilsR t getLoggert __name__t LOGt S_IRWXUt S_IRWXGt S_IRWXOt
_DEFAULT_MODER
t unlinkR t contextmanagerR t NoneR ( ( ( s8 /tmp/pip-build-lt8jXN/oslo.utils/oslo_utils/fileutils.pyt
s