From 80967822c06f9ece1ad6989bd9448464dea73ece Mon Sep 17 00:00:00 2001 From: Shirayuki Nekomata Date: Wed, 6 Nov 2019 09:18:35 +0700 Subject: Merged `else` and its single `if`, changed style to be more consistent Following Mark's reviews: - The single `if` inside the `else` can be merged with its `else` - this will reduce the level of complexity and indentation. - Changed from style ```py new = ('hello' 'world') ``` to ```py new = ( 'hello' 'world' ) ``` to be more consistent with the rest of the code --- bot/cogs/moderation/modlog.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bot/cogs/moderation/modlog.py b/bot/cogs/moderation/modlog.py index 6ce83840d..c86bf6faa 100644 --- a/bot/cogs/moderation/modlog.py +++ b/bot/cogs/moderation/modlog.py @@ -656,13 +656,14 @@ class ModLog(Cog, name="ModLog"): _before = _before.replace(sub, f"[{sub}](http://o.hi)") elif diff_type == '+': _after = _after.replace(sub, f"[{sub}](http://o.hi)") - else: - if len(words) > 2: - new = (f"{words[0] if index > 0 else ''}" - " ... " - f"{words[-1] if index < len(diff_groups) - 1 else ''}") - _before = _before.replace(sub, new) - _after = _after.replace(sub, new) + elif len(words) > 2: + new = ( + f"{words[0] if index > 0 else ''}" + " ... " + f"{words[-1] if index < len(diff_groups) - 1 else ''}" + ) + _before = _before.replace(sub, new) + _after = _after.replace(sub, new) response = ( f"**Author:** {author} (`{author.id}`)\n" -- cgit v1.2.3