Selected changesmerged Oct 1, 2026
ENH: respect display.precision for complex and float Interval values (GH#25920)Python · 123 + / 28 −
Introduces 5 new declarations in pandas/io/formats/format.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
pandas/io/formats/format.py ↗ · 7 files
@@ -1569,6 +1577,84 @@ def _format_strings(self) -> list[str]: return fmt_values +def _format_complex(value: complex, float_format: FloatFormatType | None) -> str:+ """+ Format a complex scalar from an object-dtype array.++ ``float_format`` is applied to each part separately so that formats+ written for floats also work here.+ """+ if float_format is None:+ return printing.format_with_precision(value)+ if isinstance(float_format, str):+ # "%"-style strings reach here unconverted+ fmt_str = float_format+ float_format = lambda part: fmt_str % part+ real = str(float_format(value.real)).strip()+ imag = str(float_format(value.imag)).strip()+ if not imag.startswith("-"):+ imag = f"+{imag}"+ return f"({real}{imag}j)"+++def _maybe_format_float_intervals(+ values: ArrayLike,+ formatter: Callable | None,+ float_format: FloatFormatType | None,+ decimal: str,+) -> ArrayLike:+ """+ Pre-format float-endpoint Interval column values (GH#25920).++ Only column values go through here; index labels and Categorical
[CB] Make CB more device agnostic and add support for XPUPython · 172 + / 62 −
Introduces 10 new declarations in src/transformers/generation/continuous_batching/utils.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
src/transformers/generation/continuous_batching/utils.py ↗ · 7 files
@@ -251,3 +242,107 @@ def exact_div(a: int, b: int) -> int: if remainder: raise ValueError(f"Division of {a} by {b} is not exact: {remainder = } != 0") return quotient+++# ---------------------------------------------- DEVICE AGNOSTIC UTILS ----------------------------------------------- #+++def get_available_accelerator_module() -> Any | None:+ """Returns the accelerator module if there is one and it is available, None otherwise."""+ device_module = torch.get_device_module() # the device is never specified, so that we always get the same module+ if device_module.__name__.endswith("cpu") or not device_module.is_available():+ return None+ return device_module+++def create_device_stream(device: torch.device) -> torch.cuda.Stream | None:+ """If the given device is available and supports streams, returns a new stream. Otherwise, returns None."""+ device_module = torch.get_device_module()+ if device_module.is_available() and hasattr(device_module, "Stream"):+ return device_module.Stream(device=device)+ return None+++def stream_context(stream: torch.cuda.Stream | None) -> torch.cuda.StreamContext:+ """If the stream is not None, returns a context manager to use the stream. Otherwise, returns a null context.+ This function assumes that the current device supports streams."""+ if stream is None:+ return nullcontext()+ return torch.get_device_module().stream(stream)+++def get_accelerator_graph_name() -> str | None:
test_runner: do not crash on stdout that mimics a v8 frameJavaScript · 65 + / 39 −
Introduces 2 new declarations in lib/internal/test_runner/runner.js.
Adds new runtime rather than adjusting what was there. Tests changed with it, with code of their own.
lib/internal/test_runner/runner.js ↗ · 2 files
@@ -465,59 +463,87 @@ class FileTest extends Test { } } #processRawBuffer() {- // This method is called when it is known that there is at least one message- let bufferHead = this.#rawBuffer[0];- let headerIndex = bufferHead.indexOf(v8Header);- let nonSerialized = new FastBuffer();-- while (bufferHead && headerIndex !== 0) {- const nonSerializedData = headerIndex === -1 ?- bufferHead :- bufferHead.slice(0, headerIndex);- nonSerialized = Buffer.concat([nonSerialized, nonSerializedData]);- this.#rawBufferSize -= TypedArrayPrototypeGetLength(nonSerializedData);- if (headerIndex === -1) {- ArrayPrototypeShift(this.#rawBuffer);- } else {- this.#rawBuffer[0] = TypedArrayPrototypeSubarray(bufferHead, headerIndex);+ // This method is called when it is known that there is at least one message.+ // Each pass looks at the head of the buffer and handles exactly one of four+ // cases, then re-checks the new head. Recovery from stray stdout that only+ // mimics a frame happens inline here, so no separate resync pass is needed.+ while (this.#rawBuffer.length > 0) {+ const bufferHead = this.#rawBuffer[0];+ const headerIndex = bufferHead.indexOf(v8Header);++ // 1. The head does not start with a frame header. Emit the bytes before+ // the next header, or the whole head when there is none, as stdout and+ // advance to the next header.+ if (headerIndex !== 0) {+ const nonSerialized = headerIndex === -1 ?+ bufferHead : TypedArrayPrototypeSubarray(bufferHead, 0, headerIndex);+ this.addToReport({
Streaming moving averagePython · 91 + / 0 −
Introduces 4 new declarations in financial/streaming_moving_average.py.
Adds new core implementation rather than adjusting what was there. Read the linked PR for the surrounding test context.
financial/streaming_moving_average.py ↗ · 2 files
@@ -0,0 +1,91 @@+"""This module contains a class that+calculates the moving average in real-time.++Reference+---------+https://en.wikipedia.org/wiki/Moving_average+"""++from collections import deque+++class StreamingMovingAverage:+ """Streaming Moving Average calculator that updates+ the average in real-time.++ Attributes+ ----------+ window_size : int+ The size of the moving average window.++ Methods+ -------+ update(new_value: float) -> None+ Update the moving average with a new data point.+ mov_avg() -> float+ Return the current moving average value.++ Raises+ ------+ ValueError+ If the window size is less than 1.++
Validate watch listGo · 239 + / 39 −
Introduces 9 new declarations in staging/src/k8s.io/apiserver/pkg/storage/testing/correctness/watch.go.
Adds new systems design rather than adjusting what was there. Tests changed with it, with code of their own.
staging/src/k8s.io/apiserver/pkg/storage/testing/correctness/watch.go ↗ · 8 files
@@ -88,12 +110,55 @@ func (v WatchValidator) checkWatch(request WatchRequest) error { if opts.RecordTimestamps { panic("recordTimestamps is not supported, it wraps objects in storage-internal types") }- if opts.SendInitialEvents != nil && *opts.SendInitialEvents {- panic("initial events are not supported, set sendInitialEvents=false for resourceVersion \"\" or \"0\"")+ if opts.SendInitialEvents == nil && (opts.ResourceVersion == "" || opts.ResourceVersion == "0") {+ panic("legacy initial events are not supported by correctness testing")+ }+ if opts.SendInitialEvents != nil && *opts.SendInitialEvents && !opts.Predicate.AllowWatchBookmarks {+ panic("initial events without bookmarks are not supported, set allowWatchBookmarks=true") } return nil } +func (v WatchValidator) validateInitialEvents(request WatchRequest, initialEvents []watch.Event, bookmarkRV uint64) error {+ if request.Options.ResourceVersion != "" && request.Options.ResourceVersion != "0" {+ requestedRV, err := v.versioner.ParseResourceVersion(request.Options.ResourceVersion)+ if err != nil {+ return err+ }+ if bookmarkRV < requestedRV {+ return fmt.Errorf("bookmark revision %d is older than requested revision %d", bookmarkRV, requestedRV)+ }+ }+ expected, err := v.replay.InitialEvents(request, bookmarkRV)+ if err != nil {+ return err+ }+ if err := v.compareEvents(expected, initialEvents); err != nil {+ return fmt.Errorf("at revision %d: %w", bookmarkRV, err)+ }+ return nil+}