@@ -52,8 +52,8 @@ class FilePart(SerializableAttrs):
52
52
"""
53
53
A part of a mirrored file
54
54
"""
55
- #: The part number, starting at 0 for the first part. Note that the S3 API
56
- #: numbers parts starting at 1.
55
+ #: The part number, starting at 0 for the first part, unlike S3 API part
56
+ #: numbers, which start at 1.
57
57
#:
58
58
index : int
59
59
@@ -64,7 +64,7 @@ class FilePart(SerializableAttrs):
64
64
#:
65
65
size : int
66
66
67
- #: Various quotas related to parts and part sizes
67
+ #: Various S3 quotas related to parts and part sizes
68
68
#: https://docs.aws.amazon.com/AmazonS3/latest/userguide/qfacts.html
69
69
#:
70
70
min_size : ClassVar [int ] = 5 * 1024 ** 2
@@ -102,14 +102,13 @@ def next(self, file: File) -> Self | None:
102
102
last part.
103
103
"""
104
104
assert file .size is not None , R ('File size unknown' , file )
105
- stop = self .offset + self .size
106
- if stop == file .size :
105
+ next_offset = self .offset + self .size
106
+ if next_offset == file .size :
107
107
return None
108
- elif 0 < stop < file .size :
109
- return attr .evolve (self ,
110
- index = self .index + 1 ,
111
- offset = stop ,
112
- size = min (self .size , file .size - stop ))
108
+ elif 0 < next_offset < file .size :
109
+ next_index = self .index + 1
110
+ next_size = min (self .size , file .size - next_offset )
111
+ return attr .evolve (self , index = next_index , offset = next_offset , size = next_size )
113
112
else :
114
113
assert False , R ('Part range exceeds file size' , self , file )
115
114
0 commit comments