Skip to content
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

botserver: Fix mypy error. #687

Merged
merged 1 commit into from
May 12, 2021
Merged

Conversation

LoopThrough-i-j
Copy link
Contributor

@LoopThrough-i-j LoopThrough-i-j commented May 12, 2021

Value of type "Optional[Any]" is not indexable error was originated by mypy.

zulip_botserver/zulip_botserver/server.py:172: error: Value of type "Optional[Any]" is not indexable
zulip_botserver/zulip_botserver/server.py:179: error: Value of type "Optional[Any]" is not indexable
zulip_botserver/zulip_botserver/server.py:180: error: Value of type "Optional[Any]" is not indexable
zulip_botserver/zulip_botserver/server.py:183: error: Value of type "Optional[Any]" is not indexable
zulip_botserver/zulip_botserver/server.py:187: error: Value of type "Optional[Any]" is not indexable
zulip_botserver/zulip_botserver/server.py:188: error: Value of type "Optional[Any]" is not indexable
zulip_botserver/zulip_botserver/server.py:189: error: Value of type "Optional[Any]" is not indexable

and

zulip_botserver/zulip_botserver/server.py:173: error: Value of type "Optional[Any]" is not indexable
zulip_botserver/zulip_botserver/server.py:180: error: Value of type "Optional[Any]" is not indexable
zulip_botserver/zulip_botserver/server.py:181: error: Value of type "Optional[Any]" is not indexable
zulip_botserver/zulip_botserver/server.py:184: error: Value of type "Optional[Any]" is not indexable
zulip_botserver/zulip_botserver/server.py:188: error: Value of type "Optional[Any]" is not indexable
zulip_botserver/zulip_botserver/server.py:189: error: Value of type "Optional[Any]" is not indexable
zulip_botserver/zulip_botserver/server.py:190: error: Value of type "Optional[Any]" is not indexable

was originated in PR #682.

Value of type "Optional[Any]" is not indexable error
was originated in PR zulip#682. This is due to request in Flask 2.0.
@timabbott timabbott merged commit dda9e0a into zulip:master May 12, 2021
@andersk
Copy link
Member

andersk commented May 12, 2021

We should be validating that the input is what we expect, rather than checking that the input is not None. (The input could just as easily be a number, a string, an array, a dict without the needed keys, or a dict with the needed keys but with wrong value types.)

@LoopThrough-i-j
Copy link
Contributor Author

I just considered making a simple fix to remove the error for the subsequent PRs. But we can probably use TypedDict for a better implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants