Skip to content

Commit 138c17e

Browse files
authored
Merge pull request #143 from altendky/ib_gives_any
2 parents 32d4f68 + 8ae4cb3 commit 138c17e

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

src/desert/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,19 @@ def field(
9393
*,
9494
metadata: t.Mapping[object, object] = {},
9595
**kw: object,
96-
) -> object:
96+
) -> t.Any:
9797
...
9898

9999

100-
# The return type hint of object is certainly a lie but fits a lot better with
100+
# The return type hint of Any is certainly a lie but fits a lot better with
101101
# the normal use of `x: int = desert.field()`. Both dataclasses and attrs
102102
# prioritize hinting for this usage as well. Perhaps someday we'll have a
103103
# plugin that indicates the actual type.
104104
def field(
105105
marshmallow_field: marshmallow.fields.Field,
106106
metadata: t.Mapping[object, object] = {},
107107
**kw: object,
108-
) -> object:
108+
) -> t.Any:
109109
"""Specify a marshmallow field in the metadata for a ``dataclasses.dataclass``.
110110
111111
.. code-block:: python
@@ -153,19 +153,19 @@ def ib(
153153
*,
154154
metadata: t.Mapping[object, object] = {},
155155
**kw: object,
156-
) -> object:
156+
) -> t.Any:
157157
...
158158

159159

160-
# The return type hint of object is certainly a lie but fits a lot better with
160+
# The return type hint of Any is certainly a lie but fits a lot better with
161161
# the normal use of `x: int = desert.ib()`. Both dataclasses and attrs
162162
# prioritize hinting for this usage as well. Perhaps someday we'll have a
163163
# plugin that indicates the actual type.
164164
def ib(
165165
marshmallow_field: marshmallow.fields.Field,
166166
metadata: t.Mapping[object, object] = {},
167167
**kw: object,
168-
) -> object:
168+
) -> t.Any:
169169
"""Specify a marshmallow field in the metadata for an ``attr.dataclass``.
170170
171171
.. code-block:: python

tests/test_make.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def test_concise_dataclasses_field() -> None:
245245

246246
@dataclasses.dataclass
247247
class A:
248-
x: datetime.datetime = desert.field(marshmallow.fields.NaiveDateTime()) # type: ignore[assignment]
248+
x: datetime.datetime = desert.field(marshmallow.fields.NaiveDateTime())
249249

250250
timestring = "2019-10-21T10:25:00"
251251
dt = datetime.datetime(year=2019, month=10, day=21, hour=10, minute=25, second=00)
@@ -259,7 +259,7 @@ def test_concise_attrib() -> None:
259259

260260
@attr.dataclass
261261
class A:
262-
x: datetime.datetime = desert.ib(marshmallow.fields.NaiveDateTime()) # type: ignore[assignment]
262+
x: datetime.datetime = desert.ib(marshmallow.fields.NaiveDateTime())
263263

264264
timestring = "2019-10-21T10:25:00"
265265
dt = datetime.datetime(year=2019, month=10, day=21, hour=10, minute=25, second=00)
@@ -273,7 +273,10 @@ def test_concise_field_metadata() -> None:
273273

274274
@dataclasses.dataclass
275275
class A:
276-
x: datetime.datetime = desert.field(marshmallow.fields.NaiveDateTime(), metadata={"foo": 1}) # type: ignore[assignment]
276+
x: datetime.datetime = desert.field(
277+
marshmallow.fields.NaiveDateTime(),
278+
metadata={"foo": 1},
279+
)
277280

278281
timestring = "2019-10-21T10:25:00"
279282
dt = datetime.datetime(year=2019, month=10, day=21, hour=10, minute=25, second=00)
@@ -288,7 +291,9 @@ def test_concise_attrib_metadata() -> None:
288291

289292
@attr.dataclass
290293
class A:
291-
x: datetime.datetime = desert.ib(marshmallow.fields.NaiveDateTime(), metadata={"foo": 1}) # type: ignore[assignment]
294+
x: datetime.datetime = desert.ib(
295+
marshmallow.fields.NaiveDateTime(), metadata={"foo": 1}
296+
)
292297

293298
timestring = "2019-10-21T10:25:00"
294299
dt = datetime.datetime(year=2019, month=10, day=21, hour=10, minute=25, second=00)

0 commit comments

Comments
 (0)