From 1ab21bb69143bedaba2fb757e9b48edcc2fddd6c Mon Sep 17 00:00:00 2001 From: Guillaume Charest <1690085+gcharest@users.noreply.github.com> Date: Mon, 27 May 2024 17:22:55 +0000 Subject: [PATCH] fix: fmt issue --- app/integrations/google_workspace/google_docs.py | 1 + app/integrations/google_workspace/google_meet.py | 1 + .../google_workspace/google_service.py | 1 + app/integrations/slack/users.py | 1 + app/integrations/utils/api.py | 1 + app/modules/aws/identity_center.py | 1 + app/modules/dev/google_service.py | 1 + app/modules/incident/incident.py | 12 ++++++------ app/modules/incident/incident_helper.py | 8 +++++--- app/modules/sre/geolocate_helper.py | 1 + .../google_workspace/test_google_directory.py | 1 + .../google_workspace/test_google_drive.py | 1 + .../google_workspace/test_google_meet.py | 1 + .../google_workspace/test_google_service.py | 1 + .../intergrations/test_google_drive_module.py | 1 + app/tests/modules/aws/test_sync_identity_center.py | 14 ++++++++------ app/utils/filters.py | 1 + 17 files changed, 33 insertions(+), 15 deletions(-) diff --git a/app/integrations/google_workspace/google_docs.py b/app/integrations/google_workspace/google_docs.py index 04259d96..9cd715d5 100644 --- a/app/integrations/google_workspace/google_docs.py +++ b/app/integrations/google_workspace/google_docs.py @@ -2,6 +2,7 @@ This module provides functions to create and manipulate Google Docs. """ + import logging import re from integrations.google_workspace.google_service import ( diff --git a/app/integrations/google_workspace/google_meet.py b/app/integrations/google_workspace/google_meet.py index b8bf83db..1b322345 100644 --- a/app/integrations/google_workspace/google_meet.py +++ b/app/integrations/google_workspace/google_meet.py @@ -6,6 +6,7 @@ create_google_meet(title: str) -> str: Starts a Google Meet session and returns the URL of the session. """ + import re from datetime import datetime diff --git a/app/integrations/google_workspace/google_service.py b/app/integrations/google_workspace/google_service.py index 3af9a69b..f156b7e0 100644 --- a/app/integrations/google_workspace/google_service.py +++ b/app/integrations/google_workspace/google_service.py @@ -11,6 +11,7 @@ Decorator that catches and logs any HttpError or Error exceptions that occur when the decorated function is called. """ + import os import logging import json diff --git a/app/integrations/slack/users.py b/app/integrations/slack/users.py index 870736a3..3879dcdc 100644 --- a/app/integrations/slack/users.py +++ b/app/integrations/slack/users.py @@ -2,6 +2,7 @@ This module contains the user related functionality for the Slack integration. """ + import re from slack_sdk import WebClient diff --git a/app/integrations/utils/api.py b/app/integrations/utils/api.py index c58ffd4e..49a81149 100644 --- a/app/integrations/utils/api.py +++ b/app/integrations/utils/api.py @@ -1,4 +1,5 @@ """Utilities for API integrations.""" + import re import string import random diff --git a/app/modules/aws/identity_center.py b/app/modules/aws/identity_center.py index 4a9c959a..e582c109 100644 --- a/app/modules/aws/identity_center.py +++ b/app/modules/aws/identity_center.py @@ -1,4 +1,5 @@ """Module to sync the AWS Identity Center with the Google Workspace.""" + from logging import getLogger from integrations.aws import identity_store from modules.provisioning import groups, entities diff --git a/app/modules/dev/google_service.py b/app/modules/dev/google_service.py index 2f22af7f..a1b22e05 100644 --- a/app/modules/dev/google_service.py +++ b/app/modules/dev/google_service.py @@ -1,4 +1,5 @@ """Testing new google service (will be removed)""" + import os from datetime import datetime, timedelta, timezone from integrations.google_workspace import ( diff --git a/app/modules/incident/incident.py b/app/modules/incident/incident.py index 01410267..f4d19618 100644 --- a/app/modules/incident/incident.py +++ b/app/modules/incident/incident.py @@ -236,13 +236,13 @@ def submit(ack, view, say, body, client, logger): ] if not re.match(r"^[\w\-\s]+$", name): - errors[ - "name" - ] = "Description must only contain number and letters // La description ne doit contenir que des nombres et des lettres" + errors["name"] = ( + "Description must only contain number and letters // La description ne doit contenir que des nombres et des lettres" + ) if len(name) > 60: - errors[ - "name" - ] = "Description must be less than 60 characters // La description doit contenir moins de 60 caractères" + errors["name"] = ( + "Description must be less than 60 characters // La description doit contenir moins de 60 caractères" + ) if len(errors) > 0: ack(response_action="errors", errors=errors) return diff --git a/app/modules/incident/incident_helper.py b/app/modules/incident/incident_helper.py index a53a6eb8..112598e5 100644 --- a/app/modules/incident/incident_helper.py +++ b/app/modules/incident/incident_helper.py @@ -691,9 +691,11 @@ def channel_item(channel): "elements": [ { "type": "mrkdwn", - "text": channel["topic"]["value"] - if channel["topic"]["value"] - else "No information available", + "text": ( + channel["topic"]["value"] + if channel["topic"]["value"] + else "No information available" + ), } ], }, diff --git a/app/modules/sre/geolocate_helper.py b/app/modules/sre/geolocate_helper.py index c9a8963c..029a8253 100644 --- a/app/modules/sre/geolocate_helper.py +++ b/app/modules/sre/geolocate_helper.py @@ -2,6 +2,7 @@ This module provides the ability to geolocate an IP address using the maxmind service. """ + from integrations import maxmind diff --git a/app/tests/integrations/google_workspace/test_google_directory.py b/app/tests/integrations/google_workspace/test_google_directory.py index 5002c26d..1a513e23 100644 --- a/app/tests/integrations/google_workspace/test_google_directory.py +++ b/app/tests/integrations/google_workspace/test_google_directory.py @@ -1,4 +1,5 @@ """Unit tests for google_directory module.""" + from unittest.mock import patch from integrations.google_workspace import google_directory diff --git a/app/tests/integrations/google_workspace/test_google_drive.py b/app/tests/integrations/google_workspace/test_google_drive.py index bd4aa580..20a3adf2 100644 --- a/app/tests/integrations/google_workspace/test_google_drive.py +++ b/app/tests/integrations/google_workspace/test_google_drive.py @@ -1,4 +1,5 @@ """Unit tests for google_drive module.""" + from unittest.mock import patch, call from integrations.google_workspace import google_drive diff --git a/app/tests/integrations/google_workspace/test_google_meet.py b/app/tests/integrations/google_workspace/test_google_meet.py index 49c18c02..47dad9dc 100644 --- a/app/tests/integrations/google_workspace/test_google_meet.py +++ b/app/tests/integrations/google_workspace/test_google_meet.py @@ -1,4 +1,5 @@ """Test google_meet.py functions.""" + from unittest.mock import patch from integrations.google_workspace import google_meet diff --git a/app/tests/integrations/google_workspace/test_google_service.py b/app/tests/integrations/google_workspace/test_google_service.py index d88ae268..d8ecc7f4 100644 --- a/app/tests/integrations/google_workspace/test_google_service.py +++ b/app/tests/integrations/google_workspace/test_google_service.py @@ -1,4 +1,5 @@ """Unit Tests for the google_service module.""" + import json from unittest.mock import patch, MagicMock from json import JSONDecodeError diff --git a/app/tests/intergrations/test_google_drive_module.py b/app/tests/intergrations/test_google_drive_module.py index 4b5eb031..1c86d8b7 100644 --- a/app/tests/intergrations/test_google_drive_module.py +++ b/app/tests/intergrations/test_google_drive_module.py @@ -1,4 +1,5 @@ """NOTE: this module requires a suffix while the intergration/google_drive.py still exists. It should be removed after the integration/google_drive.py is properly refactored with the new google_workspace integration.""" + import os import pytest diff --git a/app/tests/modules/aws/test_sync_identity_center.py b/app/tests/modules/aws/test_sync_identity_center.py index 783d3fef..8d33d217 100644 --- a/app/tests/modules/aws/test_sync_identity_center.py +++ b/app/tests/modules/aws/test_sync_identity_center.py @@ -29,9 +29,9 @@ def _provision_entities_side_effect(function, entities, **kwargs): entities_provisioned.append( { "entity": entity["primaryEmail"], - "response": f"membership-{entity['primaryEmail']}" - if execute - else None, + "response": ( + f"membership-{entity['primaryEmail']}" if execute else None + ), } ) elif function_name == "delete_group_membership": @@ -147,9 +147,11 @@ def _expected_output(group_users, execute_create, execute_delete): expected_output[0].append( { "entity": user["primaryEmail"], - "response": "membership-" + user["primaryEmail"] - if execute_create - else None, + "response": ( + "membership-" + user["primaryEmail"] + if execute_create + else None + ), } ) for user in group[1]: diff --git a/app/utils/filters.py b/app/utils/filters.py index 1088b568..64bf0d1c 100644 --- a/app/utils/filters.py +++ b/app/utils/filters.py @@ -1,4 +1,5 @@ """This module contains utility functions for filtering lists and dictionaries.""" + from functools import reduce import logging import re