diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b8a276d6..d725514a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,6 @@ name: Build + on: [push, pull_request] jobs: @@ -15,22 +16,22 @@ jobs: - '3.9' - '3.10' node-version: - - '15.x' + - '18.x' runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: # Need full history to determine version number. fetch-depth: 0 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - uses: actions/cache@v2 + - uses: actions/cache@v4 with: path: "**/node_modules" key: ${{ runner.os }}-${{ matrix.node-version }}-node_modules-${{ hashFiles('**/package-lock.json') }} @@ -50,7 +51,7 @@ jobs: - name: Build wheel run: python setup.py bdist_wheel - name: Upload wheels as artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 if: ${{ runner.os == 'Linux' && matrix.python-version == '3.9' }} with: name: python-packages @@ -65,7 +66,7 @@ jobs: needs: - tox steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v4.1.7 with: name: python-packages path: dist diff --git a/beancount_import/matching.py b/beancount_import/matching.py index 54bde06a..f9f5710c 100644 --- a/beancount_import/matching.py +++ b/beancount_import/matching.py @@ -314,7 +314,7 @@ def search_postings(self, negate=False) -> Iterable[SearchPosting]: # Prepare postings for searching postings_date_currency = collections.defaultdict(list) - + for mp in mps: weight = get_posting_weight(mp.posting) if weight is None: @@ -1489,8 +1489,9 @@ def get_combined_transactions(txns: Tuple[Transaction, Transaction], for match_sets in itertools.product(*match_groups.values()): combined_matches = sum((match_set.matches for match_set in match_sets), []) # type: PostingMatches - combined_removals = sum((match_set.removals - for match_set in match_sets), ()) + combined_removals: MatchablePostings = tuple(removal + for match_set in match_sets + for removal in match_set.removals) if not combined_matches: continue for m in combined_matches: diff --git a/beancount_import/source/amazon_invoice.py b/beancount_import/source/amazon_invoice.py index 8dd48ef9..608cf357 100644 --- a/beancount_import/source/amazon_invoice.py +++ b/beancount_import/source/amazon_invoice.py @@ -29,7 +29,7 @@ | +-> returns Order """ -from typing import NamedTuple, Optional, List, Union, Iterable, Dict, Sequence, cast +from typing import NamedTuple, Optional, List, Union, Iterable, Dict, Sequence, cast, Type from abc import ABC, abstractmethod import collections import re @@ -293,7 +293,7 @@ def parse_date(date_str) -> datetime.date: return dateutil.parser.parse(date_str, parserinfo=Locale_de_DE._parserinfo(dayfirst=True)).date() -LOCALES = {x.LOCALE: x for x in [Locale_en_US, Locale_de_DE]} +LOCALES: Dict[str, Type[Locale_Data]] = {x.LOCALE: x for x in [Locale_en_US, Locale_de_DE]} Errors = List[str] Adjustment = NamedTuple('Adjustment', [ diff --git a/setup.py b/setup.py index 4a03081c..e6f8a324 100644 --- a/setup.py +++ b/setup.py @@ -165,7 +165,7 @@ def run(self): python_requires='>=3.8', setup_requires=['setuptools_scm>=5.0.2'], install_requires=[ - 'beancount>=2.1.3', + 'beancount<3', 'tornado', 'numpy', 'scipy', diff --git a/tox.ini b/tox.ini index 8ab7d0cf..c180b749 100644 --- a/tox.ini +++ b/tox.ini @@ -6,5 +6,5 @@ deps = typing-extensions commands = - mypy beancount_import --install-types --non-interactive + mypy beancount_import --install-types --non-interactive --disable-error-code=type-abstract coverage run -m pytest -vv