general: migrate modules to use 3.9 features

This commit is contained in:
Dima Gerasimov 2024-10-19 22:10:40 +01:00 committed by karlicoss
parent d3f9a8e8b6
commit 8496d131e7
125 changed files with 889 additions and 739 deletions

View file

@ -1,20 +1,21 @@
# todo: uses my private export script?, timezone
from __future__ import annotations
import json
from collections.abc import Iterable, Iterator
from dataclasses import dataclass
from datetime import datetime, timezone
import json
from typing import Iterator, Iterable, Optional
from my.core import Json, datetime_aware, stat, Stats
from my.core.error import Res
from my.config import vk as config # type: ignore[attr-defined]
from my.core import Json, Stats, datetime_aware, stat
from my.core.error import Res
@dataclass
class Favorite:
dt: datetime_aware
title: str
url: Optional[str]
url: str | None
text: str

View file

@ -2,18 +2,16 @@
VK data (exported by [[https://github.com/Totktonada/vk_messages_backup][Totktonada/vk_messages_backup]])
'''
# note: could reuse the original repo, but little point I guess since VK closed their API
import json
from collections.abc import Iterator
from dataclasses import dataclass
from datetime import datetime
import json
from typing import Dict, Iterator
import pytz
from my.core import stat, Stats, Json, Res, datetime_aware, get_files
from my.core.common import unique_everseen
from my.config import vk_messages_backup as config
from my.core import Json, Res, Stats, datetime_aware, get_files, stat
from my.core.common import unique_everseen
# I think vk_messages_backup used this tz?
# not sure if vk actually used to return this tz in api?
@ -45,7 +43,7 @@ class Message:
body: str
Users = Dict[Uid, User]
Users = dict[Uid, User]
def users() -> Users: