"""Abstract base user interface module... versionadded:: 6.2"""## (C) Pywikibot team, 2021## Distributed under the terms of the MIT license.#from__future__importannotationsimportsysfromabcimportABC,abstractmethodfromtypingimportAny
[docs]classABUIC(ABC):"""Abstract base user interface class. Every user interface should derive from it to ensure that all required methods are implemented. .. versionadded:: 6.2 """
[docs]defargvu(self)->list[str]:"""Return copy of sys.argv. Assigned to pywikibot.argvu in bot module """returnlist(sys.argv)
[docs]@abstractmethoddefflush(self)->None:"""Flush cached output. May be passed to atexit.register() to flush any ui cache. """
[docs]@abstractmethoddefinit_handlers(self,*args,**kwargs)->None:"""Initialize the handlers for user output. Called in bot.init_handlers(). """
[docs]@abstractmethoddefinput(self,*args,**kwargs)->str:"""Ask the user a question and return the answer. Called by bot.input(). """ifargs:returninput(args[0])returninput()
[docs]@abstractmethoddefinput_choice(self,*args,**kwargs)->int|str:"""Ask the user and returns a value from the options. Called by bot.input_choice(). """returnself.input()
[docs]@abstractmethoddefinput_list_choice(self,*args,**kwargs)->Any:"""Ask the user to select one entry from a list of entries. Called by bot.input_list_choice(). """returnself.input()
[docs]@abstractmethoddefoutput(self,*args,**kwargs)->None:"""Output text to a stream."""print(*args,**kwargs)# noqa: T201