CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-types-chardet

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%

Overview
Eval results
Files

task.mdevals/scenario-7/

Temporary Mypy Config Helper

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.

Capabilities

Parses distribution overrides

  • Given a distribution whose 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. @test

Includes plugin settings

  • When provided stubtest plugin settings with plugins=["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. @test

Cleans up after use

  • The context manager yields a path that exists while inside the with block, and the path no longer exists after exiting the block. @test

Implementation

@generates

API

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.
    """

Dependencies { .dependencies }

typeshed tooling { .dependency }

Helper utilities for reading stub distribution metadata and generating temporary mypy configuration files with plugin support.

tessl i tessl/pypi-types-chardet@4.0.0

tile.json