updater: remove magic number

Remove the magic number, a whence value of 2 for file.seek(), and instead
use the io.SEEK_END constant from the io module.

Signed-off-by: Joshua Lock <jlock@vmware.com>
This commit is contained in:
Joshua Lock 2021-03-02 12:30:33 +00:00
parent 16bd3c2358
commit 8ee8e862af

View file

@ -128,6 +128,7 @@
import fnmatch
import copy
import warnings
import io
import tuf
import tuf.download
@ -1245,9 +1246,7 @@ def _check_file_length(self, file_object, trusted_file_length):
None.
"""
# seek to the end of the file; that is offset 0 from the end of the file,
# represented by a whence value of 2
file_object.seek(0, 2)
file_object.seek(0, io.SEEK_END)
observed_length = file_object.tell()
# Return and log a message if the length 'file_object' is equal to