Reid Barton
ccb4c5c26f
bots: Move zephyr-related files to api/integrations/zephyr/.
2017-05-26 15:07:02 -07:00
derAnfaenger
024101be6b
bots: Add mypy annotations for bots framework.
...
This commit adds mypy annotations for both the main
bots and the bots testing runner. It involves a change
to the BotHandlerApi send_message and update_message
funtions, which is compatible with every bot.
Tweaked by tabbott to use more expressive annotations.
2017-05-26 10:25:06 -07:00
Eklavya Sharma
63cc8183ad
tools/run-mypy: Add flags.
2017-05-23 12:02:57 -07:00
Eklavya Sharma
bda5517b5c
mypy: Upgrade to latest version of mypy.
2017-05-23 10:42:44 -07:00
Eeshan Garg
b8f71c5d24
Document how to set up an Asana integration via Zapier.
...
Fixes #3948 .
2017-03-21 19:56:47 -07:00
Tim Abbott
879d8cdca0
mypy: Stop using deprecated --silent-imports.
2017-02-10 23:53:44 -08:00
Tim Abbott
bb5d81281c
mypy: Upgrade to new package name and version 0.571.
...
Fixes #3448 .
2017-02-10 23:53:44 -08:00
Tim Abbott
650469ead6
mypy: Make zerver/lib/ccache.py support python 3.
2017-02-10 23:53:44 -08:00
sinwar
eab355b0cd
tools: Create more consistent checks for venv.
...
This helps make the Zulip development environment somewhat more robust
to new contributors, since it will give them a nice warning if they
try running any of our development tools outside the Zulip virtualenv.
Fixes #3468 .
2017-02-06 21:50:32 -08:00
Tim Abbott
24df5fbd97
Delete remains of deprecated inject-messages.
2017-01-07 10:53:20 -08:00
AZtheAsian
0dc9ac7dac
Delete deprecated iframe-bot.
2017-01-07 10:53:20 -08:00
AZtheAsian
e8dafcd905
mypy: Add annotations to api/integrations/asana/zulip_asana_mirror.
2017-01-05 11:08:21 -08:00
ausDensk
059b124027
mypy: Annotate /api/integrations/rss/rss-bot.
...
With a few tweaks by tabbott.
2017-01-04 22:42:11 -08:00
AZtheAsian
c155b9162d
mypy: Annotate api/integrations/codebase/zulip_codebase_mirror.
2017-01-03 20:23:06 -08:00
Jackson
98ca518461
mypy: Add annotations to api/integrations/basecamp/zulip_basecamp_mirror
2017-01-03 18:34:26 -08:00
Jackson
566d55b7c6
mypy: Annotate api/integrations/hg/zulip-changegroup.py
2017-01-03 11:44:43 -08:00
anirudhjain75
5f4a822655
mypy: Annotate zerver/tests/test_decorators.py.
2017-01-02 08:59:49 -08:00
Sampriti Panda
246ac7cadc
mypy: Annotate api/integrations/twitter/twitter-search-bot
2017-01-02 08:01:37 -08:00
Jackson
88da3dea7e
mypy: Annotate api/integrations/trac/zulip_trac.py
2016-12-30 20:05:14 -08:00
Tommy Ip
29c291b981
mypy: Annotate *api/integrations/perforce/zulip_change-commit.py*.
2016-12-30 15:19:34 -08:00
lonerz
3c1c65eaf8
mypy: Annotate api/integrations/twitter/twitter-bot
2016-12-30 11:40:45 -08:00
Tommy Ip
7f187418d4
mypy: Annotate *api/integrations/nagios/nagios-notify-zulip*.
2016-12-28 15:44:47 -08:00
Tommy Ip
3d015eb259
mypy: Annotate *api/integrations/svn/post-commit*.
2016-12-28 08:54:53 -08:00
Tim Abbott
45324e08c1
bots: Fix jabber_mirror_backend annotations.
...
mypy was super confused because the name "zulip" was both an import
and a global variable in the file.
2016-12-27 21:39:32 -08:00
Steve Howell
680ff3f80c
Remove mypy exemption for api/zulip/__init__.py.
...
This required instead exempting these files:
bots/jabber_mirror_backend.py
tools/deprecated/iframe-bot/show-last-messages
Turning on mypy for the API exposes issues in the annotations
of other files.
2016-12-21 11:22:42 -08:00
Zac Pullar-Strecker
4eb6adf547
mypy: Annotate zerver/tests/test_narrow.py
2016-12-09 05:48:22 -08:00
anirudhjain75
4bb6735e77
Annotate zephyr_mirror_backend.py.
...
With some tweaks by tabbott to update tuple->Tuple and update comments.
2016-12-07 15:57:55 -08:00
Tudor Nazarie
5b22959f1c
Annotate bots/jabber_mirror_backend.py
2016-12-06 09:52:08 -08:00
Joy Chen
77938f6247
mypy: Annotate *bots/githook-post-receive*
2016-12-03 15:58:22 -06:00
Jason Le
144d82305d
mypy: Annotate puppet/zulip_ops.
2016-12-03 11:00:25 -08:00
Heidi Dong
ba7d4e7452
mypy: Annotate bots/gcal-bot.
2016-11-29 20:49:11 -08:00
Tommy Ip
844e32ccc5
tools: Remove deprecated generate-activity-metrics.py.
...
The script uses hardcoded hostnames that do not exist anymore,
its functionality is available through directly querying the Zulip
database.
2016-11-29 09:27:59 -08:00
Tim Abbott
36e336edc3
puppet: Rename zulip_internal to zulip_ops.
...
The old "zulip_internal" name was from back when Zulip, Inc. had two
distributions of Zulip, the enterprise distribution in puppet/zulip/
and the "internal" SAAS distribution in puppet/zulip_internal. I
think the name is a bit confusing in the new fully open-source Zulip
work, so we're replacing it with "zulip_ops". I don't think the new
name is perfect, but it's better.
In the following commits, we'll delete a bunch of pieces of Zulip,
Inc.'s infrastructure that don't exist anymore and thus are no longer
useful (e.g. the old Trac configuration), with the goal of cleaning
the repository of as much unnecessary content as possible.
2016-10-16 19:23:27 -07:00
Tim Abbott
217212b773
run-mypy: Use the experimental new mypy cache.
...
This makes iteratively running mypy approximately 5x faster.
Fixes #1981 .
2016-10-15 22:57:11 -07:00
Tim Abbott
9e503f2dcf
run-mypy: Check scripts by default.
...
Previously, we checked scripts in a separate run to work around mypy
not supporting multiple scripts with the same name. Since we have
fixed that issue, we can restore the original behavior.
We leave the --scripts-only option available, though I'm not sure it's
particularly useful and we'll probably eventually remove it.
2016-10-15 22:53:29 -07:00
Tim Abbott
4dbdf7e373
run-mypy: Consolidate exclude lists.
2016-10-15 22:53:29 -07:00
Tim Abbott
67e9f35f6f
run-mypy: Use new --scripts-are-modules argument.
...
This allows us to check all the Zulip scripts in just 3s, rather than
inefficiently looping through all the Zulip scripts.
2016-10-15 22:53:29 -07:00
Tim Abbott
1a751af148
run-mypy: Exclude puppet/zulip_internal.
2016-10-15 22:53:29 -07:00
Eklavya Sharma
81617fcdb0
Annotate zerver/tests/test_upload.py.
2016-10-11 11:29:14 -07:00
Eklavya Sharma
f7092b1a90
Annotate zerver/tests/test_email_mirror.py.
2016-10-11 11:28:52 -07:00
Eklavya Sharma
1dbabfe1ab
Annotate zerver/tests/test_bugdown.py.
2016-10-11 11:27:35 -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
Tim Abbott
9b867be075
mypy: Exclude api/zulip/__init__.py so we can start enforcing.
2016-09-12 09:03:50 -07:00
Steve Howell
b2ae2dc7cc
Exclude contrib_bots from run-mypy.
2016-09-12 08:21:46 -07:00
Tim Abbott
d32e691fe9
Annotate check-mirroring.
2016-09-10 11:57:01 -07:00
Tim Abbott
317e2a63b3
Remove tools/deprecated/review and associated files.
...
This hasn't been used since before Zulip was open source, and isn't
super reusable, so we can remove it. It'll always be there in the
history if someone ends up wanting it.
While we're at it, we remove the GitPython dependency (only used for
this tool) and the example MSMTP config for the review tool.
2016-09-10 10:53:02 -07:00
Taranjeet Singh
b36dfc0395
Store coverage data under var/ tree.
...
We set the COVERAGE_FILE environment variable which controls the
output file path for the .coverage file produced by python-coverage,
and also move the mypy coverage file to that location as well.
2016-08-25 19:51:53 -07:00
Tim Abbott
39f1024740
test_messages: Fix remaining mypy errors.
2016-08-04 15:57:03 -07:00
Eklavya Sharma
29af1419db
Make tools/update-deployment pass mypy check.
2016-07-25 22:06:05 +05:30
Eklavya Sharma
b08d6769c1
tools/zulip-export/zulip-export: Fix how files are opened.
...
Instead of using codecs.open, use the builtin open in binary mode
and write data after encoding it in utf-8.
2016-07-24 22:32:08 +05:30
Eklavya Sharma
df7dcdda5f
Annotate tools/get-handlebar-vars.
2016-07-24 22:12:32 +05:30
Eklavya Sharma
61ffd835e1
Annotate tools/minify-js.
2016-07-24 21:58:02 +05:30
Eklavya Sharma
1e0a971178
Annotate tools/test-run-dev.
2016-07-24 21:33:40 +05:30
Eklavya Sharma
7edc38bbf7
Remove tools/test-js-with-casper from mypy exclude list.
2016-07-24 21:07:07 +05:30
Eklavya Sharma
e6264fa6fb
Annotate tools/compile-handlebars-templates.
2016-07-24 21:07:06 +05:30
Eklavya Sharma
1a77b599f6
Make tools/post-receive python 3 compatible.
2016-07-24 21:07:06 +05:30
Eklavya Sharma
2f889550cb
tools/check-templates: Use __init__ in Record.
...
Initialize Record by using __init__ instead of setting attributes
in validate. This is needed because mypy complains when we set
new attributes outside __init__.
2016-07-24 21:04:32 +05:30
Eklavya Sharma
bd0fa3e77b
Annotate tools/lint-all.
2016-07-24 21:04:31 +05:30
Eklavya Sharma
ec6b630537
Make tools/run-mypy pass mypy check.
2016-07-24 21:04:22 +05:30
Eklavya Sharma
3d87c376c2
Make zulip-ec2-configure-interfaces pass mypy check.
2016-07-24 12:52:58 +05:30
Eklavya Sharma
0a5aa2ccc7
Make check_send_receive_time pass mypy check.
2016-07-24 12:41:06 +05:30
Eklavya Sharma
1820f961b3
frontend_tests/run-casper: Fix annotations.
2016-07-24 10:52:54 +05:30
Eklavya Sharma
11732f9ab0
Make all scripts in scripts/ pass mypy check.
2016-07-24 00:17:21 +05:30
Eklavya Sharma
f4c557d2a7
tools/run-mypy: Exclude scripts which don't pass mypy.
2016-07-22 11:16:29 -07:00
Eklavya Sharma
c12db5246d
Use separate exclude list for scripts.
2016-07-22 11:16:29 -07:00
Eklavya Sharma
102fcda4ab
tools/run-mypy: Add option --scripts-only.
...
This option is for checking only extensionless python scripts.
2016-07-22 11:16:29 -07:00
Eklavya Sharma
2930a769a9
Add __init__.py to tools/ and tools/setup/.
...
This will make it possible to import stuff from tools/setup/.
2016-07-20 18:20:37 -07:00
Taranjeet Singh
64332d8816
Update linecoverage directory to linecoverage-report.
...
tools/provision.py: Create directory var/linecoverage-report.
tools/run-mypy: Update coverage dir to var/linecoverage-report.
2016-07-18 14:13:33 -07:00
Tim Abbott
5d990c28d0
Fix running run-mypy from any working directory.
2016-07-12 10:39:33 -07:00
Tim Abbott
b13eeae24c
Remove finbot from Zulip repository.
...
It's been split into its own repository,
https://github.com/zulip/finbot .
2016-07-08 16:15:55 -07:00
Eklavya Sharma
4cf7641ab1
zerver/tests/test_i18n.py: Ignore due to incomplete stubs.
...
In python 3, http.cookies has incomplete stubs.
2016-07-07 12:42:51 -07:00
Eklavya Sharma
6c3f1bb967
beanstalk.py: Encode and decode strings correctly.
2016-07-07 12:42:51 -07:00
Eklavya Sharma
26b8e7357a
zerver/views/messages.py: Operate on bytes in highlight_string.
2016-07-07 12:42:51 -07:00
Eklavya Sharma
83640ed0cd
runtornado.py: Ignore due to incorrect stubs.
2016-07-07 10:09:35 -07:00
Eklavya Sharma
6fd8906358
rename_stream.py: Fix broken code.
...
* get_realm returns None if no matching realm is present, but
create_stream.py assumed it raises Realm.DoesNotExist.
* encoded/decode strings properly.
2016-07-07 10:08:29 -07:00
Eklavya Sharma
c679c180f5
enqueue_file.py: Add type hint for mypy.
2016-07-07 10:07:51 -07:00
Eklavya Sharma
896c18a57b
email-mirror.py: Make it pass on mypy in python 3.
...
* Replace filter by list comprehension.
* Add '# type: ignore' to statements which use attributes from
modeule `posix`, since stubs for posix are missing on python 3.
2016-07-07 10:07:28 -07:00
Eklavya Sharma
17cb6e00bd
create_stream.py: Fix broken code.
...
* get_realm returns None if no matching realm is present, but
create_stream.py assumed it raises Realm.DoesNotExist.
* encoded/decode strings properly.
2016-07-07 10:06:39 -07:00
Eklavya Sharma
63d55bdd86
zerver/views/__init__.py: decode b64encoded ccache.
...
Convert b64encoded ccache to `str` before passing to
subprocess.check_call.
2016-07-07 10:02:08 -07:00
Eklavya Sharma
628e45defc
zerver/lib/actions.py: Use text_type in truncate_ functions.
...
The functions truncate_content, truncate_body and truncate_topic
are only meant to be used on text strings. So change its
parameter types from AnyStr to text_type.
2016-07-07 10:02:08 -07:00
Eklavya Sharma
976858f536
tornado_ioloop_logging.py: Ignore because of missing stub.
...
There is no stub for select.epoll on python 3. So ignore the
statement which uses it.
2016-07-07 10:02:08 -07:00
Eklavya Sharma
9d2a539aaa
zerver/lib/notifications.py: Add hints for mypy.
...
Add type hints for mypy using isinstance in assert and if.
2016-07-07 10:02:08 -07:00
Eklavya Sharma
5e81a4d93f
zerver/lib/email_mirror.py: Improve annotation in python 3.
...
Add asserts and if statements to help mypy.
2016-07-07 10:01:30 -07:00
Eklavya Sharma
06a7a6caee
zerver/lib/debug.py: Remove from mypy's exclude_py3.
...
traceback.print_stack doesn't have a stub yet. So ignore the
statement which uses it.
2016-07-07 09:52:24 -07:00
Eklavya Sharma
6bb266d262
bugdown's __init__.py: Add python 3 compatibility.
...
* Use Response.text instead of Response.content.
* Make unescaping work on python 3.
2016-07-07 09:52:24 -07:00
Eklavya Sharma
05046d9288
bugdown's codehilite.py: Fix annotations in python 3 mode.
...
Many stubs in xml.etree.ElementTree use Union[str, bytes] as
return type. Mypy wants us to correctly handle each case. This
is correct, but not useful for us since we know that we'll always
get str. So force the return value to text_type, to supress mypy
errors.
2016-07-07 09:52:24 -07:00
Eklavya Sharma
610f19c791
zerver/lib/camo.py: Type ignore statement with hex encode.
2016-07-07 09:52:24 -07:00
Eklavya Sharma
6a63870136
zerver/decorator.py: Correctly encode/decode strings.
2016-07-07 09:52:24 -07:00
Eklavya Sharma
4e698ab1f6
Remove zerver/lib/parallel.py from mypy's exclude_py3.
2016-07-07 09:52:24 -07:00
Eklavya Sharma
ce6ddd574a
zerver/lib/test_helpers.py: Replace os.path.walk by os.walk.
...
os.path.walk has been removed in python 3.
2016-07-06 11:49:55 -07:00
Eklavya Sharma
6505cbf2bf
zerver/lib/timeout.py: Replace isAlive by is_alive.
...
In threading.Thread, isAlive has been removed in python 3.
We should use is_alive instead.
2016-07-06 11:49:48 -07:00
Eklavya Sharma
dcd568960b
Add files to mypy's python 3 exclude list.
2016-07-02 10:38:48 -07:00
Eklavya Sharma
b44ae38bff
tools/run-mypy: Add Python 3 mode.
2016-07-02 10:38:48 -07:00
Tim Abbott
5ce0637da9
run-mypy: Explode exclude lists to specific files.
2016-06-28 16:42:59 -07:00
Tim Abbott
56e7a2f6f3
Annotate zerver.migrations.
2016-06-28 16:38:33 -07:00
Tim Abbott
50f723f50b
Split test_narrow.py out of test_messages.py.
2016-06-21 12:25:08 -07:00
Tim Abbott
5b05644c95
Run mypy on zerver/tests/test_hooks.py.
2016-06-16 14:07:34 -07:00
Tim Abbott
6723525fd3
Annotate zerver/tests/tests.py.
2016-06-16 14:07:34 -07:00
Eklavya Sharma
553a9d0b75
tools/run-mypy: Exclude py files which have a pyi.
...
If a .py file has a corresponding .pyi stub file, exclude that
.py file from mypy.
2016-06-15 22:40:31 +05:30
Reid Barton
0b7852f081
Generate mypy coverage report for travis + coveralls.
2016-06-04 13:01:19 -07:00