Commit Graph

32 Commits

Author SHA1 Message Date
Tim Abbott 4f4d56b021 tornado: Import autoreload module from upstream Tornado.
This allows to patch things directly.
2018-05-20 16:49:17 -07:00
jkiely aa8248e734 mypy: Enable strict optional for check redis management command
Removed the error handling on the get_user_profile_by_id function, as it
would have just caused a different error shortly after.
2018-05-17 13:44:35 -07:00
jkiely d5e7b9599d mypy: Remove unnecessary blocks for strict optional=True. 2018-05-17 12:13:53 -07:00
jkiely 058ee1ce1e mypy: Enable strict optional on lib/soft_deactivation.
Tweaked by tabbott to add assert statements, rather than new
conditionals.
2018-05-17 12:13:53 -07:00
jkiely 104fdd8bf9 mypy: enable strict optional for lib/message.
Add assert in order to pass checks under strict conditions.
2018-05-17 11:12:08 -07:00
jkiely 04c50cffa7 mypy: Enable strict optional in zerver/lib/bugdown.
Explicitly check for none in optional value and set it to a dict.
2018-05-17 11:12:01 -07:00
jkiely b3d43df498 mypy: Enable strict optional for lib/exceptions.
Change return type of reduce_ex to pass under stricter conditions.
2018-05-17 11:11:58 -07:00
jkiely ca3ce90496 mypy: Enable strict optional in lib/avatar.py.
Add assert to function and modify tests in order to pass under
strict conditions.
2018-05-17 11:11:55 -07:00
jkiely a1b5e7d6d5 mypy: Enable strict optional in lib/events.
Modify one variable assignment to pass under strict conditions.
2018-05-17 11:11:53 -07:00
jkiely ad065fde29 mypy: Enable strict optional for lib/notifications.
Modify fix_emojis function to pass under strict conditions.
2018-05-17 11:11:49 -07:00
Tim Abbott 495104bd56 mypy: Clean test_subs.py of mypy strict-optional errors.
Most of this is just asserting that the sub_dict return value from
access_stream_by_id is not None in the cases where it shouldn't be,
but additionally, we also need to pass a function into
validate_user_access_to_subscribers_helper (in this case, just `lambda:
True` works fine)
2018-05-16 12:09:52 -07:00
Tim Abbott 16d807d157 Revert "test_helpers: Fix a nonexistent import."
This reverts commit fa18913b8b.

We fix the typo when doing this, though.
2018-05-15 16:08:29 -07:00
Greg Price 6dbd90835b mypy: Move remaining exclusion list to config file.
This leaves the wrapper script with very little left to do!

The main thing left is finding scripts by searching for shebang lines;
mypy itself would happily do the search for importable Python files.
2018-05-15 18:14:33 -04:00
Greg Price 4c500bba64 mypy: Explain a bit more about the failed imports of API code. 2018-05-15 18:14:33 -04:00
Greg Price ae3f461e02 mypy: Explain what's up with the failed imports of our own code. 2018-05-15 18:14:33 -04:00
Greg Price fa18913b8b test_helpers: Fix a nonexistent import.
This module doesn't exist, and never did; the name appears to be a
mistaken variant of the module that really does contain ZulipTestCase.
So, fix the import to use the real name.

This would never have worked at runtime, which is why it's in an
`if False:`.  It's also an example of the kind of error that can be
hidden by `ignore_missing_imports`; we'd have caught the issue
immediately if we hadn't had a blanket application of that flag
in place.
2018-05-15 18:14:33 -04:00
Greg Price 8ca31773cb mypy: Push ignore_missing_imports down to specific modules.
This makes it explicit what libraries we're missing stubs for, and
allows us to work incrementally on shrinking the list.
2018-05-15 18:14:33 -04:00
Greg Price 9f3052b0ef mypy: Move remaining options on type-check semantics to config file.
This puts all of this config in one place, and also needs a lot fewer
lines to describe it; which, combined, makes it a lot clearer what our
normal config actually is.  (I'd been looking at this script for a few
minutes without realizing that we have `--disallow-untyped-defs` *on*
by default, not off.)

Experimenting with different values is still easy; just comment the
line in the config.
2018-05-06 19:33:55 -07:00
Greg Price cc9acbe50d mypy: Organize config file a bit, since it's grown. 2018-05-06 19:33:55 -07:00
Greg Price 6b1e76c1b1 mypy: Move cache-dir to config file. 2018-05-06 19:33:55 -07:00
Greg Price 724e849e2b mypy: Move follow-imports to config file.
It's cleaner to have this configuration in a nice declarative
config file than embedded in a script.
2018-05-06 19:33:55 -07:00
Eeshan Garg 19177a4aff webhooks: Move github_webhook/ to github/. 2018-04-19 11:00:55 -07:00
neiljp (Neil Pilgrim) 6e89b60e44 tools/mypy: Enforce a more explicit checking of Optional. 2018-03-28 12:31:51 -07:00
neiljp (Neil Pilgrim) 9d26c78ece mypy: Annotate last null=true in models.py; modify mypy.ini exclusions. 2018-03-27 10:21:25 -07:00
neiljp (Neil Pilgrim) 8810245d48 mypy.ini: Expand tests wildcard from strict-optional into files list. 2018-03-25 08:59:08 -07:00
neiljp (Neil Pilgrim) ac09687fa2 mypy: Raise in commands/create_user.py if initial_password returns None. 2018-03-25 08:59:08 -07:00
neiljp (Neil Pilgrim) de76297f31 mypy.ini: Move purge_queue exclusion into re-architecting section. 2018-03-25 08:59:08 -07:00
neiljp (Neil Pilgrim) 3b28d6ab8b mypy: Rewrite sign_is_valid in zthumbor helpers.py for None secret_key. 2018-03-25 08:59:08 -07:00
neiljp (Neil Pilgrim) 8b697b4093 mypy: Annotate stream_data in populate_analytics_db.py handle function. 2018-03-25 08:59:08 -07:00
neiljp (Neil Pilgrim) b9fdb2cbf5 mypy: Add warn_no_return option to mypy.ini.
This option "shows errors for missing return statements on some
execution paths." according to the mypy docs.

It doesn't currently bring up anything, after cleaning the cache.
2018-03-23 16:53:43 -07:00
neiljp (Neil Pilgrim) 9a49812cde mypy: Extract default run-mypy options into mypy.ini. 2018-03-23 16:53:43 -07:00
neiljp (Neil Pilgrim) 9ec3b588b1 mypy: Add mypy.ini, including strict-optional by default. 2018-03-23 13:07:39 -07:00