diff options
author | Zuul <zuul@review.openstack.org> | 2018-01-04 07:08:43 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2018-01-04 07:08:43 +0000 |
commit | 6b347590667d847c13c25a6c4746041cc04d3384 (patch) | |
tree | cf8f9b37bf8cb417064355bb8f846af324c58bbf | |
parent | e3e0bd0e7d57a7372df8d8ef3aef0280f463ae77 (diff) | |
parent | 11feb68eb3a814f507ba72b825eb7c4f4c1234f0 (diff) | |
download | oslo-utils-6b347590667d847c13c25a6c4746041cc04d3384.tar.gz |
Merge "improve docstring for last_bytes()"
-rw-r--r-- | oslo_utils/fileutils.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/oslo_utils/fileutils.py b/oslo_utils/fileutils.py index 3b0cdfc..e2b0917 100644 --- a/oslo_utils/fileutils.py +++ b/oslo_utils/fileutils.py @@ -127,12 +127,19 @@ def compute_file_checksum(path, read_chunksize=65536, algorithm='sha256'): def last_bytes(path, num): - """Return num bytes from the end of the file, and unread byte count. + """Return num bytes from the end of the file and unread byte count. + + Returns a tuple containing some content from the file and the + number of bytes that appear in the file before the point at which + reading started. The content will be at most ``num`` bytes, taken + from the end of the file. If the file is smaller than ``num`` + bytes the entire content of the file is returned. :param path: The file path to read :param num: The number of bytes to return :returns: (data, unread_bytes) + """ with open(path, 'rb') as fp: |