Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
hauntsaninja merged 1 commit into
python:masterfrom
intgr:fix-TypedDict-missing-key-casefolding
Nov 25, 2020
Merged

TypedDict: Fix casefolding of 'missing keys' error message#9757
hauntsaninja merged 1 commit into
python:masterfrom
intgr:fix-TypedDict-missing-key-casefolding

Conversation

@intgr

@intgr intgr commented Nov 25, 2020

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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