Extension modules work - #176
Merged
Merged
Conversation
KotlinIsland
force-pushed
the
extension-modules-work
branch
from
August 17, 2026 01:04
b579773 to
eb12306
Compare
Contributor
ecosystem checkLinter (stable)✅ ecosystem check detected no linter changes. Linter (preview)✅ ecosystem check detected no linter changes. Formatter (stable)✅ ecosystem check detected no format changes. Formatter (preview)✅ ecosystem check detected no format changes. |
five stdlib modules panicked salsa's iteration cap or its recovery rules, across four distinct causes. every one was found by instrumenting the cycle rather than reasoning about it, and every mechanism guessed in advance turned out wrong. `analyze_non_terminal_call` had a `cycle_initial` and no `cycle_fn`, so salsa's identity recovery let two values alternate forever at constant length. two recovery-only helpers built their unions with the ordinary `UnionBuilder` instead of the cycle-recovery one, so a relation check re-entered the cycle it was recovering from — ty already had the guard and our code simply never opted in. `body_parameter_constraints` dropped a requirement it had already seen, because narrowing an `and` arm to `Literal[True]` deletes the arm and its narrowing with it: the precondition erasing itself. and float and complex literal types were added here without being added to the widening scheme that bounds every other literal kind, so a recursive union of them grows one element per round with no fixed point. also carries the three earlier bounds — the return-type nesting limit, the typevar freshness delta, and widening a growing tuple before normalising rather than after — and stops `refutable-unpacking` firing on `tuple[Divergent, ...]`, a length that is the recovery's own artefact rather than anything the program said.
…s what it says `by compile a.py` computed its file list from the arguments and then used it only for an emptiness check, compiling every source in the project instead. that is not a harmless superset: it costs every other module's build time, it fails for a diagnostic in a file nobody named, and it silently compiles whatever sits beside the file under test — which invalidated a delta-debugging run whose original was in the same directory as each candidate. the database still holds the whole project, because a type imported from a sibling has to resolve; only the checking and the emission are narrowed. two exclude bugs, found while establishing that the third — the one that was reported — does not exist: `exclude = ["!dist"]` works and always did, and only the forms gitignore itself refuses (`!dist/**`, inside a directory the walk never descends into) do not. a rooted negation lost its `!` in `into_absolute` and registered as a positive exclude, the exact opposite of what was written, with no diagnostic. and an unreachable negation was a silent no-op; it now reports `unreachable-exclude-negation` and names the spelling that would work. `by_commands.rs` also stopped applying its own hard-coded directory list after the project filter, where it had been re-dropping files a negation deliberately re-included.
a class inside a package reported the bare last component as its `__module__`, because the module's name and its C symbol prefix had been conflated into one string. they are two names: cpython reads a class's module off the front of its `tp_name`, while the extension's file name and `PyInit_` symbol take the last component only. `dataclasses` looks that name up in `sys.modules`, so two modules failed to import at all. the artefact is now written at its module's place in the output tree rather than flat — where two members sharing a last component silently overwrote each other, and no package member's artefact was importable under the name it was compiled as. the file name and the init symbol follow different rules, and only the symbol is the last component: `a/b/__init__.py` needs the file `__init__.so` and the symbol `PyInit_b`. a class-level constant was copied off the twin *after* the twin's own decorators had run over it, so `@dataclass` deleting a `field(init=False)` left nothing to copy, and setting a bare default lost `repr=False` — a silent wrong answer no sweep can see. each class body is now captured before its decorators run, by giving the module body its own `__builtins__` carrying a wrapped `__build_class__`. per-namespace rather than process-wide, because this backend builds for free-threaded interpreters where another thread could be importing at the same time. a decorator ran twice — once in the twin's source, once at init — so any decorator with an effect performed it twice. module-level functions and classes now have theirs taken out of the twin's source, with the definitions the module body reads during import declining instead, since in that window the name would hold an undecorated definition. a *method's* still runs twice: blanking cannot work there, because the class construction consumes the decorator's effect — `ABCMeta.__new__` computes `__abstractmethods__` from the namespace the body left, so a blanked `@abstractmethod` changes the class the twin builds. also: a decorator written as a chain of attributes is lowered rather than declined; a class whose type slots publish more than its body wrote keeps its decorator's decline, turning two silent miscompiles into honest refusals; two definitions of one name in a scope decline rather than emitting one C symbol twice and failing the build; and `by run --compiled` passes the tree root, where it had been silently running every package `__init__` interpreted.
`sys.modules[type(point).__module__]` was emitted as `sys.modules[str]` — the key replaced by the type inferred for it, which raises at runtime. for `base.attr[…]` the walker asked whether the *base* was a module, where the `Name` arm beside it asked the exact question: is this a type? `typing.List` and `sys.modules` are both attributes of a module, so the weak question could not tell them apart, and the slice of an ordinary dict lookup was walked as a type expression. one predicate now asks that of whatever is being subscripted, with a `trailing_name` helper for the nine sites that also need a particular name. the two questions stay separate on purpose: the name alone cannot tell `typing.List` from an unrelated `mine.List`, and the type alone cannot tell `Callable` from any other generic. three further sites carried the same latent bug and are fixed by the same change.
a module was staged alone, so `from . import x` had nothing to resolve against and about a hundred of the 550 reported `import-failed` on both legs — walked but never exercised. a package member is now staged inside a copy of its package, under one outer package nobody else names: a copy under the real name would stand in for the interpreter's own, and `encodings` is already in `sys.modules` before a probe starts. that recovered 89 modules, and a per-stage exclude negation recovered `venv`, the last one ty's own defaults hid. `isoimport` scored a killed leg as agreement, because a leg killed by the import alarm prints exactly what a clean import prints — nothing. the exit status decides now, and `timed-out` and `died` are their own categories rather than silence. a sweep also pays macos's dylib check through `ctypes.CDLL` before it starts timing: that cost is 0.42s idle and 17.8s under contention, it landed inside the import bound, and it came back as `timed-out` — 26 of them in one run, all of which passed when re-run. `CDLL` does not call `PyInit_`, so nothing runs twice. two tools rather than two rules. `scripts/bg.sh` runs a long job and polls it, telling finished-with-status from still-running from *killed*, by recorded pid rather than by pattern — hand-rolled waiting was measured at 58% of all wall time across five agent runs, a third of it in `pgrep -f` loops matching their own command line, which never return. and `scripts/shrink.py` minimises a reproducer without fooling itself: minimising is what cracked every cycle panic here, and three separate traps each produced a confident wrong answer before being guarded — the worst turning 2714 lines into 4 that reproduce nothing.
the backend had no repeatable way to say whether a change made anything faster, and ci tested it against whatever `python3` the runner image happened to ship. the suite times cpython, this backend and mypyc on the same programs and reports ratios rather than absolutes, because cpython's own numbers move several-fold with machine load. ci now pins the interpreter and covers both supported versions across the platform axis — windows on the newest, because its toolchain path is the most version-sensitive code here (it has to name the interpreter's import library, whose stem carries both the version and the free-threaded `t`), and macos on the floor version. the two genuinely differ: 3.14 works a class's annotations out lazily, so a twin's dict holds `__annotate_func__` rather than a mapping, and it rewrote the wording of several runtime errors. a fix that greens one and breaks the other is not a fix.
… no bound `body_parameter_constraints` already computes `single_bindings` — a name bound more than once cannot stand for one value — and applied it to every local except the parameter itself. this applies it there too, which is the rule the file already states rather than an exception carved for this case. measured over the 153 top-level stdlib modules, two binaries from one tree: 5041 diagnostics to 4790. **−254 by location and +3**, across 41 modules. the other 46 of the 49 added lines are the same diagnostic at the same file:line:col with a differently rendered type, and read better for it — `has no attribute 'startswith'` on `object` becomes `not defined on 'None' in union 'Unknown | str | None'`, which names the actual bug in `inspect.getsourcefile`'s None return. all 3 genuinely new ones are correct. of the 254 removed, about 249 are false positives and 5 are real. the strongest thing lost is `code._showtraceback`, where `sys.exc_info()` gives `BaseException | None` against a body calling `value.with_traceback(tb)` — and that only survived because the same body's rebinding was not reachable above it.⚠️ this masks rather than fixes. two of the three false-positive families it removes have nothing to do with rebinding: a recovered protocol records no `__getitem__`, no operator dunders and no `__iter__`, and a member called twice is pinned to the first call's argument types. both still fire on a parameter nobody rebinds. a third family is genuinely caused by rebinding — a rebind inside a loop retroactively hides a requirement at the loop head, so `ast.visit_If` ends up contradicting its own recovered signature above the line that rebinds. the narrower rule — drop the bound only when the rebinding reads a member off the name — was built and measured: 109 removals, a strict subset, and it loses the two `code.py` signals anyway (`value = value.with_traceback(tb)` is that shape) while keeping ~145 of the false positives. strictly worse on every axis.
KotlinIsland
force-pushed
the
extension-modules-work
branch
from
August 17, 2026 02:54
eb12306 to
7d10c11
Compare
Contributor
by ecosystem round-tripbase: regressions: 0, changed: 517, improvements: 7, error changes: 1 (across 25814 files in 148 projects) ℹ️ changed round-trip outputPyGithub — scripts/openapi.py--- base/scripts/openapi.py
+++ head/scripts/openapi.py
@@ -23,5 +23,5 @@
from __future__ import annotations
-lazy from typing import Callable, Literal
+lazy from typing import Callable
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -3956,5 +3956,5 @@
for suggested_method in suggested_methods:
print(
- f" python {_soundness_check(sys.argv[Literal[0]], str)} create method {spec_file} {index_filename} {cls} {suggested_method} {verb} {candidate_path}"
+ f" python {_soundness_check(sys.argv[0], str)} create method {spec_file} {index_filename} {cls} {suggested_method} {verb} {candidate_path}"
)
print()Tanjun — tanjun/components.py--- base/tanjun/components.py
+++ head/tanjun/components.py
@@ -893,5 +893,5 @@
# <<inherited docstring from tanjun.abc.Component>>.
try:
- del self._menu_commands[(command.type, command.name)]
+ del self._menu_commands[command.type, command.name]
except KeyError:
error_message = f"Command {command.name} not found"Tanjun — tests/dependencies/test_limiters.py--- base/tests/dependencies/test_limiters.py
+++ head/tests/dependencies/test_limiters.py
@@ -1298,5 +1298,5 @@
inner.check.assert_called_once_with()
inner.increment.assert_called_once_with(mock_ctx)
- assert manager._acquiring_ctxs[("yeet me", mock_ctx)] == inner
+ assert manager._acquiring_ctxs["yeet me", mock_ctx] == inner
@pytest.mark.asyncio
@@ -1315,5 +1315,5 @@
inner.check.assert_called_once_with()
inner.increment.assert_called_once_with(mock_ctx)
- assert manager._acquiring_ctxs[("yeet me", mock_ctx)] == inner
+ assert manager._acquiring_ctxs["yeet me", mock_ctx] == inner
@pytest.mark.asyncio
@@ -1365,5 +1365,5 @@
mock_ctx = mock.Mock()
mock_inner = mock.Mock()
- manager._acquiring_ctxs[("interesting!", mock_ctx)] = mock_inner
+ manager._acquiring_ctxs["interesting!", mock_ctx] = mock_inner
await manager.release("interesting!", mock_ctx)
@@ -1440,5 +1440,5 @@
mock_ctx = mock.Mock()
manager = tanjun.dependencies.InMemoryCooldownManager()
... 1924 characters elided ...
@@ -2953,5 +2953,5 @@
mock_context = mock.Mock()
mock_limiter = mock.Mock()
- manager._acquiring_ctxs[("nya", mock_context)] = mock_limiter
+ manager._acquiring_ctxs["nya", mock_context] = mock_limiter
await manager.release("nya", mock_context)aiortc — aiortc/rtcpeerconnection.py--- base/aiortc/rtcpeerconnection.py
+++ head/aiortc/rtcpeerconnection.py
@@ -1,3 +1,2 @@
-lazy from ty_extensions import Intersection
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -271,9 +270,9 @@
def and_direction(a: str, b: str) -> str:
- return sdp.DIRECTIONS[Intersection[sdp.DIRECTIONS.index(a), sdp.DIRECTIONS.index(b)]]
+ return _soundness_check(sdp.DIRECTIONS[_soundness_check(sdp.DIRECTIONS.index(a), int) & _soundness_check(sdp.DIRECTIONS.index(b), int)], str)
def or_direction(a: str, b: str) -> str:
- return _soundness_check(sdp.DIRECTIONS[int | int], str)
+ return _soundness_check(sdp.DIRECTIONS[_soundness_check(sdp.DIRECTIONS.index(a), int) | _soundness_check(sdp.DIRECTIONS.index(b), int)], str)aiortc — tests/test_rtcpeerconnection.py(only produced on head)aiortc — tests/test_rtcrtpreceiver.py(only produced on head)aiortc — tests/test_rtcrtpsender.py(only produced on head)aiortc — tests/test_rtcrtptransceiver.py(only produced on head)aiortc — tests/test_rtcsctptransport.py(only produced on head)aiortc — tests/test_rtcsessiondescription.py(only produced on head)aiortc — tests/test_rtp.py(only produced on head)aiortc — tests/test_sdp.py(only produced on head)aiortc — tests/test_utils.py(only produced on head)aiortc — tests/test_vpx.py(only produced on head)aiortc — tests/utils.py(only produced on head)alectryon — etc/cache_textconv.py--- base/etc/cache_textconv.py
+++ head/etc/cache_textconv.py
@@ -1,3 +1,2 @@
-lazy from typing import Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -33,5 +32,5 @@
return js
-path = Path(_soundness_check(sys.argv[Literal[1]], str))
+path = Path(_soundness_check(sys.argv[1], str))
dirty = path.read_bytes()
try:alectryon — etc/lint_changes.py--- base/etc/lint_changes.py
+++ head/etc/lint_changes.py
@@ -1,3 +1,2 @@
-lazy from typing import Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -57,7 +56,7 @@
def main():
# changes = 0
- with open(_soundness_check(sys.argv[Literal[1]], str)) as f:
+ with open(_soundness_check(sys.argv[1], str)) as f:
contents = _soundness_check(f.read(), str)
- with open(_soundness_check(sys.argv[Literal[1]], str), mode="w") as f:
+ with open(_soundness_check(sys.argv[1], str), mode="w") as f:
_soundness_check(f.write(_soundness_check(ANNOT.sub(subn, contents), str)), int)alectryon — etc/regen_makefile.py--- base/etc/regen_makefile.py
+++ head/etc/regen_makefile.py
@@ -1,3 +1,2 @@
-lazy from typing import Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -93,6 +92,6 @@
def main():
- prefix = _soundness_check(sys.argv[Literal[1]], str)
- outdir = Path(_soundness_check(sys.argv[Literal[2]], str))
+ prefix = _soundness_check(sys.argv[1], str)
+ outdir = Path(_soundness_check(sys.argv[2], str))
print(HEADER.format(prefix=prefix, outdir=outdir))artigraph — tests/arti/producers/test_producer.py--- base/tests/arti/producers/test_producer.py
+++ head/tests/arti/producers/test_producer.py
@@ -70,5 +70,5 @@
assert dummy_producer._input_artifact_classes_ == {"a1": A1}
assert len(dummy_producer._outputs_) == 1
- assert dummy_producer._outputs_[Literal[0]].artifact_class == A2
+ assert dummy_producer._outputs_[0].artifact_class == A2
assert dummy_producer(a1=A1()).annotations == Producer.model_fields["annotations"].default # type: ignore[call-arg]
assert dummy_producer(a1=A1()).version == Producer.model_fields["version"].default # type: ignore[call-arg]async-utils — async_utils/_simple_lock.py--- base/async_utils/_simple_lock.py
+++ head/async_utils/_simple_lock.py
@@ -1,2 +1,3 @@
+lazy from typing import Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -95,5 +96,5 @@
break
- async def __aexit__(self, *dont_care: object) -> t.Literal[False]:
+ async def __aexit__(self, *dont_care: object) -> Literal[False]:
with self._internal_lock:
self._lockv = Falseasync-utils — async_utils/bg_loop.py--- base/async_utils/bg_loop.py
+++ head/async_utils/bg_loop.py
@@ -15,4 +15,5 @@
"""Background loop management."""
lazy from ty_extensions import JustFloat
+lazy from typing import Callable
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -152,5 +153,5 @@
use_eager_task_factory: bool = True,
wait_on_exit: bool = True,
- loop_factory: t.Callable[[], asyncio.AbstractEventLoop] | None = None,
+ loop_factory: Callable[[], asyncio.AbstractEventLoop] | None = None,
) -> t.Generator[LoopWrapper, None, None]:
"""Create and use a managed event loop in a backround thread.async-utils — async_utils/bg_tasks.py--- base/async_utils/bg_tasks.py
+++ head/async_utils/bg_tasks.py
@@ -1,3 +1,7 @@
lazy from ty_extensions import JustFloat
+lazy from typing import Protocol
+class _Callable_3ab0c1e3(Protocol):
+ def __call__(self, *args: "*Ts") -> "_CoroutineLike[R]": ...
+
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -214,5 +218,5 @@
def map[*Ts, R](
self,
- fn: t.Callable[[*Ts], _CoroutineLike[R]],
+ fn: _Callable_3ab0c1e3,
/,
*iterables: tuple[*Ts],async-utils — async_utils/corofunc_cache.py(only produced on base)async-utils — async_utils/merge_gens.py--- base/async_utils/merge_gens.py
+++ head/async_utils/merge_gens.py
@@ -1,2 +1,3 @@
+lazy from typing import Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -37,5 +38,5 @@
__all__ = ["batch_merge_gens", "merge_gens"]
-type ExceptionBehavior = t.Literal["raise", "delay", "suppress"]
+type ExceptionBehavior = Literal["raise", "delay", "suppress"]
T = t.TypeVar("T")async-utils — async_utils/priority_sem.py--- base/async_utils/priority_sem.py
+++ head/async_utils/priority_sem.py
@@ -1,3 +1,4 @@
lazy from ty_extensions import JustFloat
+lazy from typing import Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -162,5 +163,5 @@
await self.__acquire(prio)
- async def __aexit__(self, *dont_care: object) -> t.Literal[False]:
+ async def __aexit__(self, *dont_care: object) -> Literal[False]:
self.__release()
return Falseasync-utils — async_utils/sig_service.py--- base/async_utils/sig_service.py
+++ head/async_utils/sig_service.py
@@ -1,2 +1,3 @@
+lazy from typing import Callable, Literal
_MISSING = object()
def _soundness_check(_v, _t):
@@ -36,10 +37,10 @@
__all__ = ("SignalService", "SpecialExit")
-type SignalCallback = t.Callable[[signal.Signals | SpecialExit], t.Any]
-type StartStopCall = t.Callable[[], t.Any]
-type _HTC = t.Callable[[int, FrameType | None], t.Any]
+type SignalCallback = Callable[[signal.Signals | SpecialExit], t.Any]
+type StartStopCall = Callable[[], t.Any]
+type _HTC = Callable[[int, FrameType | None], t.Any]
type _HANDLER = _HTC | int | signal.Handlers | None
-type HandleableSignals = t.Literal["SIGINT", "SIGTERM", "SIGBREAK", "SIGHUP"]
+type HandleableSignals = Literal["SIGINT", "SIGTERM", "SIGBREAK", "SIGHUP"]
type SignalSequence = t.Sequence[HandleableSignals]async-utils — async_utils/task_cache.py(only produced on base)async-utils — async_utils/waterfall.py--- base/async_utils/waterfall.py
+++ head/async_utils/waterfall.py
@@ -1,3 +1,4 @@
lazy from ty_extensions import JustFloat
+lazy from typing import Callable
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -41,5 +42,5 @@
type AnyCoro = t.Coroutine[t.Any, t.Any, t.Any]
-type CallbackType[T] = t.Callable[[t.Sequence[T]], AnyCoro]
+type CallbackType[T] = Callable[[t.Sequence[T]], AnyCoro]attrs — tests/test_make.py--- base/tests/test_make.py
+++ head/tests/test_make.py
@@ -4,5 +4,4 @@
Tests for `attr._make`.
"""
-lazy from typing import Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -564,5 +563,5 @@
x = attr.ib()
- assert "x" == C.__attrs_attrs__[Literal[0]].name
+ assert "x" == C.__attrs_attrs__[0].name
assert all(isinstance(a, Attribute) for a in C.__attrs_attrs__)attrs — tests/test_validators.py--- base/tests/test_validators.py
+++ head/tests/test_validators.py
@@ -4,5 +4,4 @@
Tests for `attr.validators`.
"""
-lazy from typing import Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -332,5 +331,5 @@
a2 = _soundness_check(attr.ib("a2", validator=[instance_of(int)]), str)
- assert C.__attrs_attrs__[Literal[0]].validator == C.__attrs_attrs__[Literal[1]].validator
+ assert C.__attrs_attrs__[0].validator == C.__attrs_attrs__[1].validatorblack — black/__init__.py--- base/black/__init__.py
+++ head/black/__init__.py
@@ -385,15 +385,15 @@
return False
min_target_minor = _soundness_check(min(tv.value for tv in target_versions), int)
- return min_target_minor > sys.version_info[Literal[1]]
+ return min_target_minor > sys.version_info[1]
def _version_mismatch_message(target_versions: set[TargetVersion]) -> str:
max_target = _soundness_check(max(target_versions, key=lambda tv: tv.value), TargetVersion)
- runtime = f"{sys.version_info[Literal[0]]}.{sys.version_info[Literal[1]]}"
+ runtime = f"{sys.version_info[0]}.{sys.version_info[1]}"
return (
f"Python {runtime} cannot parse code formatted for"
f" {max_target.pretty()}. To fix this: run Black with"
f" {max_target.pretty()}, set --target-version to"
- f" py3{sys.version_info[Literal[1]]}, or use --fast to skip the safety"
+ f" py3{sys.version_info[1]}, or use --fast to skip the safety"
" check."
)black — black/parsing.py--- base/black/parsing.py
+++ head/black/parsing.py
@@ -2,5 +2,4 @@
Parse Python code and perform AST validation.
"""
-lazy from typing import Literal
_MISSING = object()
def _soundness_check(_v, _t):
@@ -188,5 +187,5 @@
def parse_ast(src: str) -> ast.AST:
# TODO: support Python 4+ ;)
- versions = [(3, minor) for minor in range(3, sys.version_info[Literal[1]] + 1)]
+ versions = [(3, minor) for minor in range(3, sys.version_info[1] + 1)]
first_error = ""black — blib2to3/pgen2/tokenize.py--- base/blib2to3/pgen2/tokenize.py
+++ head/blib2to3/pgen2/tokenize.py
@@ -27,5 +27,4 @@
function to which the 5 fields described above are passed as 5 arguments,
each time a new token is found."""
-lazy from typing import Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -283,5 +282,5 @@
if __name__ == "__main__": # testing
if len(sys.argv) > 1:
- token_iterator = tokenize(_soundness_check(open(_soundness_check(sys.argv[Literal[1]], str)).read(), str))
+ token_iterator = tokenize(_soundness_check(open(_soundness_check(sys.argv[1], str)).read(), str))
else:
token_iterator = tokenize(_soundness_check(sys.stdin.read(), str))bokeh — bokeh/util/package.py--- base/bokeh/util/package.py
+++ head/bokeh/util/package.py
@@ -9,5 +9,4 @@
"""
-lazy from typing import Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -122,6 +121,6 @@
if __name__ == "__main__":
lazy import sys
- version = _soundness_check(sys.argv[Literal[1]], str) if len(sys.argv) >= 2 else None
- build_dir = _soundness_check(sys.argv[Literal[2]], str) if len(sys.argv) >= 3 else None
+ version = _soundness_check(sys.argv[1], str) if len(sys.argv) >= 2 else None
+ build_dir = _soundness_check(sys.argv[2], str) if len(sys.argv) >= 3 else None
errors = validate(version=version, build_dir=build_dir)
for error in _soundness_iter(errors, str):bokeh — examples/interaction/widgets/color_map.py--- base/examples/interaction/widgets/color_map.py
+++ head/examples/interaction/widgets/color_map.py
@@ -1,3 +1,2 @@
-lazy from typing import Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -14,48 +13,48 @@
items0 = [
- ("Magma", _soundness_check(palettes.Magma[Literal[256]], tuple)),
- ("Inferno", _soundness_check(palettes.Inferno[Literal[256]], tuple)),
- ("Plasma", _soundness_check(palettes.Plasma[Literal[256]], tuple)),
- ("Viridis", _soundness_check(palettes.Viridis[Literal[256]], tuple)),
- ("Cividis", _soundness_check(palettes.Cividis[Literal[256]], tuple)),
- ("Turbo", _soundness_check(palettes.Turbo[Literal[256]], tuple)),
+ ("Magma", _soundness_check(palettes.Magma[256], tuple)),
+ ("Inferno", _soundness_check(palettes.Inferno[256], tuple)),
+ ("Plasma", _soundness_check(palettes.Plasma[256], tuple)),
+ ("Viridis", _soundness_check(palettes.Viridis[256], tuple)),
+ ("Cividis", _soundness_check(palettes.Cividis[256], tuple)),
+ ("Turbo", _soundness_check(palettes.Turbo[256], tuple)),
]
items1 = [
... 4267 characters elided ...
+ ("Pastel1", _soundness_check(palettes.Pastel1[9], tuple)),
+ ("Pastel2", _soundness_check(palettes.Pastel2[8], tuple)),
+ ("Set1", _soundness_check(palettes.Set1[9], tuple)),
+ ("Set2", _soundness_check(palettes.Set2[8], tuple)),
+ ("Set3", _soundness_check(palettes.Set3[12], tuple)),
]bokeh — examples/models/widgets.py--- base/examples/models/widgets.py
+++ head/examples/models/widgets.py
@@ -10,5 +10,4 @@
''' # noqa: E501
-lazy from typing import Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -35,45 +34,45 @@
palette_items = [
- ("YlGn", _soundness_check(palettes.YlGn[Literal[9]], tuple)),
- ("YlGnBu", _soundness_check(palettes.YlGnBu[Literal[9]], tuple)),
- ("GnBu", _soundness_check(palettes.GnBu[Literal[9]], tuple)),
- ("BuGn", _soundness_check(palettes.BuGn[Literal[9]], tuple)),
- ("PuBuGn", _soundness_check(palettes.PuBuGn[Literal[9]], tuple)),
- ("PuBu", _soundness_check(palettes.PuBu[Literal[9]], tuple)),
- ("BuPu", _soundness_check(palettes.BuPu[Literal[9]], tuple)),
- ("RdPu", _soundness_check(palettes.RdPu[Literal[9]], tuple)),
- ("PuRd", _soundness_check(palettes.PuRd[Literal[9]], tuple)),
- ("OrRd", _soundness_check(palettes.OrRd[Literal[9]], tuple)),
- ("YlOrRd", _soundness_check(palettes.YlOrRd[Literal[9]], tuple)),
- ("YlOrBr", _soundness_check(palettes.YlOrBr[Literal[9]], tuple)),
... 4252 characters elided ...
+ ("Inferno", _soundness_check(palettes.Inferno[256], tuple)),
+ ("Plasma", _soundness_check(palettes.Plasma[256], tuple)),
+ ("Viridis", _soundness_check(palettes.Viridis[256], tuple)),
+ ("Cividis", _soundness_check(palettes.Cividis[256], tuple)),
+ ("Turbo", _soundness_check(palettes.Turbo[256], tuple)),
]bokeh — tests/tools/release/test_stages_and_cli.py--- base/tests/tools/release/test_stages_and_cli.py
+++ head/tests/tools/release/test_stages_and_cli.py
@@ -1,3 +1,3 @@
-lazy from typing import Any, Literal
+lazy from typing import Any
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -87,5 +87,5 @@
def test_build_pipeline_checks_branch_before_mutating_steps() -> None:
assert _soundness_check(stages.BUILD_CHECKS.index(stages.check_checkout_on_base_branch), int) < len(stages.BUILD_CHECKS)
- assert stages.BUILD_STEPS[Literal[0]].__name__ == "clean_repo"
+ assert stages.BUILD_STEPS[0].__name__ == "clean_repo"
@@ -95,5 +95,5 @@
assert _soundness_check(stages.BUILD_STEPS.index(commit_staging_branch), int) < _soundness_check(stages.BUILD_STEPS.index(tag_release_version), int)
assert _soundness_check(stages.BUILD_STEPS.index(tag_release_version), int) < _soundness_check(stages.BUILD_STEPS.index(push_to_github), int)
- assert stages.BUILD_STEPS[Literal[-2]] is push_to_github
+ assert stages.BUILD_STEPS[-2] is push_to_githubbokeh — tools/release/__main__.py--- base/tools/release/__main__.py
+++ head/tools/release/__main__.py
@@ -1,3 +1,2 @@
-lazy from typing import Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -34,17 +33,17 @@
}
-if len(sys.argv) == 3 and _soundness_check(sys.argv[Literal[1]], str) == "generate-config":
- config = Config(_soundness_check(sys.argv[Literal[2]], str))
+if len(sys.argv) == 3 and _soundness_check(sys.argv[1], str) == "generate-config":
+ config = Config(_soundness_check(sys.argv[2], str))
save_config(config)
sys.exit(0)
-if len(sys.argv) == 2 and _soundness_check(sys.argv[Literal[1]], str) in stage_generators:
- print([func.__name__ for func in _soundness_check(stage_generators[_soundness_check(sys.argv[Literal[1]], str)], tuple)])
+if len(sys.argv) == 2 and _soundness_check(sys.argv[1], str) in stage_generators:
+ print([func.__name__ for func in _soundness_check(stage_generators[_soundness_check(sys.argv[1], str)], tuple)])
sys.exit(0)
-if len(sys.argv) == 2 and _soundness_check(sys.argv[Literal[1]], str) in dir(stages):
... 792 characters elided ...
- config = Config(_soundness_check(sys.argv[Literal[2]], str))
+if len(sys.argv) == 3 and _soundness_check(sys.argv[1], str) == "deploy":
+ config = Config(_soundness_check(sys.argv[2], str))
check = Pipeline(stages.DEPLOY_CHECKS, config, system)boostedblob — boostedblob/boost.py(only produced on head)check-jsonschema — scripts/bump-version.py--- base/scripts/bump-version.py
+++ head/scripts/bump-version.py
@@ -1,3 +1,2 @@
-lazy from typing import Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -62,5 +61,5 @@
sys.exit(2)
- new_version = _soundness_check(sys.argv[Literal[1]], str)
+ new_version = _soundness_check(sys.argv[1], str)
old_version = DJ.read.version()
print(f"old = {old_version}, new = {new_version}")cibuildwheel — cibuildwheel/resources/android/rust_shim.py--- base/cibuildwheel/resources/android/rust_shim.py
+++ head/cibuildwheel/resources/android/rust_shim.py
@@ -1,3 +1,2 @@
-lazy from typing import Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -25,5 +24,5 @@
target = _soundness_check(os.environ.get("CIBW_HOST_TRIPLET"), (str, type(None)))
- cmd_name = Path(_soundness_check(sys.argv[Literal[0]], str)).name
+ cmd_name = Path(_soundness_check(sys.argv[0], str)).name
# Find the real command in PATH, excluding the current script's directorycibuildwheel — cibuildwheel/resources/ios-support/make_cross_venv.py--- base/cibuildwheel/resources/ios-support/make_cross_venv.py
+++ head/cibuildwheel/resources/ios-support/make_cross_venv.py
@@ -1,3 +1,3 @@
-lazy from typing import Any, Literal
+lazy from typing import Any
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -108,5 +108,5 @@
raise ValueError(msg)
- LIB_PATH = f"lib/python{sys.version_info[Literal[0]]}.{sys.version_info[Literal[1]]}"
+ LIB_PATH = f"lib/python{sys.version_info[0]}.{sys.version_info[1]}"
# Derive the multiarch tag from the sysconfigdata filename if available;
@@ -153,15 +153,15 @@
if __name__ == "__main__":
try:
- sysconfig_path = _soundness_check(Path(_soundness_check(sys.argv[Literal[2]], str)).resolve(), Path)
+ sysconfig_path = _soundness_check(Path(_soundness_check(sys.argv[2], str)).resolve(), Path)
except IndexError:
sysconfig_path = Path(__file__).parent
try:
- platform_config_path = _soundness_check(Path(_soundness_check(sys.argv[Literal[3]], str)).resolve(), Path)
... 179 characters elided ...
try:
- venv_path = _soundness_check(Path(_soundness_check(sys.argv[Literal[1]], str)).resolve(), Path)
+ venv_path = _soundness_check(Path(_soundness_check(sys.argv[1], str)).resolve(), Path)
make_cross_venv(venv_path, sysconfig_path, platform_config_path)
except IndexError:cki-lib — cki_lib/footer.py--- base/cki_lib/footer.py
+++ head/cki_lib/footer.py
@@ -1,3 +1,4 @@
"""Common footer for bot activity."""
+lazy from typing import Callable
_MISSING = object()
def _soundness_check(_v, _t):
@@ -15,5 +16,4 @@
lazy import argparse
-lazy import collections
lazy import dataclasses
lazy from importlib import resources
@@ -97,5 +97,5 @@
*,
what: str | None = None,
- link_formatter: collections.abc.Callable[[str, str], str] = _MISSING,
+ link_formatter: Callable[[str, str], str] = _MISSING,
prefix: str = "",
suffix: str = "\n",
@@ -219,5 +219,5 @@
footer = Footer()
- footer_method: collections.abc.Callable[..., str] = getattr(footer, f"{args.format}_footer")
+ footer_method: Callable[..., str] = getattr(footer, f"{args.format}_footer")
return footer_method(what=args.what)cki-lib — cki_lib/inttests/cluster.py--- base/cki_lib/inttests/cluster.py
+++ head/cki_lib/inttests/cluster.py
@@ -2,5 +2,5 @@
from __future__ import annotations
-lazy from typing import Literal
+lazy from typing import Callable, Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -62,5 +62,5 @@
-def skip_without_requirements() -> collections.abc.Callable[[dynamic], dynamic]:
+def skip_without_requirements() -> Callable[[dynamic], dynamic]:
"""Skip without the required dependencies."""
for dependency in _soundness_iter(("kind", "docker"), str):cki-lib — cki_lib/inttests/remote_responses.py--- base/cki_lib/inttests/remote_responses.py
+++ head/cki_lib/inttests/remote_responses.py
@@ -1,4 +1,4 @@
"""Like responses, but remote."""
-lazy from typing import Any
+lazy from typing import Any, Callable
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -44,5 +44,5 @@
"""Proxy to avoid anonymous local methods."""
- target: collections.abc.Callable[..., Any]
+ target: Callable[..., Any]
args: tuple[dynamic]
kwargs: dict[str, Any]
@@ -50,5 +50,5 @@
def __init__(
self,
- target: collections.abc.Callable[..., Any],
+ target: Callable[..., Any],
*args: Any, # noqa: ANN401
**kwargs: Any, # noqa: ANN401
@@ -134,5 +134,5 @@
*,
strict_match: bool = True,
- ) -> collections.abc.Callable[[requests.PreparedRequest], tuple[bool, str]]:
+ ) -> Callable[[requests.PreparedRequest], tuple[bool, str]]:
"""Proxy for responses.matchers.json_params_matcher."""
return _CallProxy(responses.matchers.json_params_matcher, params, strict_match=strict_match)
@@ -201,5 +201,5 @@
@staticmethod
... 236 characters elided ...
- def _proxy(self, what: collections.abc.Callable[..., responses.BaseResponse]) -> str:
+ def _proxy(self, what: Callable[..., responses.BaseResponse]) -> str:
data = pickle.load(self.rfile) # noqa: S301 -- test-only IPC via pickle
return self._proxy_call(what, *data["args"], **data["kwargs"])cki-lib — cki_lib/retrying.py--- base/cki_lib/retrying.py
+++ head/cki_lib/retrying.py
@@ -1,4 +1,5 @@
"""Retrying decorator to retry method/function several times."""
lazy from ty_extensions import JustFloat
+lazy from typing import Callable
@@ -18,8 +19,5 @@
retries: int = 3,
initial_delay: JustFloat = 3,
-) -> collections.abc.Callable[
- [collections.abc.Callable[..., object]],
- collections.abc.Callable[..., object],
-]:
+) -> Callable[[Callable[..., object]], Callable[..., object]]:
"""Decorate method/function to be retried on exception after initial_delay.
@@ -37,6 +35,6 @@
def wrapper(
- function: collections.abc.Callable[..., object],
- ) -> collections.abc.Callable[..., object]:
+ function: Callable[..., object],
+ ) -> Callable[..., object]:
@functools.wraps(function)
def wrapped(*args: object, **kwargs: object) -> object:cki-lib — cki_lib/timeout.py--- base/cki_lib/timeout.py
+++ head/cki_lib/timeout.py
@@ -1,4 +1,5 @@
"""Utilities to run functions with a timeout."""
lazy from ty_extensions import JustFloat
+lazy from typing import Callable
_MISSING = object()
@@ -21,13 +22,10 @@
def timeout(
timeout_seconds: JustFloat,
-) -> collections.abc.Callable[
- [collections.abc.Callable[..., object]],
- collections.abc.Callable[..., object],
-]:
+) -> Callable[[Callable[..., object]], Callable[..., object]]:
"""Decorate a function to raise an exception on timeout."""
def timeout_decorator(
- item: collections.abc.Callable[..., object],
- ) -> collections.abc.Callable[..., object]:
+ item: Callable[..., object],
+ ) -> Callable[..., object]:
"""Wrap the original function."""
@@ -48,5 +46,5 @@
def func_timeout(
- func: collections.abc.Callable[..., object],
+ func: Callable[..., object],
timeout_seconds: JustFloat,
args: tuple[object, ...] = _MISSING,cki-lib — cki_lib/timer.py--- base/cki_lib/timer.py
+++ head/cki_lib/timer.py
@@ -1,4 +1,5 @@
"""Timer module."""
lazy from ty_extensions import JustFloat
+lazy from typing import Callable
@@ -20,5 +21,5 @@
self,
interval: JustFloat,
- function: collections.abc.Callable[..., object],
+ function: Callable[..., object],
*args: object,
**kwargs: object,cki-lib — tests/test_messagequeue.py--- base/tests/test_messagequeue.py
+++ head/tests/test_messagequeue.py
@@ -667,7 +667,5 @@
@staticmethod
- def _basic_consume() -> collections.abc.Iterator[
- tuple[mock.Mock, pika.BasicProperties, str] | tuple[None, None, None]
- ]:
+ def _basic_consume() -> collections.abc.Iterator[tuple[mock.Mock, pika.BasicProperties, str] | tuple[None, None, None]]:
for i in range(3):
yield (colour — colour/plotting/tests/test_common.py--- base/colour/plotting/tests/test_common.py
+++ head/colour/plotting/tests/test_common.py
@@ -596,5 +596,5 @@
path = os.path.join(
- _soundness_check(colour.__path__[Literal[0]], str), "..", "docs", "_static", "Logo_Medium_001.png"
+ _soundness_check(colour.__path__[0], str), "..", "docs", "_static", "Logo_Medium_001.png"
)colour — colour/utilities/verbose.py--- base/colour/utilities/verbose.py
+++ head/colour/utilities/verbose.py
@@ -832,5 +832,5 @@
output = subprocess.check_output(
["git", "describe"], # noqa: S607
- cwd=_soundness_check(colour.__path__[Literal[0]], str),
+ cwd=_soundness_check(colour.__path__[0], str),
stderr=subprocess.STDOUT,
).strip()colour — utilities/generate_plots.py--- base/utilities/generate_plots.py
+++ head/utilities/generate_plots.py
@@ -497,5 +497,5 @@
arguments["filename"] = os.path.join(output_directory, "Plotting_Plot_Image.png")
path = os.path.join(
- _soundness_check(colour.__path__[Literal[0]], str),
+ _soundness_check(colour.__path__[0], str),
"examples",
"plotting",comtypes — comtypes/client/_code_cache.py--- base/comtypes/client/_code_cache.py
+++ head/comtypes/client/_code_cache.py
@@ -5,5 +5,4 @@
be written to.
"""
-lazy from typing import Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -115,5 +114,5 @@
logger.info("Could not import comtypes.gen, trying to create it.")
try:
- comtypes_path = _soundness_check(os.path.abspath(os.path.join(_soundness_check(comtypes.__path__[Literal[0]], str), "gen")), str)
+ comtypes_path = _soundness_check(os.path.abspath(os.path.join(_soundness_check(comtypes.__path__[0], str), "gen")), str)
if not os.path.isdir(comtypes_path):
os.mkdir(comtypes_path)comtypes — comtypes/client/_generate.py--- base/comtypes/client/_generate.py
+++ head/comtypes/client/_generate.py
@@ -1,3 +1,3 @@
-lazy from typing import Any, Literal
+lazy from typing import Any
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -212,5 +212,5 @@
mod = types.ModuleType(modulename)
- abs_gen_path = _soundness_check(os.path.abspath(_soundness_check(g.__path__[Literal[0]], str)), str) # type: ignore
+ abs_gen_path = _soundness_check(os.path.abspath(_soundness_check(g.__path__[0], str)), str) # type: ignore
mod.__file__ = os.path.join(abs_gen_path, "<memory>")
exec(code, mod.__dict__)
@@ -306,3 +306,3 @@
if __name__ == "__main__":
# When started as script, generate typelib wrapper from .tlb file.
- GetModule(_soundness_check(sys.argv[Literal[1]], str))
+ GetModule(_soundness_check(sys.argv[1], str))comtypes — comtypes/server/register.py--- base/comtypes/server/register.py
+++ head/comtypes/server/register.py
@@ -36,5 +36,4 @@
python mycomobj.py /nodebug
"""
-lazy from typing import Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -339,5 +338,5 @@
modname = cls.__module__
if modname == "__main__":
- modname = _soundness_check(_soundness_check(os.path.splitext(_soundness_check(os.path.basename(_soundness_check(sys.argv[Literal[0]], str)), str)), tuple)[0], str)
+ modname = _soundness_check(_soundness_check(os.path.splitext(_soundness_check(os.path.basename(_soundness_check(sys.argv[0], str)), str)), tuple)[0], str)
return f"{modname}.{cls.__name__}"
@@ -450,5 +449,5 @@
def UseCommandLine(*classes: type) -> int:
- usage = f"""Usage: {_soundness_check(sys.argv[Literal[0]], str)} [-regserver] [-unregserver] [-nodebug] [-f logformat] [-l loggername=level]"""
+ usage = f"""Usage: {_soundness_check(sys.argv[0], str)} [-regserver] [-unregserver] [-nodebug] [-f logformat] [-l loggername=level]"""
opts, args = w_getopt(_soundness_check(sys.argv[1:], list), "regserver unregserver embedding l: f: nodebug")
if not opts:cryptography — _cffi_src/utils.py--- base/_cffi_src/utils.py
+++ head/_cffi_src/utils.py
@@ -50,5 +50,5 @@
for name in _soundness_iter(modules, str):
__import__(module_prefix + name)
- module = sys.modules[str]
+ module = sys.modules[module_prefix + name]
types.append(module.TYPES)cwltool — cwltool/argparser.py--- base/cwltool/argparser.py
+++ head/cwltool/argparser.py
@@ -1,4 +1,4 @@
"""Command line argument parsing for cwltool."""
-lazy from typing import Any, Callable, Literal, LiteralString
+lazy from typing import Any, Callable, LiteralString
_MISSING = object()
def _soundness_check(_v, _t):
@@ -107,5 +107,5 @@
# downstream tools that reuse this parser (e.g. Calrissian) keep their
# own program name.
- prog="cwltool" if _soundness_check(os.path.basename(_soundness_check(sys.argv[Literal[0]], str)), str) == "cwl-runner" else None,
+ prog="cwltool" if _soundness_check(os.path.basename(_soundness_check(sys.argv[0], str)), str) == "cwl-runner" else None,
formatter_class=RichHelpFormatter,
description="Reference executor for Common Workflow Language standards. "cwltool — cwltool/main.py--- base/cwltool/main.py
+++ head/cwltool/main.py
@@ -2,5 +2,5 @@
# PYTHON_ARGCOMPLETE_OK
"""Entry point for cwltool."""
-lazy from typing import Callable, Literal
+lazy from typing import Callable
_MISSING = object()
def _by_type_param_defaults(args):
@@ -888,5 +888,5 @@
if argsl is not None:
# Log cwltool command line options to provenance file
- _logger.info("[cwltool] %s %s", _soundness_check(sys.argv[Literal[0]], str), " ".join(argsl))
+ _logger.info("[cwltool] %s %s", _soundness_check(sys.argv[0], str), " ".join(argsl))
_logger.debug("[cwltool] Arguments: %s", args)
return log_file_io, prov_log_handler
@@ -1166,5 +1166,5 @@
user_agent = "cwltool"
- if user_agent not in (progname := _soundness_check(os.path.basename(_soundness_check(sys.argv[Literal[0]], str)), str)):
+ if user_agent not in (progname := _soundness_check(os.path.basename(_soundness_check(sys.argv[0], str)), str)):
user_agent += f" {progname}" # append the real program name as well
append_word_to_default_user_agent(user_agent)cwltool — cwltool/utils.py--- base/cwltool/utils.py
+++ head/cwltool/utils.py
@@ -119,6 +119,6 @@
"""Version of CWLtool used to execute the workflow."""
if pkg := importlib.metadata.version("cwltool"):
- return f"{_soundness_check(sys.argv[Literal[0]], str)} {pkg}"
- return "{} {}".format(_soundness_check(sys.argv[Literal[0]], str), "unknown version")
+ return f"{_soundness_check(sys.argv[0], str)} {pkg}"
+ return "{} {}".format(_soundness_check(sys.argv[0], str), "unknown version")cwltool — setup.py--- base/setup.py
+++ head/setup.py
@@ -72,5 +72,5 @@
USE_MYPYC = False
# To compile with mypyc, a mypyc checkout must be present on the PYTHONPATH
-if len(sys.argv) > 1 and _soundness_check(sys.argv[Literal[1]], str) == "--use-mypyc":
+if len(sys.argv) > 1 and _soundness_check(sys.argv[1], str) == "--use-mypyc":
_soundness_check(sys.argv.pop(1), str)
USE_MYPYC = Truecwltool — tests/wf/updateval.py--- base/tests/wf/updateval.py
+++ head/tests/wf/updateval.py
@@ -1,3 +1,2 @@
-lazy from typing import Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -10,5 +9,5 @@
lazy import sys
-f = open(_soundness_check(sys.argv[Literal[1]], str), "r+")
+f = open(_soundness_check(sys.argv[1], str), "r+")
val = int(_soundness_check(f.read(), str))
_soundness_check(f.seek(0), int)discord.py — tests/test_app_commands_group.py--- base/tests/test_app_commands_group.py
+++ head/tests/test_app_commands_group.py
@@ -22,5 +22,4 @@
DEALINGS IN THE SOFTWARE.
"""
-lazy from typing import Literal
@@ -47,5 +46,5 @@
my_group = MyGroup()
- assert MyGroup.__discord_app_commands_group_children__[Literal[0]].parent is not my_group
+ assert MyGroup.__discord_app_commands_group_children__[0].parent is not my_group
assert my_group.my_command is not MyGroup.my_command
assert my_group.my_command.parent is my_group
@@ -60,5 +59,5 @@
my_group = MyGroup()
- assert MyGroup.__discord_app_commands_group_children__[Literal[0]].parent is not my_group
+ assert MyGroup.__discord_app_commands_group_children__[0].parent is not my_group
assert MyGroup.sub_group.parent is None
assert MyGroup.my_command.parent is MyGroup.sub_group
@@ -82,6 +81,6 @@
my_group = MyGroup()
- assert MyGroup.__discord_app_commands_group_children__[Literal[0]].parent is not my_group
- assert MySubGroup.__discord_app_commands_group_children__[Literal[0]].parent is not my_group.sub_group
... 4584 characters elided ...
+ assert InnerGroup.__discord_app_commands_group_children__[0].parent is not cog.inner
+ assert InnerGroup.__discord_app_commands_group_children__[0].parent is not cog.inner
assert cog.inner is not MyCog.inner
assert cog.inner.my_command is not InnerGroup.my_commanddragonchain — dragonchain/broadcast_processor/broadcast_functions.py--- base/dragonchain/broadcast_processor/broadcast_functions.py
+++ head/dragonchain/broadcast_processor/broadcast_functions.py
@@ -251,5 +251,5 @@
p.scard(set_key)
verifications = p.execute()[1] # Execute the commands and get the result of the scard operation (number of members in the set)
- required = dragonnet_config.DRAGONNET_CONFIG[str]["nodesRequired"]
+ required = dragonnet_config.DRAGONNET_CONFIG[f"l{level}"]["nodesRequired"]
if HAS_VERIFICATION_NOTIFICATIONS:dragonchain — dragonchain/lib/dao/block_dao.py--- base/dragonchain/lib/dao/block_dao.py
+++ head/dragonchain/lib/dao/block_dao.py
@@ -79,5 +79,5 @@
return l1_block_model.export_broadcast_dto(_soundness_check(l1_block, dict))
else:
- required_verification_count = dragonnet_config.DRAGONNET_CONFIG[str]["nodesRequired"]
+ required_verification_count = dragonnet_config.DRAGONNET_CONFIG[f"l{higher_level - 1}"]["nodesRequired"]
verification_blocks = get_verifications_for_l1_block(block_id, (higher_level - 1))
if len(verification_blocks) < required_verification_count:dulwich — contrib/release_robot.py--- base/contrib/release_robot.py
+++ head/contrib/release_robot.py
@@ -45,5 +45,4 @@
"""
-lazy from typing import Literal
_MISSING = object()
def _soundness_check(_v, _t):
@@ -179,5 +178,5 @@
if __name__ == "__main__":
if len(sys.argv) > 1:
- _PROJDIR = _soundness_check(sys.argv[Literal[1]], str)
+ _PROJDIR = _soundness_check(sys.argv[1], str)
else:
_PROJDIR = PROJDIRdulwich — contrib/test_release_robot.py--- base/contrib/test_release_robot.py
+++ head/contrib/test_release_robot.py
@@ -20,5 +20,4 @@
"""Tests for release_robot."""
-lazy from typing import Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -126,16 +125,16 @@
# commit 1 ('2017-01-19T01:06:43')
cls.c1 = make_commit(
- commit_time=_soundness_check(cls.tag_test_data[_soundness_check(cls.test_tags[Literal[0]], bytes)], list)[0],
+ commit_time=_soundness_check(cls.tag_test_data[_soundness_check(cls.test_tags[0], bytes)], list)[0],
message=b"unannotated tag",
author=cls.committer,
)
obj_store.add_object(cls.c1)
- _soundness_check(cls.tag_test_data[_soundness_check(cls.test_tags[Literal[0]], bytes)], list)[1] = cls.c1.id
+ _soundness_check(cls.tag_test_data[_soundness_check(cls.test_tags[0], bytes)], list)[1] = cls.c1.id
# tag 1: unannotated
- cls.t1 = _soundness_check(cls.test_tags[Literal[0]], bytes)
- cls.repo[bytes] = cls.c1.id # add unannotated tag
... 1389 characters elided ...
tag_time=tag_data[0],
)
obj_store.add_object(cls.t2)
tag_data[1] = cls.t2.id
- cls.repo[Literal[b"refs/heads/master"]] = cls.c2.id
+ cls.repo[b"refs/heads/master"] = cls.c2.id
cls.repo[b"refs/tags/" + cls.t2.name] = cls.t2.id # add annotated tagdulwich — examples/filter_branch.py--- base/examples/filter_branch.py
+++ head/examples/filter_branch.py
@@ -10,5 +10,4 @@
lower-level filter_branch module API.
"""
-lazy from typing import Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -130,6 +129,6 @@
sys.exit(1)
- repo_path = _soundness_check(sys.argv[Literal[1]], str)
- example = _soundness_check(sys.argv[Literal[2]], str) if len(sys.argv) > 2 else "change_author"
+ repo_path = _soundness_check(sys.argv[1], str)
+ example = _soundness_check(sys.argv[2], str) if len(sys.argv) > 2 else "change_author"
examples = {dulwich — examples/latest_change.py--- base/examples/latest_change.py
+++ head/examples/latest_change.py
@@ -1,3 +1,2 @@
-lazy from typing import Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -19,10 +18,10 @@
if len(sys.argv) < 2:
- print(f"usage: {_soundness_check(sys.argv[Literal[0]], str)} filename")
+ print(f"usage: {_soundness_check(sys.argv[0], str)} filename")
sys.exit(1)
r = Repo(".")
-path = _soundness_check(sys.argv[Literal[1]], str).encode("utf-8")
+path = _soundness_check(sys.argv[1], str).encode("utf-8")
w = r.get_walker(paths=[path], max_entries=1)
@@ -30,7 +29,7 @@
c = _soundness_check(next(iter(w)), str).commit
except StopIteration:
- print(f"No file {_soundness_check(sys.argv[Literal[1]], str)} anywhere in history.")
+ print(f"No file {_soundness_check(sys.argv[1], str)} anywhere in history.")
else:
print(
- f"{_soundness_check(sys.argv[Literal[1]], str)} was last changed by {c.author} at {time.ctime(c.author_time)} (commit {c.id})"
+ f"{_soundness_check(sys.argv[1], str)} was last changed by {c.author} at {time.ctime(c.author_time)} (commit {c.id})"
)dulwich — examples/memoryrepo.py--- base/examples/memoryrepo.py
+++ head/examples/memoryrepo.py
@@ -1,3 +1,2 @@
-lazy from typing import Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -27,5 +26,5 @@
local_repo.refs.set_symbolic_ref(b"HEAD", b"refs/heads/master")
-fetch_result = porcelain.fetch(local_repo, _soundness_check(sys.argv[Literal[1]], str))
+fetch_result = porcelain.fetch(local_repo, _soundness_check(sys.argv[1], str))
local_repo.refs[b"refs/heads/master"] = fetch_result.refs[b"refs/heads/master"]
print(local_repo.refs.as_dict())
@@ -41,3 +40,3 @@
)
-porcelain.push(local_repo, _soundness_check(sys.argv[Literal[1]], str), "master")
+porcelain.push(local_repo, _soundness_check(sys.argv[1], str), "master")dulwich — tests/test_web.py--- base/tests/test_web.py
+++ head/tests/test_web.py
@@ -760,5 +760,5 @@
self._environ["wsgi.input"] = zstream
self._app(self._environ, None)
- buf = self._environ["wsgi.input"]
+ buf = _soundness_check(self._environ["wsgi.input"], str)
self.assertIsNot(buf, zstream)
buf.seek(0)flake8-pyi — tests/sysversioninfo.py--- base/tests/sysversioninfo.py
+++ head/tests/sysversioninfo.py
@@ -1,12 +1,11 @@
-lazy from typing import Literal
lazy import sys
-if sys.version_info[Literal[0]] == 2: ...
-if sys.version_info[Literal[0]] == True: ... # Y003 Unrecognized sys.version_info check # E712 comparison to True should be 'if cond is True:' or 'if cond:'
+if sys.version_info[0] == 2: ...
+if sys.version_info[0] == True: ... # Y003 Unrecognized sys.version_info check # E712 comparison to True should be 'if cond is True:' or 'if cond:'
if sys.version_info[0.0] == 2: ... # Y003 Unrecognized sys.version_info check
-if sys.version_info[Literal[False]] == 2: ... # Y003 Unrecognized sys.version_info check
+if sys.version_info[False] == 2: ... # Y003 Unrecognized sys.version_info check
if sys.version_info[0j] == 2: ... # Y003 Unrecognized sys.version_info check
-if sys.version_info[Literal[0]] == (2, 7): ... # Y003 Unrecognized sys.version_info check
-if sys.version_info[Literal[0]] == '2': ... # Y003 Unrecognized sys.version_info check
+if sys.version_info[0] == (2, 7): ... # Y003 Unrecognized sys.version_info check
+if sys.version_info[0] == '2': ... # Y003 Unrecognized sys.version_info check
if sys.version_info[1:] >= (7, 11): ... # Y003 Unrecognized sys.version_info check
if sys.version_info[::-1] < (11, 7): ... # Y003 Unrecognized sys.version_info checkgit-revise — tests/dummy_editor.py--- base/tests/dummy_editor.py
+++ head/tests/dummy_editor.py
@@ -1,3 +1,2 @@
-lazy from typing import Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -23,3 +22,3 @@
if __name__ == "__main__":
- run_editor(url=_soundness_check(sys.argv[Literal[1]], str), path=_soundness_check(Path(_soundness_check(sys.argv[Literal[2]], str)).resolve(), Path))
+ run_editor(url=_soundness_check(sys.argv[1], str), path=_soundness_check(Path(_soundness_check(sys.argv[2], str)).resolve(), Path))graphql-core — graphql/pyutils/description.py--- base/graphql/pyutils/description.py
+++ head/graphql/pyutils/description.py
@@ -1,4 +1,4 @@
"""Human-readable descriptions"""
-lazy from typing import Any, Literal
+lazy from typing import Any
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -68,5 +68,5 @@
cls.bases = object
elif len(cls.bases) == 1:
- cls.bases = cls.bases[Literal[0]]
+ cls.bases = cls.bases[0]
elif cls.bases is base:
cls.bases = objecthydpy — hydpy/auxs/smoothtools.py--- base/hydpy/auxs/smoothtools.py
+++ head/hydpy/auxs/smoothtools.py
@@ -288,5 +288,5 @@
# Load the supporting points required for method `calc_smoothpar_logistic2`:
-confpath = _soundness_check(conf.__path__[Literal[0]], str)
+confpath = _soundness_check(conf.__path__[0], str)
xys = numpy.load(os.path.join(confpath, "support_points_for_smoothpar_logistic2.npy"))
_interpolator_for_smoothpar_logistic2: Callable[[ArrayFloatFlex], ArrayFloatFlex] = (hydpy — hydpy/core/aliastools.py--- base/hydpy/core/aliastools.py
+++ head/hydpy/core/aliastools.py
@@ -167,5 +167,5 @@
("senders", sequencetools.SenderSequence, (0, 1)),
)
- modelpath: str = _soundness_check(models.__path__[Literal[0]], str)
+ modelpath: str = _soundness_check(models.__path__[0], str)
sequence2alias: dict[sequencetools.InOutSequenceTypes, str] = {}
for moduleinfo in pkgutil.iter_modules([modelpath]):
@@ -217,5 +217,5 @@
text = "\n".join(lines)
text = black.format_str(text, mode=black.FileMode())
- filepath = os.path.join(_soundness_check(hydpy.__path__[Literal[0]], str), "aliases.py")
+ filepath = os.path.join(_soundness_check(hydpy.__path__[0], str), "aliases.py")
with open(filepath, "w", encoding=config.ENCODING) as file_:
_soundness_check(file_.write(text), int)hydpy — hydpy/core/modeltools.py--- base/hydpy/core/modeltools.py
+++ head/hydpy/core/modeltools.py
@@ -3597,5 +3597,5 @@
self.dt_decrease = 10.0
path = os.path.join(
- _soundness_check(conf.__path__[Literal[0]], str), "a_coefficients_explicit_lobatto_sequence.npy"
+ _soundness_check(conf.__path__[0], str), "a_coefficients_explicit_lobatto_sequence.npy"
)
self.a_coefs = numpy.load(path)hydpy — hydpy/core/testtools.py--- base/hydpy/core/testtools.py
+++ head/hydpy/core/testtools.py
@@ -988,5 +988,5 @@
)
- docspath = _soundness_check(docs.__path__[Literal[0]], str)
+ docspath = _soundness_check(docs.__path__[0], str)
fig.write_html(
os.path.join(docspath, "html_", filename), include_plotlyjs="directory"
@@ -1347,5 +1347,5 @@
assert (path := os.getcwd()) is not None
self._path = path
- iotestingpath: str = _soundness_check(iotesting.__path__[Literal[0]], str)
+ iotestingpath: str = _soundness_check(iotesting.__path__[0], str)
os.chdir(os.path.join(iotestingpath))
if self._clear_own:
@@ -2152,5 +2152,5 @@
When passing no figure, function |save_autofig| takes the currently active one.
"""
- filepath = f"{_soundness_check(autofigs.__path__[Literal[0]], str)}/{filename}"
+ filepath = f"{_soundness_check(autofigs.__path__[0], str)}/{filename}"
if figure:
figure.savefig(filepath)
@@ -2490,6 +2490,6 @@
if dirpath is None:
TestIO.clear()
- dirpath = _soundness_check(iotesting.__path__[Literal[0]], str)
- datapath: str = _soundness_check(data.__path__[Literal[0]], str)
+ dirpath = _soundness_check(iotesting.__path__[0], str)
+ datapath: str = _soundness_check(data.__path__[0], str)
_soundness_check(shutil.copytree(
os.path.join(datapath, "HydPy-H-Lahn"), os.path.join(dirpath, "HydPy-H-Lahn")hydpy — hydpy/cythons/__init__.py--- base/hydpy/cythons/__init__.py
+++ head/hydpy/cythons/__init__.py
@@ -1,5 +1,4 @@
"""This subpackage provides tools for cythonizing hydrological models as
well as the resulting Cython extension files (in subpackage `autogen`)."""
-lazy from typing import Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -21,5 +20,5 @@
lazy from hydpy.cythons import autogen
-autogenpath: str = _soundness_check(autogen.__path__[Literal[0]], str)
+autogenpath: str = _soundness_check(autogen.__path__[0], str)
modulenames = _soundness_check(sorted(
str(_soundness_check(fn.split(".")[0], str))
@@ -31,4 +30,4 @@
if not modulename.startswith("callback_"):
module = importlib.import_module(f"hydpy.cythons.autogen.{modulename}")
- sys.modules[str] = module
+ sys.modules[f"hydpy.cythons.{modulename}"] = module
locals()[modulename] = modulehydpy — hydpy/docs/prepare.py--- base/hydpy/docs/prepare.py
+++ head/hydpy/docs/prepare.py
@@ -56,5 +56,5 @@
# Prepare folder `auto`.
-docspath: str = _soundness_check(docs.__path__[Literal[0]], str)
+docspath: str = _soundness_check(docs.__path__[0], str)
AUTOPATH = os.path.join(docspath, "auto")
if os.path.exists(AUTOPATH):
@@ -65,5 +65,5 @@
# Import all base and application models, to make sure all substituters are up-to-date.
# (I am not sure if this is really necessary but it does not hurt.)
-modelspath: str = _soundness_check(models.__path__[Literal[0]], str)
+modelspath: str = _soundness_check(models.__path__[0], str)
for filename in _soundness_iter(_soundness_check(sorted(os.listdir(modelspath)), list), str):
if not filename.startswith("_"):
@@ -181,5 +181,5 @@
# copy _themes path from sphinx subpackage into folder `auto`
# _themes folder contains the modified sphinx html themes
-themespath = os.path.join(_soundness_check(sphinx.__path__[Literal[0]], str), "_themes")
+themespath = os.path.join(_soundness_check(sphinx.__path__[0], str), "_themes")
themespathdest = os.path.join(AUTOPATH, "_themes")
... 357 characters elided ...
@@ -208,5 +208,5 @@
mark2 = "Click :download:"
-datadirpath = _soundness_check(data.__path__[Literal[0]], str)
+datadirpath = _soundness_check(data.__path__[0], str)
for projectname in _soundness_iter(os.listdir(datadirpath), str):
projectpath = os.path.join(datadirpath, projectname)hydpy — hydpy/docs/sphinx/projectstructure_extension.py--- base/hydpy/docs/sphinx/projectstructure_extension.py
+++ head/hydpy/docs/sphinx/projectstructure_extension.py
@@ -1,5 +1,5 @@
"""Sphinx extension introducing `.. project_structure:: (e.g.) HydPy-H-Lahn`
directives."""
-lazy from typing import Any, Literal
+lazy from typing import Any
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -48,5 +48,5 @@
projectstructure = autodoctools.ProjectStructure(
- projectpath=os.path.join(_soundness_check(data.__path__[Literal[0]], str), node.projectname),
+ projectpath=os.path.join(_soundness_check(data.__path__[0], str), node.projectname),
branch=_soundness_check(os.environ.get("TRAVIS_BRANCH", "master"), str),
)hydpy — hydpy/exe/servertools.py--- base/hydpy/exe/servertools.py
+++ head/hydpy/exe/servertools.py
@@ -2282,5 +2282,5 @@
expected.
"""
- confpath: str = _soundness_check(conf.__path__[Literal[0]], str)
+ confpath: str = _soundness_check(conf.__path__[0], str)
filepath = os.path.join(confpath, "mimetypes.txt")
try:hydpy — hydpy/exe/xmltools.py--- base/hydpy/exe/xmltools.py
+++ head/hydpy/exe/xmltools.py
@@ -559,5 +559,5 @@
f"({objecttools.enumeration(filenames)})."
)
- confpath: str = _soundness_check(conf.__path__[Literal[0]], str)
+ confpath: str = _soundness_check(conf.__path__[0], str)
schemapath = os.path.join(confpath, schemafile)
schema = xmlschema.XMLSchema(schemapath)
@@ -2412,5 +2412,5 @@
"""
- confpath: str = _soundness_check(conf.__path__[Literal[0]], str)
+ confpath: str = _soundness_check(conf.__path__[0], str)
filepath_source: str = os.path.join(confpath, "HydPyConfigBase" + ".xsdt")
filepath_target: str = filepath_source[:-1]
@@ -2464,5 +2464,5 @@
['arma', 'conv', ..., 'wland', 'wq']
"""
- modelspath: str = _soundness_check(models.__path__[Literal[0]], str)
+ modelspath: str = _soundness_check(models.__path__[0], str)
def _is_basemodel(dirname: str) -> bool:
@@ -2480,5 +2480,5 @@
[...'dam_v001', 'dam_v002', 'dam_v003', 'dam_v004', 'dam_v005',...]
"""
- modelspath: str = _soundness_check(models.__path__[Literal[0]], str)
+ modelspath: str = _soundness_check(models.__path__[0], str)
return _soundness_check(sorted(
str(_soundness_check(fn.split(".")[0], str))hydpy — hydpy/models/meteo/meteo_model.py(only produced on head)hydpy — hydpy/tests/check_consistency.py--- base/hydpy/tests/check_consistency.py
+++ head/hydpy/tests/check_consistency.py
@@ -1,4 +1,3 @@
"""Perform all available consistency checks."""
-lazy from typing import Literal
def _soundness_check(_v, _t):
if not isinstance(_v, _t):
@@ -21,5 +20,5 @@
print("Perform all available consistency checks:\n")
-dirpath: str = _soundness_check(models.__path__[Literal[0]], str)
+dirpath: str = _soundness_check(models.__path__[0], str)
applicationmodels = _soundness_check(sorted(
_soundness_check(fn.split(".")[0], str)✅ improvements (failed on base, now builds)
468 finding(s) omitted to fit GitHub's 65536-character comment limit. The full report is the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.