Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
yagebu committed Jan 2, 2025
1 parent 0ea5cff commit a910c45
Show file tree
Hide file tree
Showing 18 changed files with 24 additions and 20 deletions.
2 changes: 1 addition & 1 deletion frontend/src/charts/Sunburst.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
let root = $derived(partition<AccountHierarchyDatum>()(data));
let nodes = $derived(
root.descendants().filter((d) => !d.data.dummy && d.depth),
root.descendants().filter((d) => !d.data.dummy && d.depth > 0),
);
let current: AccountHierarchyNode | null = $state(null);
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/charts/Treemap.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
const tree = treemap<AccountHierarchyDatum>().paddingInner(2).round(true);
let root = $derived(tree.size([width, height])(data));
let leaves = $derived(root.leaves().filter((d) => d.value));
let leaves = $derived(
root.leaves().filter((d) => d.value != null && d.value !== 0),
);
function fill(d: AccountHierarchyNode) {
const node = d.data.dummy && d.parent ? d.parent : d;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/charts/hierarchy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export function hierarchy_from_parsed_data(
).sort((a, b) => sign * ((b.value ?? 0) - (a.value ?? 0)));
return [currency, r] as const;
})
.filter(([, h]) => h.value),
.filter(([, h]) => h.value != null && h.value !== 0),
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/fuzzy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function fuzzyfilter(
}
return suggestions
.map((s): [string, number] => [s, fuzzytest(pattern, s)])
.filter(([, score]) => score)
.filter(([, score]) => score > 0)
.sort((a, b) => b[1] - a[1])
.map(([s]) => s);
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ export class Router extends Events<"page-loaded"> {

private async frontendRender(url: URL): Promise<void> {
const report = getUrlPath(url);
const route = this.frontend_routes?.find((r) =>
report?.startsWith(`${r.report}/`),
const route = this.frontend_routes?.find(
(r) => report?.startsWith(`${r.report}/`) === true,
);
if (route) {
is_loading_internal.set(true);
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/sidebar/AsideContents.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
let user_queries = $derived($ledgerData.user_queries);
let upcoming_events_count = $derived($ledgerData.upcoming_events_count);
let sidebar_links = $derived($ledgerData.sidebar_links);
let extension_reports = $derived($extensions.filter((e) => e.report_title));
let extension_reports = $derived(
$extensions.filter((e) => e.report_title != null),
);
</script>

{#if sidebar_links.length}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/tree-table/AccountCell.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@
} else {
new_t.add(n.account);
}
n.children.filter((c) => c.children.length).forEach(toggle_all);
n.children.filter((c) => c.children.length > 0).forEach(toggle_all);
};
children.forEach(toggle_all);
}
if (is_toggled && (event.ctrlKey || event.metaKey)) {
// collapse all direct children to only expand one level
children
.filter((c) => c.children.length)
.filter((c) => c.children.length > 0)
.forEach((n) => {
new_t.add(n.account);
});
Expand Down
2 changes: 1 addition & 1 deletion src/fava/beans/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
from fava.beans.abc import Transaction

if TYPE_CHECKING: # pragma: no cover
from collections.abc import Callable
from collections.abc import Sequence
from typing import Callable

from fava.beans.abc import Directive

Expand Down
2 changes: 1 addition & 1 deletion src/fava/core/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from abc import abstractmethod
from decimal import Decimal
from typing import Any
from typing import Callable
from typing import TYPE_CHECKING

import ply.yacc # type: ignore[import-untyped]
Expand All @@ -20,6 +19,7 @@
from fava.util.date import parse_date

if TYPE_CHECKING: # pragma: no cover
from collections.abc import Callable
from collections.abc import Iterable
from collections.abc import Sequence

Expand Down
2 changes: 1 addition & 1 deletion src/fava/core/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
from fava.util.date import local_today

if TYPE_CHECKING: # pragma: no cover
from collections.abc import Callable
from collections.abc import Iterable
from collections.abc import Mapping
from collections.abc import Sequence
from typing import Any
from typing import Callable
from typing import ParamSpec
from typing import TypeVar

Expand Down
2 changes: 1 addition & 1 deletion src/fava/core/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from __future__ import annotations

from decimal import Decimal
from typing import Callable
from typing import NamedTuple
from typing import Optional
from typing import TYPE_CHECKING
Expand All @@ -13,6 +12,7 @@

if TYPE_CHECKING: # pragma: no cover
import datetime
from collections.abc import Callable
from collections.abc import Iterator
from typing import Concatenate
from typing import ParamSpec
Expand Down
2 changes: 1 addition & 1 deletion src/fava/core/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from __future__ import annotations

import copy
from collections.abc import Callable
from decimal import Decimal
from typing import Callable
from typing import TYPE_CHECKING

from babel.core import Locale
Expand Down
2 changes: 1 addition & 1 deletion src/fava/core/watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

if TYPE_CHECKING: # pragma: no cover
import types
from collections.abc import Callable
from collections.abc import Iterable
from collections.abc import Sequence
from typing import Callable

from watchfiles.main import Change

Expand Down
2 changes: 1 addition & 1 deletion src/fava/ext/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from fava.helpers import BeancountError

if TYPE_CHECKING: # pragma: no cover
from typing import Callable
from collections.abc import Callable
from typing import TypeVar

from flask.wrappers import Response
Expand Down
2 changes: 1 addition & 1 deletion src/fava/json_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from pathlib import Path
from pprint import pformat
from typing import Any
from typing import Callable
from typing import TYPE_CHECKING

from flask import Blueprint
Expand All @@ -43,6 +42,7 @@
from fava.serialisation import serialise

if TYPE_CHECKING: # pragma: no cover
from collections.abc import Callable
from collections.abc import Mapping
from collections.abc import Sequence
from datetime import date
Expand Down
2 changes: 1 addition & 1 deletion src/fava/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
from flask import send_file

if TYPE_CHECKING: # pragma: no cover
from collections.abc import Callable
from collections.abc import Iterable
from collections.abc import Mapping
from typing import Any
from typing import Callable
from typing import ParamSpec
from typing import TypeVar
from wsgiref.types import StartResponse
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from pprint import pformat
from textwrap import dedent
from typing import Any
from typing import Callable
from typing import TYPE_CHECKING

import pytest
Expand All @@ -24,6 +23,7 @@
from fava.util.date import local_today

if TYPE_CHECKING: # pragma: no cover
from collections.abc import Callable
from typing import Literal
from typing import Protocol
from typing import TypeAlias
Expand Down
2 changes: 1 addition & 1 deletion tests/test_core_query_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from fava.util import excel

if TYPE_CHECKING: # pragma: no cover
from typing import Callable
from collections.abc import Callable

from fava.core.query import QueryResult

Expand Down

0 comments on commit a910c45

Please sign in to comment.