Skip to content

Commit 330c7a6

Browse files
update imports
1 parent c63a7fe commit 330c7a6

File tree

3 files changed

+23
-14
lines changed

3 files changed

+23
-14
lines changed

databind.core/src/databind/core/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33
from .context import Context, Direction, Location, format_context_trace
44
from .converter import ConversionError, Converter, DelegateToClassmethodConverter, Module, NoMatchingConverter
55
from .mapper import ObjectMapper
6-
from .schema import Schema, convert_dataclass_to_schema, convert_to_schema, convert_typed_dict_to_schema
6+
from .schema import (
7+
Field,
8+
Schema,
9+
convert_dataclass_to_schema,
10+
convert_to_schema,
11+
convert_typed_dict_to_schema,
12+
get_fields_expanded,
13+
)
714
from .settings import (
815
Alias,
916
BooleanSetting,
@@ -43,11 +50,13 @@
4350
"DeserializeAs",
4451
"Direction",
4552
"ExtraKeys",
53+
"Field",
4654
"Flattened",
4755
"format_context_trace",
4856
"get_annotation_setting",
4957
"get_class_setting",
5058
"get_class_settings",
59+
"get_fields_expanded",
5160
"get_highest_setting",
5261
"Location",
5362
"Module",

databind.json/src/databind/json/__init__.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
import json
44
import typing as t
55

6+
from databind.core import ObjectMapper, Setting, Settings
7+
68
from databind.json.module import JsonModule
79
from databind.json.settings import JsonConverter
810

9-
if t.TYPE_CHECKING:
10-
from databind.core.mapper import ObjectMapper
11-
from databind.core.settings import Setting, Settings
12-
1311
__version__ = "4.2.8"
1412
__all__ = [
1513
"dump",
@@ -35,10 +33,6 @@
3533

3634

3735
def get_object_mapper(settings: "Settings | None" = None) -> "ObjectMapper[t.Any, JsonType]":
38-
from databind.core.mapper import ObjectMapper
39-
40-
from databind.json.module import JsonModule
41-
4236
mapper = ObjectMapper[t.Any, JsonType](settings)
4337
mapper.module.register(JsonModule())
4438
return mapper

databind.json/src/databind/json/converters.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,26 @@
55
import types
66
import typing as t
77

8-
from databind.core.context import Context, Direction
9-
from databind.core.converter import ConversionError, Converter
10-
from databind.core.schema import Field, Schema, convert_to_schema, get_fields_expanded
11-
from databind.core.settings import (
8+
from databind.core import (
129
Alias,
10+
Context,
11+
ConversionError,
12+
Converter,
1313
DateFormat,
1414
DeserializeAs,
15+
Direction,
1516
ExtraKeys,
17+
Field,
1618
Precision,
1719
Remainder,
20+
Schema,
1821
SerializeDefaults,
1922
Strict,
2023
Union,
24+
convert_to_schema,
2125
get_annotation_setting,
26+
get_fields_expanded,
2227
)
23-
from databind.core.utils import T
2428
from typeapi import (
2529
AnnotatedTypeHint,
2630
ClassTypeHint,
@@ -32,6 +36,8 @@
3236
type_repr,
3337
)
3438

39+
T = t.TypeVar("T")
40+
3541

3642
def _int_lossless(v: float) -> int:
3743
"""Convert *v* to an integer only if the conversion is lossless, otherwise raise an error."""

0 commit comments

Comments
 (0)