Skip to main content

convenience functions and classes for files and filenames/pathnames

Project description

  • Pathname: subclass of str with convenience properties useful for pathnames

  • BackedFile: a RawIOBase implementation that uses a backing file for initial data and writes new data to a front file

  • SharedAppendFile: a base class to share a modifiable file between multiple users

  • SharedAppendLines: a subclass of SharedAppendFile which shares updates in units oftext lines

  • FileState: a signature object for a file state derived from os.stat or os.lstat or os.fstat; has .mtime, .size, .dev and .ino attributes

  • Tee: an output file-like object for copying data to multiple output files

  • abspath_from_file: restore relative path with respect to another path, as for an include filename

  • chunks_of: generator yielding text or data from an open file until EOF

  • lines_of: generator yielding lines of text from an open file until EOF

  • compare: compare two filenames or file-like objects for content equality

  • @file_property: decorator for a caching property whose value is recomputed if the file changes

  • make_file_property: constructor for variants on @file_property

  • @files_property: decorator for a caching property whose value is recomputed if any of a set of files changes

  • make_files_property: constructor for variants on @files_property

  • lockfile: context manager to take a lock file around an operation, such as access to a shared file

  • shortpath: return path with the first matching leading prefix replaced with short form such as “~/” or “$LOGDIR/” etc

  • longpath: the inverse of shortpath

  • mkdirn: create a new directory named path+sep+n, where n exceeds any name already present

  • poll_file: watch a file for modification by polling its state as obtained by FileState

  • rewrite: rewrite the content of a file if changed; with an assortment of modes

  • rewrite_cmgr: a context manager made from rewrite()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cs.fileutils-20160828.tar.gz (15.3 kB view details)

Uploaded Source

File details

Details for the file cs.fileutils-20160828.tar.gz.

File metadata

File hashes

Hashes for cs.fileutils-20160828.tar.gz
Algorithm Hash digest
SHA256 b1c899ff3cb1a05a8ddb327b126da5bb139460083905dab7e74d7199f049de7d
MD5 f8509570fbb01404d266b541aa49ddc1
BLAKE2b-256 93b04b5277e9254fcaf1dd72db6025df101b1e912a230e38cc9cfea9e407e02d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page