fix: enable pylint warnings (#36195)

* fix: enable pylint warnings
This commit is contained in:
Usama Sadiq
2025-01-30 17:15:33 +05:00
committed by GitHub
parent 166282b111
commit b6828cecaa
17 changed files with 39 additions and 62 deletions

View File

@@ -71,6 +71,5 @@ class Command(BaseCommand):
if error_keys:
msg = 'The following courses encountered errors and were not updated:\n'
for error_key in error_keys:
msg += f' - {error_key}\n'
msg += '\n'.join(f' - {error_key}' for error_key in error_keys)
logger.info(msg)

View File

@@ -51,16 +51,15 @@ class Command(BaseCommand):
tarball = tasks.create_export_tarball(library, library_key, {}, None)
except Exception as e:
raise CommandError(f'Failed to export "{library_key}" with "{e}"') # lint-amnesty, pylint: disable=raise-missing-from
else:
with tarball:
# Save generated archive with keyed filename
prefix, suffix, n = str(library_key).replace(':', '+'), '.tar.gz', 0
while os.path.exists(prefix + suffix):
n += 1
prefix = '{}_{}'.format(prefix.rsplit('_', 1)[0], n) if n > 1 else f'{prefix}_1'
filename = prefix + suffix
target = os.path.join(dest_path, filename)
tarball.file.seek(0)
with open(target, 'wb') as f:
shutil.copyfileobj(tarball.file, f)
print(f'Library "{library.location.library_key}" exported to "{target}"')
with tarball:
# Save generated archive with keyed filename
prefix, suffix, n = str(library_key).replace(':', '+'), '.tar.gz', 0
while os.path.exists(prefix + suffix):
n += 1
prefix = '{}_{}'.format(prefix.rsplit('_', 1)[0], n) if n > 1 else f'{prefix}_1'
filename = prefix + suffix
target = os.path.join(dest_path, filename)
tarball.file.seek(0)
with open(target, 'wb') as f:
shutil.copyfileobj(tarball.file, f)
print(f'Library "{library.location.library_key}" exported to "{target}"')