Commit Graph

12403 Commits

Author SHA1 Message Date
Steve Howell 4c5eb3d06e Fix transaction behavior for update_subscriptions_backend().
This commit extracts compose_views() from update_subscriptions_backend(),
and it implements the correct behavior for forcing transactions to roll
back, which is to raise an exception.

There were really three steps in this commit:

- Extract buggy code to compose_views().
- Add tests on compose_views().
- Fix bugs exposed by the new tests by converting errors to exceptions.
2016-09-12 22:03:39 -07:00
umkay 82d03d603a Update Pygments to latest upstream version.
In HTML, the line break immediately following a start tag is ignored
(see: https://www.w3.org/TR/html4/appendix/notes.html#h-B.3.1). An
extra span tag has been introduced in the upstream Pygments
HtmlFormatter in order to preserve the first new line. The Bugdown
Tests as well as our fenced_code.js frontend markdown processor have
been updated to reflect this new behavior.
2016-09-12 21:58:25 -07:00
Tim Abbott 9bccd10582 check-mirroring: Fix unnecessary type: ignore. 2016-09-12 21:43:45 -07:00
Tim Abbott cd0025f67f docs: Update roadmap with recently completed projects. 2016-09-12 14:56:08 -07:00
Tim Abbott 5c88fbdc6f mypy: Require new Python functions to have type annotations.
We're now at the point where 100% of functions checked by mypy is
fully annotated; to avoid regressions, we're enforcing the requirement
that it stay this way.  We still have a moderate amount of code that
is neither checked by mypy nor annotated, but it seems reasonable to
annotate that code at the same time as we get a chance to fix the mypy
issues in it.

This is implemented by using the --disallow-untyped-defs option in
mypy by default.
2016-09-12 14:56:08 -07:00
Gordon P. Hemsley 0f4148920a Switch tools/webpack from optparse to argparse. 2016-09-12 12:00:16 -07:00
Gordon P. Hemsley aace1c5bc9 Switch tools/update-prod-static from optparse to argparse. 2016-09-12 12:00:16 -07:00
Gordon P. Hemsley 9755f3f302 Switch tools/test-tools from optparse to argparse. 2016-09-12 12:00:16 -07:00
Gordon P. Hemsley 9b47f4ab3a Switch tools/minify-js from optparse to argparse. 2016-09-12 12:00:16 -07:00
Gordon P. Hemsley 1e9a4b2bab Switch tools/check-templates from optparse to argparse. 2016-09-12 12:00:16 -07:00
Gordon P. Hemsley fc6f72174b Switch tools/find-add-class from optparse to argparse. 2016-09-12 12:00:16 -07:00
Tim Abbott 9b867be075 mypy: Exclude api/zulip/__init__.py so we can start enforcing. 2016-09-12 09:03:50 -07:00
Tim Abbott 1eb16d03a2 Finish annotating template/css parsers and tests. 2016-09-12 09:03:50 -07:00
Tim Abbott e580ed579b Finish annotating zerver/views/messages.py.
These annotations aren't perfect because the sqlalchemy stubs in
typeshed are broken (e.g. a `Select` doesn't have the ability to do
`.where()`, but we've at least used some typevars to make it easy to
address that when the sqlalchemy stubs are less broken).
2016-09-12 08:47:52 -07:00
Tim Abbott e5b8ad6666 Fix teamcity.py annotations. 2016-09-12 08:30:42 -07:00
Tim Abbott d964e5595a Finish annotating test_helpers.py. 2016-09-12 08:29:34 -07:00
Steve Howell cdee3dfb53 Annotate test_helpers.instrument_url(). 2016-09-12 08:21:46 -07:00
Steve Howell ffec98d85c Annotate zerver/lib/export.py.
This adds the remaining annotations to lib/export.py.
2016-09-12 08:21:46 -07:00
Steve Howell 62dd86bcce mypy: Set Path to str instead of text_type in export.py.
Using text_type for Path just breaks a lot of calls to
the core Python libraries that still want strings.
2016-09-12 08:21:46 -07:00
Steve Howell b2ae2dc7cc Exclude contrib_bots from run-mypy. 2016-09-12 08:21:46 -07:00
Umair Khan 593779a3b0 Annotate zerver/tests/test_push_notifications.py. 2016-09-12 08:10:50 -07:00
Umair Khan c231a440cd Annotate zerver/templatetags/minified_js.py. 2016-09-12 08:10:50 -07:00
Umair Khan 29c24d540f Annotate zerver/templatetags/app_filters.py. 2016-09-12 08:10:50 -07:00
Umair Khan b4eb3a55be Annotate zerver/management/commands/realm_emoji.py. 2016-09-12 08:10:50 -07:00
Umair Khan f8c904e611 Annotate zerver/management/commands/deliver_email.py. 2016-09-12 08:10:50 -07:00
Umair Khan c096473e06 Annotate zerver/management/commands/check_redis.py. 2016-09-12 08:10:50 -07:00
Umair Khan 6c21d7a2c8 Annotate tools/setup/emoji_dump/emoji_dump.py. 2016-09-12 08:10:49 -07:00
Umair Khan 3f7f79f4b5 Annotate confirmation/models.py. 2016-09-12 08:10:48 -07:00
Umair Khan e2f29054a4 Check type before sending confirmation email.
We can only send confirmation email with PreregistrationUser and
Confirmation objects.
2016-09-12 11:00:15 +05:00
Steve Howell 64cb5d0778 Annotate commands/export.py. 2016-09-11 17:15:35 -07:00
Steve Howell 52c6efa0a8 Annotate commands/export_single_user.py. 2016-09-11 17:15:35 -07:00
Steve Howell bb6fcaa4e7 Annotate commands/export_usermessage_batch.py. 2016-09-11 17:15:35 -07:00
Steve Howell 85e30a6d35 Annotate commands/import.py. 2016-09-11 17:15:35 -07:00
Steve Howell 43572486b2 Annotate test_export.read_file(). 2016-09-11 17:15:35 -07:00
Steve Howell 30129f609b Annotate client_post() and client_get() in test_helpers. 2016-09-11 17:15:35 -07:00
Tomasz Kolek 8b9e9a386a Add mypy annotations to various integrations-related functions.
Added to:
zerver/lib/integrations.py
zerver/tests/test_integrations.py
zerver/tests/test_management_commands.py
zerver/views/integrations.py
zerver/views/webhooks/circleci.py
2016-09-11 17:11:25 -07:00
Umair Khan d171e2c8d9 Remove race conditions in casper tests.
Chaining together `wait*` functions can create race conditions in the
frontend tests. To avoid race condition, we need to insert `then`
function between two `wait*` functions.
2016-09-11 17:10:15 -07:00
Tim Abbott 8fbbb3a471 Annotate send_password_reset_email.py. 2016-09-11 17:09:27 -07:00
Tim Abbott 06580ca76e Annotate confirmation/util.py. 2016-09-11 17:09:27 -07:00
Tim Abbott 54820de522 Annotate bots/summarize_stream.py. 2016-09-11 17:09:27 -07:00
Steve Howell 98ac51d07d Clean up imports in html_branches.py. 2016-09-11 15:30:10 -07:00
Steve Howell 071c957f14 tools: Simplify html_tag_tree().
Because of some recent changes to the tokenizer, we no longer
need to call is_special_html_tag() to filter out special tags.

I also tried to make the start/end logic for pushing/popping
the stack more obvious.
2016-09-11 13:36:55 -07:00
Gordon P. Hemsley 331617efab Factor out HtmlTreeBranch and related code from template parser.
This code is not directly related to the template parser, so it
can safely live in its own file.

The only significant change to the code is to the signature of
`html_branches` so that it can be called without requiring a file.
Since it's only used in html_grep, that has been updated to reflect
this change.

Fixes: #1774.
2016-09-11 14:57:17 -04:00
Gordon P. Hemsley 4d3350bd7b Improve branch test coverage for html_tag_tree() in template parser. 2016-09-11 09:59:13 -07:00
Gordon P. Hemsley 87b87621fe Reach 100% branch coverage for CSS parser. 2016-09-11 09:59:13 -07:00
Gordon P. Hemsley 911634d1d4 Analyze branch coverage in test-tools. 2016-09-11 09:59:13 -07:00
Tim Abbott 4f091fd844 Annotate irc-mirror.py. 2016-09-10 12:20:24 -07:00
Tim Abbott 4634aa638e Annotate zerver/lib/tornado_ioloop_logging.py. 2016-09-10 12:10:41 -07:00
Tim Abbott 799c78fbcf Annotate zerver/lib/sqlalchemy_utils.py. 2016-09-10 12:08:37 -07:00
Tim Abbott 2e6aad669c cache: Add a basic annotation for cache_with_key. 2016-09-10 11:57:08 -07:00