From 9ec3b588b1f76d9cd9ee1e6e96c94de5fb5ee507 Mon Sep 17 00:00:00 2001 From: "neiljp (Neil Pilgrim)" Date: Thu, 22 Mar 2018 17:33:37 +0000 Subject: [PATCH] mypy: Add mypy.ini, including strict-optional by default. --- mypy.ini | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 mypy.ini diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 0000000000..2d222ecfb4 --- /dev/null +++ b/mypy.ini @@ -0,0 +1,132 @@ +[mypy] +strict_optional = True + +# REQ returning None issue + +[mypy-zerver.decorator] +strict_optional = False +[mypy-zerver.views.zephyr] +strict_optional = False +[mypy-zerver.views.user_settings] +strict_optional = False +[mypy-zerver.views.streams] +strict_optional = False +[mypy-zerver.views.storage] +strict_optional = False +[mypy-zerver.views.report] +strict_optional = False +[mypy-zerver.views.integrations] +strict_optional = False +[mypy-zerver.tornado.views] +strict_optional = False +[mypy-zerver.views.events_register] +strict_optional = False + +[mypy-zerver.lib.webhooks.common] +strict_optional = False +[mypy-zerver.webhooks.yo.view] +strict_optional = False +[mypy-zerver.webhooks.transifex.view] +strict_optional = False +[mypy-zerver.webhooks.newrelic.view] +strict_optional = False +[mypy-zerver.webhooks.gogs.view] +strict_optional = False +[mypy-zerver.webhooks.gitlab.view] +strict_optional = False +[mypy-zerver.webhooks.github_webhook.view] +strict_optional = False +[mypy-zerver.webhooks.bitbucket.view] +strict_optional = False +[mypy-zerver.webhooks.bitbucket2.view] +strict_optional = False +[mypy-zerver.webhooks.beanstalk.view] +strict_optional = False + +[mypy-zerver.views.auth] # Other issues in this file too +strict_optional = False +[mypy-zerver.views.realm] # Other issues in this file too +strict_optional = False +[mypy-zerver.views.messages] # Other issues in this file too +strict_optional = False +[mypy-zerver.views.users] # Other issues in this file too +strict_optional = False + +# One change required? + +[mypy-zerver.lib.notifications] # line 122: Using group from regex, which might return None +strict_optional = False +[mypy-zerver.lib.avatar] # str vs Optional[str] +strict_optional = False +[mypy-zerver.lib.soft_deactivation] +strict_optional = False +[mypy-zerver.lib.events] # signup_notifications_stream is Optional, but accessing id property +strict_optional = False +[mypy-zerver.lib.exceptions] #21: error: Return type of "__reduce_ex__" incompatible with supertype "object" +strict_optional = False +[mypy-zerver.lib.bugdown.api_arguments_table_generator] #18: error: Item "None" of "Optional[Dict[str, Any]]" has no attribute "items" +strict_optional = False + +[mypy-zerver.migrations.0077_add_file_name_field_to_realm_emoji] #73: error: Argument 2 to "upload_files" of "Uploader" has incompatible type "Optional[bytes]"; expected "bytes" +strict_optional = False + +[mypy-zerver/management/commands/purge_queue] #24: error: Item "None" of "Optional[Any]" has no attribute "queue_purge" +strict_optional = False +[mypy-zerver/management/commands/check_redis] #32: error: Incompatible types in assignment (expression has type "None", variable has type "UserProfile") +strict_optional = False +[mypy-zerver.management.commands.create_user] #86: error: Item "None" of "Optional[str]" has no attribute "encode" +strict_optional = False + +[mypy-zilencer.management.commands.calculate_first_visible_message_id] #33: error: Argument 1 to "maybe_update_first_visible_message_id" has incompatible type "Optional[Realm]"; expected "Realm" +strict_optional = False +[mypy-zilencer.management.commands.add_new_realm] #22: error: List item 0 has incompatible type "Optional[Stream]"; expected "Stream" +strict_optional = False + +[mypy-analytics.management.commands.populate_analytics_db] #148: error: Argument 2 to "insert_fixture_data" has incompatible type "Dict[str, List[int]]"; expected "Mapping[Optional[str], List[int]]" +strict_optional = False + +[mypy-zthumbor.loaders.helpers] #83: error: Argument 2 to "get_sign_hash" has incompatible type "Optional[str]"; expected "str" +strict_optional = False + +# Re-architecting required? + +[mypy-zerver.lib.queue] # Delayed setup of SimpleQueueClient.channel (Optional) +strict_optional = False +[mypy-zerver.tornado.handlers] # Delayed setup of ASyncDjangoHandler._request_middleware (Optional), line 200 error +strict_optional = False + +[mypy-zerver.tornado.descriptors] # line 10: 'get' can return None; only used in zerver/tornado/handlers? +strict_optional = False + +# General exclusions to work on + +[mypy-zerver.tests.*] +strict_optional = False +[mypy-zerver.lib.test_helpers] +strict_optional = False +[mypy-zerver.lib.test_classes] +strict_optional = False + +[mypy-zerver.tornado.event_queue] +strict_optional = False +[mypy-zerver.lib.outgoing_webhook] +strict_optional = False +[mypy-zerver.lib.bugdown] # for __init__.py +strict_optional = False +[mypy-zerver.lib.push_notifications] +strict_optional = False +[mypy-zerver.lib.actions] +strict_optional = False +[mypy-zproject.backends] +strict_optional = False +[mypy-zerver.worker.queue_processors] +strict_optional = False +[mypy-zerver.tornado.websocket_client] +strict_optional = False +[mypy-zerver.lib.slack_message_conversion] +strict_optional = False +[mypy-zerver.views.registration] +strict_optional = False + +[mypy-tools.lib.html_branches] +strict_optional = False