Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
ruff: Fix Q002 Single quote docstring found.
Anders Kaseorg3025d9a63afa
diff --git a/analytics/views/activity_common.py b/analytics/views/activity_common.pyindex ba4ebb10014..52f1da910cf 100644--- a/analytics/views/activity_common.py+++ b/analytics/views/activity_common.py@@ -48,7 +48,7 @@ def make_table(def dictfetchall(cursor: CursorWrapper) -> List[Dict[str, Any]]:- "Returns all rows from a cursor as a dict"+ """Returns all rows from a cursor as a dict"""desc = cursor.descriptionreturn [dict(zip((col[0] for col in desc), row)) for row in cursor.fetchall()]diff --git a/zerver/lib/rate_limiter.py b/zerver/lib/rate_limiter.pyindex 5f198a41491..3b253c727d9 100644--- a/zerver/lib/rate_limiter.py+++ b/zerver/lib/rate_limiter.py@@ -69,7 +69,7 @@ class RateLimitedObject(ABC):request_notes.ratelimits_applied[-1].secs_to_freedom = seconds_until_resetdef block_access(self, seconds: int) -> None:- "Manually blocks an entity for the desired number of seconds"+ """Manually blocks an entity for the desired number of seconds"""self.backend.block_access(self.key(), seconds)def unblock_access(self) -> None:@@ -79,11 +79,11 @@ class RateLimitedObject(ABC):self.backend.clear_history(self.key())def max_api_calls(self) -> int:- "Returns the API rate limit for the highest limit"+ """Returns the API rate limit for the highest limit"""return self.get_rules()[-1][1]def max_api_window(self) -> int:- "Returns the API time window for the highest limit"+ """Returns the API time window for the highest limit"""return self.get_rules()[-1][0]def api_calls_left(self) -> Tuple[int, float]:@@ -161,7 +161,7 @@ def bounce_redis_key_prefix_for_testing(test_name: str) -> None:def add_ratelimit_rule(range_seconds: int, num_requests: int, domain: str = "api_by_user") -> None:- "Add a rate-limiting rule to the ratelimiter"+ """Add a rate-limiting rule to the ratelimiter"""if domain not in rules:# If we don't have any rules for domain yet, the domain key needs to be# added to the rules dictionary.@@ -181,7 +181,7 @@ class RateLimiterBackend(ABC):@classmethod@abstractmethoddef block_access(cls, entity_key: str, seconds: int) -> None:- "Manually blocks an entity for the desired number of seconds"+ """Manually blocks an entity for the desired number of seconds"""@classmethod@abstractmethod@@ -337,7 +337,7 @@ class RedisRateLimiterBackend(RateLimiterBackend):@classmethoddef block_access(cls, entity_key: str, seconds: int) -> None:- "Manually blocks an entity for the desired number of seconds"+ """Manually blocks an entity for the desired number of seconds"""_, _, blocking_key = cls.get_keys(entity_key)with client.pipeline() as pipe:pipe.set(blocking_key, 1)@@ -386,7 +386,7 @@ class RedisRateLimiterBackend(RateLimiterBackend):@classmethoddef is_ratelimited(cls, entity_key: str, rules: List[Tuple[int, int]]) -> Tuple[bool, float]:- "Returns a tuple of (rate_limited, time_till_free)"+ """Returns a tuple of (rate_limited, time_till_free)"""assert ruleslist_key, set_key, blocking_key = cls.get_keys(entity_key)