(self)
Method to generate a password
Method to generate a password
Method to generate a password
def gen_pass(self):
        '''Method to generate a password'''

        while True:
            items = self.gen_check_menu(((1, 0, 'Include numbers'),
                                         (2, 0,
                                          'Include capitalized letters'),
                                         (3, 0, 'Include special symbols'),
                                         (4, 0, 'Include space')),
                                        (6, 0, 'Press space to un-/check'),
                                        (7, 0,
                                         'Press return to enter options'))
            if items is False or items == -1:
                return items
            length = self.get_num('Password length: ')
            if length is False:
                continue
            elif length == -1:
                return -1
            char_set = 'abcdefghijklmnopqrstuvwxyz'
            if items[0] == 1:
                char_set += '1234567890'
            if items[1] == 1:
                char_set += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
            if items[2] == 1:
                char_set += '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~$'
            if items[3] == 1:
                char_set += ' '

            password = ''
            for _ in range(length):
                password += sample(char_set, 1)[0]
            return password
def gen_pass ( self ) : while True : items = self . gen_check_menu ( ( ( 1 , 0 , 'Include numbers' ) , ( 2 , 0 , 'Include capitalized letters' ) , ( 3 , 0 , 'Include special symbols' ) , ( 4 , 0 , 'Include space' ) ) , ( 6 , 0 , 'Press space to un-/check' ) , ( 7 , 0 , 'Press return to enter options' ) ) if items is False or items == - 1 : return items length = self . get_num ( 'Password length: ' ) if length is False : continue elif length == - 1 : return - 1 char_set = 'abcdefghijklmnopqrstuvwxyz' if items [ 0 ] == 1 : char_set += '1234567890' if items [ 1 ] == 1 : char_set += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' if items [ 2 ] == 1 : char_set += '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~$' if items [ 3 ] == 1 : char_set += ' ' password = '' for _ in range ( length ) : password += sample ( char_set , 1 ) [ 0 ] return password