scikit-base 0.7.5__tar.gz → 0.7.7__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.
Files changed (67) hide show
  1. {scikit-base-0.7.5/scikit_base.egg-info → scikit_base-0.7.7}/PKG-INFO +4 -3
  2. {scikit-base-0.7.5 → scikit_base-0.7.7}/README.md +3 -2
  3. {scikit-base-0.7.5 → scikit_base-0.7.7}/pyproject.toml +1 -1
  4. {scikit-base-0.7.5 → scikit_base-0.7.7/scikit_base.egg-info}/PKG-INFO +4 -3
  5. {scikit-base-0.7.5 → scikit_base-0.7.7}/scikit_base.egg-info/SOURCES.txt +2 -0
  6. {scikit-base-0.7.5 → scikit_base-0.7.7}/scikit_base.egg-info/top_level.txt +1 -0
  7. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/__init__.py +1 -1
  8. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/base/_pretty_printing/_object_html_repr.py +17 -15
  9. scikit_base-0.7.7/skbase/base/_pretty_printing/tests/__init__.py +2 -0
  10. scikit_base-0.7.7/skbase/base/_pretty_printing/tests/test_pprint.py +26 -0
  11. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/testing/utils/inspect.py +1 -0
  12. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/utils/deep_equals/_deep_equals.py +13 -2
  13. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/utils/tests/test_deep_equals.py +9 -2
  14. {scikit-base-0.7.5 → scikit_base-0.7.7}/LICENSE +0 -0
  15. {scikit-base-0.7.5 → scikit_base-0.7.7}/docs/source/conf.py +0 -0
  16. {scikit-base-0.7.5 → scikit_base-0.7.7}/scikit_base.egg-info/dependency_links.txt +0 -0
  17. {scikit-base-0.7.5 → scikit_base-0.7.7}/scikit_base.egg-info/requires.txt +0 -0
  18. {scikit-base-0.7.5 → scikit_base-0.7.7}/scikit_base.egg-info/zip-safe +0 -0
  19. {scikit-base-0.7.5 → scikit_base-0.7.7}/setup.cfg +0 -0
  20. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/_exceptions.py +0 -0
  21. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/_nopytest_tests.py +0 -0
  22. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/base/__init__.py +0 -0
  23. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/base/_base.py +0 -0
  24. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/base/_meta.py +0 -0
  25. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/base/_pretty_printing/__init__.py +0 -0
  26. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/base/_pretty_printing/_pprint.py +0 -0
  27. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/base/_tagmanager.py +0 -0
  28. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/lookup/__init__.py +0 -0
  29. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/lookup/_lookup.py +0 -0
  30. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/lookup/tests/__init__.py +0 -0
  31. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/lookup/tests/test_lookup.py +0 -0
  32. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/testing/__init__.py +0 -0
  33. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/testing/test_all_objects.py +0 -0
  34. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/testing/utils/__init__.py +0 -0
  35. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/testing/utils/_conditional_fixtures.py +0 -0
  36. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/tests/__init__.py +0 -0
  37. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/tests/conftest.py +0 -0
  38. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/tests/mock_package/__init__.py +0 -0
  39. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/tests/mock_package/test_mock_package.py +0 -0
  40. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/tests/test_base.py +0 -0
  41. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/tests/test_baseestimator.py +0 -0
  42. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/tests/test_exceptions.py +0 -0
  43. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/tests/test_meta.py +0 -0
  44. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/utils/__init__.py +0 -0
  45. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/utils/_check.py +0 -0
  46. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/utils/_iter.py +0 -0
  47. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/utils/_nested_iter.py +0 -0
  48. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/utils/_utils.py +0 -0
  49. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/utils/deep_equals/__init__.py +0 -0
  50. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/utils/deep_equals/_common.py +0 -0
  51. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/utils/dependencies/__init__.py +0 -0
  52. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/utils/dependencies/_dependencies.py +0 -0
  53. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/utils/dependencies/tests/__init__.py +0 -0
  54. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/utils/dependencies/tests/test_check_dependencies.py +0 -0
  55. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/utils/random_state.py +0 -0
  56. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/utils/tests/__init__.py +0 -0
  57. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/utils/tests/test_check.py +0 -0
  58. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/utils/tests/test_iter.py +0 -0
  59. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/utils/tests/test_nested_iter.py +0 -0
  60. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/utils/tests/test_random_state.py +0 -0
  61. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/utils/tests/test_utils.py +0 -0
  62. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/validate/__init__.py +0 -0
  63. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/validate/_named_objects.py +0 -0
  64. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/validate/_types.py +0 -0
  65. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/validate/tests/__init__.py +0 -0
  66. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/validate/tests/test_iterable_named_objects.py +0 -0
  67. {scikit-base-0.7.5 → scikit_base-0.7.7}/skbase/validate/tests/test_type_validations.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: scikit-base
3
- Version: 0.7.5
3
+ Version: 0.7.7
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,14 +114,15 @@ 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.7.4 is now available. Check out our
117
+ :rocket: Version 0.7.7 is now available. Check out our
118
118
  [release notes](https://skbase.readthedocs.io/en/latest/changelog.html).
119
119
 
120
120
  | Overview | |
121
121
  |---|---|
122
122
  | **CI/CD** | [![Tests](https://github.com/sktime/skbase/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/sktime/skbase/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/sktime/skbase/branch/main/graph/badge.svg?token=2J424NLO82)](https://codecov.io/gh/sktime/skbase) [![Documentation Status](https://readthedocs.org/projects/skbase/badge/?version=latest)](https://skbase.readthedocs.io/en/latest/?badge=latest) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/sktime/skbase/main.svg)](https://results.pre-commit.ci/latest/github/sktime/skbase/main) |
123
123
  | **Code** | [![!pypi](https://img.shields.io/pypi/v/scikit-base?color=orange)](https://pypi.org/project/scikit-base/) [![!python-versions](https://img.shields.io/pypi/pyversions/scikit-base)](https://www.python.org/) [![!black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit) |
124
- | **Downloads**| [![Downloads](https://static.pepy.tech/personalized-badge/scikit-base?period=week&units=international_system&left_color=grey&right_color=blue&left_text=weekly%20(pypi))](https://pepy.tech/project/scikit-base) [![Downloads](https://static.pepy.tech/personalized-badge/scikit-base?period=month&units=international_system&left_color=grey&right_color=blue&left_text=monthly%20(pypi))](https://pepy.tech/project/scikit-base) [![Downloads](https://static.pepy.tech/personalized-badge/scikit-base?period=total&units=international_system&left_color=grey&right_color=blue&left_text=cumulative%20(pypi))](https://pepy.tech/project/scikit-base) |
124
+ | **Downloads** | [![Downloads](https://static.pepy.tech/personalized-badge/scikit-base?period=week&units=international_system&left_color=grey&right_color=blue&left_text=weekly%20(pypi))](https://pepy.tech/project/scikit-base) [![Downloads](https://static.pepy.tech/personalized-badge/scikit-base?period=month&units=international_system&left_color=grey&right_color=blue&left_text=monthly%20(pypi))](https://pepy.tech/project/scikit-base) [![Downloads](https://static.pepy.tech/personalized-badge/scikit-base?period=total&units=international_system&left_color=grey&right_color=blue&left_text=cumulative%20(pypi))](https://pepy.tech/project/scikit-base) |
125
+ | **Citation** | [![DOI](https://zenodo.org/badge/494649836.svg)](https://zenodo.org/doi/10.5281/zenodo.10980557) |
125
126
 
126
127
  <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
127
128
  [![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](#contributors)
@@ -7,14 +7,15 @@
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.7.4 is now available. Check out our
10
+ :rocket: Version 0.7.7 is now available. Check out our
11
11
  [release notes](https://skbase.readthedocs.io/en/latest/changelog.html).
12
12
 
13
13
  | Overview | |
14
14
  |---|---|
15
15
  | **CI/CD** | [![Tests](https://github.com/sktime/skbase/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/sktime/skbase/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/sktime/skbase/branch/main/graph/badge.svg?token=2J424NLO82)](https://codecov.io/gh/sktime/skbase) [![Documentation Status](https://readthedocs.org/projects/skbase/badge/?version=latest)](https://skbase.readthedocs.io/en/latest/?badge=latest) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/sktime/skbase/main.svg)](https://results.pre-commit.ci/latest/github/sktime/skbase/main) |
16
16
  | **Code** | [![!pypi](https://img.shields.io/pypi/v/scikit-base?color=orange)](https://pypi.org/project/scikit-base/) [![!python-versions](https://img.shields.io/pypi/pyversions/scikit-base)](https://www.python.org/) [![!black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit) |
17
- | **Downloads**| [![Downloads](https://static.pepy.tech/personalized-badge/scikit-base?period=week&units=international_system&left_color=grey&right_color=blue&left_text=weekly%20(pypi))](https://pepy.tech/project/scikit-base) [![Downloads](https://static.pepy.tech/personalized-badge/scikit-base?period=month&units=international_system&left_color=grey&right_color=blue&left_text=monthly%20(pypi))](https://pepy.tech/project/scikit-base) [![Downloads](https://static.pepy.tech/personalized-badge/scikit-base?period=total&units=international_system&left_color=grey&right_color=blue&left_text=cumulative%20(pypi))](https://pepy.tech/project/scikit-base) |
17
+ | **Downloads** | [![Downloads](https://static.pepy.tech/personalized-badge/scikit-base?period=week&units=international_system&left_color=grey&right_color=blue&left_text=weekly%20(pypi))](https://pepy.tech/project/scikit-base) [![Downloads](https://static.pepy.tech/personalized-badge/scikit-base?period=month&units=international_system&left_color=grey&right_color=blue&left_text=monthly%20(pypi))](https://pepy.tech/project/scikit-base) [![Downloads](https://static.pepy.tech/personalized-badge/scikit-base?period=total&units=international_system&left_color=grey&right_color=blue&left_text=cumulative%20(pypi))](https://pepy.tech/project/scikit-base) |
18
+ | **Citation** | [![DOI](https://zenodo.org/badge/494649836.svg)](https://zenodo.org/doi/10.5281/zenodo.10980557) |
18
19
 
19
20
  <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
20
21
  [![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](#contributors)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "scikit-base"
3
- version = "0.7.5"
3
+ version = "0.7.7"
4
4
  description = "Base classes for sklearn-like parametric objects"
5
5
  authors = [
6
6
  {name = "sktime developers", email = "sktime.toolbox@gmail.com"},
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: scikit-base
3
- Version: 0.7.5
3
+ Version: 0.7.7
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,14 +114,15 @@ 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.7.4 is now available. Check out our
117
+ :rocket: Version 0.7.7 is now available. Check out our
118
118
  [release notes](https://skbase.readthedocs.io/en/latest/changelog.html).
119
119
 
120
120
  | Overview | |
121
121
  |---|---|
122
122
  | **CI/CD** | [![Tests](https://github.com/sktime/skbase/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/sktime/skbase/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/sktime/skbase/branch/main/graph/badge.svg?token=2J424NLO82)](https://codecov.io/gh/sktime/skbase) [![Documentation Status](https://readthedocs.org/projects/skbase/badge/?version=latest)](https://skbase.readthedocs.io/en/latest/?badge=latest) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/sktime/skbase/main.svg)](https://results.pre-commit.ci/latest/github/sktime/skbase/main) |
123
123
  | **Code** | [![!pypi](https://img.shields.io/pypi/v/scikit-base?color=orange)](https://pypi.org/project/scikit-base/) [![!python-versions](https://img.shields.io/pypi/pyversions/scikit-base)](https://www.python.org/) [![!black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit) |
124
- | **Downloads**| [![Downloads](https://static.pepy.tech/personalized-badge/scikit-base?period=week&units=international_system&left_color=grey&right_color=blue&left_text=weekly%20(pypi))](https://pepy.tech/project/scikit-base) [![Downloads](https://static.pepy.tech/personalized-badge/scikit-base?period=month&units=international_system&left_color=grey&right_color=blue&left_text=monthly%20(pypi))](https://pepy.tech/project/scikit-base) [![Downloads](https://static.pepy.tech/personalized-badge/scikit-base?period=total&units=international_system&left_color=grey&right_color=blue&left_text=cumulative%20(pypi))](https://pepy.tech/project/scikit-base) |
124
+ | **Downloads** | [![Downloads](https://static.pepy.tech/personalized-badge/scikit-base?period=week&units=international_system&left_color=grey&right_color=blue&left_text=weekly%20(pypi))](https://pepy.tech/project/scikit-base) [![Downloads](https://static.pepy.tech/personalized-badge/scikit-base?period=month&units=international_system&left_color=grey&right_color=blue&left_text=monthly%20(pypi))](https://pepy.tech/project/scikit-base) [![Downloads](https://static.pepy.tech/personalized-badge/scikit-base?period=total&units=international_system&left_color=grey&right_color=blue&left_text=cumulative%20(pypi))](https://pepy.tech/project/scikit-base) |
125
+ | **Citation** | [![DOI](https://zenodo.org/badge/494649836.svg)](https://zenodo.org/doi/10.5281/zenodo.10980557) |
125
126
 
126
127
  <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
127
128
  [![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](#contributors)
@@ -19,6 +19,8 @@ skbase/base/_tagmanager.py
19
19
  skbase/base/_pretty_printing/__init__.py
20
20
  skbase/base/_pretty_printing/_object_html_repr.py
21
21
  skbase/base/_pretty_printing/_pprint.py
22
+ skbase/base/_pretty_printing/tests/__init__.py
23
+ skbase/base/_pretty_printing/tests/test_pprint.py
22
24
  skbase/lookup/__init__.py
23
25
  skbase/lookup/_lookup.py
24
26
  skbase/lookup/tests/__init__.py
@@ -1,3 +1,4 @@
1
+ build
1
2
  build_tools
2
3
  docs
3
4
  enhancement_proposals
@@ -6,4 +6,4 @@
6
6
  The included functionality makes it easy to reuse scikit-learn and
7
7
  sktime design principles in your project.
8
8
  """
9
- __version__: str = "0.7.5"
9
+ __version__: str = "0.7.7"
@@ -22,35 +22,37 @@ class _VisualBlock:
22
22
  kind : {'serial', 'parallel', 'single'}
23
23
  kind of HTML block
24
24
 
25
- objs : list of BaseObjects or `_VisualBlock`s or a single BaseObject
26
- If kind != 'single', then `objs` is a list of
27
- BaseObjects. If kind == 'single', then `objs` is a single BaseObject.
25
+ estimators : list of ``BaseObject``s or ``_VisualBlock`s or a single ``BaseObject``
26
+ If ``kind != 'single'``, then ``estimators`` is a list of ``BaseObjects``.
27
+ If ``kind == 'single'``, then ``estimators`` is a single ``BaseObject``.
28
28
 
29
29
  names : list of str, default=None
30
- If kind != 'single', then `names` corresponds to BaseObjects.
31
- If kind == 'single', then `names` is a single string corresponding to
32
- the single BaseObject.
30
+ If ``kind != 'single'``, then ``names`` corresponds to ``BaseObjects``.
31
+ If ``kind == 'single'``, then ``names`` is a single string corresponding to
32
+ the single ``BaseObject``.
33
33
 
34
34
  name_details : list of str, str, or None, default=None
35
- If kind != 'single', then `name_details` corresponds to `names`.
36
- If kind == 'single', then `name_details` is a single string
37
- corresponding to the single BaseObject.
35
+ If ``kind != 'single'``, then ``name_details`` corresponds to ``names``.
36
+ If ``kind == 'single'``, then ``name_details`` is a single string
37
+ corresponding to the single ``BaseObject``.
38
38
 
39
39
  dash_wrapped : bool, default=True
40
40
  If true, wrapped HTML element will be wrapped with a dashed border.
41
- Only active when kind != 'single'.
41
+ Only active when ``kind != 'single'``.
42
42
  """
43
43
 
44
- def __init__(self, kind, objs, *, names=None, name_details=None, dash_wrapped=True):
44
+ def __init__(
45
+ self, kind, estimators, *, names=None, name_details=None, dash_wrapped=True
46
+ ):
45
47
  self.kind = kind
46
- self.objs = objs
48
+ self.estimators = estimators
47
49
  self.dash_wrapped = dash_wrapped
48
50
 
49
51
  if self.kind in ("parallel", "serial"):
50
52
  if names is None:
51
- names = (None,) * len(objs)
53
+ names = (None,) * len(estimators)
52
54
  if name_details is None:
53
- name_details = (None,) * len(objs)
55
+ name_details = (None,) * len(estimators)
54
56
 
55
57
  self.names = names
56
58
  self.name_details = name_details
@@ -135,7 +137,7 @@ def _write_base_object_html(
135
137
 
136
138
  kind = est_block.kind
137
139
  out.write(f'<div class="sk-{kind}">')
138
- est_infos = zip(est_block.objs, est_block.names, est_block.name_details)
140
+ est_infos = zip(est_block.estimators, est_block.names, est_block.name_details)
139
141
 
140
142
  for est, name, name_details in est_infos:
141
143
  if kind == "serial":
@@ -0,0 +1,2 @@
1
+ # -*- coding: utf-8 -*-
2
+ """Tests of skbase pretty printing functionality."""
@@ -0,0 +1,26 @@
1
+ # -*- coding: utf-8 -*-
2
+ # copyright: skbase developers, BSD-3-Clause License (see LICENSE file)
3
+ """Tests for skbase pretty printing functionality."""
4
+
5
+ from skbase.base import BaseObject
6
+
7
+
8
+ class CompositionDummy(BaseObject):
9
+ """Potentially composite object, for testing."""
10
+
11
+ def __init__(self, foo, bar=84):
12
+ self.foo = foo
13
+ self.bar = bar
14
+
15
+ super(CompositionDummy, self).__init__()
16
+
17
+
18
+ def test_sklearn_compatibility():
19
+ """Test that the pretty printing functions are compatible with sklearn."""
20
+ from sklearn.ensemble import RandomForestRegressor
21
+ from sklearn.pipeline import make_pipeline
22
+
23
+ regressor = make_pipeline(
24
+ RandomForestRegressor(),
25
+ )
26
+ CompositionDummy(regressor)
@@ -1,4 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
+ # flake8: noqa A005
2
3
  """Utilities for inspection of function arguments."""
3
4
 
4
5
 
@@ -122,7 +122,7 @@ def _coerce_list(x):
122
122
  return x
123
123
 
124
124
 
125
- def _numpy_equals_plugin(x, y, return_msg=False):
125
+ def _numpy_equals_plugin(x, y, return_msg=False, deep_equals=None):
126
126
  numpy_available = _softdep_available("numpy")
127
127
 
128
128
  if not numpy_available or not _is_npndarray(x):
@@ -132,10 +132,21 @@ def _numpy_equals_plugin(x, y, return_msg=False):
132
132
 
133
133
  ret = _make_ret(return_msg)
134
134
 
135
+ if x.ndim != y.ndim:
136
+ return ret(False, f".ndim, x.ndim = {x.ndim} != y.ndim = {y.ndim}")
137
+ if x.shape != y.shape:
138
+ return ret(False, f".shape, x.shape = {x.shape} != y.shape = {y.shape}")
135
139
  if x.dtype != y.dtype:
136
140
  return ret(False, f".dtype, x.dtype = {x.dtype} != y.dtype = {y.dtype}")
137
- if x.dtype in ["object", "str"]:
141
+ if x.dtype == "str":
138
142
  return ret(np.array_equal(x, y), ".values")
143
+ elif x.dtype == "object":
144
+ x_flat = x.flatten()
145
+ y_flat = y.flatten()
146
+ for i in range(len(x_flat)):
147
+ is_equal, msg = deep_equals(x_flat[i], y_flat[i], return_msg=True)
148
+ return ret(is_equal, f"[{i}]" + msg)
149
+ return ret(True, "") # catches len(x_flat) == 0
139
150
  else:
140
151
  return ret(np.array_equal(x, y, equal_nan=True), ".values")
141
152
 
@@ -35,6 +35,13 @@ if _check_soft_dependencies("numpy", severity="none"):
35
35
  np.array([0.2, 1, 4], dtype="object"),
36
36
  ]
37
37
 
38
+ # test cases with nested numpy arrays
39
+ a = np.array(["a", "b"], dtype="object")
40
+ a[0] = np.array([1, 2, 3])
41
+ b = np.array(["a", "b", 42], dtype="object")
42
+ b[1] = a
43
+ EXAMPLES += [a, b]
44
+
38
45
  if _check_soft_dependencies("pandas", severity="none"):
39
46
  import pandas as pd
40
47
 
@@ -80,7 +87,7 @@ def test_deep_equals_positive(fixture):
80
87
  y = copy_except_if_sklearn(fixture)
81
88
 
82
89
  msg = (
83
- f"deep_copy incorrectly returned False for two identical copies of "
90
+ f"deep_equals incorrectly returned False for two identical copies of "
84
91
  f"the following object: {x}"
85
92
  )
86
93
  assert deep_equals(x, y), msg
@@ -99,7 +106,7 @@ def test_deep_equals_negative(fixture1, fixture2):
99
106
  y = copy_except_if_sklearn(fixture2)
100
107
 
101
108
  msg = (
102
- f"deep_copy incorrectly returned True when comparing "
109
+ f"deep_equals incorrectly returned True when comparing "
103
110
  f"the following, different objects: x={x}, y={y}"
104
111
  )
105
112
  assert not deep_equals(x, y), msg
File without changes
File without changes