Skip to content

Commit

Permalink
Fix tests, remove Nested
Browse files Browse the repository at this point in the history
  • Loading branch information
Erotemic committed May 31, 2024
1 parent 486b73b commit 7dd2640
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ This project (loosely) adheres to [Semantic Versioning](https://semver.org/spec/

### Added:
* Add `ub.IndexableWalker.diff`
* Add alias `Nested = IndexableWalker`

### Fixed:
* `ub.import_module_from_path` now correctly accepts `PathLike` objects.
Expand Down
4 changes: 2 additions & 2 deletions ubelt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
from ubelt.util_import import (import_module_from_name,
import_module_from_path, modname_to_modpath,
modpath_to_modname, split_modpath,)
from ubelt.util_indexable import (Nested, IndexableWalker, indexable_allclose,)
from ubelt.util_indexable import (IndexableWalker, indexable_allclose,)
from ubelt.util_memoize import (memoize, memoize_method, memoize_property,)
from ubelt.util_mixins import (NiceRepr,)
from ubelt.util_path import (ChDir, Path, TempDir, augpath, ensuredir,
Expand All @@ -195,7 +195,7 @@
__all__ = ['AutoDict', 'AutoOrderedDict', 'CacheStamp', 'Cacher',
'CaptureStdout', 'CaptureStream', 'ChDir', 'DARWIN',
'DownloadManager', 'Executor', 'FormatterExtensions',
'IndexableWalker', 'Nested', 'JobPool', 'LINUX', 'NO_COLOR', 'NiceRepr',
'IndexableWalker', 'JobPool', 'LINUX', 'NO_COLOR', 'NiceRepr',
'NoParam', 'OrderedSet', 'POSIX', 'Path', 'ProgIter',
'ReprExtensions', 'SetDict', 'TeeStringIO', 'TempDir', 'Timer',
'UDict', 'WIN32', 'allsame', 'argflag', 'argmax', 'argmin',
Expand Down
4 changes: 2 additions & 2 deletions ubelt/util_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
Example:
>>> import ubelt as ub
>>> @ub.Cacher('name', depends={'dep1': 1, 'dep2': 2}) # boilerplate:1
>>> @ub.Cacher('name', depends='set-of-deps') # boilerplate:1
>>> def func(): # boilerplate:2
>>> data = 'mydata'
>>> return data # boilerplate:3
>>> data = func() # boilerplate:4
>>> cacher = ub.Cacher('name', depends=['dependencies']) # boilerplate:1
>>> cacher = ub.Cacher('name', depends='set-of-deps') # boilerplate:1
>>> data = cacher.tryload(on_error='clear') # boilerplate:2
>>> if data is None: # boilerplate:3
>>> data = 'mydata'
Expand Down
3 changes: 3 additions & 0 deletions ubelt/util_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,9 @@ def _pkgutil_modname_to_modpath(modname): # nocover
faster version of :func:`_syspath_modname_to_modpath` using builtin python
mechanisms, but unfortunately it doesn't play nice with pytest.
Note:
pkgutil.find_loader is deprecated in 3.12 and removed in 3.14
Args:
modname (str): the module name.
Expand Down
9 changes: 5 additions & 4 deletions ubelt/util_indexable.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
from typing import NamedTuple, Tuple, Any
# from collections.abc import Iterable

from functools import cache
try:
from functools import cache
except ImportError:
from ubelt.util_memoize import memoize as cache


@cache
Expand Down Expand Up @@ -711,9 +714,7 @@ def indexable_allclose(items1, items2, rel_tol=1e-9, abs_tol=0.0, return_info=Fa
return_info=return_info)


Nested = IndexableWalker


# Nested = IndexableWalker
# class Indexable(IndexableWalker):
# """
# In the future IndexableWalker may simply change to Indexable or maybe Nested
Expand Down

0 comments on commit 7dd2640

Please sign in to comment.