mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-17 02:48:34 +03:00
[pylint] Fix referencing undefined variable 'shutil'
Let's just use the scope limited TemporaryDirectory() instead, so the temporary directory will be removed by Python automatically. pySim/filesystem.py:679:16: E0602: Undefined variable 'shutil' (undefined-variable) Change-Id: I4ea833fd79f4342c33899124379be509ba1e35ed
This commit is contained in:
@@ -659,8 +659,7 @@ class LinFixedEF(CardEF):
|
||||
def do_edit_record_decoded(self, opts):
|
||||
"""Edit the JSON representation of one record in an editor."""
|
||||
(orig_json, sw) = self._cmd.rs.read_record_dec(opts.record_nr)
|
||||
dirname = tempfile.mkdtemp(prefix='pysim_')
|
||||
try:
|
||||
with tempfile.TemporaryDirectory(prefix='pysim_') as dirname:
|
||||
filename = '%s/file' % dirname
|
||||
# write existing data as JSON to file
|
||||
with open(filename, 'w') as text_file:
|
||||
@@ -675,8 +674,6 @@ class LinFixedEF(CardEF):
|
||||
(data, sw) = self._cmd.rs.update_record_dec(opts.record_nr, edited_json)
|
||||
if data:
|
||||
self._cmd.poutput_json(data)
|
||||
finally:
|
||||
shutil.rmtree(dirname)
|
||||
|
||||
|
||||
def __init__(self, fid:str, sfid:str=None, name:str=None, desc:str=None,
|
||||
|
||||
Reference in New Issue
Block a user