Zixuan James Li
27af5865b0
soft_deactivation: Tighten function signatures with generic QuerySet.
...
Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-07-07 11:28:13 -07:00
Anders Kaseorg
544bbd5398
docs: Fix capitalization mistakes.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-10 09:57:26 -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
72d6ff3c3b
docs: Fix more capitalization issues.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-10-23 11:46:55 -07:00
Anders Kaseorg
bb5a963086
soft_deactivate_users: Elide default=[] for users argument.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-09-03 16:17:14 -07: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
Anders Kaseorg
b4597a8ca8
python: Elide default for store_{true,false} argparse arguments.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-09-03 16:17:14 -07:00
Anders Kaseorg
a5dbab8fb0
python: Remove redundant dest for argparse arguments.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-09-02 11:04:10 -07:00
Anders Kaseorg
5dc9b55c43
python: Manually convert more percent-formatting to f-strings.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-14 23:27:22 -07:00
Anders Kaseorg
4b6d2cf25f
logging: Pass more format arguments to logging.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-14 23:27:22 -07:00
Anders Kaseorg
365fe0b3d5
python: Sort imports with isort.
...
Fixes #2665 .
Regenerated by tabbott with `lint --fix` after a rebase and change in
parameters.
Note from tabbott: In a few cases, this converts technical debt in the
form of unsorted imports into different technical debt in the form of
our largest files having very long, ugly import sequences at the
start. I expect this change will increase pressure for us to split
those files, which isn't a bad thing.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-11 16:45:32 -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
Tim Abbott
8e7ce7cc79
python: Sort migrations/management command imports with isort.
...
This is a preparatory commit for using isort for sorting all of our
imports, merging changes to files where we can easily review the
changes as something we're happy with.
These are also files with relatively little active development, which
means we don't expect much merge conflict risk from these changes.
2020-01-14 13:07:47 -08:00
Tim Abbott
e124837cdc
management commands: Fix incorrect use of user_profile.email.
...
All of these management commands should be interacting with
.delivery_email; this results in buggy behavior with
EMAIL_ADDRESS_VISIBILITY_ADMINS.
2019-11-15 16:43:51 -08:00
Anders Kaseorg
d05578817e
soft_deactivate_users: Clean up type ignores.
...
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 17:42:33 -07:00
Vishnu Ks
123bcea518
management: Don't use sys.exit(1).
...
Using sys.exit in a management command makes it impossible
to unit test the code in question. The correct approach to do the same
thing in Django management commands is to raise CommandError.
Followup of b570c0dafa
2019-05-03 14:20:39 -07:00
Anders Kaseorg
643bd18b9f
lint: Fix code that evaded our lint checks for string % non-tuple.
...
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-23 15:21:37 -07:00
Puneeth Chaganti
d75d2c9974
soft-deactivation: Run catch-up when "auto" deactivate is run.
...
When soft deactivation is run for in "auto" mode (no emails are
specified and all users inactive for specified number of days are
deactivated), catch-up is also run in the "auto" mode if
AUTO_CATCH_UP_SOFT_DEACTIVATED_USERS is True.
Automatically catching up soft-deactivated users periodically would
ensure a good user experience for returning users, but on some servers
we may want to turn off this option to save on some disk space.
Fixes #8858 , at least for the default configuration, by eliminating
the situation where there are a very large number of messages to recover.
2019-03-14 11:53:15 -07:00
Puneeth Chaganti
c61d3420e8
soft-deactivation: Extract getting users from emails to a function.
2019-03-14 20:57:00 +05:30
Puneeth Chaganti
7f06f6bd73
soft-deactivation: Raise exception with all missing emails at once.
2019-03-13 17:16:22 -07:00
Anders Kaseorg
2a2e744b27
management: Remove unused imports in management commands.
...
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-02-02 17:12:36 -08:00
Tim Abbott
f04d6ed19e
python: Sort imports in management commands.
2017-11-15 15:43:47 -08:00
rht
a93b7c40a7
zerver: Text-wrap long lines exceeding 110.
2017-11-10 16:29:32 -08:00
rht
d6aa7f7738
zerver/management: Remove unused imports (F401).
2017-11-07 16:36:54 -08:00
rht
80a8d4f9f3
refactor: Remove six.moves.map import.
2017-11-07 10:46:42 -08:00
Tim Abbott
8e2cdedf9a
lint: Fix lines in Python codebase longer than 120 characters.
2017-10-26 17:47:30 -07:00
Tim Abbott
b936e8c24b
lint: Fix lines in Python codebase longer than 125 characters.
2017-10-26 17:36:54 -07:00
rht
a311678190
zerver/management: Use python 3 syntax for typing.
2017-10-26 15:24:56 -07:00
Tim Abbott
0f2e4a55c0
soft deactivation: Shorten management command name.
...
This command is really for soft deactivation; there's just an undo
feature.
2017-10-06 08:48:43 -07:00