Skip to content

TypedDict: Fix casefolding of 'missing keys' error message #9757

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

intgr
Copy link
Contributor

@intgr intgr commented Nov 25, 2020

Description

Previously the message accidentally converted all identifiers to
lowercase. By rephrasing the message, I avoided complicating the
format_key_list() function.

Test Plan

Added a test case as well.

Code:

from mypy_extensions import TypedDict

Foo = TypedDict('Foo', {'camelCaseKey': str})
value: Foo = {}

Old output:

casetest.py:4: error: Key 'camelcasekey' missing for TypedDict "Foo"

Output after my changes:

casetest.py:4: error: Missing key 'camelCaseKey' for TypedDict "Foo"

Previously the message accidentally converted all identifiers to
lowercase. By rephrasing the message, I avoided complicating the
`format_key_list()` function.
@intgr intgr force-pushed the fix-TypedDict-missing-key-casefolding branch from abf3881 to ca8aff5 Compare November 25, 2020 15:40
@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

- dragonchain/webserver/helpers_utest.py:169:48: error: Key 'options' missing for TypedDict "custom_index"
+ dragonchain/webserver/helpers_utest.py:169:48: error: Missing key 'options' for TypedDict "custom_index"
- dragonchain/webserver/helpers_utest.py:172:48: error: Key 'options' missing for TypedDict "custom_index"
+ dragonchain/webserver/helpers_utest.py:172:48: error: Missing key 'options' for TypedDict "custom_index"
- dragonchain/webserver/helpers_utest.py:175:48: error: Key 'options' missing for TypedDict "custom_index"
+ dragonchain/webserver/helpers_utest.py:175:48: error: Missing key 'options' for TypedDict "custom_index"
- dragonchain/lib/database/redisearch_utest.py:71:56: error: Key 'options' missing for TypedDict "custom_index"
+ dragonchain/lib/database/redisearch_utest.py:71:56: error: Missing key 'options' for TypedDict "custom_index"

1 similar comment
@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

- dragonchain/webserver/helpers_utest.py:169:48: error: Key 'options' missing for TypedDict "custom_index"
+ dragonchain/webserver/helpers_utest.py:169:48: error: Missing key 'options' for TypedDict "custom_index"
- dragonchain/webserver/helpers_utest.py:172:48: error: Key 'options' missing for TypedDict "custom_index"
+ dragonchain/webserver/helpers_utest.py:172:48: error: Missing key 'options' for TypedDict "custom_index"
- dragonchain/webserver/helpers_utest.py:175:48: error: Key 'options' missing for TypedDict "custom_index"
+ dragonchain/webserver/helpers_utest.py:175:48: error: Missing key 'options' for TypedDict "custom_index"
- dragonchain/lib/database/redisearch_utest.py:71:56: error: Key 'options' missing for TypedDict "custom_index"
+ dragonchain/lib/database/redisearch_utest.py:71:56: error: Missing key 'options' for TypedDict "custom_index"

@hauntsaninja hauntsaninja merged commit dbca5a5 into python:master Nov 25, 2020
@hauntsaninja
Copy link
Collaborator

Thank you!

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.

3 participants