Method: rich.prompt.PromptBase.make_prompt
Calls: 14, Exceptions: 0, Paths: 4Back
Path 1: 6 calls (0.43)
ellipsis (6)
Text (6)
1def make_prompt(self, default: DefaultType) -> Text:
2 """Make prompt text.
3
4 Args:
5 default (DefaultType): Default value.
6
7 Returns:
8 Text: Text to display in prompt.
9 """
10 prompt = self.prompt.copy()
11 prompt.end = ""
12
13 if self.show_choices and self.choices:
14 _choices = "/".join(self.choices)
15 choices = f"[{_choices}]"
16 prompt.append(" ")
17 prompt.append(choices, "prompt.choices")
18
19 if (
20 default != ...
21 and self.show_default
22 and isinstance(default, (str, self.response_type))
23 ):
24 prompt.append(" ")
25 _default = self.render_default(default)
26 prompt.append(_default)
27
28 prompt.append(self.prompt_suffix)
29
30 return prompt
Path 2: 5 calls (0.36)
True (3) 'baz' (2)
Text (5)
1def make_prompt(self, default: DefaultType) -> Text:
2 """Make prompt text.
3
4 Args:
5 default (DefaultType): Default value.
6
7 Returns:
8 Text: Text to display in prompt.
9 """
10 prompt = self.prompt.copy()
11 prompt.end = ""
12
13 if self.show_choices and self.choices:
14 _choices = "/".join(self.choices)
15 choices = f"[{_choices}]"
16 prompt.append(" ")
17 prompt.append(choices, "prompt.choices")
18
19 if (
20 default != ...
21 and self.show_default
22 and isinstance(default, (str, self.response_type))
23 ):
24 prompt.append(" ")
25 _default = self.render_default(default)
26 prompt.append(_default)
27
28 prompt.append(self.prompt_suffix)
29
30 return prompt
Path 3: 2 calls (0.14)
ellipsis (2)
Text (2)
1def make_prompt(self, default: DefaultType) -> Text:
2 """Make prompt text.
3
4 Args:
5 default (DefaultType): Default value.
6
7 Returns:
8 Text: Text to display in prompt.
9 """
10 prompt = self.prompt.copy()
11 prompt.end = ""
12
13 if self.show_choices and self.choices:
14 _choices = "/".join(self.choices)
15 choices = f"[{_choices}]"
16 prompt.append(" ")
17 prompt.append(choices, "prompt.choices")
18
19 if (
20 default != ...
21 and self.show_default
22 and isinstance(default, (str, self.response_type))
23 ):
24 prompt.append(" ")
25 _default = self.render_default(default)
26 prompt.append(_default)
27
28 prompt.append(self.prompt_suffix)
29
30 return prompt
Path 4: 1 calls (0.07)
'Will' (1)
Text (1)
1def make_prompt(self, default: DefaultType) -> Text:
2 """Make prompt text.
3
4 Args:
5 default (DefaultType): Default value.
6
7 Returns:
8 Text: Text to display in prompt.
9 """
10 prompt = self.prompt.copy()
11 prompt.end = ""
12
13 if self.show_choices and self.choices:
14 _choices = "/".join(self.choices)
15 choices = f"[{_choices}]"
16 prompt.append(" ")
17 prompt.append(choices, "prompt.choices")
18
19 if (
20 default != ...
21 and self.show_default
22 and isinstance(default, (str, self.response_type))
23 ):
24 prompt.append(" ")
25 _default = self.render_default(default)
26 prompt.append(_default)
27
28 prompt.append(self.prompt_suffix)
29
30 return prompt