mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	ruff: Fix SIM110 Use return any(…) instead of for loop.
				
					
				
			Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							ff1971f5ad
						
					
				
				
					commit
					b8b29dc3ad
				
			@@ -65,10 +65,10 @@ def process_user(
 | 
			
		||||
    def is_team_admin(user_dict: Dict[str, Any]) -> bool:
 | 
			
		||||
        if user_dict["teams"] is None:
 | 
			
		||||
            return False
 | 
			
		||||
        for team in user_dict["teams"]:
 | 
			
		||||
            if team["name"] == team_name and "team_admin" in team["roles"]:
 | 
			
		||||
                return True
 | 
			
		||||
        return False
 | 
			
		||||
        return any(
 | 
			
		||||
            team["name"] == team_name and "team_admin" in team["roles"]
 | 
			
		||||
            for team in user_dict["teams"]
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    def get_full_name(user_dict: Dict[str, Any]) -> str:
 | 
			
		||||
        full_name = "{} {}".format(user_dict["first_name"], user_dict["last_name"])
 | 
			
		||||
@@ -809,10 +809,7 @@ def check_user_in_team(user: Dict[str, Any], team_name: str) -> bool:
 | 
			
		||||
    if user["teams"] is None:
 | 
			
		||||
        # This is null for users not on any team
 | 
			
		||||
        return False
 | 
			
		||||
    for team in user["teams"]:
 | 
			
		||||
        if team["name"] == team_name:
 | 
			
		||||
            return True
 | 
			
		||||
    return False
 | 
			
		||||
    return any(team["name"] == team_name for team in user["teams"])
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def label_mirror_dummy_users(
 | 
			
		||||
 
 | 
			
		||||
@@ -768,10 +768,7 @@ class InlineInterestingLinkProcessor(markdown.treeprocessors.Treeprocessor):
 | 
			
		||||
        if parsed_url.netloc == "pasteboard.co":
 | 
			
		||||
            return False
 | 
			
		||||
 | 
			
		||||
        for ext in IMAGE_EXTENSIONS:
 | 
			
		||||
            if parsed_url.path.lower().endswith(ext):
 | 
			
		||||
                return True
 | 
			
		||||
        return False
 | 
			
		||||
        return any(parsed_url.path.lower().endswith(ext) for ext in IMAGE_EXTENSIONS)
 | 
			
		||||
 | 
			
		||||
    def corrected_image_source(self, url: str) -> Optional[str]:
 | 
			
		||||
        # This function adjusts any URLs from linx.li and
 | 
			
		||||
 
 | 
			
		||||
@@ -121,17 +121,14 @@ def is_web_public_narrow(narrow: Optional[Iterable[Dict[str, Any]]]) -> bool:
 | 
			
		||||
    if narrow is None:
 | 
			
		||||
        return False
 | 
			
		||||
 | 
			
		||||
    for term in narrow:
 | 
			
		||||
    return any(
 | 
			
		||||
        # Web-public queries are only allowed for limited types of narrows.
 | 
			
		||||
        # term == {'operator': 'streams', 'operand': 'web-public', 'negated': False}
 | 
			
		||||
        if (
 | 
			
		||||
        term["operator"] == "streams"
 | 
			
		||||
        and term["operand"] == "web-public"
 | 
			
		||||
        and term["negated"] is False
 | 
			
		||||
        ):
 | 
			
		||||
            return True
 | 
			
		||||
 | 
			
		||||
    return False
 | 
			
		||||
        for term in narrow
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def build_narrow_filter(narrow: Collection[Sequence[str]]) -> Callable[[Mapping[str, Any]], bool]:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user