Skip to content

Commit

Permalink
chore: another ruff-related cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
sfermigier committed Feb 7, 2024
1 parent 50e9d9c commit be20d20
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
1 change: 0 additions & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ lint.extend-ignore = [
"PLR5501", # Use `elif` instead of `else` then `if`, to reduce indentation
"PLR6201", # Use a `set` literal when testing for membership
#
"PLW0108", # Lambda may be unnecessary; consider inlining inner function
"PLW1514", # `open` in text mode without explicit `encoding` argument
"PLW2901", # `for` loop variable overwritten by assignment target
"PLW3201", # Bad or misspelled dunder method name. (bad-dunder-name)
Expand Down
2 changes: 1 addition & 1 deletion src/abilian/sbe/apps/social/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class UserProfileViewForm(UserProfileForm):
"Communautés d'appartenance",
get_label="name",
view_widget=abilian_widgets.ListWidget(),
query_factory=lambda: Community.query.all(),
query_factory=lambda: Community.query.all(), # noqa: PLW0108
multiple=True,
validators=[optional()],
)
Expand Down
8 changes: 6 additions & 2 deletions src/abilian/services/indexing/tests/test_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ def test_build_attrs_3():
"text",
"updated_at",
}
assert all(lambda f: callable(f) for f in adapter.doc_attrs.values())

# FIXME: this test doesn't make sense
# assert all(lambda f: callable(f) for f in adapter.doc_attrs.values())

assert set(schema.names()) == {
"allowed_roles_and_users",
Expand Down Expand Up @@ -111,7 +113,9 @@ def test_build_attrs_4():
"object_type",
"object_key",
}
assert all(lambda f: callable(f) for f in adapter.doc_attrs.values())

# FIXME: this test doesn't make sense
# assert all(lambda f: callable(f) for f in adapter.doc_attrs.values())

assert set(schema.names()) == {
"id",
Expand Down
2 changes: 1 addition & 1 deletion src/abilian/web/admin/panels/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def uniquelogins(sessions: list[Any]) -> tuple[list[Any], list[Any], list[Any]]:
# convert the index to Datetime type
daily_serie.index = pd.DatetimeIndex(daily_serie.index)
# calculate the values instead of users lists
daily_serie = daily_serie.apply(lambda x: len(x))
daily_serie = daily_serie.apply(len)

# GroupBy Week/month, Thanks Panda
weekly_serie = daily_serie.groupby(pd.Grouper(freq="W")).aggregate(numpysum)
Expand Down
2 changes: 1 addition & 1 deletion src/abilian/web/forms/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ def _get_data(self):
if all(hasattr(x, "name") for x in data):
data = sorted(data, key=lambda x: x.name)
else:
data = sorted(data, key=lambda x: str(x))
data = sorted(data, key=str)

if data:
if not self.multiple:
Expand Down
2 changes: 1 addition & 1 deletion src/abilian/web/preferences/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class UserPreferencesForm(Form):
locale = fields.LocaleSelectField(
label=_l("Preferred Language"),
validators=[required()],
default=lambda: get_default_locale(),
default=get_default_locale,
)

timezone = fields.TimezoneField(
Expand Down

0 comments on commit be20d20

Please sign in to comment.