Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 3 additions & 2 deletions larray/core/axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from larray.util.misc import (duplicates, array_lookup2, ReprString, index_by_id, renamed_to, LHDFStore,
lazy_attribute, _isnoneslice, unique_list, unique_multi, Product, argsort, has_duplicates,
exactly_one, concatenate_ndarrays)
from larray.util.misc import first, find_names
from larray.util.misc import first, find_names, PY312_OR_LATER
from larray.util.types import Scalar


Expand Down Expand Up @@ -2921,7 +2921,8 @@ def _guess_axis(self, axis_key):
# behavior, we must wait for a future release, and we
# only output a warning for now (see #1117)
# return axis_key.retarget_to(real_axis)
check_warn_retarget(axis_key, real_axis, stacklevel=8)
stack_level = 8 if PY312_OR_LATER else 9
check_warn_retarget(axis_key, real_axis, stacklevel=stack_level)
return axis_key.with_axis(real_axis)

real_axis, axis_pos_key = self._translate_nice_key(axis_key)
Expand Down
10 changes: 4 additions & 6 deletions larray/core/group.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import sys

import fnmatch
import re
import warnings
Expand All @@ -12,13 +10,13 @@

from larray.core.abstractbases import ABCAxis, ABCAxisReference, ABCArray
from larray.util.oset import OrderedSet
from larray.util.misc import (unique_list, find_closing_chr, _parse_bound, _seq_summary, _isintstring, renamed_to,
LHDFStore)
from larray.util.misc import (
unique_list, find_closing_chr, _parse_bound, _seq_summary, _isintstring,
renamed_to, LHDFStore, PY312_OR_LATER
)
from larray.util.types import Scalar, Key


PY312_OR_LATER = sys.version_info[:2] >= (3, 12)

def _slice_to_str(key: slice, repr_func=str) -> str:
r"""
Convert a slice to a string.
Expand Down
3 changes: 3 additions & 0 deletions larray/util/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1130,3 +1130,6 @@ def find_names(obj, depth=0):
if any(not name.startswith('_') for name in names):
names = [name for name in names if not name.startswith('_')]
return sorted(names)


PY312_OR_LATER = sys.version_info[:2] >= (3, 12)