Anders Kaseorg
2665a3ce2b
python: Elide unnecessary list wrappers.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-13 12:41:23 -07:00
Anders Kaseorg
6988622fe8
ruff: Enable B023 Function definition does not bind loop variable.
...
Python’s loop scoping is misdesigned, resulting in a very common
gotcha for functions that close over loop variables [1]. The general
problem is so bad that even the Go developers plan to break
compatibility in order to fix the same design mistake in their
language [2].
Enable the Ruff rule function-uses-loop-variable (B023) [3], which
conservatively prohibits functions from binding loop variables at all.
[1] https://docs.python-guide.org/writing/gotchas/#late-binding-closures
[2] https://go.dev/s/loopvar-design
[3] https://beta.ruff.rs/docs/rules/function-uses-loop-variable/
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-11 18:03:45 -07:00
Alex Vandiver
b94402152d
models: Always search Messages with a realm_id or id limit.
...
Unless there is a limit on `id`, always provide a `realm_id` limit as
well. We also notate which index is expected to be used in each
query.
2023-09-11 15:00:37 -07:00
Anders Kaseorg
562a79ab76
ruff: Fix PERF401 Use a list comprehension to create a transformed list.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-08-07 17:23:55 -07:00
Anders Kaseorg
afa218fa2a
semgrep: Detect some unsafe uses of markupsafe.Markup.
...
Use the built-in HTML escaping of Markup("…{var}…").format(), in order
to allow Semgrep to detect mistakes like Markup("…{var}…".format())
and Markup(f"…{var}…").
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-22 11:23:27 -07:00
Anders Kaseorg
ff1971f5ad
ruff: Fix SIM105 Use `contextlib.suppress` instead of try-except-pass.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-01-23 11:18:36 -08:00
Lauryn Menard
c05c25e742
analytics-activity: Fix UTC timezone and adjust header type.
...
Fixes an error with how the `utctime` was being generated and makes
the header on the summary table the same type as the other tabs.
2022-12-02 17:30:30 -08:00
Lauryn Menard
c75e5c8ba6
analytics-activity: Add links for realm's Zulip and support page.
2022-12-02 17:30:30 -08:00
Lauryn Menard
90d0531e20
analytics-activity: Remove link with realm owners emails.
...
Note that a link to copy these emails to the clipboard is still
availabe on the realm's support page.
2022-12-02 17:30:30 -08:00
Anders Kaseorg
924d530292
ruff: Fix N813 camelcase imported as lowercase.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-16 09:29:11 -08:00
Anders Kaseorg
73374996a5
analytics: Add Composable type annotations.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-07-30 06:46:34 -07:00
Anders Kaseorg
78e54a0d7a
python: Replace deprecated jinja2.utils.Markup with markupsafe.Markup.
...
Fixes “DeprecationWarning: 'jinja2.Markup' is deprecated and will be
removed in Jinja 3.1. Import 'markupsafe.Markup' instead.”
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-01-13 14:22:48 -08:00
Eeshan Garg
b325a4f1be
realm: Rename plan type constants to be more descriptive.
...
It is confusing to have the plan type constants not be namespaced
by the thing they represent. We already have a namespacing
convention in place for constants, so we should use it for
Realm.plan_type as well.
2021-10-19 12:20:39 -07:00
Vishnu KS
aff52722a7
billing: Add PLUS as a plan_type to Realm.
2021-10-15 17:27:50 -07:00
PIG208
e517f967b8
typing: Amend inaccurate type annotations.
...
This amend some type annotations that turn out to be inaccurate with
django-stubs.
2021-07-27 12:17:00 -07:00
Anders Kaseorg
fb3ddf50d4
python: Fix mypy no_implicit_reexport errors.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-07-16 14:02:31 -07:00
Eeshan Garg
434c262365
analytics: Display org_type on /activity.
...
Moving forward we are hoping to collect data on org types from our
users, so it makes sense to display the org type on the "Counts"
tab of our /activity page.
2021-07-15 10:14:38 -07:00
Tim Abbott
e0c7581168
analytics: Rename get_activity to get_installation_activity.
2021-06-17 17:39:28 -07:00
Tim Abbott
0e358e4cc2
analytics: Rename analytics/views/legacy.py.
2021-06-17 17:39:28 -07:00