mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	bpo-44712: Replace "type(literal)" with corresponding builtin types (GH-27294)
I suppose it is a remnants of very old code written when str, int, list, dict, etc were functions and not classes.
This commit is contained in:
		
							parent
							
								
									c826867b7c
								
							
						
					
					
						commit
						3680ebed7f
					
				
					 19 changed files with 41 additions and 39 deletions
				
			
		|  | @ -70,7 +70,7 @@ def get_errors(self): | |||
| # compile the re's in the list and store them in-place. | ||||
| for i in range(len(emparse_list_list)): | ||||
|     x = emparse_list_list[i] | ||||
|     if type(x) is type(''): | ||||
|     if isinstance(x, str): | ||||
|         x = re.compile(x, re.MULTILINE) | ||||
|     else: | ||||
|         xl = [] | ||||
|  | @ -105,7 +105,7 @@ def emparse_list(fp, sub): | |||
|     emails = [] | ||||
|     reason = None | ||||
|     for regexp in emparse_list_list: | ||||
|         if type(regexp) is type(()): | ||||
|         if isinstance(regexp, tuple): | ||||
|             res = regexp[0].search(data, 0, from_index) | ||||
|             if res is not None: | ||||
|                 try: | ||||
|  | @ -134,7 +134,7 @@ def emparse_list(fp, sub): | |||
|         if reason[:15] == 'returned mail: ': | ||||
|             reason = reason[15:] | ||||
|         for regexp in emparse_list_reason: | ||||
|             if type(regexp) is type(''): | ||||
|             if isinstance(regexp, str): | ||||
|                 for i in range(len(emails)-1,-1,-1): | ||||
|                     email = emails[i] | ||||
|                     exp = re.compile(re.escape(email).join(regexp.split('<>')), re.MULTILINE) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Serhiy Storchaka
						Serhiy Storchaka