Skip to content

Commit

Permalink
chore: fix SPDX-FileCopyrightText
Browse files Browse the repository at this point in the history
  • Loading branch information
bolinocroustibat committed May 7, 2024
1 parent dc39150 commit 9b96775
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2024 Etalab/Datalab <[email protected]>
# SPDX-FileCopyrightText: 2024 Etalab <[email protected]>
#
# SPDX-License-Identifier: CC0-1.0

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--
SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique <[email protected]>
SPDX-FileCopyrightText: 2024 Etalab/Datalab <[email protected]>
SPDX-FileCopyrightText: 2024 Etalab <[email protected]>
SPDX-License-Identifier: MIT
-->
Expand Down
2 changes: 1 addition & 1 deletion app/.env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique <[email protected]>
# SPDX-FileCopyrightText: 2024 Etalab/Datalab <[email protected]>
# SPDX-FileCopyrightText: 2024 Etalab <[email protected]>
#
# SPDX-License-Identifier: CC0-1.0

Expand Down
2 changes: 1 addition & 1 deletion app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique <[email protected]>
# SPDX-FileCopyrightText: 2024 Etalab/Datalab <[email protected]>
# SPDX-FileCopyrightText: 2024 Etalab <[email protected]>
#
# SPDX-License-Identifier: MIT

Expand Down
2 changes: 1 addition & 1 deletion app/__main__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique <[email protected]>
# SPDX-FileCopyrightText: 2024 Etalab/Datalab <[email protected]>
# SPDX-FileCopyrightText: 2024 Etalab <[email protected]>
#
# SPDX-License-Identifier: MIT

Expand Down
6 changes: 3 additions & 3 deletions app/bot.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique <[email protected]>
# SPDX-FileCopyrightText: 2024 Etalab/Datalab <[email protected]>
# SPDX-FileCopyrightText: 2024 Etalab <[email protected]>
#
# SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -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()
2 changes: 1 addition & 1 deletion app/commands.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique <[email protected]>
# SPDX-FileCopyrightText: 2024 Etalab/Datalab <[email protected]>
# SPDX-FileCopyrightText: 2024 Etalab <[email protected]>
#
# SPDX-License-Identifier: MIT

Expand Down
6 changes: 3 additions & 3 deletions app/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique <[email protected]>
# SPDX-FileCopyrightText: 2024 Etalab/Datalab <[email protected]>
# SPDX-FileCopyrightText: 2024 Etalab <[email protected]>
#
# SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion app/matrix_bot/eventparser.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-FileCopyrightText: 2021 - 2022 Isaac Beverly <https://github.com/imbev>
# SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique <[email protected]>
# SPDX-FileCopyrightText: 2024 Etalab/Datalab <[email protected]>
# SPDX-FileCopyrightText: 2024 Etalab <[email protected]>
#
# SPDX-License-Identifier: MIT
from dataclasses import dataclass
Expand Down
4 changes: 2 additions & 2 deletions app/pyalbert_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2024 Etalab/Datalab <[email protected]>
# SPDX-FileCopyrightText: 2024 Etalab <[email protected]>
#
# SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -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()
Expand Down
12 changes: 9 additions & 3 deletions app/tchap_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPDX-FileCopyrightText: 2023 Pôle d'Expertise de la Régulation Numérique <[email protected]>
# SPDX-FileCopyrightText: 2024 Etalab/Datalab <[email protected]>
# SPDX-FileCopyrightText: 2024 Etalab <[email protected]>
#
# SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 9b96775

Please sign in to comment.