BOM-2477: pylint warnings lint-amnesty (#27585)
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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. """
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user