mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	validator: Generalize type of check_string_in argument.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							01241f0e72
						
					
				
				
					commit
					79c1123700
				
			@@ -36,6 +36,7 @@ from typing import (
 | 
			
		||||
    Any,
 | 
			
		||||
    Callable,
 | 
			
		||||
    Collection,
 | 
			
		||||
    Container,
 | 
			
		||||
    Dict,
 | 
			
		||||
    Iterator,
 | 
			
		||||
    List,
 | 
			
		||||
@@ -83,7 +84,7 @@ def check_required_string(var_name: str, val: object) -> str:
 | 
			
		||||
    return s
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def check_string_in(possible_values: Union[Set[str], List[str]]) -> Validator[str]:
 | 
			
		||||
def check_string_in(possible_values: Container[str]) -> Validator[str]:
 | 
			
		||||
    def validator(var_name: str, val: object) -> str:
 | 
			
		||||
        s = check_string(var_name, val)
 | 
			
		||||
        if s not in possible_values:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user