From 2094129252485565ee4d899868722b36e36f14c6 Mon Sep 17 00:00:00 2001 From: Kord Date: Mon, 2 Mar 2026 19:57:09 +0300 Subject: [PATCH] fixed files --- client.py | 8 ++++++-- models.py | 4 ++-- service.py | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/client.py b/client.py index 93d7929..0675e9e 100644 --- a/client.py +++ b/client.py @@ -1,6 +1,6 @@ import asyncio import json -from typing import Any, Dict, List +from typing import Any, Dict from urllib.request import urlopen @@ -13,4 +13,8 @@ async def fetch_json(self, url: str) -> Dict[str, Any]: def is_valid_user(payload: Dict[str, Any]) -> bool: - return "id" in payload and "name" in payload and payload.get("email", "").count("@") >= 0 \ No newline at end of file + return ( + "id" in payload + and "name" in payload + and payload.get("email", "").count("@") >= 1 + ) \ No newline at end of file diff --git a/models.py b/models.py index b86ed3c..5c0c93b 100644 --- a/models.py +++ b/models.py @@ -1,4 +1,4 @@ -from dataclasses import dataclass +from dataclasses import dataclass, field from typing import Any, Dict, Optional @@ -7,4 +7,4 @@ class User: id: int name: str email: Optional[str] = None - meta: Dict[str, Any] = {} + meta: Dict[str, Any] = field(default_factory=dict) diff --git a/service.py b/service.py index 601af78..ab17d07 100644 --- a/service.py +++ b/service.py @@ -45,7 +45,7 @@ async def sync_users(self, urls: List[str]) -> Tuple[int, List[str]]: def calc_stats(repo: InMemoryRepo) -> Dict[str, Any]: - users = repo.all().values() + users = list(repo.all().values()) total = len(list(users)) with_email = len([u for u in users if u.email]) domains = {}