Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1"""LICENSE 

2Copyright 2018 Hermann Krumrey <hermann@krumreyh.com> 

3 

4This file is part of bokkichat. 

5 

6bokkichat is free software: you can redistribute it and/or modify 

7it under the terms of the GNU General Public License as published by 

8the Free Software Foundation, either version 3 of the License, or 

9(at your option) any later version. 

10 

11bokkichat is distributed in the hope that it will be useful, 

12but WITHOUT ANY WARRANTY; without even the implied warranty of 

13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

14GNU General Public License for more details. 

15 

16You should have received a copy of the GNU General Public License 

17along with bokkichat. If not, see <http://www.gnu.org/licenses/>. 

18LICENSE""" 

19 

20 

21class Settings: 

22 """ 

23 Class that defines what methods a Settings class must implement. 

24 Settings objects are used to initialize a Connection. 

25 """ 

26 

27 def serialize(self) -> str: 

28 """ 

29 Serializes the settings to a string 

30 :return: The serialized Settings object 

31 """ 

32 raise NotImplementedError() 

33 

34 @classmethod 

35 def deserialize(cls, serialized: str) -> "Settings": 

36 """ 

37 Deserializes a string and generates a Settings object from it 

38 :param serialized: The serialized string 

39 :return: The deserialized Settings object 

40 """ 

41 raise NotImplementedError() 

42 

43 @classmethod 

44 def prompt(cls) -> "Settings": 

45 """ 

46 Prompts the user for input to generate a Settings object 

47 :return: The generated settings object 

48 """ 

49 raise NotImplementedError() 

50 

51 @staticmethod 

52 def user_input(prompt: str) -> str: 

53 """ 

54 Prompts the user for input 

55 :param prompt: The text to display with the prompt 

56 :return: The resulting response 

57 """ 

58 resp = "" 

59 while not resp: 

60 resp = input(prompt + ": ") 

61 return resp