@@ -1728,12 +1728,11 @@ def complete_users() -> List[str]:
17281728 return complete_users ()
17291729
17301730 # Otherwise expand the user dir
1731- else :
1732- search_str = os .path .expanduser (search_str )
1731+ search_str = os .path .expanduser (search_str )
17331732
1734- # Get what we need to restore the original tilde path later
1735- orig_tilde_path = text [:sep_index ]
1736- expanded_tilde_path = os .path .expanduser (orig_tilde_path )
1733+ # Get what we need to restore the original tilde path later
1734+ orig_tilde_path = text [:sep_index ]
1735+ expanded_tilde_path = os .path .expanduser (orig_tilde_path )
17371736
17381737 # If the search text does not have a directory, then use the cwd
17391738 elif not os .path .dirname (text ):
@@ -1804,10 +1803,9 @@ def shell_cmd_complete(self, text: str, line: str, begidx: int, endidx: int, *,
18041803 return utils .get_exes_in_path (text )
18051804
18061805 # Otherwise look for executables in the given path
1807- else :
1808- return self .path_complete (
1809- text , line , begidx , endidx , path_filter = lambda path : os .path .isdir (path ) or os .access (path , os .X_OK )
1810- )
1806+ return self .path_complete (
1807+ text , line , begidx , endidx , path_filter = lambda path : os .path .isdir (path ) or os .access (path , os .X_OK )
1808+ )
18111809
18121810 def _redirect_complete (self , text : str , line : str , begidx : int , endidx : int , compfunc : CompleterFunc ) -> List [str ]:
18131811 """Called by complete() as the first tab completion function for all commands
@@ -1878,12 +1876,12 @@ def _redirect_complete(self, text: str, line: str, begidx: int, endidx: int, com
18781876 if do_shell_completion :
18791877 return self .shell_cmd_complete (text , line , begidx , endidx )
18801878
1881- elif do_path_completion :
1879+ if do_path_completion :
18821880 return self .path_complete (text , line , begidx , endidx )
18831881
18841882 # If there were redirection strings anywhere on the command line, then we
18851883 # are no longer tab completing for the current command
1886- elif has_redirection :
1884+ if has_redirection :
18871885 return []
18881886
18891887 # Call the command's completer function
@@ -2771,9 +2769,8 @@ def combine_rl_history(statement: Statement) -> None:
27712769
27722770 if not statement .command :
27732771 raise EmptyStatement
2774- else :
2775- # If necessary, update history with completed multiline command.
2776- combine_rl_history (statement )
2772+ # If necessary, update history with completed multiline command.
2773+ combine_rl_history (statement )
27772774
27782775 return statement
27792776
@@ -2940,10 +2937,9 @@ def _redirect_output(self, statement: Statement) -> utils.RedirectionSavedState:
29402937 subproc_stdin .close ()
29412938 new_stdout .close ()
29422939 raise RedirectionError (f'Pipe process exited with code { proc .returncode } before command could run' )
2943- else :
2944- redir_saved_state .redirecting = True # type: ignore[unreachable]
2945- cmd_pipe_proc_reader = utils .ProcReader (proc , cast (TextIO , self .stdout ), sys .stderr )
2946- sys .stdout = self .stdout = new_stdout
2940+ redir_saved_state .redirecting = True # type: ignore[unreachable]
2941+ cmd_pipe_proc_reader = utils .ProcReader (proc , cast (TextIO , self .stdout ), sys .stderr )
2942+ sys .stdout = self .stdout = new_stdout
29472943
29482944 elif statement .output :
29492945 if statement .output_to :
@@ -3080,14 +3076,13 @@ def default(self, statement: Statement) -> Optional[bool]: # type: ignore[overr
30803076 self .history .append (statement )
30813077
30823078 return self .do_shell (statement .command_and_args )
3083- else :
3084- err_msg = self .default_error .format (statement .command )
3085- if self .suggest_similar_command and (suggested_command := self ._suggest_similar_command (statement .command )):
3086- err_msg += f"\n { self .default_suggestion_message .format (suggested_command )} "
3079+ err_msg = self .default_error .format (statement .command )
3080+ if self .suggest_similar_command and (suggested_command := self ._suggest_similar_command (statement .command )):
3081+ err_msg += f"\n { self .default_suggestion_message .format (suggested_command )} "
30873082
3088- # Set apply_style to False so styles for default_error and default_suggestion_message are not overridden
3089- self .perror (err_msg , apply_style = False )
3090- return None
3083+ # Set apply_style to False so styles for default_error and default_suggestion_message are not overridden
3084+ self .perror (err_msg , apply_style = False )
3085+ return None
30913086
30923087 def _suggest_similar_command (self , command : str ) -> Optional [str ]:
30933088 return suggest_similar (command , self .get_visible_commands ())
@@ -5092,8 +5087,7 @@ def _current_script_dir(self) -> Optional[str]:
50925087 """Accessor to get the current script directory from the _script_dir LIFO queue."""
50935088 if self ._script_dir :
50945089 return self ._script_dir [- 1 ]
5095- else :
5096- return None
5090+ return None
50975091
50985092 run_script_description = (
50995093 "Run commands in script file that is encoded as either ASCII or UTF-8 text\n "
@@ -5748,5 +5742,4 @@ def _resolve_func_self(
57485742 # Case 3: There exists exactly 1 CommandSet that is a sub-class match of the function's CommandSet
57495743 func_self = candidate_sets [0 ]
57505744 return func_self
5751- else :
5752- return self
5745+ return self
0 commit comments