diff options
author | James Falcon <james.falcon@canonical.com> | 2021-12-15 20:16:38 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-15 19:16:38 -0700 |
commit | bae9b11da9ed7dd0b16fe5adeaf4774b7cc628cf (patch) | |
tree | 1fbb3269fc87e39832e3286ef42eefd2b23fcd44 /cloudinit/temp_utils.py | |
parent | 2bcf4fa972fde686c2e3141c58e640640b44dd00 (diff) | |
download | vyos-cloud-init-bae9b11da9ed7dd0b16fe5adeaf4774b7cc628cf.tar.gz vyos-cloud-init-bae9b11da9ed7dd0b16fe5adeaf4774b7cc628cf.zip |
Adopt Black and isort (SC-700) (#1157)
Applied Black and isort, fixed any linting issues, updated tox.ini
and CI.
Diffstat (limited to 'cloudinit/temp_utils.py')
-rw-r--r-- | cloudinit/temp_utils.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/cloudinit/temp_utils.py b/cloudinit/temp_utils.py index 346276ec..e23b6599 100644 --- a/cloudinit/temp_utils.py +++ b/cloudinit/temp_utils.py @@ -42,7 +42,7 @@ def _tempfile_dir_arg(odir=None, needs_exe=False): if os.getuid() == 0: tdir = _ROOT_TMPDIR else: - tdir = os.environ.get('TMPDIR', '/tmp') + tdir = os.environ.get("TMPDIR", "/tmp") if not os.path.isdir(tdir): os.makedirs(tdir) os.chmod(tdir, 0o1777) @@ -52,8 +52,9 @@ def _tempfile_dir_arg(odir=None, needs_exe=False): def ExtendedTemporaryFile(**kwargs): - kwargs['dir'] = _tempfile_dir_arg( - kwargs.pop('dir', None), kwargs.pop('needs_exe', False)) + kwargs["dir"] = _tempfile_dir_arg( + kwargs.pop("dir", None), kwargs.pop("needs_exe", False) + ) fh = tempfile.NamedTemporaryFile(**kwargs) # Replace its unlink with a quiet version # that does not raise errors when the @@ -76,7 +77,7 @@ def ExtendedTemporaryFile(**kwargs): def unlink_now(): fh.unlink(fh.name) - setattr(fh, 'unlink_now', unlink_now) + setattr(fh, "unlink_now", unlink_now) return fh @@ -93,14 +94,17 @@ def tempdir(rmtree_ignore_errors=False, **kwargs): def mkdtemp(**kwargs): - kwargs['dir'] = _tempfile_dir_arg( - kwargs.pop('dir', None), kwargs.pop('needs_exe', False)) + kwargs["dir"] = _tempfile_dir_arg( + kwargs.pop("dir", None), kwargs.pop("needs_exe", False) + ) return tempfile.mkdtemp(**kwargs) def mkstemp(**kwargs): - kwargs['dir'] = _tempfile_dir_arg( - kwargs.pop('dir', None), kwargs.pop('needs_exe', False)) + kwargs["dir"] = _tempfile_dir_arg( + kwargs.pop("dir", None), kwargs.pop("needs_exe", False) + ) return tempfile.mkstemp(**kwargs) + # vi: ts=4 expandtab |