Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
yagebu committed Oct 20, 2023
1 parent 7301230 commit 4ff94a1
Show file tree
Hide file tree
Showing 64 changed files with 82 additions and 20 deletions.
1 change: 1 addition & 0 deletions _build_backend.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Build backend that also compiles translations and frontend."""

# pylint: disable=wildcard-import,function-redefined,unused-wildcard-import

from __future__ import annotations
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""fava wsgi application"""

from __future__ import annotations

from fava.application import create_app
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""fava wsgi application"""

from __future__ import annotations

from fava.application import create_app
Expand Down
1 change: 1 addition & 0 deletions docs/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
sphinx-apidoc is not customizeable enough to do this.
"""

from __future__ import annotations

import pkgutil
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/AutocompleteInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,7 @@
ul {
position: absolute;
z-index: var(--z-index-autocomplete);
overflow-x: hidden;
overflow-y: auto;
overflow: hidden auto;
background-color: var(--background);
border: 1px solid var(--border-darker);
box-shadow: 0 3px 3px var(--border);
Expand Down
1 change: 1 addition & 0 deletions src/fava/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Fava - A web interface for Beancount."""

from __future__ import annotations

from contextlib import suppress
Expand Down
5 changes: 3 additions & 2 deletions src/fava/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
app.run('localhost', 5000)
"""

from __future__ import annotations

import logging
Expand All @@ -26,7 +27,7 @@
from urllib.parse import urlparse
from urllib.parse import urlunparse

import markdown2 # type: ignore[import]
import markdown2 # type: ignore[import-untyped]
from beancount import __version__ as beancount_version
from beancount.utils.text_utils import replace_numbers
from flask import abort
Expand All @@ -38,7 +39,7 @@
from flask import request
from flask import send_file
from flask import url_for as flask_url_for
from flask_babel import Babel # type: ignore[import]
from flask_babel import Babel # type: ignore[import-untyped]
from flask_babel import get_translations
from markupsafe import Markup
from werkzeug.utils import secure_filename
Expand Down
1 change: 1 addition & 0 deletions src/fava/beans/abc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Abstract base classes for Beancount types."""

from __future__ import annotations

from abc import ABC
Expand Down
1 change: 1 addition & 0 deletions src/fava/beans/account.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Account name helpers."""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 0 additions & 1 deletion src/fava/beans/create.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Helpers to create entries."""


from __future__ import annotations

from decimal import Decimal
Expand Down
1 change: 1 addition & 0 deletions src/fava/beans/flags.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Beancount entry flags."""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions src/fava/beans/funcs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Various functions to deal with Beancount data."""

from __future__ import annotations

from typing import Any
Expand Down
1 change: 1 addition & 0 deletions src/fava/beans/helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Helpers for Beancount entries."""

from __future__ import annotations

from typing import Any
Expand Down
1 change: 1 addition & 0 deletions src/fava/beans/load.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Load Beancount files and strings."""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions src/fava/beans/prices.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Price helpers."""

from __future__ import annotations

import datetime
Expand Down
8 changes: 5 additions & 3 deletions src/fava/beans/str.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
"""Convert Beancount types to string."""

from __future__ import annotations

from decimal import Decimal
from functools import singledispatch

from beancount.core.position import CostSpec
from beancount.parser.printer import format_entry # type: ignore[import]
from beancount.parser.printer import ( # type: ignore[import-untyped]
format_entry,
)

from fava.beans.abc import Amount
from fava.beans.abc import Cost
Expand Down Expand Up @@ -51,8 +54,7 @@ def _(cost: CostSpec) -> str:
if isinstance(cost.number_per, Decimal):
amountlist.append(f"{cost.number_per}")
if isinstance(cost.number_total, Decimal):
amountlist.append("#")
amountlist.append(f"{cost.number_total}")
amountlist.extend(("#", f"{cost.number_total}"))
if cost.currency:
amountlist.append(cost.currency)
strs.append(" ".join(amountlist))
Expand Down
1 change: 1 addition & 0 deletions src/fava/beans/types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Typing helpers."""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions src/fava/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The command-line interface for Fava."""

from __future__ import annotations

import errno
Expand Down
1 change: 1 addition & 0 deletions src/fava/context.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Specify types for the flask application context."""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions src/fava/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module provides the data required by Fava's reports."""

from __future__ import annotations

from datetime import date
Expand Down
1 change: 1 addition & 0 deletions src/fava/core/accounts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Account close date and metadata."""

from __future__ import annotations

import datetime
Expand Down
1 change: 1 addition & 0 deletions src/fava/core/attributes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Attributes for auto-completion."""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions src/fava/core/budgets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Parsing and computing budgets."""

from __future__ import annotations

from collections import Counter
Expand Down
1 change: 1 addition & 0 deletions src/fava/core/charts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide data suitable for Fava's charts."""

from __future__ import annotations

from collections import defaultdict
Expand Down
1 change: 1 addition & 0 deletions src/fava/core/commodities.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Attributes for auto-completion."""

from __future__ import annotations

from contextlib import suppress
Expand Down
1 change: 1 addition & 0 deletions src/fava/core/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
All functions in this module will be automatically added as template filters.
"""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions src/fava/core/documents.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Document path related helpers."""

from __future__ import annotations

from os import altsep
Expand Down
1 change: 1 addition & 0 deletions src/fava/core/extensions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Fava extensions."""

from __future__ import annotations

from dataclasses import dataclass
Expand Down
1 change: 1 addition & 0 deletions src/fava/core/fava_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
parsing the options.
"""

from __future__ import annotations

import re
Expand Down
1 change: 1 addition & 0 deletions src/fava/core/file.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Reading/writing Beancount files."""

from __future__ import annotations

import re
Expand Down
5 changes: 3 additions & 2 deletions src/fava/core/filters.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Entry filters."""

from __future__ import annotations

import re
Expand All @@ -9,9 +10,9 @@
from typing import Iterable
from typing import TYPE_CHECKING

import ply.yacc # type: ignore[import]
import ply.yacc # type: ignore[import-untyped]
from beancount.core import account
from beancount.ops.summarize import clamp_opt # type: ignore[import]
from beancount.ops.summarize import clamp_opt # type: ignore[import-untyped]

from fava.beans.account import get_entry_accounts
from fava.helpers import FavaAPIError
Expand Down
1 change: 1 addition & 0 deletions src/fava/core/group_entries.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Entries grouped by type."""

from __future__ import annotations

from collections import defaultdict
Expand Down
3 changes: 2 additions & 1 deletion src/fava/core/ingest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Ingest helper functions."""

from __future__ import annotations

import datetime
Expand All @@ -12,7 +13,7 @@
from typing import Any
from typing import TYPE_CHECKING

from beancount.ingest import cache # type: ignore[import]
from beancount.ingest import cache # type: ignore[import-untyped]
from beancount.ingest import extract
from beancount.ingest import identify

Expand Down
1 change: 1 addition & 0 deletions src/fava/core/inventory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Alternative implementation of Beancount's Inventory."""

from __future__ import annotations

from decimal import Decimal
Expand Down
1 change: 1 addition & 0 deletions src/fava/core/misc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Some miscellaneous reports."""

from __future__ import annotations

import datetime
Expand Down
1 change: 1 addition & 0 deletions src/fava/core/module_base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base class for the "modules" of FavaLedger."""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions src/fava/core/number.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Formatting numbers."""

from __future__ import annotations

import copy
Expand Down
3 changes: 2 additions & 1 deletion src/fava/core/query_shell.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""For using the Beancount shell from Fava."""

from __future__ import annotations

import contextlib
Expand All @@ -12,7 +13,7 @@
from beancount.query.query_compile import CompilationError
from beancount.query.query_parser import ParseError
from beancount.query.query_parser import RunCustom
from beancount.query.shell import BQLShell # type: ignore[import]
from beancount.query.shell import BQLShell # type: ignore[import-untyped]
from beancount.utils import pager # type: ignore[attr-defined]

from fava.beans.funcs import execute_query
Expand Down
1 change: 1 addition & 0 deletions src/fava/core/tree.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Account balance trees."""

from __future__ import annotations

from collections import defaultdict
Expand Down
1 change: 1 addition & 0 deletions src/fava/core/watcher.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A simple file and folder watcher."""

from __future__ import annotations

from os import walk
Expand Down
7 changes: 4 additions & 3 deletions src/fava/ext/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Fava's extension system."""

from __future__ import annotations

import ast
Expand Down Expand Up @@ -158,9 +159,9 @@ def find_extensions(


def extension_endpoint(
func_or_endpoint_name: Callable[[FavaExtensionBase], Any]
| str
| None = None,
func_or_endpoint_name: (
Callable[[FavaExtensionBase], Any] | str | None
) = None,
methods: list[str] | None = None,
) -> (
Callable[[FavaExtensionBase], Response]
Expand Down
1 change: 1 addition & 0 deletions src/fava/ext/auto_commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
This mainly serves as an example how Fava's extension systems, which only
really does hooks at the moment, works.
"""

from __future__ import annotations

from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions src/fava/ext/portfolio_list/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This is a simple example of Fava's extension reports system.
"""

from __future__ import annotations

import re
Expand Down
1 change: 1 addition & 0 deletions src/fava/help/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""List of all available help pages."""

from __future__ import annotations

HELP_PAGES = {
Expand Down
1 change: 1 addition & 0 deletions src/fava/helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Exceptions and module base class."""

from __future__ import annotations

from typing import NamedTuple
Expand Down
3 changes: 2 additions & 1 deletion src/fava/internal_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
this part of the functionality to be tested and allowing some end-to-end tests
for the frontend data validation.
"""

from __future__ import annotations

from copy import copy
Expand All @@ -13,7 +14,7 @@

from flask import current_app
from flask import url_for
from flask_babel import gettext # type: ignore[import]
from flask_babel import gettext # type: ignore[import-untyped]

from fava.context import g
from fava.util.excel import HAVE_EXCEL
Expand Down
Loading

0 comments on commit 4ff94a1

Please sign in to comment.