Skip to content

Commit 5ebfaa9

Browse files
ci: update ci versions
1 parent 741022a commit 5ebfaa9

4 files changed

Lines changed: 71 additions & 57 deletions

File tree

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.11.2
3+
rev: v0.14.9
44
hooks:
55
- id: ruff
66
args: [--fix, --exit-non-zero-on-fix]
77
- id: ruff-format
88
- repo: https://github.com/pre-commit/pre-commit-hooks
9-
rev: v5.0.0
9+
rev: v6.0.0
1010
hooks:
1111
- id: check-ast
1212
- id: check-docstring-first

src/lithium/strategies.py

Lines changed: 66 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,16 +1299,16 @@ def try_making_globals(
12991299
rb"[\w_.]+\." + word, word, new_tc.parts[chunk_start]
13001300
)
13011301
maybe_removed += len(new_tc.parts[chunk_start]) - len(subst)
1302-
new_tc.parts = (
1303-
new_tc.parts[:chunk_start]
1304-
+ [subst]
1305-
+ new_tc.parts[(chunk_start + 1) :]
1306-
)
1307-
new_tc.reducible = (
1308-
new_tc.reducible[:chunk_start]
1309-
+ [True]
1310-
+ new_tc.reducible[(chunk_start + 1) :]
1311-
)
1302+
new_tc.parts = [
1303+
*new_tc.parts[:chunk_start],
1304+
subst,
1305+
*new_tc.parts[chunk_start + 1 :],
1306+
]
1307+
new_tc.reducible = [
1308+
*new_tc.reducible[:chunk_start],
1309+
True,
1310+
*new_tc.reducible[chunk_start + 1 :],
1311+
]
13121312

13131313
for test in iterator.try_testcase(
13141314
new_tc, "Removing prefixes of " + description
@@ -1480,14 +1480,16 @@ def try_arguments_as_globals(
14801480
arg_defs = args_map["defs"]
14811481
def_chunk = args_map["chunk"]
14821482
subst = new_tc.parts[def_chunk].replace(args_map["args_pattern"], b"", 1)
1483-
new_tc.parts = (
1484-
new_tc.parts[:def_chunk] + [subst] + new_tc.parts[(def_chunk + 1) :]
1485-
)
1486-
new_tc.reducible = (
1487-
new_tc.reducible[:def_chunk]
1488-
+ [True]
1489-
+ new_tc.reducible[(def_chunk + 1) :]
1490-
)
1483+
new_tc.parts = [
1484+
*new_tc.parts[:def_chunk],
1485+
subst,
1486+
*new_tc.parts[def_chunk + 1 :],
1487+
]
1488+
new_tc.reducible = [
1489+
*new_tc.reducible[:def_chunk],
1490+
True,
1491+
*new_tc.reducible[def_chunk + 1 :],
1492+
]
14911493

14921494
# Copy callers arguments to globals.
14931495
for arg_use in args_map["uses"]:
@@ -1501,12 +1503,16 @@ def try_arguments_as_globals(
15011503
(a + b" = " + v + b";\n") for (a, v) in zip(arg_defs, values)
15021504
)
15031505
subst = setters + new_tc.parts[chunk]
1504-
new_tc.parts = (
1505-
new_tc.parts[:chunk] + [subst] + new_tc.parts[(chunk + 1) :]
1506-
)
1507-
new_tc.reducible = (
1508-
new_tc.reducible[:chunk] + [True] + new_tc.reducible[(chunk + 1) :]
1509-
)
1506+
new_tc.parts = [
1507+
*new_tc.parts[:chunk],
1508+
subst,
1509+
*new_tc.parts[chunk + 1 :],
1510+
]
1511+
new_tc.reducible = [
1512+
*new_tc.reducible[:chunk],
1513+
True,
1514+
*new_tc.reducible[chunk + 1 :],
1515+
]
15101516
maybe_moved_arguments += len(arg_defs)
15111517

15121518
for test in iterator.try_testcase(new_tc, "Removing " + description):
@@ -1527,12 +1533,16 @@ def try_arguments_as_globals(
15271533
subst = new_tc.parts[chunk].replace(arg_use["pattern"], fun + b"()", 1)
15281534
if new_tc.parts[chunk] == subst:
15291535
continue
1530-
new_tc.parts = (
1531-
new_tc.parts[:chunk] + [subst] + new_tc.parts[(chunk + 1) :]
1532-
)
1533-
new_tc.reducible = (
1534-
new_tc.reducible[:chunk] + [True] + new_tc.reducible[(chunk + 1) :]
1535-
)
1536+
new_tc.parts = [
1537+
*new_tc.parts[:chunk],
1538+
subst,
1539+
*new_tc.parts[chunk + 1 :],
1540+
]
1541+
new_tc.reducible = [
1542+
*new_tc.reducible[:chunk],
1543+
True,
1544+
*new_tc.reducible[chunk + 1 :],
1545+
]
15361546
maybe_moved_arguments = len(values)
15371547

15381548
for test in iterator.try_testcase(
@@ -1564,14 +1574,16 @@ def try_arguments_as_globals(
15641574
subst = new_tc.parts[def_chunk].replace(b",".join(arg_defs), b"", 1)
15651575
if new_tc.parts[def_chunk] == subst:
15661576
noop_changes += 1
1567-
new_tc.parts = (
1568-
new_tc.parts[:def_chunk] + [subst] + new_tc.parts[(def_chunk + 1) :]
1569-
)
1570-
new_tc.reducible = (
1571-
new_tc.reducible[:def_chunk]
1572-
+ [True]
1573-
+ new_tc.reducible[(def_chunk + 1) :]
1574-
)
1577+
new_tc.parts = [
1578+
*new_tc.parts[:def_chunk],
1579+
subst,
1580+
*new_tc.parts[def_chunk + 1 :],
1581+
]
1582+
new_tc.reducible = [
1583+
*new_tc.reducible[:def_chunk],
1584+
True,
1585+
*new_tc.reducible[def_chunk + 1 :],
1586+
]
15751587

15761588
# Replace arguments by their value in the scope of the function.
15771589
while len(values) < len(arg_defs):
@@ -1582,23 +1594,27 @@ def try_arguments_as_globals(
15821594
subst = new_tc.parts[def_chunk] + b"\n" + setters
15831595
if new_tc.parts[def_chunk] == subst:
15841596
noop_changes += 1
1585-
new_tc.parts = (
1586-
new_tc.parts[:def_chunk] + [subst] + new_tc.parts[(def_chunk + 1) :]
1587-
)
1588-
new_tc.reducible = (
1589-
new_tc.reducible[:def_chunk]
1590-
+ [True]
1591-
+ new_tc.reducible[(def_chunk + 1) :]
1592-
)
1597+
new_tc.parts = [
1598+
*new_tc.parts[:def_chunk],
1599+
subst,
1600+
*new_tc.parts[def_chunk + 1 :],
1601+
]
1602+
new_tc.reducible = [
1603+
*new_tc.reducible[:def_chunk],
1604+
True,
1605+
*new_tc.reducible[def_chunk + 1 :],
1606+
]
15931607

15941608
# Remove arguments of the anonymous function call.
15951609
subst = new_tc.parts[chunk].replace(b",".join(anon["use"]), b"", 1)
15961610
if new_tc.parts[chunk] == subst:
15971611
noop_changes += 1
1598-
new_tc.parts = new_tc.parts[:chunk] + [subst] + new_tc.parts[(chunk + 1) :]
1599-
new_tc.reducible = (
1600-
new_tc.reducible[:chunk] + [True] + new_tc.reducible[(chunk + 1) :]
1601-
)
1612+
new_tc.parts = [*new_tc.parts[:chunk], subst, *new_tc.parts[chunk + 1 :]]
1613+
new_tc.reducible = [
1614+
*new_tc.reducible[:chunk],
1615+
True,
1616+
*new_tc.reducible[chunk + 1 :],
1617+
]
16021618
maybe_moved_arguments += len(values)
16031619

16041620
if noop_changes == 3:

src/lithium/testcases.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def _clamp(bound: int | None, default: int) -> int:
7070
stop = _clamp(stop, len_self)
7171

7272
opts = [i for i in range(len(self.parts)) if self.reducible[i]]
73-
opts = [0] + opts[1:] + [len(self.parts)]
73+
opts = [0, *opts[1:], len(self.parts)]
7474

7575
return opts[start], opts[stop]
7676

tox.ini

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ passenv =
1212
BUILD_CACHE
1313
CI
1414
TOXENV
15-
TRAVIS
16-
TRAVIS_*
1715
usedevelop = true
1816

1917
[testenv:lint]
@@ -27,12 +25,12 @@ skip_install = true
2725
commands =
2826
mypy --install-types --non-interactive {posargs}
2927
deps =
30-
mypy==v1.15.0
28+
mypy==v1.19.1
3129
usedevelop = true
3230

3331
[testenv:pylint]
3432
commands =
3533
pylint {posargs}
3634
deps =
37-
pylint==3.3.6
35+
pylint==4.0.4
3836
usedevelop = true

0 commit comments

Comments
 (0)