From bd554881c23ead6e0b46289cd17150eca0f2e76f Mon Sep 17 00:00:00 2001 From: Mel Hall <37735232+datamel@users.noreply.github.com> Date: Mon, 23 Nov 2020 13:17:20 +0000 Subject: [PATCH] remove redundant _dump_item method --- cylc/flow/suite_files.py | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/cylc/flow/suite_files.py b/cylc/flow/suite_files.py index 5925c90dd60..16536b66af4 100644 --- a/cylc/flow/suite_files.py +++ b/cylc/flow/suite_files.py @@ -598,28 +598,6 @@ def create_server_keys(keys, suite_srv_dir): os.umask(old_umask) -def _dump_item(path, item, value): - """Dump "value" to a file called "item" in the directory "path". - - 1. File permission should already be user-read-write-only on - creation by mkstemp. - 2. The combination of os.fsync and os.rename should guarantee - that we don't end up with an incomplete file. - """ - os.makedirs(path, exist_ok=True) - from tempfile import NamedTemporaryFile - handle = NamedTemporaryFile(prefix=item, dir=path, delete=False) - try: - handle.write(value.encode()) - except AttributeError: - handle.write(value) - os.fsync(handle.fileno()) - handle.close() - fname = os.path.join(path, item) - os.rename(handle.name, fname) - LOG.debug('Generated %s', fname) - - def get_suite_title(reg): """Return the the suite title without a full file parse