islpy 2025.2__cp313-cp313-macosx_11_0_arm64.whl → 2025.2.2__cp313-cp313-macosx_11_0_arm64.whl

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.
islpy/__init__.py CHANGED
@@ -21,7 +21,7 @@ THE SOFTWARE.
21
21
  """
22
22
 
23
23
  from collections.abc import Collection, Sequence
24
- from typing import Literal, TypeAlias, TypeVar
24
+ from typing import Literal, TypeAlias, TypeVar, cast
25
25
 
26
26
  from islpy.version import VERSION, VERSION_TEXT
27
27
 
@@ -149,44 +149,34 @@ def _get_default_context() -> Context:
149
149
  return DEFAULT_CONTEXT
150
150
 
151
151
 
152
- def _back_to_basic(new_obj, old_obj):
153
- # Work around set_dim_id not being available for Basic{Set,Map}
154
- if isinstance(old_obj, BasicSet) and isinstance(new_obj, Set):
155
- bsets = new_obj.get_basic_sets()
152
+ def _set_dim_id(obj: AlignableT, dt: dim_type, idx: int, id: Id) -> AlignableT:
153
+ if isinstance(obj, BasicSet):
154
+ p, = obj.to_set().set_dim_id(dt, idx, id).get_basic_sets()
155
+ return cast("AlignableT", p)
156
+ elif isinstance(obj, BasicMap):
157
+ p, = obj.to_map().set_dim_id(dt, idx, id).get_basic_maps()
158
+ return cast("AlignableT", p)
156
159
 
157
- if len(bsets) == 0:
158
- bset = BasicSet.universe(new_obj.space).complement()
159
- else:
160
- bset, = bsets
161
-
162
- return bset
163
-
164
- if isinstance(old_obj, BasicMap) and isinstance(new_obj, Map):
165
- bmaps = new_obj.get_basic_maps()
166
-
167
- if len(bmaps) == 0:
168
- bmap = BasicMap.universe(new_obj.space).complement()
169
- else:
170
- bmap, = bmaps
171
-
172
- return bmap
173
-
174
- return new_obj
175
-
176
-
177
- def _set_dim_id(obj, dt, idx, id):
178
- return _back_to_basic(obj.set_dim_id(dt, idx, id), obj)
160
+ return cast("AlignableT", obj.set_dim_id(dt, idx, id))
179
161
 
180
162
 
181
163
  def _align_dim_type(
182
164
  template_dt: dim_type,
183
165
  obj: AlignableT,
184
- template: AlignableT,
166
+ template: Alignable,
185
167
  obj_bigger_ok: bool,
186
168
  obj_names: Collection[str],
187
169
  template_names: Collection[str],
188
170
  ) -> AlignableT:
189
171
 
172
+ # convert to a type that has get_dim_id
173
+ if isinstance(template, BasicSet):
174
+ template = template.to_set()
175
+ elif isinstance(template, BasicMap):
176
+ template = template.to_map()
177
+ elif isinstance(template, Aff):
178
+ template = template.to_pw_aff()
179
+
190
180
  # {{{ deal with Aff, PwAff
191
181
 
192
182
  # The technique below will not work for PwAff et al, because there is *only*
Binary file
islpy/_isl.pyi CHANGED
@@ -1,3 +1,4 @@
1
+ from typing_extensions import Self
1
2
  from collections.abc import Callable
2
3
  import enum
3
4
  from typing import overload
@@ -1489,83 +1490,83 @@ class IdToAstExpr:
1489
1490
  pass
1490
1491
 
1491
1492
  class Printer:
1492
- def print_id_list(self, list: IdList) -> Printer: ...
1493
+ def print_id_list(self, list: IdList) -> Self: ...
1493
1494
 
1494
- def print_id(self, id: Id) -> Printer: ...
1495
+ def print_id(self, id: Id) -> Self: ...
1495
1496
 
1496
- def print_multi_id(self, mi: MultiId) -> Printer: ...
1497
+ def print_multi_id(self, mi: MultiId) -> Self: ...
1497
1498
 
1498
- def print_space(self, space: Space) -> Printer: ...
1499
+ def print_space(self, space: Space) -> Self: ...
1499
1500
 
1500
- def print_basic_set(self, bset: BasicSet) -> Printer: ...
1501
+ def print_basic_set(self, bset: BasicSet) -> Self: ...
1501
1502
 
1502
- def print_set(self, map: Set | BasicSet) -> Printer: ...
1503
+ def print_set(self, map: Set | BasicSet) -> Self: ...
1503
1504
 
1504
- def print_basic_map(self, bmap: BasicMap) -> Printer: ...
1505
+ def print_basic_map(self, bmap: BasicMap) -> Self: ...
1505
1506
 
1506
- def print_map(self, map: Map | BasicMap) -> Printer: ...
1507
+ def print_map(self, map: Map | BasicMap) -> Self: ...
1507
1508
 
1508
- def print_basic_map_list(self, list: BasicMapList) -> Printer: ...
1509
+ def print_basic_map_list(self, list: BasicMapList) -> Self: ...
1509
1510
 
1510
- def print_map_list(self, list: MapList) -> Printer: ...
1511
+ def print_map_list(self, list: MapList) -> Self: ...
1511
1512
 
1512
- def print_basic_set_list(self, list: BasicSetList) -> Printer: ...
1513
+ def print_basic_set_list(self, list: BasicSetList) -> Self: ...
1513
1514
 
1514
- def print_set_list(self, list: SetList) -> Printer: ...
1515
+ def print_set_list(self, list: SetList) -> Self: ...
1515
1516
 
1516
- def print_local_space(self, ls: LocalSpace | Space) -> Printer: ...
1517
+ def print_local_space(self, ls: LocalSpace | Space) -> Self: ...
1517
1518
 
1518
- def print_aff(self, aff: Aff) -> Printer: ...
1519
+ def print_aff(self, aff: Aff) -> Self: ...
1519
1520
 
1520
- def print_pw_aff(self, pwaff: PwAff | Aff) -> Printer: ...
1521
+ def print_pw_aff(self, pwaff: PwAff | Aff) -> Self: ...
1521
1522
 
1522
- def print_multi_aff(self, maff: MultiAff) -> Printer: ...
1523
+ def print_multi_aff(self, maff: MultiAff) -> Self: ...
1523
1524
 
1524
- def print_pw_multi_aff(self, pma: PwMultiAff | MultiAff) -> Printer: ...
1525
+ def print_pw_multi_aff(self, pma: PwMultiAff | MultiAff) -> Self: ...
1525
1526
 
1526
- def print_union_pw_multi_aff(self, upma: UnionPwMultiAff | MultiAff | PwMultiAff) -> Printer: ...
1527
+ def print_union_pw_multi_aff(self, upma: UnionPwMultiAff | MultiAff | PwMultiAff) -> Self: ...
1527
1528
 
1528
- def print_multi_pw_aff(self, mpa: MultiPwAff) -> Printer: ...
1529
+ def print_multi_pw_aff(self, mpa: MultiPwAff) -> Self: ...
1529
1530
 
1530
- def print_union_pw_aff(self, upa: UnionPwAff | Aff | PwAff) -> Printer: ...
1531
+ def print_union_pw_aff(self, upa: UnionPwAff | Aff | PwAff) -> Self: ...
1531
1532
 
1532
- def print_multi_union_pw_aff(self, mupa: MultiUnionPwAff) -> Printer: ...
1533
+ def print_multi_union_pw_aff(self, mupa: MultiUnionPwAff) -> Self: ...
1533
1534
 
1534
- def print_aff_list(self, list: AffList) -> Printer: ...
1535
+ def print_aff_list(self, list: AffList) -> Self: ...
1535
1536
 
1536
- def print_pw_aff_list(self, list: PwAffList) -> Printer: ...
1537
+ def print_pw_aff_list(self, list: PwAffList) -> Self: ...
1537
1538
 
1538
- def print_pw_multi_aff_list(self, list: PwMultiAffList) -> Printer: ...
1539
+ def print_pw_multi_aff_list(self, list: PwMultiAffList) -> Self: ...
1539
1540
 
1540
- def print_union_pw_aff_list(self, list: UnionPwAffList) -> Printer: ...
1541
+ def print_union_pw_aff_list(self, list: UnionPwAffList) -> Self: ...
1541
1542
 
1542
- def print_union_pw_multi_aff_list(self, list: UnionPwMultiAffList) -> Printer: ...
1543
+ def print_union_pw_multi_aff_list(self, list: UnionPwMultiAffList) -> Self: ...
1543
1544
 
1544
- def print_qpolynomial(self, qp: QPolynomial) -> Printer: ...
1545
+ def print_qpolynomial(self, qp: QPolynomial) -> Self: ...
1545
1546
 
1546
- def print_pw_qpolynomial(self, pwqp: PwQPolynomial) -> Printer: ...
1547
+ def print_pw_qpolynomial(self, pwqp: PwQPolynomial) -> Self: ...
1547
1548
 
1548
- def print_qpolynomial_fold(self, fold: QPolynomialFold) -> Printer: ...
1549
+ def print_qpolynomial_fold(self, fold: QPolynomialFold) -> Self: ...
1549
1550
 
1550
- def print_pw_qpolynomial_fold(self, pwf: PwQPolynomialFold) -> Printer: ...
1551
+ def print_pw_qpolynomial_fold(self, pwf: PwQPolynomialFold) -> Self: ...
1551
1552
 
1552
- def print_union_pw_qpolynomial(self, upwqp: UnionPwQPolynomial) -> Printer: ...
1553
+ def print_union_pw_qpolynomial(self, upwqp: UnionPwQPolynomial) -> Self: ...
1553
1554
 
1554
- def print_union_pw_qpolynomial_fold(self, upwf: UnionPwQPolynomialFold) -> Printer: ...
1555
+ def print_union_pw_qpolynomial_fold(self, upwf: UnionPwQPolynomialFold) -> Self: ...
1555
1556
 
1556
- def print_qpolynomial_list(self, list: QPolynomialList) -> Printer: ...
1557
+ def print_qpolynomial_list(self, list: QPolynomialList) -> Self: ...
1557
1558
 
1558
- def print_pw_qpolynomial_list(self, list: PwQPolynomialList) -> Printer: ...
1559
+ def print_pw_qpolynomial_list(self, list: PwQPolynomialList) -> Self: ...
1559
1560
 
1560
- def print_pw_qpolynomial_fold_list(self, list: PwQPolynomialFoldList) -> Printer: ...
1561
+ def print_pw_qpolynomial_fold_list(self, list: PwQPolynomialFoldList) -> Self: ...
1561
1562
 
1562
- def print_union_map(self, umap: UnionMap | BasicMap | Map) -> Printer: ...
1563
+ def print_union_map(self, umap: UnionMap | BasicMap | Map) -> Self: ...
1563
1564
 
1564
- def print_union_map_list(self, list: UnionMapList) -> Printer: ...
1565
+ def print_union_map_list(self, list: UnionMapList) -> Self: ...
1565
1566
 
1566
- def print_union_set(self, uset: UnionSet | BasicSet | Set) -> Printer: ...
1567
+ def print_union_set(self, uset: UnionSet | BasicSet | Set) -> Self: ...
1567
1568
 
1568
- def print_union_set_list(self, list: UnionSetList) -> Printer: ...
1569
+ def print_union_set_list(self, list: UnionSetList) -> Self: ...
1569
1570
 
1570
1571
  @staticmethod
1571
1572
  def to_str(ctx: Context) -> Printer: ...
@@ -1574,87 +1575,87 @@ class Printer:
1574
1575
 
1575
1576
  def get_str(self) -> str: ...
1576
1577
 
1577
- def set_indent(self, indent: int) -> Printer: ...
1578
+ def set_indent(self, indent: int) -> Self: ...
1578
1579
 
1579
- def indent(self, indent: int) -> Printer: ...
1580
+ def indent(self, indent: int) -> Self: ...
1580
1581
 
1581
- def set_output_format(self, output_format: int) -> Printer: ...
1582
+ def set_output_format(self, output_format: int) -> Self: ...
1582
1583
 
1583
1584
  def get_output_format(self) -> int: ...
1584
1585
 
1585
- def set_yaml_style(self, yaml_style: int) -> Printer: ...
1586
+ def set_yaml_style(self, yaml_style: int) -> Self: ...
1586
1587
 
1587
1588
  def get_yaml_style(self) -> int: ...
1588
1589
 
1589
- def set_indent_prefix(self, prefix: str) -> Printer: ...
1590
+ def set_indent_prefix(self, prefix: str) -> Self: ...
1590
1591
 
1591
- def set_prefix(self, prefix: str) -> Printer: ...
1592
+ def set_prefix(self, prefix: str) -> Self: ...
1592
1593
 
1593
- def set_suffix(self, suffix: str) -> Printer: ...
1594
+ def set_suffix(self, suffix: str) -> Self: ...
1594
1595
 
1595
- def set_isl_int_width(self, width: int) -> Printer: ...
1596
+ def set_isl_int_width(self, width: int) -> Self: ...
1596
1597
 
1597
1598
  def has_note(self, id: Id) -> bool: ...
1598
1599
 
1599
1600
  def get_note(self, id: Id) -> Id: ...
1600
1601
 
1601
- def set_note(self, id: Id, note: Id) -> Printer: ...
1602
+ def set_note(self, id: Id, note: Id) -> Self: ...
1602
1603
 
1603
- def start_line(self) -> Printer: ...
1604
+ def start_line(self) -> Self: ...
1604
1605
 
1605
- def end_line(self) -> Printer: ...
1606
+ def end_line(self) -> Self: ...
1606
1607
 
1607
- def print_double(self, d: int) -> Printer: ...
1608
+ def print_double(self, d: int) -> Self: ...
1608
1609
 
1609
- def print_int(self, i: int) -> Printer: ...
1610
+ def print_int(self, i: int) -> Self: ...
1610
1611
 
1611
- def print_str(self, s: str) -> Printer: ...
1612
+ def print_str(self, s: str) -> Self: ...
1612
1613
 
1613
- def yaml_start_mapping(self) -> Printer: ...
1614
+ def yaml_start_mapping(self) -> Self: ...
1614
1615
 
1615
- def yaml_end_mapping(self) -> Printer: ...
1616
+ def yaml_end_mapping(self) -> Self: ...
1616
1617
 
1617
- def yaml_start_sequence(self) -> Printer: ...
1618
+ def yaml_start_sequence(self) -> Self: ...
1618
1619
 
1619
- def yaml_end_sequence(self) -> Printer: ...
1620
+ def yaml_end_sequence(self) -> Self: ...
1620
1621
 
1621
- def yaml_next(self) -> Printer: ...
1622
+ def yaml_next(self) -> Self: ...
1622
1623
 
1623
- def flush(self) -> Printer: ...
1624
+ def flush(self) -> Self: ...
1624
1625
 
1625
- def print_point(self, pnt: Point) -> Printer: ...
1626
+ def print_point(self, pnt: Point) -> Self: ...
1626
1627
 
1627
- def print_constraint_list(self, list: ConstraintList) -> Printer: ...
1628
+ def print_constraint_list(self, list: ConstraintList) -> Self: ...
1628
1629
 
1629
- def print_constraint(self, c: Constraint) -> Printer: ...
1630
+ def print_constraint(self, c: Constraint) -> Self: ...
1630
1631
 
1631
- def print_val(self, v: Val | int) -> Printer: ...
1632
+ def print_val(self, v: Val | int) -> Self: ...
1632
1633
 
1633
- def print_multi_val(self, mv: MultiVal) -> Printer: ...
1634
+ def print_multi_val(self, mv: MultiVal) -> Self: ...
1634
1635
 
1635
- def print_val_list(self, list: ValList) -> Printer: ...
1636
+ def print_val_list(self, list: ValList) -> Self: ...
1636
1637
 
1637
- def print_vec(self, vec: Vec) -> Printer: ...
1638
+ def print_vec(self, vec: Vec) -> Self: ...
1638
1639
 
1639
- def print_schedule_constraints(self, sc: ScheduleConstraints) -> Printer: ...
1640
+ def print_schedule_constraints(self, sc: ScheduleConstraints) -> Self: ...
1640
1641
 
1641
- def print_schedule(self, schedule: Schedule) -> Printer: ...
1642
+ def print_schedule(self, schedule: Schedule) -> Self: ...
1642
1643
 
1643
- def print_schedule_node(self, node: ScheduleNode) -> Printer: ...
1644
+ def print_schedule_node(self, node: ScheduleNode) -> Self: ...
1644
1645
 
1645
- def print_union_access_info(self, access: UnionAccessInfo) -> Printer: ...
1646
+ def print_union_access_info(self, access: UnionAccessInfo) -> Self: ...
1646
1647
 
1647
- def print_union_flow(self, flow: UnionFlow) -> Printer: ...
1648
+ def print_union_flow(self, flow: UnionFlow) -> Self: ...
1648
1649
 
1649
- def print_ast_expr(self, expr: AstExpr) -> Printer: ...
1650
+ def print_ast_expr(self, expr: AstExpr) -> Self: ...
1650
1651
 
1651
- def print_ast_node(self, node: AstNode) -> Printer: ...
1652
+ def print_ast_node(self, node: AstNode) -> Self: ...
1652
1653
 
1653
- def ast_op_type_set_print_name(self, type: ast_expr_op_type, name: str) -> Printer: ...
1654
+ def ast_op_type_set_print_name(self, type: ast_expr_op_type, name: str) -> Self: ...
1654
1655
 
1655
- def print_ast_expr_list(self, list: AstExprList) -> Printer: ...
1656
+ def print_ast_expr_list(self, list: AstExprList) -> Self: ...
1656
1657
 
1657
- def print_ast_node_list(self, list: AstNodeList) -> Printer: ...
1658
+ def print_ast_node_list(self, list: AstNodeList) -> Self: ...
1658
1659
 
1659
1660
  class Val:
1660
1661
  @overload
@@ -2150,6 +2151,8 @@ class FixedBox:
2150
2151
  class Aff:
2151
2152
  def __init__(self, s: str, context: Context | None = None) -> None: ...
2152
2153
 
2154
+ def to_pw_aff(self) -> PwAff: ...
2155
+
2153
2156
  @staticmethod
2154
2157
  def zero_on_domain_space(space: Space) -> Aff: ...
2155
2158
 
@@ -2904,9 +2907,6 @@ class PwAff:
2904
2907
  __repr__ = islpy._monkeypatch.generic_repr
2905
2908
 
2906
2909
  class UnionPwAff:
2907
- @overload
2908
- def __init__(self, arg: Aff, /) -> None: ...
2909
-
2910
2910
  @overload
2911
2911
  def __init__(self, arg: PwAff, /) -> None: ...
2912
2912
 
@@ -4574,6 +4574,8 @@ class Constraint:
4574
4574
  class Space:
4575
4575
  def __init__(self, s: str, context: Context | None = None) -> None: ...
4576
4576
 
4577
+ def to_local_space(self) -> LocalSpace: ...
4578
+
4577
4579
  def multi_id(self, list: IdList) -> MultiId: ...
4578
4580
 
4579
4581
  def get_ctx(self) -> Context: ...
@@ -4931,6 +4933,10 @@ class LocalSpace:
4931
4933
  class BasicSet:
4932
4934
  def __init__(self, s: str, context: Context | None = None) -> None: ...
4933
4935
 
4936
+ def __hash__(self) -> int: ...
4937
+
4938
+ def is_params(self) -> bool: ...
4939
+
4934
4940
  def n_dim(self) -> int: ...
4935
4941
 
4936
4942
  def n_param(self) -> int: ...
@@ -5311,8 +5317,6 @@ class BasicSet:
5311
5317
 
5312
5318
  def involves_locals(self) -> bool: ...
5313
5319
 
5314
- def is_params(self) -> bool: ...
5315
-
5316
5320
  @overload
5317
5321
  def is_strict_subset(self, set2: Set | BasicSet) -> bool: ...
5318
5322
 
@@ -5365,8 +5369,6 @@ class BasicSet:
5365
5369
 
5366
5370
  def plain_is_disjoint(self, set2: Set | BasicSet) -> bool: ...
5367
5371
 
5368
- def __hash__(self) -> int: ...
5369
-
5370
5372
  def n_basic_set(self) -> int: ...
5371
5373
 
5372
5374
  def foreach_basic_set(self, fn: Callable[[BasicSet], None]) -> None: ...
@@ -5504,6 +5506,10 @@ class BasicSet:
5504
5506
  class BasicMap:
5505
5507
  def __init__(self, s: str, context: Context | None = None) -> None: ...
5506
5508
 
5509
+ def __hash__(self) -> int: ...
5510
+
5511
+ def to_map(self) -> Map: ...
5512
+
5507
5513
  def total_dim(self) -> int: ...
5508
5514
 
5509
5515
  def dim(self, type: dim_type) -> int: ...
@@ -6106,8 +6112,6 @@ class BasicMap:
6106
6112
 
6107
6113
  def plain_is_equal(self, map2: Map | BasicMap) -> bool: ...
6108
6114
 
6109
- def __hash__(self) -> int: ...
6110
-
6111
6115
  def n_basic_map(self) -> int: ...
6112
6116
 
6113
6117
  def foreach_basic_map(self, fn: Callable[[BasicMap], None]) -> None: ...
islpy/_monkeypatch.py CHANGED
@@ -1,14 +1,21 @@
1
+ import os
2
+ import re
1
3
  from collections.abc import Callable, Collection, Iterable, Mapping, Sequence
4
+ from functools import update_wrapper
5
+ from sys import intern
2
6
  from typing import (
3
7
  TYPE_CHECKING,
4
8
  Any,
5
9
  ClassVar,
10
+ Concatenate,
6
11
  Literal,
12
+ ParamSpec,
7
13
  Protocol,
8
14
  TypeAlias,
9
15
  TypeVar,
10
16
  cast,
11
17
  )
18
+ from warnings import warn
12
19
 
13
20
 
14
21
  if TYPE_CHECKING:
@@ -544,6 +551,8 @@ def obj_get_var_names(self: HasSpace, dimtype: _isl.dim_type) -> Sequence[str]:
544
551
 
545
552
 
546
553
  def pwaff_get_pieces(self: _isl.PwAff | _isl.Aff) -> list[tuple[_isl.Set, _isl.Aff]]:
554
+ if isinstance(self, _isl.Aff):
555
+ self = self.to_pw_aff()
547
556
  result: list[tuple[_isl.Set, _isl.Aff]] = []
548
557
 
549
558
  def append_tuple(s: _isl.Set, v: _isl.Aff):
@@ -1013,3 +1022,78 @@ for cls in ALL_CLASSES:
1013
1022
 
1014
1023
 
1015
1024
  _add_functionality()
1025
+
1026
+
1027
+ P = ParamSpec("P")
1028
+ ResultT = TypeVar("ResultT")
1029
+
1030
+
1031
+ _DOWNCAST_RE = re.compile(
1032
+ r"Downcast from :class:`([A-Za-z]+)` to :class:`([A-Za-z]+)`.")
1033
+
1034
+
1035
+ _TO_METHODS = {
1036
+ "PwAff": "to_pw_aff",
1037
+ "PwMultiAff": "to_pw_multi_aff",
1038
+ "UnionPwAff": "to_union_pw_aff",
1039
+ "UnionPwMultiAff": "to_union_pw_multi_aff",
1040
+ "LocalSpace": "to_local_space",
1041
+ "Set": "to_set",
1042
+ "UnionSet": "to_union_set",
1043
+ "Map": "to_map",
1044
+ "UnionMap": "to_union_map",
1045
+ }
1046
+
1047
+
1048
+ def _depr_downcast_wrapper(
1049
+ f: Callable[Concatenate[object, P], ResultT],
1050
+ ) -> Callable[Concatenate[object, P], ResultT]:
1051
+ doc = f.__doc__
1052
+ assert doc is not None
1053
+ m = _DOWNCAST_RE.search(doc)
1054
+ assert m, doc
1055
+ basic_cls_name = intern(m.group(1))
1056
+ tgt_cls_name = m.group(2)
1057
+
1058
+ tgt_cls = cast("type", getattr(_isl, tgt_cls_name))
1059
+ is_overload = "Overloaded function" in doc
1060
+ msg = (f"{basic_cls_name}.{f.__name__} "
1061
+ f"with implicit conversion of self to {tgt_cls_name} is deprecated "
1062
+ "and will stop working in 2026. "
1063
+ f"Explicitly convert to {tgt_cls_name}, "
1064
+ f"using .{_TO_METHODS[tgt_cls_name]}().")
1065
+
1066
+ if is_overload:
1067
+ def wrapper(self: object, *args: P.args, **kwargs: P.kwargs) -> ResultT:
1068
+ # "Try to" detect bad invocations of, e.g., Set.union, which is
1069
+ # an overload of normal union and UnionSet.union.
1070
+ if (
1071
+ any(isinstance(arg, tgt_cls) for arg in args)
1072
+ or
1073
+ any(isinstance(arg, tgt_cls) for arg in kwargs.values())
1074
+ ):
1075
+ warn(msg, DeprecationWarning, stacklevel=2)
1076
+
1077
+ return f(self, *args, **kwargs)
1078
+ else:
1079
+ def wrapper(self: object, *args: P.args, **kwargs: P.kwargs) -> ResultT:
1080
+ warn(msg, DeprecationWarning, stacklevel=2)
1081
+
1082
+ return f(self, *args, **kwargs)
1083
+ update_wrapper(wrapper, f)
1084
+ return wrapper
1085
+
1086
+
1087
+ def _monkeypatch_self_downcast_deprecation():
1088
+ for cls in ALL_CLASSES:
1089
+ for attr_name in dir(cls):
1090
+ val = cast("object", getattr(cls, attr_name))
1091
+ doc = getattr(val, "__doc__", None)
1092
+ if doc and "\nDowncast from " in doc:
1093
+ setattr(cls, attr_name, _depr_downcast_wrapper(
1094
+ cast("Callable", val), # pyright: ignore[reportMissingTypeArgument]
1095
+ ))
1096
+
1097
+
1098
+ if not os.environ.get("ISLPY_NO_DOWNCAST_DEPRECATION", None):
1099
+ _monkeypatch_self_downcast_deprecation()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: islpy
3
- Version: 2025.2
3
+ Version: 2025.2.2
4
4
  Summary: Wrapper around isl, an integer set library
5
5
  Author-Email: Andreas Kloeckner <inform@tiker.net>
6
6
  License-Expression: MIT
@@ -0,0 +1,9 @@
1
+ islpy/version.py,sha256=9KVEg7OX9uCaA6ElUMeiAh-zDrxsy3u2H6VQm_-LTUE,301
2
+ islpy/_isl.cpython-313-darwin.so,sha256=QhUZVDAMG6d-lfiVJt9fk00yG84tGmf2akrNbgTHu9U,7927080
3
+ islpy/__init__.py,sha256=di9XuiCE0E17rYvJF2odx710bD4X07gsKGWDW6oSgH0,13021
4
+ islpy/_isl.pyi,sha256=_QvIK3y21H8sud47dr3bBOfxkSONwZzxV1x09WIxtRQ,260121
5
+ islpy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ islpy/_monkeypatch.py,sha256=J_EIwyHBinfCo_rBu1V9o1OzG9R3dE34lJ0XIMOJSQ4,31309
7
+ islpy-2025.2.2.dist-info/RECORD,,
8
+ islpy-2025.2.2.dist-info/WHEEL,sha256=LDEcERf6NwqnVU7GVh2ePzziJ1dorOEI8grnlWj9zQ0,141
9
+ islpy-2025.2.2.dist-info/METADATA,sha256=Us2hmRlX7V2rNYGp3pg3ZEqYgbSbuzNYT7IIHd9dbT4,2966
@@ -1,9 +0,0 @@
1
- islpy/version.py,sha256=9KVEg7OX9uCaA6ElUMeiAh-zDrxsy3u2H6VQm_-LTUE,301
2
- islpy/_isl.cpython-313-darwin.so,sha256=dYn3efr8wy86ZyGApl0cMfmxLW4DayHKkPYm0CReu2M,7927080
3
- islpy/__init__.py,sha256=6In7YFiBLKNNVIGkpKMiB1H_-H2OQ5ovlqJ_Tz0nAvA,13073
4
- islpy/_isl.pyi,sha256=rmWMkaV2DBUBqDl6c4hdyJR2QE7uOfS2yo2t4SOApSc,260256
5
- islpy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- islpy/_monkeypatch.py,sha256=iFDDVUTNZhf98TcprqaW7UMXtx-fMm9sP-A3jWF32OA,28592
7
- islpy-2025.2.dist-info/RECORD,,
8
- islpy-2025.2.dist-info/WHEEL,sha256=LDEcERf6NwqnVU7GVh2ePzziJ1dorOEI8grnlWj9zQ0,141
9
- islpy-2025.2.dist-info/METADATA,sha256=MP7D5-bXwNkMnh82YAQwyKnxuYie87BD6azadm508mA,2964