scikit-base 0.8.0__tar.gz → 0.8.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {scikit_base-0.8.0/scikit_base.egg-info → scikit_base-0.8.1}/PKG-INFO +2 -2
- {scikit_base-0.8.0 → scikit_base-0.8.1}/README.md +1 -1
- {scikit_base-0.8.0 → scikit_base-0.8.1}/pyproject.toml +1 -1
- {scikit_base-0.8.0 → scikit_base-0.8.1/scikit_base.egg-info}/PKG-INFO +2 -2
- {scikit_base-0.8.0 → scikit_base-0.8.1}/scikit_base.egg-info/SOURCES.txt +1 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/__init__.py +1 -1
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/base/_base.py +17 -4
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/lookup/_lookup.py +24 -38
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/tests/conftest.py +4 -1
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/tests/test_base.py +8 -3
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/utils/dependencies/_dependencies.py +3 -7
- scikit_base-0.8.1/skbase/utils/stdout_mute.py +64 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/validate/tests/test_type_validations.py +7 -7
- {scikit_base-0.8.0 → scikit_base-0.8.1}/LICENSE +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/docs/source/conf.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/scikit_base.egg-info/dependency_links.txt +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/scikit_base.egg-info/requires.txt +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/scikit_base.egg-info/top_level.txt +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/scikit_base.egg-info/zip-safe +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/setup.cfg +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/_exceptions.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/_nopytest_tests.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/base/__init__.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/base/_meta.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/base/_pretty_printing/__init__.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/base/_pretty_printing/_object_html_repr.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/base/_pretty_printing/_pprint.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/base/_pretty_printing/tests/__init__.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/base/_pretty_printing/tests/test_pprint.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/base/_tagmanager.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/lookup/__init__.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/lookup/tests/__init__.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/lookup/tests/test_lookup.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/testing/__init__.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/testing/test_all_objects.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/testing/utils/__init__.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/testing/utils/_conditional_fixtures.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/testing/utils/inspect.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/tests/__init__.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/tests/mock_package/__init__.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/tests/mock_package/test_mock_package.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/tests/test_baseestimator.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/tests/test_exceptions.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/tests/test_meta.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/utils/__init__.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/utils/_check.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/utils/_iter.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/utils/_nested_iter.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/utils/_utils.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/utils/deep_equals/__init__.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/utils/deep_equals/_common.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/utils/deep_equals/_deep_equals.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/utils/dependencies/__init__.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/utils/dependencies/tests/__init__.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/utils/dependencies/tests/test_check_dependencies.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/utils/random_state.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/utils/tests/__init__.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/utils/tests/test_check.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/utils/tests/test_deep_equals.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/utils/tests/test_iter.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/utils/tests/test_nested_iter.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/utils/tests/test_random_state.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/utils/tests/test_utils.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/validate/__init__.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/validate/_named_objects.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/validate/_types.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/validate/tests/__init__.py +0 -0
- {scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/validate/tests/test_iterable_named_objects.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: scikit-base
|
3
|
-
Version: 0.8.
|
3
|
+
Version: 0.8.1
|
4
4
|
Summary: Base classes for sklearn-like parametric objects
|
5
5
|
Author-email: sktime developers <sktime.toolbox@gmail.com>
|
6
6
|
Maintainer: Franz Király
|
@@ -114,7 +114,7 @@ Requires-Dist: scikit-learn>=0.24.0; extra == "test"
|
|
114
114
|
`skbase` provides base classes for creating scikit-learn-like parametric objects,
|
115
115
|
along with tools to make it easier to build your own packages that follow these design patterns.
|
116
116
|
|
117
|
-
:rocket: Version 0.8.
|
117
|
+
:rocket: Version 0.8.1 is now available. Check out our
|
118
118
|
[release notes](https://skbase.readthedocs.io/en/latest/changelog.html).
|
119
119
|
|
120
120
|
| Overview | |
|
@@ -7,7 +7,7 @@
|
|
7
7
|
`skbase` provides base classes for creating scikit-learn-like parametric objects,
|
8
8
|
along with tools to make it easier to build your own packages that follow these design patterns.
|
9
9
|
|
10
|
-
:rocket: Version 0.8.
|
10
|
+
:rocket: Version 0.8.1 is now available. Check out our
|
11
11
|
[release notes](https://skbase.readthedocs.io/en/latest/changelog.html).
|
12
12
|
|
13
13
|
| Overview | |
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: scikit-base
|
3
|
-
Version: 0.8.
|
3
|
+
Version: 0.8.1
|
4
4
|
Summary: Base classes for sklearn-like parametric objects
|
5
5
|
Author-email: sktime developers <sktime.toolbox@gmail.com>
|
6
6
|
Maintainer: Franz Király
|
@@ -114,7 +114,7 @@ Requires-Dist: scikit-learn>=0.24.0; extra == "test"
|
|
114
114
|
`skbase` provides base classes for creating scikit-learn-like parametric objects,
|
115
115
|
along with tools to make it easier to build your own packages that follow these design patterns.
|
116
116
|
|
117
|
-
:rocket: Version 0.8.
|
117
|
+
:rocket: Version 0.8.1 is now available. Check out our
|
118
118
|
[release notes](https://skbase.readthedocs.io/en/latest/changelog.html).
|
119
119
|
|
120
120
|
| Overview | |
|
@@ -44,6 +44,7 @@ skbase/utils/_iter.py
|
|
44
44
|
skbase/utils/_nested_iter.py
|
45
45
|
skbase/utils/_utils.py
|
46
46
|
skbase/utils/random_state.py
|
47
|
+
skbase/utils/stdout_mute.py
|
47
48
|
skbase/utils/deep_equals/__init__.py
|
48
49
|
skbase/utils/deep_equals/_common.py
|
49
50
|
skbase/utils/deep_equals/_deep_equals.py
|
@@ -206,16 +206,29 @@ class BaseObject(_FlagManager):
|
|
206
206
|
return parameters
|
207
207
|
|
208
208
|
@classmethod
|
209
|
-
def get_param_names(cls):
|
209
|
+
def get_param_names(cls, sort=True):
|
210
210
|
"""Get object's parameter names.
|
211
211
|
|
212
|
+
Parameters
|
213
|
+
----------
|
214
|
+
sort : bool, default=True
|
215
|
+
Whether to return the parameter names sorted in alphabetical order (True),
|
216
|
+
or in the order they appear in the class ``__init__`` (False).
|
217
|
+
|
212
218
|
Returns
|
213
219
|
-------
|
214
220
|
param_names: list[str]
|
215
|
-
|
221
|
+
List of parameter names of cls.
|
222
|
+
If ``sort=False``, in same order as they appear in the class ``__init__``.
|
223
|
+
If ``sort=True``, alphabetically ordered.
|
216
224
|
"""
|
225
|
+
if sort is None:
|
226
|
+
sort = True
|
227
|
+
|
217
228
|
parameters = cls._get_init_signature()
|
218
|
-
param_names =
|
229
|
+
param_names = [p.name for p in parameters]
|
230
|
+
if sort:
|
231
|
+
param_names = sorted(param_names)
|
219
232
|
return param_names
|
220
233
|
|
221
234
|
@classmethod
|
@@ -586,7 +599,7 @@ class BaseObject(_FlagManager):
|
|
586
599
|
`create_test_instance` uses the first (or only) dictionary in `params`
|
587
600
|
"""
|
588
601
|
params_with_defaults = set(cls.get_param_defaults().keys())
|
589
|
-
all_params = set(cls.get_param_names())
|
602
|
+
all_params = set(cls.get_param_names(sort=False))
|
590
603
|
params_without_defaults = all_params - params_with_defaults
|
591
604
|
|
592
605
|
# if non-default parameters are required, but none have been found, raise error
|
@@ -16,12 +16,10 @@ all_objects(object_types, filter_tags)
|
|
16
16
|
# https://github.com/sktime/sktime/blob/main/LICENSE
|
17
17
|
import importlib
|
18
18
|
import inspect
|
19
|
-
import io
|
20
19
|
import os
|
21
20
|
import pathlib
|
22
21
|
import pkgutil
|
23
22
|
import re
|
24
|
-
import sys
|
25
23
|
import warnings
|
26
24
|
from collections.abc import Iterable
|
27
25
|
from copy import deepcopy
|
@@ -31,6 +29,7 @@ from types import ModuleType
|
|
31
29
|
from typing import Any, List, Mapping, MutableMapping, Optional, Sequence, Tuple, Union
|
32
30
|
|
33
31
|
from skbase.base import BaseObject
|
32
|
+
from skbase.utils.stdout_mute import StdoutMute
|
34
33
|
from skbase.validate import check_sequence
|
35
34
|
|
36
35
|
__all__: List[str] = ["all_objects", "get_package_metadata"]
|
@@ -335,7 +334,7 @@ def _import_module(
|
|
335
334
|
|
336
335
|
# if suppress_import_stdout:
|
337
336
|
# setup text trap, import
|
338
|
-
with
|
337
|
+
with StdoutMuteNCatchMNF(active=suppress_import_stdout):
|
339
338
|
if isinstance(module, str):
|
340
339
|
imported_mod = importlib.import_module(module)
|
341
340
|
elif isinstance(module, importlib.machinery.SourceFileLoader):
|
@@ -865,7 +864,7 @@ def all_objects(
|
|
865
864
|
obj_types = _check_object_types(object_types, class_lookup)
|
866
865
|
|
867
866
|
# Ignore deprecation warnings triggered at import time and from walking packages
|
868
|
-
with warnings.catch_warnings(),
|
867
|
+
with warnings.catch_warnings(), StdoutMuteNCatchMNF(active=suppress_import_stdout):
|
869
868
|
warnings.simplefilter("ignore", category=FutureWarning)
|
870
869
|
warnings.simplefilter("module", category=ImportWarning)
|
871
870
|
warnings.filterwarnings(
|
@@ -1025,7 +1024,7 @@ def _make_dataframe(all_objects, columns):
|
|
1025
1024
|
return pd.DataFrame(all_objects, columns=columns)
|
1026
1025
|
|
1027
1026
|
|
1028
|
-
class StdoutMute:
|
1027
|
+
class StdoutMuteNCatchMNF(StdoutMute):
|
1029
1028
|
"""A context manager to suppress stdout.
|
1030
1029
|
|
1031
1030
|
This class is used to suppress stdout when importing modules.
|
@@ -1042,39 +1041,26 @@ class StdoutMute:
|
|
1042
1041
|
except catch and suppress ModuleNotFoundError.
|
1043
1042
|
"""
|
1044
1043
|
|
1045
|
-
def
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
# we suppress to a warning if "soft dependency" is in the error message
|
1066
|
-
# otherwise, raise
|
1067
|
-
if type is ModuleNotFoundError:
|
1068
|
-
if "soft dependency" not in str(value):
|
1069
|
-
return False
|
1070
|
-
warnings.warn(str(value), ImportWarning, stacklevel=2)
|
1071
|
-
return True
|
1072
|
-
|
1073
|
-
# all other exceptions are raised
|
1074
|
-
return False
|
1075
|
-
# if no exception was raised, return True to indicate successful exit
|
1076
|
-
# return statement not needed as type was None, but included for clarity
|
1077
|
-
return True
|
1044
|
+
def _handle_exit_exceptions(self, type, value, traceback): # noqa: A002
|
1045
|
+
"""Handle exceptions raised during __exit__.
|
1046
|
+
|
1047
|
+
Parameters
|
1048
|
+
----------
|
1049
|
+
type : type
|
1050
|
+
The type of the exception raised.
|
1051
|
+
Known to be not-None and Exception subtype when this method is called.
|
1052
|
+
"""
|
1053
|
+
# if a ModuleNotFoundError is raised,
|
1054
|
+
# we suppress to a warning if "soft dependency" is in the error message
|
1055
|
+
# otherwise, raise
|
1056
|
+
if type is ModuleNotFoundError:
|
1057
|
+
if "soft dependency" not in str(value):
|
1058
|
+
return False
|
1059
|
+
warnings.warn(str(value), ImportWarning, stacklevel=2)
|
1060
|
+
return True
|
1061
|
+
|
1062
|
+
# all other exceptions are raised
|
1063
|
+
return False
|
1078
1064
|
|
1079
1065
|
|
1080
1066
|
def _coerce_to_tuple(x):
|
@@ -54,6 +54,7 @@ SKBASE_MODULES = (
|
|
54
54
|
"skbase.utils.dependencies",
|
55
55
|
"skbase.utils.dependencies._dependencies",
|
56
56
|
"skbase.utils.random_state",
|
57
|
+
"skbase.utils.stdout_mute",
|
57
58
|
"skbase.validate",
|
58
59
|
"skbase.validate._named_objects",
|
59
60
|
"skbase.validate._types",
|
@@ -79,6 +80,7 @@ SKBASE_PUBLIC_MODULES = (
|
|
79
80
|
"skbase.utils.deep_equals",
|
80
81
|
"skbase.utils.dependencies",
|
81
82
|
"skbase.utils.random_state",
|
83
|
+
"skbase.utils.stdout_mute",
|
82
84
|
"skbase.validate",
|
83
85
|
)
|
84
86
|
SKBASE_PUBLIC_CLASSES_BY_MODULE = {
|
@@ -99,13 +101,14 @@ SKBASE_PUBLIC_CLASSES_BY_MODULE = {
|
|
99
101
|
"BaseMetaEstimatorMixin",
|
100
102
|
),
|
101
103
|
"skbase.base._pretty_printing._pprint": ("KeyValTuple", "KeyValTupleParam"),
|
102
|
-
"skbase.lookup._lookup": ("
|
104
|
+
"skbase.lookup._lookup": ("StdoutMuteNCatchMNF",),
|
103
105
|
"skbase.testing": ("BaseFixtureGenerator", "QuickTester", "TestAllObjects"),
|
104
106
|
"skbase.testing.test_all_objects": (
|
105
107
|
"BaseFixtureGenerator",
|
106
108
|
"QuickTester",
|
107
109
|
"TestAllObjects",
|
108
110
|
),
|
111
|
+
"skbase.utils.stdout_mute": ("StdoutMute",),
|
109
112
|
}
|
110
113
|
SKBASE_CLASSES_BY_MODULE = SKBASE_PUBLIC_CLASSES_BY_MODULE.copy()
|
111
114
|
SKBASE_CLASSES_BY_MODULE.update(
|
@@ -706,16 +706,21 @@ def test_get_init_signature_raises_error_for_invalid_signature(
|
|
706
706
|
fixture_invalid_init._get_init_signature()
|
707
707
|
|
708
708
|
|
709
|
+
@pytest.mark.parametrize("sort", [True, False])
|
709
710
|
def test_get_param_names(
|
710
711
|
fixture_object: Type[BaseObject],
|
711
712
|
fixture_class_parent: Type[Parent],
|
712
713
|
fixture_class_parent_expected_params: Dict[str, Any],
|
714
|
+
sort: bool,
|
713
715
|
):
|
714
716
|
"""Test that get_param_names returns list of string parameter names."""
|
715
|
-
param_names = fixture_class_parent.get_param_names()
|
716
|
-
|
717
|
+
param_names = fixture_class_parent.get_param_names(sort=sort)
|
718
|
+
if sort:
|
719
|
+
assert param_names == sorted([*fixture_class_parent_expected_params])
|
720
|
+
else:
|
721
|
+
assert param_names == [*fixture_class_parent_expected_params]
|
717
722
|
|
718
|
-
param_names = fixture_object.get_param_names()
|
723
|
+
param_names = fixture_object.get_param_names(sort=sort)
|
719
724
|
assert param_names == []
|
720
725
|
|
721
726
|
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
"""Utility to check soft dependency imports, and raise warnings or errors."""
|
3
|
-
import io
|
4
3
|
import sys
|
5
4
|
import warnings
|
6
5
|
from importlib import import_module
|
@@ -10,6 +9,8 @@ from typing import List
|
|
10
9
|
from packaging.requirements import InvalidRequirement, Requirement
|
11
10
|
from packaging.specifiers import InvalidSpecifier, SpecifierSet
|
12
11
|
|
12
|
+
from skbase.utils.stdout_mute import StdoutMute
|
13
|
+
|
13
14
|
__author__: List[str] = ["fkiraly", "mloning"]
|
14
15
|
|
15
16
|
|
@@ -130,12 +131,7 @@ def _check_soft_dependencies(
|
|
130
131
|
package_import_name = package_name
|
131
132
|
# attempt import - if not possible, we know we need to raise warning/exception
|
132
133
|
try:
|
133
|
-
|
134
|
-
# setup text trap, import, then restore
|
135
|
-
sys.stdout = io.StringIO()
|
136
|
-
pkg_ref = import_module(package_import_name)
|
137
|
-
sys.stdout = sys.__stdout__
|
138
|
-
else:
|
134
|
+
with StdoutMute(active=suppress_import_stdout):
|
139
135
|
pkg_ref = import_module(package_import_name)
|
140
136
|
# if package cannot be imported, make the user aware of installation requirement
|
141
137
|
except ModuleNotFoundError as e:
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
"""Context manager to suppress stdout."""
|
3
|
+
|
4
|
+
__author__ = ["fkiraly"]
|
5
|
+
|
6
|
+
import io
|
7
|
+
import sys
|
8
|
+
|
9
|
+
|
10
|
+
class StdoutMute:
|
11
|
+
"""A context manager to suppress stdout.
|
12
|
+
|
13
|
+
Exception handling on exit can be customized by overriding
|
14
|
+
the ``_handle_exit_exceptions`` method.
|
15
|
+
|
16
|
+
Parameters
|
17
|
+
----------
|
18
|
+
active : bool, default=True
|
19
|
+
Whether to suppress stdout or not.
|
20
|
+
If True, stdout is suppressed.
|
21
|
+
If False, stdout is not suppressed, and the context manager does nothing
|
22
|
+
except catch and suppress ModuleNotFoundError.
|
23
|
+
"""
|
24
|
+
|
25
|
+
def __init__(self, active=True):
|
26
|
+
self.active = active
|
27
|
+
|
28
|
+
def __enter__(self):
|
29
|
+
"""Context manager entry point."""
|
30
|
+
# capture stdout if active
|
31
|
+
# store the original stdout so it can be restored in __exit__
|
32
|
+
if self.active:
|
33
|
+
self._stdout = sys.stdout
|
34
|
+
sys.stdout = io.StringIO()
|
35
|
+
|
36
|
+
def __exit__(self, type, value, traceback): # noqa: A002
|
37
|
+
"""Context manager exit point."""
|
38
|
+
# restore stdout if active
|
39
|
+
# if not active, nothing needs to be done, since stdout was not replaced
|
40
|
+
if self.active:
|
41
|
+
sys.stdout = self._stdout
|
42
|
+
|
43
|
+
if type is not None:
|
44
|
+
return self._handle_exit_exceptions(type, value, traceback)
|
45
|
+
|
46
|
+
# if no exception was raised, return True to indicate successful exit
|
47
|
+
# return statement not needed as type was None, but included for clarity
|
48
|
+
return True
|
49
|
+
|
50
|
+
def _handle_exit_exceptions(self, type, value, traceback): # noqa: A002
|
51
|
+
"""Handle exceptions raised during __exit__.
|
52
|
+
|
53
|
+
Parameters
|
54
|
+
----------
|
55
|
+
type : type
|
56
|
+
The type of the exception raised.
|
57
|
+
Known to be not-None and Exception subtype when this method is called.
|
58
|
+
value : Exception
|
59
|
+
The exception instance raised.
|
60
|
+
traceback : traceback
|
61
|
+
The traceback object associated with the exception.
|
62
|
+
"""
|
63
|
+
# by default, all exceptions are raised
|
64
|
+
return False
|
@@ -127,10 +127,10 @@ def test_is_sequence_output():
|
|
127
127
|
)
|
128
128
|
|
129
129
|
# Test with 3rd party types works in default way via exact type
|
130
|
-
assert is_sequence([1.2, 4.7], element_type=np.
|
131
|
-
assert is_sequence([np.
|
130
|
+
assert is_sequence([1.2, 4.7], element_type=np.float64) is False
|
131
|
+
assert is_sequence([np.float64(1.2), np.float64(4.7)], element_type=np.float64)
|
132
132
|
|
133
|
-
# np.nan is float, not int or np.
|
133
|
+
# np.nan is float, not int or np.float64
|
134
134
|
assert is_sequence([np.nan, 4.8], element_type=float) is True
|
135
135
|
assert is_sequence([np.nan, 4], element_type=int) is False
|
136
136
|
|
@@ -243,11 +243,11 @@ def test_check_sequence_output():
|
|
243
243
|
TypeError,
|
244
244
|
match="Invalid sequence: .*",
|
245
245
|
):
|
246
|
-
check_sequence([1.2, 4.7], element_type=np.
|
247
|
-
input_seq = [np.
|
248
|
-
assert check_sequence(input_seq, element_type=np.
|
246
|
+
check_sequence([1.2, 4.7], element_type=np.float64)
|
247
|
+
input_seq = [np.float64(1.2), np.float64(4.7)]
|
248
|
+
assert check_sequence(input_seq, element_type=np.float64) == input_seq
|
249
249
|
|
250
|
-
# np.nan is float, not int or np.
|
250
|
+
# np.nan is float, not int or np.float64
|
251
251
|
assert check_sequence([np.nan, 4.8], element_type=float) == [np.nan, 4.8]
|
252
252
|
assert check_sequence([np.nan, 4.8, 7], element_type=(float, int)) == [
|
253
253
|
np.nan,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/utils/dependencies/tests/test_check_dependencies.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{scikit_base-0.8.0 → scikit_base-0.8.1}/skbase/validate/tests/test_iterable_named_objects.py
RENAMED
File without changes
|