mirror of https://github.com/zulip/zulip.git
ruff: Fix PLW0602 Using global but no assignment is done.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
1ac5526023
commit
f7e97b1180
|
@ -96,7 +96,7 @@ def send_zulip(sender: zulip.Client, message: Dict[str, Any]) -> None:
|
|||
|
||||
|
||||
def get_zulips() -> List[Dict[str, Any]]:
|
||||
global queue_id, last_event_id
|
||||
global last_event_id
|
||||
res = zulip_recipient.get_events(queue_id=queue_id, last_event_id=last_event_id)
|
||||
if "error" in res.get("result", {}):
|
||||
report("CRITICAL", msg="Error receiving Zulips, error was: {}".format(res["msg"]))
|
||||
|
|
|
@ -65,7 +65,6 @@ def remote_cache_stats_start() -> None:
|
|||
def remote_cache_stats_finish() -> None:
|
||||
global remote_cache_total_time
|
||||
global remote_cache_total_requests
|
||||
global remote_cache_time_start
|
||||
remote_cache_total_requests += 1
|
||||
remote_cache_total_time += time.time() - remote_cache_time_start
|
||||
|
||||
|
|
|
@ -2491,8 +2491,6 @@ def topic_links(linkifiers_key: int, topic_name: str) -> List[Dict[str, str]]:
|
|||
|
||||
|
||||
def maybe_update_markdown_engines(linkifiers_key: int, email_gateway: bool) -> None:
|
||||
global linkifier_data
|
||||
|
||||
linkifiers = linkifiers_for_realm(linkifiers_key)
|
||||
if linkifiers_key not in linkifier_data or linkifier_data[linkifiers_key] != linkifiers:
|
||||
# Linkifier data has changed, update `linkifier_data` and any
|
||||
|
@ -2676,7 +2674,6 @@ def markdown_stats_start() -> None:
|
|||
def markdown_stats_finish() -> None:
|
||||
global markdown_total_time
|
||||
global markdown_total_requests
|
||||
global markdown_time_start
|
||||
markdown_total_requests += 1
|
||||
markdown_total_time += time.time() - markdown_time_start
|
||||
|
||||
|
|
|
@ -162,8 +162,6 @@ 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"
|
||||
global rules
|
||||
|
||||
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.
|
||||
|
@ -176,7 +174,6 @@ def add_ratelimit_rule(range_seconds: int, num_requests: int, domain: str = "api
|
|||
def remove_ratelimit_rule(
|
||||
range_seconds: int, num_requests: int, domain: str = "api_by_user"
|
||||
) -> None:
|
||||
global rules
|
||||
rules[domain] = [x for x in rules[domain] if x[0] != range_seconds and x[1] != num_requests]
|
||||
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ kerberos_alter_egos = {
|
|||
def webathena_kerberos_login(
|
||||
request: HttpRequest, user_profile: UserProfile, cred: Optional[str] = REQ(default=None)
|
||||
) -> HttpResponse:
|
||||
global kerberos_alter_egos
|
||||
if cred is None:
|
||||
raise JsonableError(_("Could not find Kerberos credential"))
|
||||
if not user_profile.realm.webathena_enabled:
|
||||
|
|
Loading…
Reference in New Issue