Show More
@@ -31,6 +31,7 b' from typing import (' | |||
|
31 | 31 | TypeVar, |
|
32 | 32 | Union, |
|
33 | 33 | cast, |
|
34 | overload, | |
|
34 | 35 | ) |
|
35 | 36 | |
|
36 | 37 | from .i18n import _ |
@@ -1780,12 +1781,36 b' class ui:' | |||
|
1780 | 1781 | |
|
1781 | 1782 | return line |
|
1782 | 1783 | |
|
1784 | if pycompat.TYPE_CHECKING: | |
|
1785 | ||
|
1786 | @overload | |
|
1787 | def prompt(self, msg: bytes, default: bytes) -> bytes: | |
|
1788 | pass | |
|
1789 | ||
|
1790 | @overload | |
|
1791 | def prompt(self, msg: bytes, default: None) -> Optional[bytes]: | |
|
1792 | pass | |
|
1793 | ||
|
1783 | 1794 | def prompt(self, msg, default=b"y"): |
|
1784 | 1795 | """Prompt user with msg, read response. |
|
1785 | 1796 | If ui is not interactive, the default is returned. |
|
1786 | 1797 | """ |
|
1787 | 1798 | return self._prompt(msg, default=default) |
|
1788 | 1799 | |
|
1800 | if pycompat.TYPE_CHECKING: | |
|
1801 | ||
|
1802 | @overload | |
|
1803 | def _prompt( | |
|
1804 | self, msg: bytes, default: bytes, **opts: _MsgOpts | |
|
1805 | ) -> bytes: | |
|
1806 | pass | |
|
1807 | ||
|
1808 | @overload | |
|
1809 | def _prompt( | |
|
1810 | self, msg: bytes, default: None, **opts: _MsgOpts | |
|
1811 | ) -> Optional[bytes]: | |
|
1812 | pass | |
|
1813 | ||
|
1789 | 1814 | def _prompt(self, msg, default=b'y', **opts): |
|
1790 | 1815 | opts = {**opts, 'default': default} |
|
1791 | 1816 | if not self.interactive(): |
General Comments 0
You need to be logged in to leave comments.
Login now