diff --git a/_build_backend.py b/_build_backend.py index 6bbbff45d..67e11cae5 100644 --- a/_build_backend.py +++ b/_build_backend.py @@ -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 diff --git a/contrib/pythonanywhere/fava/fava_pythonanywhere_com_wsgi.py b/contrib/pythonanywhere/fava/fava_pythonanywhere_com_wsgi.py index e98e19561..7d371ba12 100644 --- a/contrib/pythonanywhere/fava/fava_pythonanywhere_com_wsgi.py +++ b/contrib/pythonanywhere/fava/fava_pythonanywhere_com_wsgi.py @@ -1,4 +1,5 @@ """fava wsgi application""" + from __future__ import annotations from fava.application import create_app diff --git a/contrib/pythonanywhere/favadev/favadev_pythonanywhere_com_wsgi.py b/contrib/pythonanywhere/favadev/favadev_pythonanywhere_com_wsgi.py index df4ba476c..bccb391c8 100644 --- a/contrib/pythonanywhere/favadev/favadev_pythonanywhere_com_wsgi.py +++ b/contrib/pythonanywhere/favadev/favadev_pythonanywhere_com_wsgi.py @@ -1,4 +1,5 @@ """fava wsgi application""" + from __future__ import annotations from fava.application import create_app diff --git a/docs/generate.py b/docs/generate.py index 76ea2bc3b..4e57acde0 100644 --- a/docs/generate.py +++ b/docs/generate.py @@ -2,6 +2,7 @@ sphinx-apidoc is not customizeable enough to do this. """ + from __future__ import annotations import pkgutil diff --git a/src/fava/__init__.py b/src/fava/__init__.py index 2a6fdb4bc..9e5e4e675 100644 --- a/src/fava/__init__.py +++ b/src/fava/__init__.py @@ -1,4 +1,5 @@ """Fava - A web interface for Beancount.""" + from __future__ import annotations from contextlib import suppress diff --git a/src/fava/application.py b/src/fava/application.py index 5bd1a2669..6fb06bfbf 100644 --- a/src/fava/application.py +++ b/src/fava/application.py @@ -9,6 +9,7 @@ app.run('localhost', 5000) """ + from __future__ import annotations import logging diff --git a/src/fava/beans/abc.py b/src/fava/beans/abc.py index 8633c855b..fce957285 100644 --- a/src/fava/beans/abc.py +++ b/src/fava/beans/abc.py @@ -1,4 +1,5 @@ """Abstract base classes for Beancount types.""" + from __future__ import annotations from abc import ABC diff --git a/src/fava/beans/account.py b/src/fava/beans/account.py index b787bf0d6..5a6c67e7a 100644 --- a/src/fava/beans/account.py +++ b/src/fava/beans/account.py @@ -1,4 +1,5 @@ """Account name helpers.""" + from __future__ import annotations from typing import TYPE_CHECKING diff --git a/src/fava/beans/create.py b/src/fava/beans/create.py index 73543dfc3..52379b7a7 100644 --- a/src/fava/beans/create.py +++ b/src/fava/beans/create.py @@ -1,6 +1,5 @@ """Helpers to create entries.""" - from __future__ import annotations from decimal import Decimal diff --git a/src/fava/beans/flags.py b/src/fava/beans/flags.py index 76a57bb65..7250331d8 100644 --- a/src/fava/beans/flags.py +++ b/src/fava/beans/flags.py @@ -1,4 +1,5 @@ """Beancount entry flags.""" + from __future__ import annotations from typing import TYPE_CHECKING diff --git a/src/fava/beans/funcs.py b/src/fava/beans/funcs.py index 3cb9f7544..d51824a23 100644 --- a/src/fava/beans/funcs.py +++ b/src/fava/beans/funcs.py @@ -1,4 +1,5 @@ """Various functions to deal with Beancount data.""" + from __future__ import annotations from typing import Any diff --git a/src/fava/beans/helpers.py b/src/fava/beans/helpers.py index 84f824816..ba6b5fbd2 100644 --- a/src/fava/beans/helpers.py +++ b/src/fava/beans/helpers.py @@ -1,4 +1,5 @@ """Helpers for Beancount entries.""" + from __future__ import annotations from typing import Any diff --git a/src/fava/beans/load.py b/src/fava/beans/load.py index 8e4ce9cd0..ddc41af5f 100644 --- a/src/fava/beans/load.py +++ b/src/fava/beans/load.py @@ -1,4 +1,5 @@ """Load Beancount files and strings.""" + from __future__ import annotations from typing import TYPE_CHECKING diff --git a/src/fava/beans/prices.py b/src/fava/beans/prices.py index 4b16ac91b..e4de9d297 100644 --- a/src/fava/beans/prices.py +++ b/src/fava/beans/prices.py @@ -1,4 +1,5 @@ """Price helpers.""" + from __future__ import annotations import datetime diff --git a/src/fava/beans/str.py b/src/fava/beans/str.py index 499ba5124..37e6a069f 100644 --- a/src/fava/beans/str.py +++ b/src/fava/beans/str.py @@ -1,4 +1,5 @@ """Convert Beancount types to string.""" + from __future__ import annotations from decimal import Decimal diff --git a/src/fava/beans/types.py b/src/fava/beans/types.py index 6421465f4..874dad931 100644 --- a/src/fava/beans/types.py +++ b/src/fava/beans/types.py @@ -1,4 +1,5 @@ """Typing helpers.""" + from __future__ import annotations from typing import TYPE_CHECKING diff --git a/src/fava/cli.py b/src/fava/cli.py index 601272bcf..43511f844 100644 --- a/src/fava/cli.py +++ b/src/fava/cli.py @@ -1,4 +1,5 @@ """The command-line interface for Fava.""" + from __future__ import annotations import errno diff --git a/src/fava/context.py b/src/fava/context.py index 11d95c69e..2b82aebac 100644 --- a/src/fava/context.py +++ b/src/fava/context.py @@ -1,4 +1,5 @@ """Specify types for the flask application context.""" + from __future__ import annotations from typing import TYPE_CHECKING diff --git a/src/fava/core/__init__.py b/src/fava/core/__init__.py index c90c96daf..6d5c79f06 100644 --- a/src/fava/core/__init__.py +++ b/src/fava/core/__init__.py @@ -1,4 +1,5 @@ """This module provides the data required by Fava's reports.""" + from __future__ import annotations from datetime import date diff --git a/src/fava/core/accounts.py b/src/fava/core/accounts.py index 6f81298f3..c9b394d7b 100644 --- a/src/fava/core/accounts.py +++ b/src/fava/core/accounts.py @@ -1,4 +1,5 @@ """Account close date and metadata.""" + from __future__ import annotations import datetime diff --git a/src/fava/core/attributes.py b/src/fava/core/attributes.py index 3c44d60bf..6ab70de46 100644 --- a/src/fava/core/attributes.py +++ b/src/fava/core/attributes.py @@ -1,4 +1,5 @@ """Attributes for auto-completion.""" + from __future__ import annotations from typing import TYPE_CHECKING diff --git a/src/fava/core/budgets.py b/src/fava/core/budgets.py index 2b1bbd139..1b5ba1498 100644 --- a/src/fava/core/budgets.py +++ b/src/fava/core/budgets.py @@ -1,4 +1,5 @@ """Parsing and computing budgets.""" + from __future__ import annotations from collections import Counter diff --git a/src/fava/core/charts.py b/src/fava/core/charts.py index 214d048cd..b5029393f 100644 --- a/src/fava/core/charts.py +++ b/src/fava/core/charts.py @@ -1,4 +1,5 @@ """Provide data suitable for Fava's charts.""" + from __future__ import annotations from collections import defaultdict diff --git a/src/fava/core/commodities.py b/src/fava/core/commodities.py index 93e5d46df..a3dbd91d3 100644 --- a/src/fava/core/commodities.py +++ b/src/fava/core/commodities.py @@ -1,4 +1,5 @@ """Attributes for auto-completion.""" + from __future__ import annotations from contextlib import suppress diff --git a/src/fava/core/conversion.py b/src/fava/core/conversion.py index 5395141c6..4f24a990b 100644 --- a/src/fava/core/conversion.py +++ b/src/fava/core/conversion.py @@ -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 diff --git a/src/fava/core/documents.py b/src/fava/core/documents.py index 0eb32cf7b..aa505dedb 100644 --- a/src/fava/core/documents.py +++ b/src/fava/core/documents.py @@ -1,4 +1,5 @@ """Document path related helpers.""" + from __future__ import annotations from os import altsep diff --git a/src/fava/core/extensions.py b/src/fava/core/extensions.py index 49f564de0..8a593ac01 100644 --- a/src/fava/core/extensions.py +++ b/src/fava/core/extensions.py @@ -1,4 +1,5 @@ """Fava extensions.""" + from __future__ import annotations from dataclasses import dataclass diff --git a/src/fava/core/fava_options.py b/src/fava/core/fava_options.py index 4434320b7..134bcf1d2 100644 --- a/src/fava/core/fava_options.py +++ b/src/fava/core/fava_options.py @@ -5,6 +5,7 @@ parsing the options. """ + from __future__ import annotations import re diff --git a/src/fava/core/file.py b/src/fava/core/file.py index 65d70ef2e..fae317492 100644 --- a/src/fava/core/file.py +++ b/src/fava/core/file.py @@ -1,4 +1,5 @@ """Reading/writing Beancount files.""" + from __future__ import annotations import re diff --git a/src/fava/core/filters.py b/src/fava/core/filters.py index df829f588..b918ea69e 100644 --- a/src/fava/core/filters.py +++ b/src/fava/core/filters.py @@ -1,4 +1,5 @@ """Entry filters.""" + from __future__ import annotations import re diff --git a/src/fava/core/group_entries.py b/src/fava/core/group_entries.py index 148279fcc..d53d0f112 100644 --- a/src/fava/core/group_entries.py +++ b/src/fava/core/group_entries.py @@ -1,4 +1,5 @@ """Entries grouped by type.""" + from __future__ import annotations from collections import defaultdict diff --git a/src/fava/core/ingest.py b/src/fava/core/ingest.py index 67a838009..504e40f62 100644 --- a/src/fava/core/ingest.py +++ b/src/fava/core/ingest.py @@ -1,4 +1,5 @@ """Ingest helper functions.""" + from __future__ import annotations import datetime diff --git a/src/fava/core/inventory.py b/src/fava/core/inventory.py index 7fb952062..8b8678105 100644 --- a/src/fava/core/inventory.py +++ b/src/fava/core/inventory.py @@ -1,4 +1,5 @@ """Alternative implementation of Beancount's Inventory.""" + from __future__ import annotations from decimal import Decimal diff --git a/src/fava/core/misc.py b/src/fava/core/misc.py index e5f2bf330..df475885c 100644 --- a/src/fava/core/misc.py +++ b/src/fava/core/misc.py @@ -1,4 +1,5 @@ """Some miscellaneous reports.""" + from __future__ import annotations import datetime diff --git a/src/fava/core/module_base.py b/src/fava/core/module_base.py index 2c7a97169..0b69302a8 100644 --- a/src/fava/core/module_base.py +++ b/src/fava/core/module_base.py @@ -1,4 +1,5 @@ """Base class for the "modules" of FavaLedger.""" + from __future__ import annotations from typing import TYPE_CHECKING diff --git a/src/fava/core/number.py b/src/fava/core/number.py index ad0f0b1b2..ff461b6c0 100644 --- a/src/fava/core/number.py +++ b/src/fava/core/number.py @@ -1,4 +1,5 @@ """Formatting numbers.""" + from __future__ import annotations import copy diff --git a/src/fava/core/query_shell.py b/src/fava/core/query_shell.py index 8038c7c57..7f42708ca 100644 --- a/src/fava/core/query_shell.py +++ b/src/fava/core/query_shell.py @@ -1,4 +1,5 @@ """For using the Beancount shell from Fava.""" + from __future__ import annotations import contextlib diff --git a/src/fava/core/tree.py b/src/fava/core/tree.py index a30c46bbb..1efc108f0 100644 --- a/src/fava/core/tree.py +++ b/src/fava/core/tree.py @@ -1,4 +1,5 @@ """Account balance trees.""" + from __future__ import annotations from collections import defaultdict diff --git a/src/fava/core/watcher.py b/src/fava/core/watcher.py index 1b32953ed..2c7663366 100644 --- a/src/fava/core/watcher.py +++ b/src/fava/core/watcher.py @@ -1,4 +1,5 @@ """A simple file and folder watcher.""" + from __future__ import annotations from os import walk diff --git a/src/fava/ext/__init__.py b/src/fava/ext/__init__.py index 45058cce7..3f83c689d 100644 --- a/src/fava/ext/__init__.py +++ b/src/fava/ext/__init__.py @@ -1,4 +1,5 @@ """Fava's extension system.""" + from __future__ import annotations import ast @@ -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] diff --git a/src/fava/ext/auto_commit.py b/src/fava/ext/auto_commit.py index 047ca0a79..aae0c25ce 100644 --- a/src/fava/ext/auto_commit.py +++ b/src/fava/ext/auto_commit.py @@ -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 diff --git a/src/fava/ext/portfolio_list/__init__.py b/src/fava/ext/portfolio_list/__init__.py index 81dfc3b85..04af96ece 100644 --- a/src/fava/ext/portfolio_list/__init__.py +++ b/src/fava/ext/portfolio_list/__init__.py @@ -2,6 +2,7 @@ This is a simple example of Fava's extension reports system. """ + from __future__ import annotations import re diff --git a/src/fava/help/__init__.py b/src/fava/help/__init__.py index 5b4897c80..d7396c2cd 100644 --- a/src/fava/help/__init__.py +++ b/src/fava/help/__init__.py @@ -1,4 +1,5 @@ """List of all available help pages.""" + from __future__ import annotations HELP_PAGES = { diff --git a/src/fava/helpers.py b/src/fava/helpers.py index 04baa8d30..2365902ed 100644 --- a/src/fava/helpers.py +++ b/src/fava/helpers.py @@ -1,4 +1,5 @@ """Exceptions and module base class.""" + from __future__ import annotations from typing import NamedTuple diff --git a/src/fava/internal_api.py b/src/fava/internal_api.py index ae50ff001..f7fd9bf94 100644 --- a/src/fava/internal_api.py +++ b/src/fava/internal_api.py @@ -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 diff --git a/src/fava/json_api.py b/src/fava/json_api.py index df7d7fee1..ddc51f4da 100644 --- a/src/fava/json_api.py +++ b/src/fava/json_api.py @@ -3,6 +3,7 @@ This module contains the url endpoints of the JSON API that is used by the web interface for asynchronous functionality. """ + from __future__ import annotations import shutil diff --git a/src/fava/plugins/__init__.py b/src/fava/plugins/__init__.py index ea71cdd0b..5076461bb 100644 --- a/src/fava/plugins/__init__.py +++ b/src/fava/plugins/__init__.py @@ -1,2 +1,3 @@ """Some Beancount plugins.""" + from __future__ import annotations diff --git a/src/fava/plugins/link_documents.py b/src/fava/plugins/link_documents.py index 301dafcd8..a7c2a4f2b 100644 --- a/src/fava/plugins/link_documents.py +++ b/src/fava/plugins/link_documents.py @@ -4,6 +4,7 @@ associate them to Document entries. For transactions, it then also adds a link from the transaction to documents, as well as the "#linked" tag. """ + from __future__ import annotations from collections import defaultdict diff --git a/src/fava/plugins/tag_discovered_documents.py b/src/fava/plugins/tag_discovered_documents.py index f115ae142..d98bf1d05 100644 --- a/src/fava/plugins/tag_discovered_documents.py +++ b/src/fava/plugins/tag_discovered_documents.py @@ -3,6 +3,7 @@ It looks through all Document entries that were added by Beancount automatically through file discovery and adds the tag "#discovered". """ + from __future__ import annotations from typing import TYPE_CHECKING diff --git a/src/fava/serialisation.py b/src/fava/serialisation.py index ee04882f4..8a2e18b78 100644 --- a/src/fava/serialisation.py +++ b/src/fava/serialisation.py @@ -7,6 +7,7 @@ This is not intended to work well enough for full roundtrips yet. """ + from __future__ import annotations import datetime diff --git a/src/fava/template_filters.py b/src/fava/template_filters.py index 274cf2634..cf560ba42 100644 --- a/src/fava/template_filters.py +++ b/src/fava/template_filters.py @@ -2,6 +2,7 @@ All functions in this module will be automatically added as template filters. """ + from __future__ import annotations from decimal import Decimal diff --git a/src/fava/util/__init__.py b/src/fava/util/__init__.py index 11e3f34cf..d88cf78a4 100644 --- a/src/fava/util/__init__.py +++ b/src/fava/util/__init__.py @@ -1,4 +1,5 @@ """Some small utility functions.""" + from __future__ import annotations import logging diff --git a/src/fava/util/date.py b/src/fava/util/date.py index fc3380d7f..b2fbdd8c6 100644 --- a/src/fava/util/date.py +++ b/src/fava/util/date.py @@ -4,6 +4,7 @@ Date ranges are always tuples (start, end) from the (inclusive) start date to the (exclusive) end date. """ + from __future__ import annotations import datetime diff --git a/src/fava/util/excel.py b/src/fava/util/excel.py index e44db383e..6f393f32f 100644 --- a/src/fava/util/excel.py +++ b/src/fava/util/excel.py @@ -1,4 +1,5 @@ """Writing query results to CSV and spreadsheet documents.""" + from __future__ import annotations import csv diff --git a/src/fava/util/ranking.py b/src/fava/util/ranking.py index a3b2689e0..3a0a85e26 100644 --- a/src/fava/util/ranking.py +++ b/src/fava/util/ranking.py @@ -1,4 +1,5 @@ """Ranking utilities.""" + from __future__ import annotations import math diff --git a/src/fava/util/sets.py b/src/fava/util/sets.py index d49fcb4a5..3def2a4fd 100644 --- a/src/fava/util/sets.py +++ b/src/fava/util/sets.py @@ -1,4 +1,5 @@ """Utils for Python sets.""" + from __future__ import annotations from typing import AbstractSet diff --git a/tests/conftest.py b/tests/conftest.py index f9a69e30f..358b2468c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,5 @@ """Test fixtures.""" + # pylint: disable=redefined-outer-name from __future__ import annotations diff --git a/tests/data/import_config.py b/tests/data/import_config.py index 68164d108..6fde669c0 100644 --- a/tests/data/import_config.py +++ b/tests/data/import_config.py @@ -1,4 +1,5 @@ """Test importer for Fava.""" + from __future__ import annotations import csv diff --git a/tests/test_application.py b/tests/test_application.py index 677ca671d..8ce29ab88 100644 --- a/tests/test_application.py +++ b/tests/test_application.py @@ -1,4 +1,5 @@ """Tests for Fava's main Flask app.""" + from __future__ import annotations from typing import TYPE_CHECKING diff --git a/tests/test_core_budgets.py b/tests/test_core_budgets.py index 26b04f290..8a4e7fa02 100644 --- a/tests/test_core_budgets.py +++ b/tests/test_core_budgets.py @@ -1,4 +1,5 @@ """Fava's budget syntax.""" + from __future__ import annotations from datetime import date diff --git a/tests/test_extensions.py b/tests/test_extensions.py index 5cc2fc0b8..fb1b40b59 100644 --- a/tests/test_extensions.py +++ b/tests/test_extensions.py @@ -1,4 +1,5 @@ """Tests for the extension system.""" + from __future__ import annotations from typing import TYPE_CHECKING diff --git a/tests/test_internal_api.py b/tests/test_internal_api.py index 76df4e4b8..641d8f233 100644 --- a/tests/test_internal_api.py +++ b/tests/test_internal_api.py @@ -1,4 +1,5 @@ """Tests for Fava's main Flask app.""" + from __future__ import annotations from typing import TYPE_CHECKING