Skip to content

fix: relax Client constructor cfg typing#138

Open
anzzyspeaksgit wants to merge 1 commit intopeeringdb:masterfrom
anzzyspeaksgit:fix/issue-134
Open

fix: relax Client constructor cfg typing#138
anzzyspeaksgit wants to merge 1 commit intopeeringdb:masterfrom
anzzyspeaksgit:fix/issue-134

Conversation

@anzzyspeaksgit
Copy link

Closes #134

Description

This addresses the issue with the overly strict type annotation on the Client constructor's cfg parameter. Since dict is invariant, mypy correctly rejects valid nested configurations passed as dictionaries (e.g. dict[str, dict[str, object]]).

By changing the type hint from Optional[dict[str, object]] to Optional[Mapping[str, Any]], it now safely accepts user-supplied dictionaries containing nested configuration dictionaries without raising mypy type errors.

Using Mapping instead of dict ensures covariance, which fixes the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

peeringdb.client.Client constructor type is too strict

1 participant