Skip to content

Commit

Permalink
Finish off mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
znicholls committed Sep 12, 2024
1 parent 0cdd0d7 commit 3cf7e42
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/openscm_calibration/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ class AlignmentError(ValueError):
def __init__( # noqa: PLR0913
self,
name_left: str,
val_left: pd.DataFrame | pd.Series,
val_left: pd.DataFrame | pd.Series[Any],
name_right: str,
val_right: pd.DataFrame | pd.Series,
val_right: pd.DataFrame | pd.Series[Any],
extra_context: str | None = None,
) -> None:
"""
Expand Down
2 changes: 1 addition & 1 deletion src/openscm_calibration/matplotlib_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def get_fig_axes_holder_from_mosaic(
)

fig, axes = plt.subplot_mosaic(
mosaic=mosaic,
mosaic=mosaic, # type: ignore # matplotlib's type hints are unclear
**kwargs,
)
holder = IPython.display.display(fig, display_id=True) # type: ignore
Expand Down
7 changes: 4 additions & 3 deletions src/openscm_calibration/scmdata_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def scmrun_as_dict(
Parameters
----------
inp
:obj:`scmdata.run.BaseScmRun` to group
[scmdata.run.BaseScmRun][] to group
groups
Metadata keys to use to make the groups
Expand All @@ -30,11 +30,12 @@ def scmrun_as_dict(
Returns
-------
Grouped ``inp``
:
Grouped `inp`
"""
res = {}
for inp_g in inp.groupby(groups):
key = separator.join([inp_g.get_unique_meta(g, True) for g in groups])
key = str(separator.join([str(inp_g.get_unique_meta(g, True)) for g in groups]))
res[key] = inp_g

return res
10 changes: 9 additions & 1 deletion stubs/emcee/backends.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,12 @@ import numpy as np
import numpy.typing as nptype

class Backend:
def get_chain(self, **kwargs: Any) -> nptype.NDArray[np.floating[Any]]: ...
iteration: int
def get_autocorr_time(
self, discard: int = 0, thin: int = 1, **kwargs: Any
) -> nptype.NDArray[np.floating[Any]]: ...
def get_chain(
self, **kwargs: Any
) -> nptype.NDArray[np.floating[Any] | np.integer[Any]]: ...
# Dimensionality of type hint would be helpful, anyway...
def get_log_prob(self, **kwargs: Any) -> nptype.NDArray[np.floating[Any]]: ...

0 comments on commit 3cf7e42

Please sign in to comment.