Anders Kaseorg
a50eb2e809
mypy: Enable new error explicit-override.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-12 12:28:41 -07:00
Anders Kaseorg
32a8151ce8
profile_request: Support only synchronous responses for now.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-07-19 16:14:59 -07:00
Anders Kaseorg
d0481be3e5
requirements: Upgrade Python requirements.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-05-10 19:44:47 -07:00
Anders Kaseorg
1dfddffc8d
profile_request: Use modern Django middleware API.
...
Fixes “RemovedInDjango40Warning: Passing None for the middleware
get_response argument is deprecated.” from LogRequests().
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-01-13 21:03:22 -08:00
PIG208
53888e5a26
request: Refactor ZulipRequestNotes to RequestNotes.
...
This utilizes the generic `BaseNotes` we added for multipurpose
patching. With this migration as an example, we can further support
more types of notes to replace the monkey-patching approach we have used
throughout the codebase for type safety.
2021-09-03 08:48:45 -07:00
PIG208
bb36bd8b6b
profile_request: Replace MockRequest with HostRequestMock.
...
Since previously we use a custom mock request that doesn't inherit
HttpRequest, there are some typing problems when we use it.
2021-08-20 05:54:19 -07:00
PIG208
460119986b
management: Fix typing for management scripts.
...
There are some remaining errors related to the django `Manager[T]` and
the `List[T]` type that we use to annotate the `Manage[T]` objects.
2021-08-20 05:54:18 -07:00
Tim Abbott
a35b9fd2d9
profile_request: Specify self.POST in mock request.
...
This file is a hack, so this is likely not fully correct, but it makes
it run and provide useful profiles.
2021-07-02 10:54:06 -07:00
Anders Kaseorg
6e4c3e41dc
python: Normalize quotes with Black.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-12 13:11:19 -08:00
Anders Kaseorg
11741543da
python: Reformat with Black, except quotes.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-12 13:11:19 -08:00
Anders Kaseorg
a50fae89e2
python: Elide type=str from argparse arguments.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-09-03 16:17:14 -07:00
Tim Abbott
866965f162
views: Rename messages.py to message_fetch.py.
...
This completes to effort to split zerver.views.messages into smaller
modules focused on the different core type of work.
2020-06-22 15:08:34 -07:00
Anders Kaseorg
69730a78cc
python: Use trailing commas consistently.
...
Automatically generated by the following script, based on the output
of lint with flake8-comma:
import re
import sys
last_filename = None
last_row = None
lines = []
for msg in sys.stdin:
m = re.match(
r"\x1b\[35mflake8 \|\x1b\[0m \x1b\[1;31m(.+):(\d+):(\d+): (\w+)", msg
)
if m:
filename, row_str, col_str, err = m.groups()
row, col = int(row_str), int(col_str)
if filename == last_filename:
assert last_row != row
else:
if last_filename is not None:
with open(last_filename, "w") as f:
f.writelines(lines)
with open(filename) as f:
lines = f.readlines()
last_filename = filename
last_row = row
line = lines[row - 1]
if err in ["C812", "C815"]:
lines[row - 1] = line[: col - 1] + "," + line[col - 1 :]
elif err in ["C819"]:
assert line[col - 2] == ","
lines[row - 1] = line[: col - 2] + line[col - 1 :].lstrip(" ")
if last_filename is not None:
with open(last_filename, "w") as f:
f.writelines(lines)
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-06-11 16:04:12 -07:00
Anders Kaseorg
bdc365d0fe
logging: Pass format arguments to logging.
...
https://docs.python.org/3/howto/logging.html#optimization
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-05-02 10:18:02 -07:00
Anders Kaseorg
fead14951c
python: Convert assignment type annotations to Python 3.6 style.
...
This commit was split by tabbott; this piece covers the vast majority
of files in Zulip, but excludes scripts/, tools/, and puppet/ to help
ensure we at least show the right error messages for Xenial systems.
We can likely further refine the remaining pieces with some testing.
Generated by com2ann, with whitespace fixes and various manual fixes
for runtime issues:
- invoiced_through: Optional[LicenseLedger] = models.ForeignKey(
+ invoiced_through: Optional["LicenseLedger"] = models.ForeignKey(
-_apns_client: Optional[APNsClient] = None
+_apns_client: Optional["APNsClient"] = None
- notifications_stream: Optional[Stream] = models.ForeignKey('Stream', related_name='+', null=True, blank=True, on_delete=CASCADE)
- signup_notifications_stream: Optional[Stream] = models.ForeignKey('Stream', related_name='+', null=True, blank=True, on_delete=CASCADE)
+ notifications_stream: Optional["Stream"] = models.ForeignKey('Stream', related_name='+', null=True, blank=True, on_delete=CASCADE)
+ signup_notifications_stream: Optional["Stream"] = models.ForeignKey('Stream', related_name='+', null=True, blank=True, on_delete=CASCADE)
- author: Optional[UserProfile] = models.ForeignKey('UserProfile', blank=True, null=True, on_delete=CASCADE)
+ author: Optional["UserProfile"] = models.ForeignKey('UserProfile', blank=True, null=True, on_delete=CASCADE)
- bot_owner: Optional[UserProfile] = models.ForeignKey('self', null=True, on_delete=models.SET_NULL)
+ bot_owner: Optional["UserProfile"] = models.ForeignKey('self', null=True, on_delete=models.SET_NULL)
- default_sending_stream: Optional[Stream] = models.ForeignKey('zerver.Stream', null=True, related_name='+', on_delete=CASCADE)
- default_events_register_stream: Optional[Stream] = models.ForeignKey('zerver.Stream', null=True, related_name='+', on_delete=CASCADE)
+ default_sending_stream: Optional["Stream"] = models.ForeignKey('zerver.Stream', null=True, related_name='+', on_delete=CASCADE)
+ default_events_register_stream: Optional["Stream"] = models.ForeignKey('zerver.Stream', null=True, related_name='+', on_delete=CASCADE)
-descriptors_by_handler_id: Dict[int, ClientDescriptor] = {}
+descriptors_by_handler_id: Dict[int, "ClientDescriptor"] = {}
-worker_classes: Dict[str, Type[QueueProcessingWorker]] = {}
-queues: Dict[str, Dict[str, Type[QueueProcessingWorker]]] = {}
+worker_classes: Dict[str, Type["QueueProcessingWorker"]] = {}
+queues: Dict[str, Dict[str, Type["QueueProcessingWorker"]]] = {}
-AUTH_LDAP_REVERSE_EMAIL_SEARCH: Optional[LDAPSearch] = None
+AUTH_LDAP_REVERSE_EMAIL_SEARCH: Optional["LDAPSearch"] = None
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-22 11:02:32 -07:00
Anders Kaseorg
79d888223f
profiling: Use mkstemp for profile.data filename.
...
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-01-15 16:08:48 -08:00
rht
138c486548
zilencer: Use python 3 syntax for typing.
2017-11-22 12:29:03 -08:00
Tim Abbott
2b43a0302a
python: Sort imports in smaller apps.
2017-11-15 15:55:49 -08:00
rht
548c96ad86
zilencer: Text-wrap long lines exceeding 110.
2017-11-07 17:24:06 -08:00
rht
0e71b243ce
zilencer: Remove inheritance from object.
2017-11-06 08:53:48 -08:00
rht
8d289b8228
zilencer: Remove absolute_import.
2017-09-27 20:20:07 -07:00
Vishnu Ks
754db8ec9f
zilencer: Eliminate get_user_profile_by_email from profile_request.
2017-07-18 17:14:05 -07:00
Aditya Bansal
b07273c2d0
pep8: Add compliance with rule E261 to commands/profile_request.py.
2017-05-07 23:21:50 -07:00
Tim Abbott
3617ebfd41
api: Rename get_old_messages to get_messages in the backend.
...
Fixes #1315 .
2017-03-23 23:52:44 -07:00
Umair Khan
682aa1f298
Django 1.10: Use add_argument for options in BaseCommand.
2016-11-04 10:20:23 -07:00
Taranjeet Singh
230cc228c2
profile_request.py: Fix line with length greater than 120.
...
This updates file zilencer/management/commands/profile_request.py.
2016-08-19 11:56:43 -07:00
Tim Abbott
a1a27b1789
Annotate most Zulip management commands.
2016-06-04 10:12:06 -07:00
Tim Abbott
a1b306f9ce
Finish purging 'fromt typing import *' from Zulip codebase.
2016-04-07 14:11:21 -07:00
Tim Abbott
b7dcf2181f
Add PEP-484 type annotations to management commands.
2016-04-03 15:40:23 -07:00
Tim Abbott
16ae985807
profile_request: Fix get_old_messages_backend import.
2015-11-11 21:34:39 -08:00
Zev Benjamin
3720cb1c33
Move message-related views into their own file
...
(imported from commit 2c71cc1b5d3f0210c98767888c461d5c6d046b49)
2014-01-10 21:38:59 -05:00
Leo Franchi
fe1313ad76
Split management commands for internal use into zilencer/
...
(imported from commit 3fd81bfc7e987fc88bd1d632546850eebbb92234)
2013-11-04 11:58:52 -05:00