From a99bdcad288a58a6a96f1a4d18e8a2898dd7a2e2 Mon Sep 17 00:00:00 2001 From: Emmanuel Ferdman Date: Tue, 6 May 2025 11:20:55 -0700 Subject: [PATCH] Resolve daemon warnings for threading methods Signed-off-by: Emmanuel Ferdman --- securedrop/pretty_bad_protocol/_meta.py | 8 ++++---- securedrop/pretty_bad_protocol/_util.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/securedrop/pretty_bad_protocol/_meta.py b/securedrop/pretty_bad_protocol/_meta.py index 3ef45166bb..8e202cb75c 100644 --- a/securedrop/pretty_bad_protocol/_meta.py +++ b/securedrop/pretty_bad_protocol/_meta.py @@ -388,7 +388,7 @@ def _homedir_setter(self, directory): # type: ignore[no-untyped-def] If unspecified, use $HOME/.config/python-gnupg. If specified, ensure that the ``directory`` does not contain various shell escape characters. If ``directory`` is not found, it will be automatically - created. Lastly, the ``direcory`` will be checked that the EUID has + created. Lastly, the ``directory`` will be checked that the EUID has read and write permissions for it. :param str directory: A relative or absolute path to the directory to @@ -491,7 +491,7 @@ def _check_sane_and_get_gpg_version(self): # type: ignore[no-untyped-def] except OSError: log.error( "Could neither invoke nor terminate a gpg process... " - "Are you sure you specified the corrent (and full) " + "Are you sure you specified the correct (and full) " "path to the gpg binary?" ) @@ -728,13 +728,13 @@ def _collect_output(self, process, result, writer=None, stdin=None): # type: ig """ stderr = codecs.getreader(self._encoding)(process.stderr) rr = threading.Thread(target=self._read_response, args=(stderr, result)) - rr.setDaemon(True) + rr.daemon = True log.debug("stderr reader: %r", rr) rr.start() stdout = process.stdout dr = threading.Thread(target=self._read_data, args=(stdout, result)) - dr.setDaemon(True) + dr.daemon = True log.debug("stdout reader: %r", dr) dr.start() diff --git a/securedrop/pretty_bad_protocol/_util.py b/securedrop/pretty_bad_protocol/_util.py index 6b1b556a59..0fe6f1ee55 100644 --- a/securedrop/pretty_bad_protocol/_util.py +++ b/securedrop/pretty_bad_protocol/_util.py @@ -100,7 +100,7 @@ def _copy_data(instream, outstream): # type: ignore[no-untyped-def] except TypeError as te: # XXX FIXME This appears to happen because # _threaded_copy_data() sometimes passes the `outstream` as an - # object with type <_io.BufferredWriter> and at other times + # object with type <_io.BufferedWriter> and at other times # with type . We hit the # following error when the `outstream` has type # . @@ -393,7 +393,7 @@ def _threaded_copy_data(instream, outstream): # type: ignore[no-untyped-def] :param file outstream: The file descriptor of a tmpfile to write to. """ copy_thread = threading.Thread(target=_copy_data, args=(instream, outstream)) - copy_thread.setDaemon(True) + copy_thread.daemon = True log.debug("%r, %r, %r", copy_thread, instream, outstream) copy_thread.start() return copy_thread @@ -406,7 +406,7 @@ def _which(executable, flags=os.X_OK, abspath_only=False, disallow_symlinks=Fals On newer versions of MS-Windows, the PATHEXT environment variable will be set to the list of file extensions for files considered executable. This - will normally include things like ".EXE". This fuction will also find files + will normally include things like ".EXE". This function will also find files with the given name ending with any of these extensions. On MS-Windows the only flag that has any meaning is os.F_OK. Any other