From 650befed37eadcaea735673638d5475fa957ca7e Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Mon, 8 Aug 2022 13:18:28 -0700 Subject: Add missing space after keywords. (#78480) Also remove unnecessary parenthesis. --- lib/ansible/cli/__init__.py | 4 ++-- lib/ansible/executor/task_executor.py | 2 +- lib/ansible/modules/copy.py | 8 ++++---- lib/ansible/modules/find.py | 2 +- lib/ansible/parsing/splitter.py | 2 +- lib/ansible/plugins/action/pause.py | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/ansible/cli/__init__.py b/lib/ansible/cli/__init__.py index da62cfe283..15ab5fe17e 100644 --- a/lib/ansible/cli/__init__.py +++ b/lib/ansible/cli/__init__.py @@ -455,8 +455,8 @@ class CLI(ABC): try: options = self.parser.parse_args(self.args[1:]) - except SystemExit as e: - if(e.code != 0): + except SystemExit as ex: + if ex.code != 0: self.parser.exit(status=2, message=" \n%s" % self.parser.format_help()) raise options = self.post_process_args(options) diff --git a/lib/ansible/executor/task_executor.py b/lib/ansible/executor/task_executor.py index fb55dae772..8cdf51bb5c 100644 --- a/lib/ansible/executor/task_executor.py +++ b/lib/ansible/executor/task_executor.py @@ -1069,7 +1069,7 @@ class TaskExecutor: task_keys['password'] = self._play_context.password # Prevent task retries from overriding connection retries - del(task_keys['retries']) + del task_keys['retries'] # set options with 'templated vars' specific to this plugin and dependent ones self._connection.set_options(task_keys=task_keys, var_options=options) diff --git a/lib/ansible/modules/copy.py b/lib/ansible/modules/copy.py index ca6ae0df0e..7fed4a5c8f 100644 --- a/lib/ansible/modules/copy.py +++ b/lib/ansible/modules/copy.py @@ -469,7 +469,7 @@ def copy_left_only(src, dest, module): b_dest_item_path = to_bytes(dest_item_path, errors='surrogate_or_strict') if os.path.islink(b_src_item_path) and os.path.isdir(b_src_item_path) and local_follow is True: - shutil.copytree(b_src_item_path, b_dest_item_path, symlinks=not(local_follow)) + shutil.copytree(b_src_item_path, b_dest_item_path, symlinks=not local_follow) chown_recursive(b_dest_item_path, module) if os.path.islink(b_src_item_path) and os.path.isdir(b_src_item_path) and local_follow is False: @@ -497,7 +497,7 @@ def copy_left_only(src, dest, module): module.set_group_if_different(b_dest_item_path, group, False) if not os.path.islink(b_src_item_path) and os.path.isdir(b_src_item_path): - shutil.copytree(b_src_item_path, b_dest_item_path, symlinks=not(local_follow)) + shutil.copytree(b_src_item_path, b_dest_item_path, symlinks=not local_follow) chown_recursive(b_dest_item_path, module) changed = True @@ -766,7 +766,7 @@ def main(): b_dest = to_bytes(os.path.join(b_dest, b_basename), errors='surrogate_or_strict') b_src = to_bytes(os.path.join(module.params['src'], ""), errors='surrogate_or_strict') if not module.check_mode: - shutil.copytree(b_src, b_dest, symlinks=not(local_follow)) + shutil.copytree(b_src, b_dest, symlinks=not local_follow) chown_recursive(dest, module) changed = True @@ -775,7 +775,7 @@ def main(): b_dest = to_bytes(os.path.join(b_dest, b_basename), errors='surrogate_or_strict') b_src = to_bytes(os.path.join(module.params['src'], ""), errors='surrogate_or_strict') if not module.check_mode and not os.path.exists(b_dest): - shutil.copytree(b_src, b_dest, symlinks=not(local_follow)) + shutil.copytree(b_src, b_dest, symlinks=not local_follow) changed = True chown_recursive(dest, module) if module.check_mode and not os.path.exists(b_dest): diff --git a/lib/ansible/modules/find.py b/lib/ansible/modules/find.py index eb9c8aa839..788eb71ded 100644 --- a/lib/ansible/modules/find.py +++ b/lib/ansible/modules/find.py @@ -468,7 +468,7 @@ def main(): depth = int(fsname.count(os.path.sep)) - int(wpath.count(os.path.sep)) + 1 if depth > params['depth']: # Empty the list used by os.walk to avoid traversing deeper unnecessarily - del(dirs[:]) + del dirs[:] continue if os.path.basename(fsname).startswith('.') and not params['hidden']: continue diff --git a/lib/ansible/parsing/splitter.py b/lib/ansible/parsing/splitter.py index ab7df04db7..b68444fef7 100644 --- a/lib/ansible/parsing/splitter.py +++ b/lib/ansible/parsing/splitter.py @@ -229,7 +229,7 @@ def split_args(args): # to the end of the list, since we'll tack on more to it later # otherwise, if we're inside any jinja2 block, inside quotes, or we were # inside quotes (but aren't now) concat this token to the last param - if inside_quotes and not was_inside_quotes and not(print_depth or block_depth or comment_depth): + if inside_quotes and not was_inside_quotes and not (print_depth or block_depth or comment_depth): params.append(token) appended = True elif print_depth or block_depth or comment_depth or inside_quotes or was_inside_quotes: diff --git a/lib/ansible/plugins/action/pause.py b/lib/ansible/plugins/action/pause.py index 5b6f9016f6..4c98cbbff5 100644 --- a/lib/ansible/plugins/action/pause.py +++ b/lib/ansible/plugins/action/pause.py @@ -286,7 +286,7 @@ class ActionModule(ActionBase): finally: # cleanup and save some information # restore the old settings for the duped stdin stdin_fd - if not(None in (stdin_fd, old_settings)) and isatty(stdin_fd): + if not (None in (stdin_fd, old_settings)) and isatty(stdin_fd): termios.tcsetattr(stdin_fd, termios.TCSADRAIN, old_settings) duration = time.time() - start -- cgit v1.2.1