mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add int() calls in some places where they might be needed in the translation of %d to f-string
This commit is contained in:
parent
18d57d6298
commit
4d6066163d
@ -194,7 +194,7 @@ def compress_readable_output(src_file, compress_level=6):
|
||||
def get_range_parts(ranges, content_type, content_length): # {{{
|
||||
|
||||
def part(r):
|
||||
ans = [f'--{MULTIPART_SEPARATOR}', f'Content-Range: bytes {r.start}-{r.stop}/{content_length}']
|
||||
ans = [f'--{MULTIPART_SEPARATOR}', f'Content-Range: bytes {int(r.start)}-{int(r.stop)}/{content_length}']
|
||||
if content_type:
|
||||
ans.append(f'Content-Type: {content_type}')
|
||||
ans.append('')
|
||||
@ -719,7 +719,7 @@ class HTTPConnection(HTTPRequest):
|
||||
if len(ranges) == 1:
|
||||
r = ranges[0]
|
||||
outheaders.set('Content-Length', f'{r.size}', replace_all=True)
|
||||
outheaders.set('Content-Range', f'bytes {r.start}-{r.stop}/{output.content_length}', replace_all=True)
|
||||
outheaders.set('Content-Range', f'bytes {int(r.start)}-{int(r.stop)}/{output.content_length}', replace_all=True)
|
||||
output.ranges = r
|
||||
else:
|
||||
range_parts = get_range_parts(ranges, outheaders.get('Content-Type'), output.content_length)
|
||||
|
@ -318,7 +318,7 @@ class RotatingStream:
|
||||
for i in range(self.history - 1, 0, -1):
|
||||
src, dest = f'{self.filename}.{i}', f'{self.filename}.{i + 1}'
|
||||
self.rename(src, dest)
|
||||
self.rename(self.filename, f'{self.filename}.{1}')
|
||||
self.rename(self.filename, f'{self.filename}.1')
|
||||
self.set_output()
|
||||
|
||||
def clear(self):
|
||||
|
@ -430,7 +430,7 @@ class SchedulerConfig:
|
||||
text = '%d:%d:%d'%schedule
|
||||
elif typ in ('days_of_week', 'days_of_month'):
|
||||
dw = ','.join(map(str, map(int, schedule[0])))
|
||||
text = f'{dw}:{schedule[1]}:{schedule[2]}'
|
||||
text = f'{dw}:{int(schedule[1])}:{int(schedule[2])}'
|
||||
else:
|
||||
raise ValueError(f'Unknown schedule type: {typ!r}')
|
||||
s.text = text
|
||||
|
Loading…
x
Reference in New Issue
Block a user