| 1921 | return lines |
| 1922 | |
| 1923 | class UserInput(SecretYamlObject): |
| 1924 | yaml_tag = u'!UserInput' |
| 1925 | |
| 1926 | def __init__(self, name, prompt, type=None): |
| 1927 | self.type = type |
| 1928 | self.prompt = prompt |
| 1929 | self.name = name |
| 1930 | |
| 1931 | @classmethod |
| 1932 | def from_yaml(cls, loader, node): |
| 1933 | fields = loader.construct_mapping(node, deep = True) |
| 1934 | return UserInput(**fields) |
| 1935 | |
| 1936 | def run(self, dict=None): |
| 1937 | correct = False |
| 1938 | while not correct: |
| 1939 | try: |
| 1940 | result = str(input("%s : " % self.prompt)) |
| 1941 | if self.type and self.type == 'int': |
| 1942 | result = int(result) |
| 1943 | correct = True |
| 1944 | except Exception as e: |
| 1945 | print("Incorrect input: %s, try again" % e) |
| 1946 | continue |
| 1947 | if dict: |
| 1948 | dict[self.name] = result |
| 1949 | return result |
| 1950 | |
| 1951 | |
| 1952 | def create_ical(todo): # pylint: disable=unused-argument |
no outgoing calls
no test coverage detected
searching dependent graphs…