mirror of
https://gitlab.com/chicken-riders/RcGcDw.git
synced 2025-02-23 00:24:09 +00:00
Bunch of code style fixups
This commit is contained in:
parent
805dc858f6
commit
957aad3f50
|
@ -79,12 +79,12 @@ def compact_summary(ctx: Context) -> str:
|
||||||
return " *({})*".format(ctx.parsedcomment)
|
return " *({})*".format(ctx.parsedcomment)
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
def compact_author(ctx: Context, change: dict, is_anon=None) -> (Optional[str], Optional[str]):
|
def compact_author(ctx: Context, change: dict, is_anon: Optional[bool] = None) -> (Optional[str], Optional[str]):
|
||||||
"""Returns link to the author and the author itself respecting the settings"""
|
"""Returns link to the author and the author itself respecting the settings"""
|
||||||
author, author_url = None, None
|
author, author_url = None, None
|
||||||
if ctx.event != "suppressed":
|
if ctx.event != "suppressed":
|
||||||
author_url = clean_link(ctx.client.create_article_path("User:{user}".format(user=sanitize_to_url(change["user"]))))
|
author_url = clean_link(ctx.client.create_article_path("User:{user}".format(user=sanitize_to_url(change["user"]))))
|
||||||
if ("anon" in change if is_anon is None else is_anon):
|
if "anon" in change if is_anon is None else is_anon:
|
||||||
if settings.get("hide_ips", False):
|
if settings.get("hide_ips", False):
|
||||||
author = _("Unregistered user")
|
author = _("Unregistered user")
|
||||||
else:
|
else:
|
||||||
|
@ -94,7 +94,7 @@ def compact_author(ctx: Context, change: dict, is_anon=None) -> (Optional[str],
|
||||||
return author, author_url
|
return author, author_url
|
||||||
|
|
||||||
|
|
||||||
def embed_helper(ctx: Context, message: DiscordMessage, change: dict, set_user=True, set_edit_meta=True, set_desc=True, is_anon=None) -> None:
|
def embed_helper(ctx: Context, message: DiscordMessage, change: dict, set_user=True, set_edit_meta=True, set_desc=True, is_anon: Optional[bool] = None) -> None:
|
||||||
"""Helps in preparing common edit/log fields for events. Passed arguments automatically become saturated with needed data.
|
"""Helps in preparing common edit/log fields for events. Passed arguments automatically become saturated with needed data.
|
||||||
All automatic setups can be disabled by setting relevant variable to False
|
All automatic setups can be disabled by setting relevant variable to False
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ def embed_helper(ctx: Context, message: DiscordMessage, change: dict, set_user=T
|
||||||
setting default description (to ctx.parsedcomment)"""
|
setting default description (to ctx.parsedcomment)"""
|
||||||
if set_user:
|
if set_user:
|
||||||
author = None
|
author = None
|
||||||
if ("anon" in change if is_anon is None else is_anon):
|
if "anon" in change if is_anon is None else is_anon:
|
||||||
author_url = ctx.client.create_article_path("Special:Contributions/{user}".format(user=sanitize_to_url(change["user"])))
|
author_url = ctx.client.create_article_path("Special:Contributions/{user}".format(user=sanitize_to_url(change["user"])))
|
||||||
ip_mapper = ctx.client.get_ipmapper()
|
ip_mapper = ctx.client.get_ipmapper()
|
||||||
logger.debug("current user: {} with cache of IPs: {}".format(change["user"], ip_mapper.keys()))
|
logger.debug("current user: {} with cache of IPs: {}".format(change["user"], ip_mapper.keys()))
|
||||||
|
|
Loading…
Reference in a new issue