(self)
| 418 | self._vocabulary = _load_wordlist(word_list_file) |
| 419 | |
| 420 | def generate(self): |
| 421 | if not self._vocabulary: |
| 422 | raise Exception('Passphrase word list was not loaded') |
| 423 | |
| 424 | passphrase = '' |
| 425 | first_word = True |
| 426 | for _ in range(self.word_count): |
| 427 | word = secrets.choice(self._vocabulary) |
| 428 | if self.capitalize and word: |
| 429 | word = word[0].upper() + word[1:] |
| 430 | if self.append_number and first_word: |
| 431 | word += str(secrets.randbelow(10)) |
| 432 | if not first_word: |
| 433 | passphrase += self.separator |
| 434 | passphrase += word |
| 435 | first_word = False |
| 436 | return passphrase |
| 437 | |
| 438 | @classmethod |
| 439 | def create_with_options(cls, policy=None, word_count=None, separator=None, |
no outgoing calls