diff options
author | Adam J. Stewart <ajstewart426@gmail.com> | 2023-02-16 22:06:12 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-16 23:06:12 -0600 |
commit | 603569e321013a1a63a637813c94c2834d0a0023 (patch) | |
tree | 366d3ba04458bb748c1f494e270401a56c10a7f2 /lib/spack/llnl/util | |
parent | b9358099488b6c9851e28ca912c8be246178974a (diff) | |
download | spack-603569e321013a1a63a637813c94c2834d0a0023.tar.gz spack-603569e321013a1a63a637813c94c2834d0a0023.tar.bz2 spack-603569e321013a1a63a637813c94c2834d0a0023.tar.xz spack-603569e321013a1a63a637813c94c2834d0a0023.zip |
Style: black 23, skip magic trailing comma (#35351)
* Style: black 23, skip magic trailing commas
* isort should use same line length as black
* Fix unused import
* Update version of black used in CI
* Update new packages
* Update new packages
Diffstat (limited to 'lib/spack/llnl/util')
-rw-r--r-- | lib/spack/llnl/util/filesystem.py | 3 | ||||
-rw-r--r-- | lib/spack/llnl/util/lang.py | 12 | ||||
-rw-r--r-- | lib/spack/llnl/util/tty/__init__.py | 1 | ||||
-rw-r--r-- | lib/spack/llnl/util/tty/log.py | 5 | ||||
-rw-r--r-- | lib/spack/llnl/util/tty/pty.py | 11 |
5 files changed, 7 insertions, 25 deletions
diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py index b39a17b52a..330ee35911 100644 --- a/lib/spack/llnl/util/filesystem.py +++ b/lib/spack/llnl/util/filesystem.py @@ -268,7 +268,6 @@ def filter_file( regex = re.escape(regex) filenames = path_to_os_path(*filenames) for filename in filenames: - msg = 'FILTER FILE: {0} [replacing "{1}"]' tty.debug(msg.format(filename, regex)) @@ -1220,7 +1219,6 @@ def traverse_tree( # target is relative to the link, then that may not resolve properly # relative to our cwd - see resolve_link_target_relative_to_the_link if os.path.isdir(source_child) and (follow_links or not os.path.islink(source_child)): - # When follow_nonexisting isn't set, don't descend into dirs # in source that do not exist in dest if follow_nonexisting or os.path.exists(dest_child): @@ -1662,7 +1660,6 @@ def find(root, files, recursive=True): @system_path_filter def _find_recursive(root, search_files): - # The variable here is **on purpose** a defaultdict. The idea is that # we want to poke the filesystem as little as possible, but still maintain # stability in the order of the answer. Thus we are recording each library diff --git a/lib/spack/llnl/util/lang.py b/lib/spack/llnl/util/lang.py index b03558b4f7..2f484cb874 100644 --- a/lib/spack/llnl/util/lang.py +++ b/lib/spack/llnl/util/lang.py @@ -198,7 +198,7 @@ def memoized(func): except TypeError as e: # TypeError is raised when indexing into a dict if the key is unhashable. raise UnhashableArguments( - "args + kwargs '{}' was not hashable for function '{}'".format(key, func.__name__), + "args + kwargs '{}' was not hashable for function '{}'".format(key, func.__name__) ) from e return _memoized_function @@ -237,6 +237,7 @@ def decorator_with_or_without_args(decorator): @decorator """ + # See https://stackoverflow.com/questions/653368 for more on this @functools.wraps(decorator) def new_dec(*args, **kwargs): @@ -990,8 +991,7 @@ def enum(**kwargs): def stable_partition( - input_iterable: Iterable, - predicate_fn: Callable[[Any], bool], + input_iterable: Iterable, predicate_fn: Callable[[Any], bool] ) -> Tuple[List[Any], List[Any]]: """Partition the input iterable according to a custom predicate. @@ -1104,11 +1104,7 @@ class GroupedExceptionForwarder(object): def __exit__(self, exc_type, exc_value, tb): if exc_value is not None: - self._handler._receive_forwarded( - self._context, - exc_value, - traceback.format_tb(tb), - ) + self._handler._receive_forwarded(self._context, exc_value, traceback.format_tb(tb)) # Suppress any exception from being re-raised: # https://docs.python.org/3/reference/datamodel.html#object.__exit__. diff --git a/lib/spack/llnl/util/tty/__init__.py b/lib/spack/llnl/util/tty/__init__.py index c723fe8051..ba9a627587 100644 --- a/lib/spack/llnl/util/tty/__init__.py +++ b/lib/spack/llnl/util/tty/__init__.py @@ -108,7 +108,6 @@ class SuppressOutput: """Class for disabling output in a scope using 'with' keyword""" def __init__(self, msg_enabled=True, warn_enabled=True, error_enabled=True): - self._msg_enabled_initial = _msg_enabled self._warn_enabled_initial = _warn_enabled self._error_enabled_initial = _error_enabled diff --git a/lib/spack/llnl/util/tty/log.py b/lib/spack/llnl/util/tty/log.py index 9a3ee46450..f2aed3d5b9 100644 --- a/lib/spack/llnl/util/tty/log.py +++ b/lib/spack/llnl/util/tty/log.py @@ -161,10 +161,7 @@ class keyboard_input(object): def _get_canon_echo_flags(self): """Get current termios canonical and echo settings.""" cfg = termios.tcgetattr(self.stream) - return ( - bool(cfg[3] & termios.ICANON), - bool(cfg[3] & termios.ECHO), - ) + return (bool(cfg[3] & termios.ICANON), bool(cfg[3] & termios.ECHO)) def _enable_keyboard_input(self): """Disable canonical input and echoing on ``self.stream``.""" diff --git a/lib/spack/llnl/util/tty/pty.py b/lib/spack/llnl/util/tty/pty.py index 1b5626f4ff..db959b3cff 100644 --- a/lib/spack/llnl/util/tty/pty.py +++ b/lib/spack/llnl/util/tty/pty.py @@ -77,10 +77,7 @@ class ProcessController(object): def get_canon_echo_attrs(self): """Get echo and canon attributes of the terminal of controller_fd.""" cfg = termios.tcgetattr(self.controller_fd) - return ( - bool(cfg[3] & termios.ICANON), - bool(cfg[3] & termios.ECHO), - ) + return (bool(cfg[3] & termios.ICANON), bool(cfg[3] & termios.ECHO)) def horizontal_line(self, name): """Labled horizontal line for debugging.""" @@ -92,11 +89,7 @@ class ProcessController(object): if self.debug: canon, echo = self.get_canon_echo_attrs() sys.stderr.write( - "canon: %s, echo: %s\n" - % ( - "on" if canon else "off", - "on" if echo else "off", - ) + "canon: %s, echo: %s\n" % ("on" if canon else "off", "on" if echo else "off") ) sys.stderr.write("input: %s\n" % self.input_on()) sys.stderr.write("bg: %s\n" % self.background()) |