Skip to content

Commit

Permalink
fixed all tests/ci/etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
wolph committed Jan 15, 2025
1 parent 21bfdb4 commit de3b084
Show file tree
Hide file tree
Showing 21 changed files with 275 additions and 165 deletions.
25 changes: 25 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
target-branch: master
labels:
- "meta: CI"
schedule:
interval: monthly
groups:
actions:
patterns:
- "*"

- package-ecosystem: pip
directory: /
target-branch: master
labels:
- "meta: deps"
schedule:
interval: monthly
groups:
actions:
patterns:
- "*"
6 changes: 5 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ on:
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Close stale issues and pull requests
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Run every day at midnight
- cron: "0 0 * * *" # Run every day at midnight

jobs:
stale:
Expand All @@ -14,4 +14,3 @@ jobs:
days-before-stale: 30
exempt-issue-labels: in-progress,help-wanted,pinned,security,enhancement
exempt-all-pr-assignees: true

44 changes: 44 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,40 @@ ci:
autoupdate_branch: "master"
autoupdate_commit_msg: "⬆️ update pre-commit hooks"

exclude: "^mt940_tests/self-provided/"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-illegal-windows-names
- id: check-json
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-symlinks
- id: check-toml

- id: check-vcs-permalinks
- id: check-xml
- id: debug-statements
- id: destroyed-symlinks
- id: detect-aws-credentials
args: [--allow-missing-credentials]
- id: detect-private-key
- id: fix-byte-order-marker
- id: forbid-submodules
- id: name-tests-test
args: [--pytest-test-first]
- id: no-commit-to-branch
args: [--branch, master]
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.1
hooks:
Expand All @@ -13,3 +46,14 @@ repos:
- id: ruff-format
types_or: [python, pyi]

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
args: ['--skip="*/htmlcov,./docs/_build,*.asc,*.yml,*.sta,*.txt,*.html,./docs/html"']

- repo: https://github.com/rbubley/mirrors-prettier
rev: "v3.4.2"
hooks:
- id: prettier
types_or: ['markdown']
6 changes: 3 additions & 3 deletions mt940/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,8 @@ def currency(self) -> str | None:
self.data.get('d_floor_limit'),
)

if balance:
if isinstance(balance, Amount):
if balance is not None:
if hasattr(balance, 'currency'): # type: ignore[unreachable]
return balance.currency

return balance.amount.currency
Expand Down Expand Up @@ -602,7 +602,7 @@ def sanitize_tag_id_matches(
return valid_matches


class TransactionsAndTransaction(Transactions, Transaction):
class TransactionsAndTransaction(Transactions, Transaction): # type: ignore[misc]
"""
Subclass of both Transactions and Transaction for scope definitions.
Expand Down
13 changes: 12 additions & 1 deletion mt940/processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import collections
import functools
import re
import typing
from typing import TYPE_CHECKING, Any, Callable

if TYPE_CHECKING:
Expand Down Expand Up @@ -373,7 +374,17 @@ def transaction_details_post_processor(
"""


def transactions_to_transaction(*keys: str):
def transactions_to_transaction(
*keys: str,
) -> typing.Callable[
[
models.Transactions,
tags.Tag,
dict[str, Any],
dict[str, Any],
],
dict[str, Any],
]:
"""
Copy the global transactions details to the transaction.
Expand Down
2 changes: 1 addition & 1 deletion mt940/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def __call__(
"""
return value

def __new__(cls, *args: typing.Any, **kwargs: typing.Any):
def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Tag:
"""
Creates a new Tag instance and sets up logging details.
"""
Expand Down
86 changes: 43 additions & 43 deletions mt940_tests/ASNB/mt940.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
:61:2001010101D65,00NOVBNL47INGB9999999999
hr gjlm paulissen
:86:NL47INGB9999999999 hr gjlm paulissen
Betaling sieraden

Betaling sieraden



:62F:C200101EUR379,29
-}{5:}
{1:F01ASNBNL21XXXX0000000000}{2:O940ASNBNL21XXXXN}{3:}{4:
Expand Down Expand Up @@ -42,19 +42,19 @@ Betaling sieraden
:61:2001050105C1000,00NIOBNL56ASNB9999999999
paulissen g j l m
:86:NL56ASNB9999999999 paulissen g j l m
INTERNE OVERBOEKING VIA MOBIEL

INTERNE OVERBOEKING VIA MOBIEL



:61:2001050105D801,55NIDBNL08ABNA9999999999
international card services
:86:NL08ABNA9999999999 international card services
international card services
:86:NL08ABNA9999999999 international card services

000000000000000000000000000000000 0000000000000000 Betaling aan I
CS 99999999999 ICS Referentie: 2020-01-05 19:47 000000000000000
CS 99999999999 ICS Referentie: 2020-01-05 19:47 000000000000000


:62F:C200105EUR577,74
-}{5:}
{1:F01ASNBNL21XXXX0000000000}{2:O940ASNBNL21XXXXN}{3:}{4:
Expand Down Expand Up @@ -196,12 +196,12 @@ CS 99999999999 ICS Referentie: 2020-01-05 19:47 000000000000000
:28C:25/1
:60F:C200125EUR577,74
:61:2001250125D1,65NDIV
:86:
Kosten gebruik betaalrekening inclusief 1 betaalpas
:86:

Kosten gebruik betaalrekening inclusief 1 betaalpas



:62F:C200125EUR576,09
-}{5:}
{1:F01ASNBNL21XXXX0000000000}{2:O940ASNBNL21XXXXN}{3:}{4:
Expand Down Expand Up @@ -233,19 +233,19 @@ Kosten gebruik betaalrekening inclusief 1 betaalpas
:61:2001290129C828,72NOVBNL25INGB9999999999
transfer solutions bv
:86:NL25INGB9999999999 transfer solutions bv

2020-01-28T14:32:46-000000000000089-NL25INGB9999999999-Transfer S
olutions BV-DIVIDEND 28/01/2020
olutions BV-DIVIDEND 28/01/2020


:61:2001290129D1000,00NIDBNL08ABNA9999999999
international card services
:86:NL08ABNA9999999999 international card services
international card services
:86:NL08ABNA9999999999 international card services

000000000000000000000000000000000 0000000000000000 Betaling aan I
CS 99999999999 ICS Referentie: 2020-01-29 18:36 000000000000000
CS 99999999999 ICS Referentie: 2020-01-29 18:36 000000000000000


:62F:C200129EUR404,81
-}{5:}
{1:F01ASNBNL21XXXX0000000000}{2:O940ASNBNL21XXXXN}{3:}{4:
Expand All @@ -263,18 +263,18 @@ CS 99999999999 ICS Referentie: 2020-01-29 18:36 000000000000000
:61:2001310131C1000,18NIOBNL56ASNB9999999999
paulissen g j l m
:86:NL56ASNB9999999999 paulissen g j l m
INTERNE OVERBOEKING VIA MOBIEL

INTERNE OVERBOEKING VIA MOBIEL



:61:2001310131D903,76NIDBNL08ABNA9999999999
international card services
:86:NL08ABNA9999999999 international card services
international card services
:86:NL08ABNA9999999999 international card services

000000000000000000000000000000000 0000000000000000 Betaling aan I
CS 99999999999 ICS Referentie: 2020-01-31 21:27 000000000000000
CS 99999999999 ICS Referentie: 2020-01-31 21:27 000000000000000


:62F:C200131EUR501,23
-}{5:}
22 changes: 11 additions & 11 deletions mt940_tests/ASNB/mt940_with_spaces_for_entry_date.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
:61:200101 D65,00NOVBNL47INGB9999999999
hr gjlm paulissen
:86:NL47INGB9999999999 hr gjlm paulissen
Betaling sieraden

Betaling sieraden



:62F:C200101EUR379,29
-}{5:}
{1:F01ASNBNL21XXXX0000000000}{2:O940ASNBNL21XXXXN}{3:}{4:
Expand Down Expand Up @@ -269,12 +269,12 @@ INTERNE OVERBOEKING VIA MOBIEL


:61:200131 D903,76NIDBNL08ABNA9999999999
international card services
:86:NL08ABNA9999999999 international card services
international card services
:86:NL08ABNA9999999999 international card services

000000000000000000000000000000000 0000000000000000 Betaling aan I
CS 99999999999 ICS Referentie: 2020-01-31 21:27 000000000000000
CS 99999999999 ICS Referentie: 2020-01-31 21:27 000000000000000


:62F:C200131EUR501,23
-}{5:}
Loading

0 comments on commit de3b084

Please sign in to comment.