Skip to content

Commit

Permalink
remove extraneous casts
Browse files Browse the repository at this point in the history
  • Loading branch information
nstarman committed Nov 14, 2023
1 parent cf2f66f commit f8fde3c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,8 @@ dmypy.json
# Pyre type checker
.pyre/

# Visual Studio Code
.vscode/

# Mac stuff
.DS_Store
3 changes: 1 addition & 2 deletions src/stream_ml/core/params/_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from collections.abc import Iterable, Mapping
from dataclasses import replace
from itertools import chain
from typing import TYPE_CHECKING, Any, cast, overload
from typing import TYPE_CHECKING, Any, overload

from stream_ml.core.params._core import ModelParameter
from stream_ml.core.setup_package import PACK_PARAM_JOIN
Expand Down Expand Up @@ -78,7 +78,6 @@ def __getitem__(
elif len(key) == 1:
value = self._dict[key[0]]
elif len(key) == LEN_NAME_TUPLE:
key = cast("tuple[str, str]", key) # TODO: remove cast
cm = self._dict[key[0]]
if not isinstance(cm, Mapping):
raise KeyError(str(key))
Expand Down
4 changes: 1 addition & 3 deletions src/stream_ml/core/params/_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from collections.abc import Iterable, Mapping
import itertools
from typing import TYPE_CHECKING, TypeVar, cast, overload
from typing import TYPE_CHECKING, TypeVar, overload

from stream_ml.core.setup_package import PACK_PARAM_JOIN
from stream_ml.core.utils.frozen_dict import FrozenDict
Expand Down Expand Up @@ -60,7 +60,6 @@ def __getitem__(self, key: ParamNameAllOpts) -> V | FrozenDict[str, V]:
elif len(key) == 1:
value = self._dict[key[0]]
elif len(key) == LEN_NAME_TUPLE:
key = cast("tuple[str, str]", key) # TODO: remove cast
cm = self._dict[key[0]]
if not isinstance(cm, Mapping):
raise KeyError(str(key))
Expand Down Expand Up @@ -211,7 +210,6 @@ def _set_param_dict(
elif len(key) == 1:
m[key[0]] = value
else:
key = cast("tuple[str, str]", key) # TODO: remove cast
if key[0] not in m:
m[key[0]] = {}
if not isinstance((cm := m[key[0]]), dict):
Expand Down

0 comments on commit f8fde3c

Please sign in to comment.