Skip to content

Commit

Permalink
Review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gjcthinkst committed Nov 18, 2024
1 parent 3f99b2a commit 0b335b0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions canarytokens/utils.py
Original file line number Diff line number Diff line change
@@ -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)))


Expand Down
10 changes: 5 additions & 5 deletions canarytokens/webhook_formatting.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)


Expand Down

0 comments on commit 0b335b0

Please sign in to comment.