Skip to content

Commit

Permalink
revert changes in io.selective input (None to Ellipsis)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramin-RX7 committed Jul 13, 2023
1 parent d177a94 commit c8ee714
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions rx7/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ def wait_for_input(prompt="") -> str:
return answer


def selective_input(prompt:Any, choices:Iterable|Callable[[str],bool], default:Any=None,
def selective_input(prompt:Any, choices:Iterable|Callable[[str],bool], default:Any=...,
*,
ignore_case:bool=False, invalid_message:Any='Invalid input',
pre_action:Callable=None,post_action:Callable=None) -> str|Any:
pre_action:Callable=...,post_action:Callable=...) -> str|Any:
"""Prompts for user input and waits until a acceptable input is given
Args:
Expand All @@ -50,8 +50,8 @@ def selective_input(prompt:Any, choices:Iterable|Callable[[str],bool], default:A
Returns:
str|Any: user input as a string unless pre_action/post_action change the string type
"""
assert (callable(pre_action ) or pre_action ==None)
assert (callable(post_action) or post_action==None)
assert (callable(pre_action ) or pre_action ==...)
assert (callable(post_action) or post_action==...)
if not callable(choices):
Choices = choices
if type(choices) == dict:
Expand All @@ -69,7 +69,7 @@ def selective_input(prompt:Any, choices:Iterable|Callable[[str],bool], default:A
elif invalid_message:
style.print(invalid_message, color='red')
elif inp == "":
if default:
if default != ...:
inp = default
break
else:
Expand Down

0 comments on commit c8ee714

Please sign in to comment.