From 021af9e31530cfd5cfd4df414c90b3b536c7ffd8 Mon Sep 17 00:00:00 2001 From: Tamas Kiss <kiss.tamas@kszk.bme.hu> Date: Tue, 8 Mar 2022 03:55:15 +0100 Subject: [PATCH] fixup: small typing related changes --- mattermost_matchmaker/matchmaking.py | 9 ++++----- mattermost_matchmaker/run.py | 2 +- mypy.ini | 8 ++++++++ 3 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 mypy.ini diff --git a/mattermost_matchmaker/matchmaking.py b/mattermost_matchmaker/matchmaking.py index c041f8b..bb5cc0e 100644 --- a/mattermost_matchmaker/matchmaking.py +++ b/mattermost_matchmaker/matchmaking.py @@ -1,7 +1,6 @@ -import copy import random -from typing import Generator, Iterable, Tuple, List -import mattermost +from typing import Generator, Iterable, Tuple, Optional, List +import mattermost # type: ignore #pylint: disable=invalid-name @@ -11,7 +10,7 @@ def random_nonrepeating_tuples(population: Iterable, n: int) -> Generator[tuple, Generates a random sequence of n-tuples, using every element in population only once """ - population_copy = copy.copy(population) + population_copy = list(population) random.shuffle(population_copy) buffer = list() @@ -52,7 +51,7 @@ def matching_in_channel(client: mattermost.MMApi, channel_id: str, client.create_post(channel_id=channel_id, message=left_out_message.format(user=user_data)) -def create_group(client: mattermost.MMApi, ids: Iterable[str]) -> None: +def create_group(client: mattermost.MMApi, ids: Iterable[str]) -> str: """ Creating a group-message for the group """ diff --git a/mattermost_matchmaker/run.py b/mattermost_matchmaker/run.py index b3607e9..60aa5d5 100755 --- a/mattermost_matchmaker/run.py +++ b/mattermost_matchmaker/run.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 import argparse -import mattermost +import mattermost # type: ignore from mattermost_matchmaker.matchmaking import matching_in_channel #pylint: disable=too-many-arguments diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 0000000..e119717 --- /dev/null +++ b/mypy.ini @@ -0,0 +1,8 @@ +[mypy] + +[mypy-mattermost.*] +ignore_missing_imports = True + +[mypy-pylint.*] +ignore_missing_imports = True + -- GitLab