Skip to content

Commit

Permalink
latest linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Perceval ARENOU committed Nov 9, 2023
1 parent c31db79 commit 0634327
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
11 changes: 6 additions & 5 deletions audio/download_audio.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#!/usr/bin/python3
""" Download all OSS 117 audio files from zonesons.com. """

import base64
from urllib.request import Request, urlopen

from bs4 import BeautifulSoup

# 96 pages
SITE = "https://zonesons.com"
OSS1 = "/repliques-cultes-de-films-d-espionnage/phrases-cultes-de-oss-117-le-caire-nid-d-espions"
OSS2 = "/repliques-cultes-de-films-d-espionnage/phrases-cultes-de-oss-117-rio-ne-repond-plus"
SITE = "https://zonesons.com/"
OSS1 = "repliques-cultes-de-films-d-espionnage/phrases-cultes-de-oss-117-le-caire-nid-d-espions"
OSS2 = "repliques-cultes-de-films-d-espionnage/phrases-cultes-de-oss-117-rio-ne-repond-plus"
FILMS = [OSS1, OSS2]
FILENAME = "oss1172.txt"

Expand Down Expand Up @@ -42,13 +43,13 @@ def url_to_soup(url):

for a in audio:
mp3 = base64.b64decode(a.get("src")[1:]).decode("utf-8")
url = f"{SITE}/{mp3}"
mp3_url = f"{SITE}/{mp3}"
# filename = str(mp3).split("/")[-1]
filename = str(mp3).rsplit("/", maxsplit=1)[-1]
print(filename)
# pylint: disable=W1514
with open(FILENAME, "a") as file:
file.write(f"{url}\n")
file.write(f"{mp3_url}\n")

# to download all files use the following command
# not working (IP ban)
Expand Down
6 changes: 3 additions & 3 deletions src/flantier/christmas-bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,9 @@ def open_registrations(update: Update, context: CallbackContext):
context.bot.send_message(
chat_id=update.message.chat_id,
text=(
"🎉 Les inscriptions sont ouvertes 🎉\n🎅 Vous pouvez désormais v"
"ous inscrire en envoyant /particip
)er",
"🎉 Les inscriptions sont ouvertes 🎉\n"
"🎅 Vous pouvez désormais vous inscrire en envoyant /participer"
),
)


Expand Down
6 changes: 3 additions & 3 deletions src/flantier/roulette.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def __new__(cls, *args, **kwargs):
return Roulette.__instance

def _does_participate(self, tg_id: int):
for id, user in enumerate(self.participants):
for tgid, user in enumerate(self.participants):
if user["tg_id"] == tg_id:
return id, user
return tgid, user
return None, None

def add_user(self, tg_id: int, name: str) -> int:
Expand Down Expand Up @@ -95,7 +95,7 @@ def search_user(self, name: str):
def exclude(self, tg_id: int, exclude: int):
"""Ajoute un utilisateur à la liste des exclus d'un autre"""
for user in self.participants:
if user["tg_id"] == user:
if user["tg_id"] == tg_id:
user["exclude"].append(exclude)
return True
# FIXME uncomment
Expand Down

0 comments on commit 0634327

Please sign in to comment.