mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-29 23:39:35 +00:00 
			
		
		
		
	swagger_model.py: Fix invalid escape sequence in get_list_parameter_type().
Recent python versions complain when backslashes in strings create invalid escape sequences. This causes issues for strings used as regex patterns like `'^List\[(.*)\]$'` where you want the regex parser to treat `[` and `]` as literals. Double-backslashing is one way to fix it but simply converting the string to a raw string `re.match(r'^List\[(.*)\]$', text)` is easier and less error prone.
This commit is contained in:
		
				
					committed by
					
						![github-actions[bot]](/avatar/af2ab225b7c0eec44a8d0eba6b5c869a?size=40) github-actions[bot]
						github-actions[bot]
					
				
			
			
				
	
			
			
			
						parent
						
							e02de88e4e
						
					
				
				
					commit
					5470a23b48
				
			| @@ -464,7 +464,7 @@ def get_list_parameter_type(type_string): | |||||||
|     @param type_string: Type string to parse |     @param type_string: Type string to parse | ||||||
|     @returns Type parameter of the list, or None if not a List. |     @returns Type parameter of the list, or None if not a List. | ||||||
|     """ |     """ | ||||||
|     list_match = re.match('^List\[(.*)\]$', type_string) |     list_match = re.match(r'^List\[(.*)\]$', type_string) | ||||||
|     return list_match and list_match.group(1) |     return list_match and list_match.group(1) | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user