core: migrate code to benefit from 3.9 stuff (#401)
for now keeping ruff on 3.8 target version, need to sort out modules as well
This commit is contained in:
parent
bc7c3ac253
commit
d3f9a8e8b6
43 changed files with 515 additions and 404 deletions
|
@ -7,17 +7,14 @@ from __future__ import annotations
|
|||
# todo not sure if belongs to 'core'. It's certainly 'more' core than actual modules, but still not essential
|
||||
# NOTE: this file is meant to be importable without Pandas installed
|
||||
import dataclasses
|
||||
from collections.abc import Iterable, Iterator
|
||||
from datetime import datetime, timezone
|
||||
from pprint import pformat
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
Iterable,
|
||||
Iterator,
|
||||
Literal,
|
||||
Type,
|
||||
TypeVar,
|
||||
)
|
||||
|
||||
|
@ -178,7 +175,7 @@ def _to_jsons(it: Iterable[Res[Any]]) -> Iterable[Json]:
|
|||
Schema = Any
|
||||
|
||||
|
||||
def _as_columns(s: Schema) -> Dict[str, Type]:
|
||||
def _as_columns(s: Schema) -> dict[str, type]:
|
||||
# todo would be nice to extract properties; add tests for this as well
|
||||
if dataclasses.is_dataclass(s):
|
||||
return {f.name: f.type for f in dataclasses.fields(s)} # type: ignore[misc] # ugh, why mypy thinks f.type can return str??
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue