BOM-2477: pylint warnings lint-amnesty (#27585)

This commit is contained in:
Usama Sadiq
2021-05-11 17:22:40 +05:00
committed by GitHub
parent 156a1a80ee
commit 4f4be6538a
52 changed files with 67 additions and 69 deletions

View File

@@ -47,7 +47,7 @@ class Command(BaseCommand):
course_dir = data_root / subdir
# Extract library archive
tar_file = tarfile.open(archive_path)
tar_file = tarfile.open(archive_path) # lint-amnesty, pylint: disable=consider-using-with
try:
safetar_extractall(tar_file, course_dir.encode('utf-8'))
except SuspiciousOperation as exc:

View File

@@ -336,7 +336,7 @@ def create_export_tarball(course_module, course_key, context, status=None):
Updates the context with any error information if applicable.
"""
name = course_module.url_name
export_file = NamedTemporaryFile(prefix=name + '.', suffix=".tar.gz")
export_file = NamedTemporaryFile(prefix=name + '.', suffix=".tar.gz") # lint-amnesty, pylint: disable=consider-using-with
root_dir = path(mkdtemp())
try:
@@ -595,7 +595,7 @@ def import_olx(self, user_id, course_key_string, archive_path, archive_name, lan
# try-finally block for proper clean up after receiving file.
try:
tar_file = tarfile.open(temp_filepath)
tar_file = tarfile.open(temp_filepath) # lint-amnesty, pylint: disable=consider-using-with
try:
safetar_extractall(tar_file, (course_dir + '/'))
except SuspiciousOperation as exc:

View File

@@ -812,7 +812,7 @@ class TestGetTranscript(SharedModuleStoreTestCase):
"""
Create srt file.
"""
srt_file = tempfile.NamedTemporaryFile(suffix=".srt")
srt_file = tempfile.NamedTemporaryFile(suffix=".srt") # lint-amnesty, pylint: disable=consider-using-with
srt_file.content_type = transcripts_utils.Transcript.SRT
srt_file.write(content)
srt_file.seek(0)

View File

@@ -720,7 +720,7 @@ class ExportTestCase(CourseTestCase):
resp_content += item
buff = BytesIO(resp_content)
return tarfile.open(fileobj=buff)
return tarfile.open(fileobj=buff) # lint-amnesty, pylint: disable=consider-using-with
def _verify_export_succeeded(self, resp):
""" Export success helper method. """

View File

@@ -183,7 +183,7 @@ class TestUploadTranscripts(BaseTranscripts):
"""
Setup a transcript file with suffix and content.
"""
transcript_file = tempfile.NamedTemporaryFile(suffix=suffix)
transcript_file = tempfile.NamedTemporaryFile(suffix=suffix) # lint-amnesty, pylint: disable=consider-using-with
wrapped_content = textwrap.dedent(content)
if include_bom:
wrapped_content = wrapped_content.encode('utf-8-sig')