DHI / mikeio

Read, write and manipulate dfs0, dfs1, dfs2, dfs3, dfsu and mesh files.
https://dhi.github.io/mikeio
BSD 3-Clause "New" or "Revised" License
138 stars 55 forks source link

Type hints from the future #592

Closed ecomodeller closed 1 year ago

ecomodeller commented 1 year ago

This line enables the union type hint syntax from 3.10 to be used in 3.7+

from __future__ import annotations

I.e.

We can replace

def foo(Union[int,str]) -> Union[int,bool):
  ...

with the version that is easier to read for humans🙂

def foo(int | str) -> int | bool
  ...
ecomodeller commented 1 year ago

And remove some deprecated things, mainly the aggregation on Dataset, which now consistently returns a new Dataset, which should be helpful for auto-completion.