Public viewer

The journey of every round

Every round-trip in the corpus is public. Open one to see the prompt, the zero-point index, the baseline response, the enhanced response, and how each grader read the difference. Leave a comment if a grader's reading lands — or doesn't.

#114522 May 26

Author a pytest test module that verifies a class whose attribute lookup runs through __getattr__ for missing names. Use a @pytest.fixture to construct the instance under test and a second fixture with scope="module" for shared setup. Inside one test, use the monkeypatch fixture to replace os.environ entries for the duration of the test; inside another test, use unittest.mock.patch as a context manager to swap a method implementation. Assert behaviour with pytest.raises against a custom exception class and confirm the descriptor protocol still routes correctly through __get__ on a property.

V1BetterV2ΔLpython
#114422 May 26

Define a Python decorator factory called trace_calls that returns a wrapper preserving the original function via functools.wraps so the __name__ and __doc__ attributes survive. The wrapper should log every call with logging.getLogger before delegating. Stack this decorator above functools.lru_cache with maxsize=128 on a recursive Fibonacci function and confirm the cache hit path still produces the trace entry. Separately, register a functools.singledispatch generic that formats int, list, and dict arguments differently, and decorate each registered overload with trace_calls. Use typing.Callable for the parameter annotation.

V1BetterV2ΔLpython
#114322 May 26

Write an async function fetch_all that takes a list of URLs and concurrently fetches each one using async def coroutines and the await expression. Bound parallelism with asyncio.Semaphore set to 5 concurrent tasks. Schedule the work via asyncio.gather and collect results as a list of tuples (url, status, body). Use asyncio.wait_for to apply a per-request timeout that raises asyncio.TimeoutError on deadline. Launch the top-level coroutine with asyncio.run inside the main guard. Annotate the return type with typing.List and typing.Tuple.

V1BetterV2ΔLpython
#114222 May 26

Implement an iterator class RingBuffer that exposes the __iter__ and __next__ methods to walk a fixed-capacity circular buffer of integers. Store the underlying state as a @dataclass with frozen=True for the capacity field and a separate mutable list for the contents. Expose __len__ for the len builtin and __contains__ for the in operator. Raise StopIteration when iteration completes one full lap. Add type hints using typing.Iterator and typing.Optional. The class should behave correctly under isinstance checks against collections.abc.Iterator.

V1BetterV2ΔLpython
#114122 May 26

Write a Python script that uses pathlib.Path to walk a directory tree, calls path.glob on the pattern "*.log" recursively, reads each file with path.read_text, and extracts HTTP status codes using re.compile and re.finditer with a named capture group. Aggregate the counts into a dict keyed by status code, then emit the result via json.dumps with indent=2 to stdout. Guard the script body with an if __name__ == "__main__": block so the helper functions remain importable from other modules. Raise a clear exception if no log files match.

V1BetterV2ΔLpython