Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor sub modules #78

Merged
merged 22 commits into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Rename _nested_seq.py to _nested_iter.py
  • Loading branch information
RNKuhns committed Dec 6, 2022
commit 494cc93b4ad104c55ccfef7797168b8fe94a62bc
2 changes: 1 addition & 1 deletion skbase/base/_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from typing import List

from skbase.base._base import BaseEstimator
from skbase.utils._nested_seq import flatten, is_flat, unflatten
from skbase.utils._nested_iter import flatten, is_flat, unflatten

__author__: List[str] = ["mloning", "fkiraly"]
__all__: List[str] = ["BaseMetaEstimator"]
Expand Down
2 changes: 1 addition & 1 deletion skbase/testing/utils/_conditional_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from typing import Callable, Dict, List

from skbase._exceptions import FixtureGenerationError
from skbase.utils._misc import _remove_single
from skbase.utils._nested_iter import _remove_single
from skbase.validate._types import _check_list_of_str

__author__: List[str] = ["fkiraly"]
Expand Down
2 changes: 1 addition & 1 deletion skbase/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""Functionality used through `skbase`."""
from typing import List

from skbase.utils._nested_seq import flatten, is_flat, unflat_len, unflatten
from skbase.utils._nested_iter import flatten, is_flat, unflat_len, unflatten

__author__: List[str] = ["RNKuhns", "fkiraly"]
__all__: List[str] = ["flatten", "is_flat", "unflat_len", "unflatten"]
25 changes: 0 additions & 25 deletions skbase/utils/_misc.py

This file was deleted.

17 changes: 17 additions & 0 deletions skbase/utils/_nested_seq.py → skbase/utils/_nested_iter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@
__all__: List[str] = ["flatten", "is_flat", "unflat_len", "unflatten"]


def _remove_single(x):
"""Remove tuple wrapping from singleton.

Parameters
----------
x : tuple

Returns
-------
x[0] if x is a singleton, otherwise x
"""
if len(x) == 1:
return x[0]
else:
return x


def flatten(obj):
"""Flatten nested list/tuple structure.

Expand Down