style(deepsource): fix some analysis fails

This commit is contained in:
Romain J 2021-01-21 16:11:29 +01:00
parent 5d585bf218
commit 01e0e5e27e
5 changed files with 13 additions and 15 deletions

View file

@ -23,6 +23,7 @@ install_requires =
humanize>=2.6.0 humanize>=2.6.0
jishaku>=1.19.1.200 jishaku>=1.19.1.200
psutil>=5.7.2 psutil>=5.7.2
requests>=2.25.1
rich>=6.0.0 rich>=6.0.0
structured_config>=4.12 structured_config>=4.12
tortoise-orm>=0.16.17 tortoise-orm>=0.16.17

View file

@ -2,7 +2,7 @@ from discord.ext import commands
from jishaku.models import copy_context_with from jishaku.models import copy_context_with
_ = lambda x: x def _(x): return x
class AliasConvertor(commands.Converter): class AliasConvertor(commands.Converter):

View file

@ -6,7 +6,8 @@ from tuxbot.cogs.Polls.functions.exceptions import (
) )
from tuxbot.cogs.Polls.models import Poll from tuxbot.cogs.Polls.models import Poll
_ = lambda x: x
def _(x): return x
class PollConverter(commands.Converter): class PollConverter(commands.Converter):
@ -50,7 +51,7 @@ class PollConverter(commands.Converter):
class NewPropositionConvertor(commands.Converter): class NewPropositionConvertor(commands.Converter):
async def convert(self, ctx, argument): async def convert(self, ctx, argument): # skipcq: PYL-W0613
if len(argument) > 30: if len(argument) > 30:
raise TooLongProposition( raise TooLongProposition(
_("Your proposal must be smaller than 30") _("Your proposal must be smaller than 30")

View file

@ -166,11 +166,11 @@ class Polls(commands.Cog, name="Polls"):
for i, field in enumerate(content.get("fields")): for i, field in enumerate(content.get("fields")):
responders = responses.get(i, 0) responders = responses.get(i, 0)
chart_options.get("data").get("labels").append( chart_options["data"]["labels"].append(
field.get("name")[6:].replace("__", "") field["name"][6:].replace("__", "")
) )
chart_options.get("data").get("datasets")[0].get("data").append( chart_options["data"]["datasets"][0].get("data").append(
responders responders
) )

View file

@ -8,7 +8,7 @@ import sys
from argparse import Namespace from argparse import Namespace
from pathlib import Path from pathlib import Path
from typing import Union, List from typing import Union, List
from urllib.request import urlopen import requests
from rich.prompt import Prompt, IntPrompt from rich.prompt import Prompt, IntPrompt
from rich.console import Console from rich.console import Console
@ -402,22 +402,18 @@ def basic_setup() -> None:
def update() -> None: def update() -> None:
response = ( response = (
urlopen( requests.get(
"https://api.github.com/repos/Rom1-J/tuxbot-bot/commits/master" "https://api.github.com/repos/Rom1-J/tuxbot-bot/commits/master"
) ).json()
.read()
.decode("utf-8")
) )
json_response = json.loads(response) if response.get("sha")[:6] == version_info.build:
if json_response.get("sha")[:6] == version_info.build:
print( print(
"Nothing to update, you can run `tuxbot [instance_name]` " "Nothing to update, you can run `tuxbot [instance_name]` "
"to start the bot" "to start the bot"
) )
else: else:
print(f"Updating to {json_response.get('sha')[:6]}...") print(f"Updating to {response.get('sha')[:6]}...")
os.popen("/usr/bin/git pull") os.popen("/usr/bin/git pull")