mirror of https://gitlab.com/bashrc2/epicyon
				
				
				
			Less indentation
							parent
							
								
									76d0bcf3fd
								
							
						
					
					
						commit
						86e963abc0
					
				
							
								
								
									
										32
									
								
								petnames.py
								
								
								
								
							
							
						
						
									
										32
									
								
								petnames.py
								
								
								
								
							|  | @ -86,20 +86,24 @@ def get_pet_name(base_dir: str, nickname: str, domain: str, | ||||||
| 
 | 
 | ||||||
|     if not os.path.isfile(petnames_filename): |     if not os.path.isfile(petnames_filename): | ||||||
|         return '' |         return '' | ||||||
|     with open(petnames_filename, 'r', encoding='utf-8') as petnames_file: |     petnames_str = '' | ||||||
|         petnames_str = petnames_file.read() |     try: | ||||||
|         if ' ' + handle + '\n' in petnames_str: |         with open(petnames_filename, 'r', encoding='utf-8') as petnames_file: | ||||||
|             petnames_list = petnames_str.split('\n') |             petnames_str = petnames_file.read() | ||||||
|             for pet in petnames_list: |     except OSError: | ||||||
|                 if pet.endswith(' ' + handle): |         print('EX: get_pet_name unable to read ' + petnames_filename) | ||||||
|                     return pet.replace(' ' + handle, '').strip() |     if ' ' + handle + '\n' in petnames_str: | ||||||
|         elif ' ' + handle.lower() + '\n' in petnames_str.lower(): |         petnames_list = petnames_str.split('\n') | ||||||
|             petnames_list = petnames_str.split('\n') |         for pet in petnames_list: | ||||||
|             handle = handle.lower() |             if pet.endswith(' ' + handle): | ||||||
|             for pet in petnames_list: |                 return pet.replace(' ' + handle, '').strip() | ||||||
|                 if pet.lower().endswith(' ' + handle): |     elif ' ' + handle.lower() + '\n' in petnames_str.lower(): | ||||||
|                     handle2 = pet.split(' ')[-1] |         petnames_list = petnames_str.split('\n') | ||||||
|                     return pet.replace(' ' + handle2, '').strip() |         handle = handle.lower() | ||||||
|  |         for pet in petnames_list: | ||||||
|  |             if pet.lower().endswith(' ' + handle): | ||||||
|  |                 handle2 = pet.split(' ')[-1] | ||||||
|  |                 return pet.replace(' ' + handle2, '').strip() | ||||||
|     return '' |     return '' | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue