From 0b335b0c35d16983963e08d43976ef160f102096 Mon Sep 17 00:00:00 2001 From: Gerrie Crafford Date: Mon, 18 Nov 2024 11:08:09 +0200 Subject: [PATCH] Review changes --- canarytokens/utils.py | 4 ++-- canarytokens/webhook_formatting.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/canarytokens/utils.py b/canarytokens/utils.py index 938a0ce0b..410d5fda4 100644 --- a/canarytokens/utils.py +++ b/canarytokens/utils.py @@ -1,13 +1,13 @@ import subprocess from pathlib import Path -from typing import Any, Literal, Union, Tuple, Dict +from typing import Any, Literal, Union import json import pycountry_convert from pydantic import BaseModel -def json_safe_dict(m: BaseModel, exclude: Tuple = ()) -> Dict[str, str]: +def json_safe_dict(m: BaseModel, exclude: tuple = ()) -> dict[str, str]: return json.loads(m.json(exclude_none=True, exclude=set(exclude))) diff --git a/canarytokens/webhook_formatting.py b/canarytokens/webhook_formatting.py index 6edaeef97..6efb307b1 100644 --- a/canarytokens/webhook_formatting.py +++ b/canarytokens/webhook_formatting.py @@ -1,5 +1,5 @@ from __future__ import annotations -from typing import List, Union, Optional, Dict +from typing import Union, Optional import json from enum import Enum import re @@ -261,9 +261,9 @@ class DiscordEmbeds(BaseModel): description: Optional[str] = None url: Optional[HttpUrl] timestamp: datetime - fields: List[DiscordFieldEntry] = [] + fields: list[DiscordFieldEntry] = [] - def add_fields(self, fields_info: Dict[str, str]) -> None: + def add_fields(self, fields_info: dict[str, str]) -> None: for label, text in fields_info.items(): if not label or not text: continue @@ -296,9 +296,9 @@ class Config: class TokenAlertDetailsDiscord(BaseModel): """Details that are sent to Discord webhooks""" - embeds: List[DiscordEmbeds] + embeds: list[DiscordEmbeds] - def json_safe_dict(self) -> Dict[str, str]: + def json_safe_dict(self) -> dict[str, str]: return json_safe_dict(self)