Type stubs for chardet - Universal encoding detector for Python
Agent Success
Agent success rate when using this tile
65%
Improvement
Agent success rate improvement when using this tile compared to baseline
0.97x
Baseline
Agent success rate without this tile
67%
Build a context-managed helper that produces a temporary mypy configuration file by combining distribution-specific mypy overrides with optional plugin configuration, then cleans up automatically.
METADATA.toml includes two [mypy-tests.<section>] entries (module_name "yaml" with disallow_untyped_defs = true and module "yaml.csafe" with allow_untyped_calls = false), entering the context yields a file path whose contents include [mypy-yaml] and [mypy-yaml.csafe] sections with matching key/value lines before a trailing [mypy] header. @testplugins=["stubtest.plugin","extra.hooks"] and plugin_options={"stubtest.plugin":{"setting":"enabled"},"extra.hooks":{"flags":"strict"}}, the [mypy] section contains plugins = stubtest.plugin.extra.hooks and the file adds [mypy.plugins.stubtest.plugin] and [mypy.plugins.extra.hooks] sections with the provided key/value pairs. @testwith block, and the path no longer exists after exiting the block. @test@generates
from contextlib import AbstractContextManager
from pathlib import Path
from typing import Mapping, TypedDict
class StubtestPluginSettings(TypedDict, total=False):
plugins: list[str]
plugin_options: Mapping[str, Mapping[str, object]]
def temporary_mypy_config_for_distribution(
distribution: str,
stubtest_settings: StubtestPluginSettings | None = None,
) -> AbstractContextManager[Path]:
"""
Creates a temporary mypy configuration file for the given stub distribution.
- Reads any per-module mypy overrides declared for the distribution and writes [mypy-<module>] sections with key/value pairs.
- Always writes a [mypy] section; if plugin data is present, add a plugins line using the plugin module paths joined by dots.
- When plugin_options are provided, add [mypy.plugins.<plugin>] subsections with key/value pairs.
- The temporary file is cleaned up automatically when the context manager exits, and the yielded path points to the file on disk.
"""Helper utilities for reading stub distribution metadata and generating temporary mypy configuration files with plugin support.
tessl i tessl/pypi-types-chardet@4.0.0docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9