boltons/docs/fileutils.rst

58 lines
1.6 KiB
ReStructuredText
Raw Permalink Normal View History

``fileutils`` - Filesystem helpers
==================================
2015-03-22 00:12:50 +00:00
.. automodule:: boltons.fileutils
2015-04-05 22:01:20 +00:00
Creating, Finding, and Copying
------------------------------
Python's :mod:`os`, :mod:`os.path`, and :mod:`shutil` modules provide
good coverage of file wrangling fundamentals, and these functions help
2015-04-05 22:01:20 +00:00
close a few remaining gaps.
.. autofunction:: boltons.fileutils.mkdir_p
.. autofunction:: boltons.fileutils.iter_find_files
.. autofunction:: boltons.fileutils.copytree
Atomic File Saving
------------------
Ideally, the road to success should never put current progress at
2017-03-15 16:45:34 +00:00
risk. And that's exactly why :func:`atomic_save` and
:class:`AtomicSaver` exist.
Using the same API as a writable file, all output is saved to a
temporary file, and when the file is closed, the old file is replaced
by the new file in a single system call, portable across all major
operating systems. No more partially-written or partially-overwritten
files.
2015-04-05 22:01:20 +00:00
.. autofunction:: boltons.fileutils.atomic_save
.. autoclass:: boltons.fileutils.AtomicSaver
2016-02-24 10:36:17 +00:00
.. autofunction:: boltons.fileutils.atomic_rename
.. autofunction:: boltons.fileutils.replace
2015-04-05 22:01:20 +00:00
File Permissions
----------------
Linux, BSD, Mac OS, and other Unix-like operating systems all share a
simple, foundational file permission structure that is commonly
complicit in accidental access denial, as well as file
leakage. :class:`FilePerms` was built to increase clarity and cut down
on permission-related accidents when working with files from Python
code.
.. autoclass:: boltons.fileutils.FilePerms
2016-02-24 10:36:17 +00:00
Miscellaneous
-------------
.. autoclass:: boltons.fileutils.DummyFile