| 28 | |
| 29 | |
| 30 | class Interface: |
| 31 | has_characters = { |
| 32 | "lowercase": True, |
| 33 | "uppercase": True, |
| 34 | "digits": True, |
| 35 | "punctuation": True, |
| 36 | } |
| 37 | |
| 38 | @classmethod |
| 39 | def change_has_characters(cls, change): |
| 40 | try: |
| 41 | cls.has_characters[ |
| 42 | change |
| 43 | ] # to check if the specified key exists in the dicitonary |
| 44 | except Exception as err: |
| 45 | print(f"Invalid \nan Exception: {err}") |
| 46 | else: |
| 47 | cls.has_characters[change] = not cls.has_characters[ |
| 48 | change |
| 49 | ] # automaticly changres to the oppesite value already there |
| 50 | print(f"{change} is now set to {cls.has_characters[change]}") |
| 51 | |
| 52 | @classmethod |
| 53 | def show_has_characters(cls): |
| 54 | print(cls.has_characters) # print the output |
| 55 | |
| 56 | def generate_password(self, lenght): |
| 57 | sequence = PasswordGenerator.gen_sequence(list(self.has_characters.values())) |
| 58 | print(PasswordGenerator.gen_password(sequence, lenght)) |
| 59 | |
| 60 | |
| 61 | def list_to_vertical_string(list): |