Skip to content

Commit 68cce51

Browse files
committed
Small fixes pointed out by pylint.
Signed-off-by: Chris Lalancette <clalancette@gmail.com>
1 parent 2732b6b commit 68cce51

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

pycdlib/pycdlib.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2609,9 +2609,7 @@ def __init__(self, total, progress_cb, progress_opaque):
26092609
def call(self, length):
26102610
# type: (int) -> None
26112611
"""Add the length to done, then call progress_cb if it is not None."""
2612-
self.done += length
2613-
if self.done > self.total:
2614-
self.done = self.total
2612+
self.done = min(self.done + length, self.total)
26152613
self._call(self.done, self.total, self.progress_opaque)
26162614

26172615
def finish(self):

pycdlib/utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,8 @@ def copy_data_yield(data_length, blocksize, infp, outfp):
106106
Nothing.
107107
"""
108108
left = data_length
109-
readsize = blocksize
110109
while left > 0:
111-
if left < readsize:
112-
readsize = left
110+
readsize = min(blocksize, left)
113111
data = infp.read(readsize)
114112
# We have seen ISOs in the wild (Tribes Vengeance 1of4.iso) that
115113
# lie about the size of their files, causing reads to fail (since

0 commit comments

Comments
 (0)