From 9b9677576c944a6eac9021e1bdb22a2fc8bb76c1 Mon Sep 17 00:00:00 2001 From: Adrien Carpentier Date: Tue, 7 May 2024 16:39:16 +0900 Subject: [PATCH] chore: fix SPDX-FileCopyrightText --- .pre-commit-config.yaml | 2 +- README.md | 2 +- app/.env.example | 2 +- app/__init__.py | 2 +- app/__main__.py | 2 +- app/bot.py | 6 +++--- app/commands.py | 2 +- app/config.py | 6 +++--- app/matrix_bot/eventparser.py | 2 +- app/pyalbert_utils.py | 4 ++-- app/tchap_utils.py | 12 +++++++++--- 11 files changed, 24 insertions(+), 18 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9c318bb..d73471d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2024 Etalab/Datalab +# SPDX-FileCopyrightText: 2024 Etalab # # SPDX-License-Identifier: CC0-1.0 diff --git a/README.md b/README.md index aba6367..eef78e0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ diff --git a/app/.env.example b/app/.env.example index 9b68dbc..6ab5f68 100644 --- a/app/.env.example +++ b/app/.env.example @@ -1,5 +1,5 @@ # SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique -# SPDX-FileCopyrightText: 2024 Etalab/Datalab +# SPDX-FileCopyrightText: 2024 Etalab # # SPDX-License-Identifier: CC0-1.0 diff --git a/app/__init__.py b/app/__init__.py index 1e39807..c40f29f 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -1,5 +1,5 @@ # SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique -# SPDX-FileCopyrightText: 2024 Etalab/Datalab +# SPDX-FileCopyrightText: 2024 Etalab # # SPDX-License-Identifier: MIT diff --git a/app/__main__.py b/app/__main__.py index fbcec2e..b37cf8f 100644 --- a/app/__main__.py +++ b/app/__main__.py @@ -1,5 +1,5 @@ # SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique -# SPDX-FileCopyrightText: 2024 Etalab/Datalab +# SPDX-FileCopyrightText: 2024 Etalab # # SPDX-License-Identifier: MIT diff --git a/app/bot.py b/app/bot.py index b2719a6..f579473 100755 --- a/app/bot.py +++ b/app/bot.py @@ -1,5 +1,5 @@ # SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique -# SPDX-FileCopyrightText: 2024 Etalab/Datalab +# SPDX-FileCopyrightText: 2024 Etalab # # SPDX-License-Identifier: MIT @@ -34,8 +34,8 @@ def main(): logger.info("loaded feature", feature=feature["name"]) # To send message if Albert is updated for example... - #async def startup_action(room_id): + # async def startup_action(room_id): # await tchap_bot.matrix_client.send_markdown_message(room_id, command_registry.get_help()) - #tchap_bot.callbacks.register_on_startup(startup_action) + # tchap_bot.callbacks.register_on_startup(startup_action) tchap_bot.run() diff --git a/app/commands.py b/app/commands.py index 79cd778..1378dd8 100755 --- a/app/commands.py +++ b/app/commands.py @@ -1,5 +1,5 @@ # SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique -# SPDX-FileCopyrightText: 2024 Etalab/Datalab +# SPDX-FileCopyrightText: 2024 Etalab # # SPDX-License-Identifier: MIT diff --git a/app/config.py b/app/config.py index 090d399..964fa4c 100755 --- a/app/config.py +++ b/app/config.py @@ -1,5 +1,5 @@ # SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique -# SPDX-FileCopyrightText: 2024 Etalab/Datalab +# SPDX-FileCopyrightText: 2024 Etalab # # SPDX-License-Identifier: MIT @@ -40,8 +40,8 @@ class Config(BaseConfig): # Conversational settings with_history: bool = Field(True, description="Conversational mode") - chat_id: int|None = Field(None, description="Current chat id") - stream_id: int|None = Field(None, description="Current stream id") + chat_id: int | None = Field(None, description="Current chat id") + stream_id: int | None = Field(None, description="Current stream id") env_config = Config() diff --git a/app/matrix_bot/eventparser.py b/app/matrix_bot/eventparser.py index 40c8210..0d0d24f 100755 --- a/app/matrix_bot/eventparser.py +++ b/app/matrix_bot/eventparser.py @@ -1,6 +1,6 @@ # SPDX-FileCopyrightText: 2021 - 2022 Isaac Beverly # SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique -# SPDX-FileCopyrightText: 2024 Etalab/Datalab +# SPDX-FileCopyrightText: 2024 Etalab # # SPDX-License-Identifier: MIT from dataclasses import dataclass diff --git a/app/pyalbert_utils.py b/app/pyalbert_utils.py index 64ad422..992f0b5 100755 --- a/app/pyalbert_utils.py +++ b/app/pyalbert_utils.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2024 Etalab/Datalab +# SPDX-FileCopyrightText: 2024 Etalab # # SPDX-License-Identifier: MIT @@ -106,7 +106,7 @@ def generate_sources(config: Config, stream_id: int) -> list[dict]: # Fetch chunks sources if not stream.get("rag_sources"): return [] - data = {"uids": stream['rag_sources']} + data = {"uids": stream["rag_sources"]} response = requests.post(f"{url}/get_chunks", headers=headers, json=data) log_and_raise_for_status(response) sources = response.json() diff --git a/app/tchap_utils.py b/app/tchap_utils.py index a5c65f3..34f46e3 100644 --- a/app/tchap_utils.py +++ b/app/tchap_utils.py @@ -1,5 +1,5 @@ # SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique -# SPDX-FileCopyrightText: 2024 Etalab/Datalab +# SPDX-FileCopyrightText: 2024 Etalab # # SPDX-License-Identifier: MIT @@ -33,7 +33,9 @@ def get_salon_users_str(salon: MatrixRoom): return "\n".join(f" - **{key}** : {','.join(value) } " for key, value in user_to_print.items()) -def get_salon_moderators(salon: MatrixRoom, *, fomo_user_name=None, kick_user_name=None) -> Optional[list[str]]: +def get_salon_moderators( + salon: MatrixRoom, *, fomo_user_name=None, kick_user_name=None +) -> Optional[list[str]]: user_to_power_level = get_user_to_power_level(salon) if fomo_user_name and fomo_user_name in user_to_power_level.keys(): return None @@ -42,7 +44,11 @@ def get_salon_moderators(salon: MatrixRoom, *, fomo_user_name=None, kick_user_na minimum_power_level = 50 if kick_user_name: minimum_power_level = user_to_power_level[kick_user_name] + 1 - return [user_name for user_name, power_level in user_to_power_level.items() if power_level >= minimum_power_level] + return [ + user_name + for user_name, power_level in user_to_power_level.items() + if power_level >= minimum_power_level + ] def user_name_to_non_hl_user(complete_user_name: str) -> str: