10000 configparser.SectionProxy.get* methods aren't correctly typed · Issue #1543 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content
configparser.SectionProxy.get* methods aren't correctly typed #1543
Closed
@OddBloke

Description

@OddBloke

On instantiation, configparser.SectionProxy takes as an argument the parser that it's a section of and uses setattr to populate itself with partially applied converters (i.e. methods that start with get) that the parser it is passed has.

Currently, this is stubbed as:

class SectionProxy(MutableMapping[str, str]):
    def __init__(self, parser: RawConfigParser, name: str) -> None: ...

    <snip>

    # SectionProxy can have arbitrary attributes when custon converters are used
    def __getattr__(self, key: str) -> Callable[..., Any]: ...

which means that ConfigParser()['section'].getboolean('key') type checks as Any, whereas it should in fact be bool.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    2EE2 Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0