One function

ToxEnvlist in advice-animal/codemod-tox

The author described this change as fix: don't add numeric factors if there isn't already an option.. It counts as a record because the check below fails on the code as it stood at a7c68aea7 and passes on 88e7deb20, with nothing else changed between the two runs.

Fix saved2026-04-14
Sharing licenceMIT · LICENSE
Change size+3 0

What the code was meant to do, written into the code itself as a docstring

An envlist. e.g. `py{37,38}-tests, coverage, lint` Although both comma and newline separated are supported during parsing, only newline separated will be output with `str()`. Check that set(a) != set(b) before changing a configuration value to avoid (one-time) churn.

The change

7474 new_envs: list[ToxEnv] = []
7575 added = False
7676 for env in self.envs:
77+ if not any(isinstance(p, ToxOptions) for p in env.pieces):
78+ new_envs.append(env)
79+ continue
7780 try:
7881 new_envs.append(env.add_numeric_option(value))
7982 added = True

The check that tells the two apart

failpass·tests/test_envlist.py::test_add_numeric_option_to_envlist

Check file tests/test_envlist.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before ita7c68aea78dbb1e9889a87b0c621d4edf65e6b54
Broken version dated2026-03-23
Modulecodemod_tox.envlist
Units changedToxEnvlist
Fingerprint85d145ffefc2e867
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.