bankstatementparser-lsp 0.0.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bankstatementparser_lsp/__init__.py +31 -0
- bankstatementparser_lsp/diagnostics.py +162 -0
- bankstatementparser_lsp/server.py +106 -0
- bankstatementparser_lsp-0.0.10.dist-info/METADATA +402 -0
- bankstatementparser_lsp-0.0.10.dist-info/RECORD +8 -0
- bankstatementparser_lsp-0.0.10.dist-info/WHEEL +4 -0
- bankstatementparser_lsp-0.0.10.dist-info/entry_points.txt +3 -0
- bankstatementparser_lsp-0.0.10.dist-info/licenses/LICENSE +189 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Copyright (C) 2023-2026 Bank Statement Parser. All rights reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
12
|
+
# implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
"""LSP server for MT940 bank statement files (bankstatementparser).
|
|
17
|
+
|
|
18
|
+
The :mod:`bankstatementparser_lsp.diagnostics` module holds a pure,
|
|
19
|
+
dependency-free diagnostic engine; :mod:`bankstatementparser_lsp.server`
|
|
20
|
+
wires it to an editor over stdio using ``pygls``.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
from bankstatementparser_lsp.diagnostics import (
|
|
24
|
+
Diagnostic,
|
|
25
|
+
Severity,
|
|
26
|
+
diagnostics_for_mt940,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
__version__ = "0.0.10"
|
|
30
|
+
|
|
31
|
+
__all__ = ["Diagnostic", "Severity", "diagnostics_for_mt940"]
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# Copyright (C) 2023-2026 Bank Statement Parser. All rights reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
12
|
+
# implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
"""Pure diagnostic engine for MT940 bank statement documents.
|
|
17
|
+
|
|
18
|
+
No LSP or editor dependencies, so it is unit-testable in isolation.
|
|
19
|
+
Given the raw text of an MT940 (``.mt940``/``.sta``) file it returns a
|
|
20
|
+
list of :class:`Diagnostic` objects locating missing mandatory tags and
|
|
21
|
+
malformed balance / statement lines, using the same tag patterns the
|
|
22
|
+
bankstatementparser MT940 parser relies on.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
import re
|
|
26
|
+
from dataclasses import dataclass
|
|
27
|
+
from enum import IntEnum
|
|
28
|
+
|
|
29
|
+
_BALANCE_RE = re.compile(r"^:(60F|62F):[CD]\d{6}[A-Z]{3}[0-9,]+$")
|
|
30
|
+
_STATEMENT_RE = re.compile(r"^:61:\d{6}(?:\d{4})?[CD][0-9,]+.*$")
|
|
31
|
+
_REQUIRED_TAGS: tuple[str, ...] = (":20:", ":25:", ":28C:", ":60F:", ":62F:")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class Severity(IntEnum):
|
|
35
|
+
"""Diagnostic severity, matching the LSP numeric scale."""
|
|
36
|
+
|
|
37
|
+
ERROR = 1
|
|
38
|
+
WARNING = 2
|
|
39
|
+
INFORMATION = 3
|
|
40
|
+
HINT = 4
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@dataclass(frozen=True)
|
|
44
|
+
class Diagnostic:
|
|
45
|
+
"""A single editor diagnostic over a 0-based line/character range.
|
|
46
|
+
|
|
47
|
+
Attributes:
|
|
48
|
+
line: Zero-based line index of the affected text.
|
|
49
|
+
col_start: Zero-based start character on the line.
|
|
50
|
+
col_end: Zero-based end character (exclusive) on the line.
|
|
51
|
+
severity: Diagnostic severity.
|
|
52
|
+
message: Human-readable description of the problem.
|
|
53
|
+
code: Stable machine-readable rule identifier.
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
line: int
|
|
57
|
+
col_start: int
|
|
58
|
+
col_end: int
|
|
59
|
+
severity: Severity
|
|
60
|
+
message: str
|
|
61
|
+
code: str
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _tag_of(stripped: str) -> str | None:
|
|
65
|
+
"""Return the leading ``:tag:`` of a stripped line, if any.
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
stripped: A whitespace-stripped MT940 line.
|
|
69
|
+
|
|
70
|
+
Returns:
|
|
71
|
+
The tag token including its colons, or ``None`` when the line
|
|
72
|
+
does not begin with a tag.
|
|
73
|
+
"""
|
|
74
|
+
match = re.match(r"^:[0-9]{2}[A-Z]?:", stripped)
|
|
75
|
+
return match.group(0) if match is not None else None
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def diagnostics_for_mt940(text: str) -> list[Diagnostic]:
|
|
79
|
+
"""Lint an MT940 statement document and return diagnostics.
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
text: The full text of the MT940 document.
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
A list of :class:`Diagnostic` objects (empty when the document
|
|
86
|
+
is clean or has no content).
|
|
87
|
+
"""
|
|
88
|
+
lines = text.splitlines()
|
|
89
|
+
if not any(line.strip() for line in lines):
|
|
90
|
+
return []
|
|
91
|
+
|
|
92
|
+
diagnostics: list[Diagnostic] = []
|
|
93
|
+
seen_tags: set[str] = set()
|
|
94
|
+
seen_statement = False
|
|
95
|
+
|
|
96
|
+
for index, raw_line in enumerate(lines):
|
|
97
|
+
stripped = raw_line.strip()
|
|
98
|
+
if not stripped:
|
|
99
|
+
continue
|
|
100
|
+
tag = _tag_of(stripped)
|
|
101
|
+
if tag is not None:
|
|
102
|
+
seen_tags.add(tag)
|
|
103
|
+
|
|
104
|
+
if tag in (":60F:", ":62F:") and not _BALANCE_RE.match(stripped):
|
|
105
|
+
diagnostics.append(
|
|
106
|
+
Diagnostic(
|
|
107
|
+
line=index,
|
|
108
|
+
col_start=0,
|
|
109
|
+
col_end=len(raw_line),
|
|
110
|
+
severity=Severity.ERROR,
|
|
111
|
+
message=(
|
|
112
|
+
f"Malformed balance line {tag} — expected "
|
|
113
|
+
"C/D + YYMMDD + 3-letter currency + amount"
|
|
114
|
+
),
|
|
115
|
+
code="malformed-balance",
|
|
116
|
+
)
|
|
117
|
+
)
|
|
118
|
+
elif tag == ":61:":
|
|
119
|
+
if _STATEMENT_RE.match(stripped):
|
|
120
|
+
seen_statement = True
|
|
121
|
+
else:
|
|
122
|
+
diagnostics.append(
|
|
123
|
+
Diagnostic(
|
|
124
|
+
line=index,
|
|
125
|
+
col_start=0,
|
|
126
|
+
col_end=len(raw_line),
|
|
127
|
+
severity=Severity.ERROR,
|
|
128
|
+
message=(
|
|
129
|
+
"Malformed :61: statement line — expected "
|
|
130
|
+
"YYMMDD + C/D + amount"
|
|
131
|
+
),
|
|
132
|
+
code="malformed-statement-line",
|
|
133
|
+
)
|
|
134
|
+
)
|
|
135
|
+
elif tag == ":86:" and not seen_statement:
|
|
136
|
+
diagnostics.append(
|
|
137
|
+
Diagnostic(
|
|
138
|
+
line=index,
|
|
139
|
+
col_start=0,
|
|
140
|
+
col_end=len(raw_line),
|
|
141
|
+
severity=Severity.WARNING,
|
|
142
|
+
message=(
|
|
143
|
+
":86: information line has no preceding :61: "
|
|
144
|
+
"statement line; it will be ignored"
|
|
145
|
+
),
|
|
146
|
+
code="orphan-information-line",
|
|
147
|
+
)
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
for tag in _REQUIRED_TAGS:
|
|
151
|
+
if tag not in seen_tags:
|
|
152
|
+
diagnostics.append(
|
|
153
|
+
Diagnostic(
|
|
154
|
+
line=0,
|
|
155
|
+
col_start=0,
|
|
156
|
+
col_end=len(lines[0]),
|
|
157
|
+
severity=Severity.ERROR,
|
|
158
|
+
message=f"Missing mandatory MT940 tag: {tag}",
|
|
159
|
+
code="missing-tag",
|
|
160
|
+
)
|
|
161
|
+
)
|
|
162
|
+
return diagnostics
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Copyright (C) 2023-2026 Bank Statement Parser. All rights reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
12
|
+
# implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
"""Language Server (stdio) for MT940 bank statement files.
|
|
17
|
+
|
|
18
|
+
Wraps the pure :mod:`bankstatementparser_lsp.diagnostics` engine in a
|
|
19
|
+
``pygls`` server so editors get live missing-tag and malformed-line
|
|
20
|
+
diagnostics as they type. Run it with ``bankstatementparser-lsp``.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
from lsprotocol import types as lsp
|
|
24
|
+
from pygls.server import LanguageServer
|
|
25
|
+
|
|
26
|
+
from bankstatementparser_lsp import __version__
|
|
27
|
+
from bankstatementparser_lsp.diagnostics import (
|
|
28
|
+
Diagnostic,
|
|
29
|
+
diagnostics_for_mt940,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
server = LanguageServer("bankstatementparser-lsp", __version__)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _to_lsp_diagnostic(diagnostic: Diagnostic) -> lsp.Diagnostic:
|
|
36
|
+
"""Convert an internal diagnostic to an LSP diagnostic.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
diagnostic: The engine-produced diagnostic.
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
The equivalent ``lsprotocol`` diagnostic.
|
|
43
|
+
"""
|
|
44
|
+
return lsp.Diagnostic(
|
|
45
|
+
range=lsp.Range(
|
|
46
|
+
start=lsp.Position(
|
|
47
|
+
line=diagnostic.line, character=diagnostic.col_start
|
|
48
|
+
),
|
|
49
|
+
end=lsp.Position(
|
|
50
|
+
line=diagnostic.line, character=diagnostic.col_end
|
|
51
|
+
),
|
|
52
|
+
),
|
|
53
|
+
message=diagnostic.message,
|
|
54
|
+
severity=lsp.DiagnosticSeverity(diagnostic.severity.value),
|
|
55
|
+
code=diagnostic.code,
|
|
56
|
+
source="bankstatementparser",
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _publish(ls: LanguageServer, uri: str) -> None:
|
|
61
|
+
"""Lint a document and publish its diagnostics to the client.
|
|
62
|
+
|
|
63
|
+
Args:
|
|
64
|
+
ls: The active language server.
|
|
65
|
+
uri: URI of the document to lint.
|
|
66
|
+
"""
|
|
67
|
+
document = ls.workspace.get_text_document(uri)
|
|
68
|
+
diagnostics = [
|
|
69
|
+
_to_lsp_diagnostic(d) for d in diagnostics_for_mt940(document.source)
|
|
70
|
+
]
|
|
71
|
+
ls.publish_diagnostics(uri, diagnostics)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@server.feature(lsp.TEXT_DOCUMENT_DID_OPEN)
|
|
75
|
+
def did_open(
|
|
76
|
+
ls: LanguageServer, params: lsp.DidOpenTextDocumentParams
|
|
77
|
+
) -> None: # pragma: no cover - thin pygls event binding
|
|
78
|
+
"""Lint a document when it is opened.
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
ls: The active language server.
|
|
82
|
+
params: The open-document notification parameters.
|
|
83
|
+
"""
|
|
84
|
+
_publish(ls, params.text_document.uri)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
@server.feature(lsp.TEXT_DOCUMENT_DID_CHANGE)
|
|
88
|
+
def did_change(
|
|
89
|
+
ls: LanguageServer, params: lsp.DidChangeTextDocumentParams
|
|
90
|
+
) -> None: # pragma: no cover - thin pygls event binding
|
|
91
|
+
"""Re-lint a document when it changes.
|
|
92
|
+
|
|
93
|
+
Args:
|
|
94
|
+
ls: The active language server.
|
|
95
|
+
params: The change-document notification parameters.
|
|
96
|
+
"""
|
|
97
|
+
_publish(ls, params.text_document.uri)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def main() -> None: # pragma: no cover - process entry point
|
|
101
|
+
"""Start the language server over stdio."""
|
|
102
|
+
server.start_io()
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
if __name__ == "__main__": # pragma: no cover
|
|
106
|
+
main()
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bankstatementparser-lsp
|
|
3
|
+
Version: 0.0.10
|
|
4
|
+
Summary: Language Server Protocol (LSP) server for linting MT940 bank statement files with the bankstatementparser library.
|
|
5
|
+
License: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Author: Sebastien Rousseau
|
|
8
|
+
Author-email: sebastian.rousseau@gmail.com
|
|
9
|
+
Requires-Python: >=3.10,<4.0
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Requires-Dist: bankstatementparser (>=0.0.9)
|
|
18
|
+
Requires-Dist: pygls (>=1.3,<2)
|
|
19
|
+
Project-URL: Homepage, https://bankstatementparser.com
|
|
20
|
+
Project-URL: Repository, https://github.com/sebastienrousseau/bankstatementparser-lsp
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
<!-- SPDX-License-Identifier: Apache-2.0 -->
|
|
24
|
+
|
|
25
|
+
<p align="center">
|
|
26
|
+
<img
|
|
27
|
+
src="https://cloudcdn.pro/bankstatementparser/v1/logos/bankstatementparser.svg"
|
|
28
|
+
alt="bankstatementparser-lsp logo"
|
|
29
|
+
width="120"
|
|
30
|
+
height="120"
|
|
31
|
+
/>
|
|
32
|
+
</p>
|
|
33
|
+
|
|
34
|
+
<h1 align="center">bankstatementparser-lsp</h1>
|
|
35
|
+
|
|
36
|
+
<p align="center">
|
|
37
|
+
<b>Language Server Protocol server that lints MT940 bank-statement files as you type, backed by the bankstatementparser library.</b>
|
|
38
|
+
</p>
|
|
39
|
+
|
|
40
|
+
<p align="center">
|
|
41
|
+
<a href="https://pypi.org/project/bankstatementparser-lsp/"><img src="https://img.shields.io/pypi/v/bankstatementparser-lsp?style=for-the-badge" alt="PyPI version" /></a>
|
|
42
|
+
<a href="https://pypi.org/project/bankstatementparser-lsp/"><img src="https://img.shields.io/pypi/pyversions/bankstatementparser-lsp.svg?style=for-the-badge" alt="Python versions" /></a>
|
|
43
|
+
<a href="https://pypi.org/project/bankstatementparser-lsp/"><img src="https://img.shields.io/pypi/dm/bankstatementparser-lsp.svg?style=for-the-badge" alt="PyPI downloads" /></a>
|
|
44
|
+
<a href="https://github.com/sebastienrousseau/bankstatementparser-lsp/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/sebastienrousseau/bankstatementparser-lsp/ci.yml?branch=main&label=Tests&style=for-the-badge" alt="Tests" /></a>
|
|
45
|
+
<a href="https://github.com/sebastienrousseau/bankstatementparser-lsp/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/sebastienrousseau/bankstatementparser-lsp/ci.yml?branch=main&label=Coverage&style=for-the-badge" alt="Coverage" /></a>
|
|
46
|
+
<a href="#license"><img src="https://img.shields.io/pypi/l/bankstatementparser-lsp?style=for-the-badge" alt="License" /></a>
|
|
47
|
+
</p>
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Contents
|
|
52
|
+
|
|
53
|
+
**Getting started**
|
|
54
|
+
|
|
55
|
+
- [What is bankstatementparser-lsp?](#what-is-bankstatementparser-lsp) — the problem it solves
|
|
56
|
+
- [Install](#install) — PyPI, virtualenv, Docker
|
|
57
|
+
- [Quick start](#quick-start) — wire it to your editor in 60 seconds
|
|
58
|
+
|
|
59
|
+
**Library reference**
|
|
60
|
+
|
|
61
|
+
- [Features](#features) — live MT940 diagnostics as you type
|
|
62
|
+
- [Editor wiring](#editor-wiring) — Neovim, VS Code, Helix, generic
|
|
63
|
+
- [Using the helpers](#using-the-helpers) — call the diagnostic engine from Python
|
|
64
|
+
- [The bankstatementparser suite](#the-bankstatementparser-suite) — core lib and LSP server
|
|
65
|
+
|
|
66
|
+
**Operational**
|
|
67
|
+
|
|
68
|
+
- [When not to use bankstatementparser-lsp](#when-not-to-use-bankstatementparser-lsp) — honest boundaries
|
|
69
|
+
- [Development](#development) — gates, make targets
|
|
70
|
+
- [Security](#security) — sandboxing posture
|
|
71
|
+
- [Documentation](#documentation) — examples, guides
|
|
72
|
+
- [Contributing](#contributing) — how to get changes in
|
|
73
|
+
- [License](#license) — Apache-2.0
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## What is bankstatementparser-lsp?
|
|
78
|
+
|
|
79
|
+
A **Language Server** speaks the
|
|
80
|
+
[Language Server Protocol (LSP)](https://microsoft.github.io/language-server-protocol/) —
|
|
81
|
+
the editor-agnostic protocol that lets a single backend deliver
|
|
82
|
+
diagnostics to any LSP client (VS Code, Neovim, Helix, Emacs, …).
|
|
83
|
+
**bankstatementparser-lsp** is that backend for **MT940 bank-statement
|
|
84
|
+
files** (`.mt940` / `.sta`): the SWIFT tag-and-line format parsed by the
|
|
85
|
+
[`bankstatementparser`](https://github.com/sebastienrousseau/bankstatementparser)
|
|
86
|
+
library.
|
|
87
|
+
|
|
88
|
+
The diagnostic engine shares the MT940 tag patterns the
|
|
89
|
+
`bankstatementparser` parser relies on, so the squiggles you see in the
|
|
90
|
+
editor match the structure the parser will accept.
|
|
91
|
+
|
|
92
|
+
| Concern | How bankstatementparser-lsp handles it |
|
|
93
|
+
| :--- | :--- |
|
|
94
|
+
| Mandatory tags | Flags any missing `:20:`, `:25:`, `:28C:`, `:60F:`, `:62F:` tag |
|
|
95
|
+
| Balance lines | Validates `:60F:` / `:62F:` against `C/D + YYMMDD + 3-letter currency + amount` |
|
|
96
|
+
| Statement lines | Validates `:61:` against `YYMMDD + C/D + amount` |
|
|
97
|
+
| Information lines | Warns when an `:86:` line has no preceding `:61:` statement line |
|
|
98
|
+
| Live linting | Re-lints on open and on every change, publishing diagnostics back to the editor |
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Install
|
|
103
|
+
|
|
104
|
+
| Channel | Command | Notes |
|
|
105
|
+
| :--- | :--- | :--- |
|
|
106
|
+
| PyPI | `pip install bankstatementparser-lsp` | Pulls in `bankstatementparser >= 0.0.9` + `pygls` |
|
|
107
|
+
| Source | `git clone https://github.com/sebastienrousseau/bankstatementparser-lsp && cd bankstatementparser-lsp && poetry install` | For development |
|
|
108
|
+
| Docker (GHCR) | `docker pull ghcr.io/sebastienrousseau/bankstatementparser-lsp:latest` | Multi-arch (linux/amd64, linux/arm64); runs `bankstatementparser-lsp` over stdio |
|
|
109
|
+
|
|
110
|
+
Requires Python 3.10 or later. Works on macOS, Linux, and Windows.
|
|
111
|
+
|
|
112
|
+
Verify the installation:
|
|
113
|
+
|
|
114
|
+
```sh
|
|
115
|
+
python -c "import bankstatementparser_lsp; print('bankstatementparser-lsp', bankstatementparser_lsp.__version__)"
|
|
116
|
+
# -> bankstatementparser-lsp 0.0.10
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
<details>
|
|
120
|
+
<summary>Using an isolated virtual environment (recommended)</summary>
|
|
121
|
+
|
|
122
|
+
```sh
|
|
123
|
+
python -m venv venv
|
|
124
|
+
source venv/bin/activate # macOS/Linux
|
|
125
|
+
venv\Scripts\activate # Windows
|
|
126
|
+
python -m pip install -U bankstatementparser-lsp
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
</details>
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Quick start
|
|
134
|
+
|
|
135
|
+
The package installs a `bankstatementparser-lsp` console entry point that starts
|
|
136
|
+
the language server over **stdio**:
|
|
137
|
+
|
|
138
|
+
```sh
|
|
139
|
+
bankstatementparser-lsp
|
|
140
|
+
# -> (waiting on stdin for LSP JSON-RPC)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
The command speaks LSP on stdin/stdout — it is meant to be launched by
|
|
144
|
+
your editor's LSP client, not used interactively. Wire it up
|
|
145
|
+
([Editor wiring](#editor-wiring)) and open any MT940 statement file
|
|
146
|
+
(`.mt940` / `.sta`); diagnostics light up as you type.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Features
|
|
151
|
+
|
|
152
|
+
For MT940 bank-statement documents (one statement of SWIFT-style
|
|
153
|
+
`:tag:` lines), `bankstatementparser-lsp` publishes diagnostics:
|
|
154
|
+
|
|
155
|
+
| Rule code | Severity | Behaviour |
|
|
156
|
+
| :--- | :--- | :--- |
|
|
157
|
+
| `missing-tag` | error | A mandatory tag (`:20:`, `:25:`, `:28C:`, `:60F:`, `:62F:`) is absent |
|
|
158
|
+
| `malformed-balance` | error | A `:60F:` / `:62F:` balance line does not match `C/D + YYMMDD + 3-letter currency + amount` |
|
|
159
|
+
| `malformed-statement-line` | error | A `:61:` statement line does not match `YYMMDD + C/D + amount` |
|
|
160
|
+
| `orphan-information-line` | warning | An `:86:` information line has no preceding `:61:` statement line |
|
|
161
|
+
|
|
162
|
+
Diagnostics are republished on `textDocument/didOpen` and
|
|
163
|
+
`textDocument/didChange`, so the editor stays in sync on every keystroke.
|
|
164
|
+
An empty or whitespace-only document produces no diagnostics.
|
|
165
|
+
|
|
166
|
+
The feature logic lives in a pure, importable engine
|
|
167
|
+
(`diagnostics_for_mt940`, returning `Diagnostic` objects with a
|
|
168
|
+
`Severity`); the LSP handlers are thin glue that map those objects to
|
|
169
|
+
`lsprotocol` types.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Editor wiring
|
|
174
|
+
|
|
175
|
+
Register `bankstatementparser-lsp` as the server `cmd` for MT940 files in
|
|
176
|
+
your editor's LSP client. MT940 files commonly use the `.mt940` or `.sta`
|
|
177
|
+
extension; most editors will need a filetype mapping for them.
|
|
178
|
+
|
|
179
|
+
<details>
|
|
180
|
+
<summary>Neovim (built-in <code>vim.lsp.config</code>)</summary>
|
|
181
|
+
|
|
182
|
+
```lua
|
|
183
|
+
-- Map the MT940 extensions to a filetype.
|
|
184
|
+
vim.filetype.add({
|
|
185
|
+
extension = {
|
|
186
|
+
mt940 = "mt940",
|
|
187
|
+
sta = "mt940",
|
|
188
|
+
},
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
vim.lsp.config["bankstatementparser"] = {
|
|
192
|
+
cmd = { "bankstatementparser-lsp" },
|
|
193
|
+
filetypes = { "mt940" },
|
|
194
|
+
root_markers = { ".git" },
|
|
195
|
+
}
|
|
196
|
+
vim.lsp.enable("bankstatementparser")
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
</details>
|
|
200
|
+
|
|
201
|
+
<details>
|
|
202
|
+
<summary>VS Code (bundled scaffold)</summary>
|
|
203
|
+
|
|
204
|
+
A TypeScript language-client scaffold ships at
|
|
205
|
+
[`editors/vscode/`](editors/vscode/) — runnable straight from source:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
cd editors/vscode
|
|
209
|
+
npm install
|
|
210
|
+
npm run compile
|
|
211
|
+
# Press F5 in VS Code to launch an Extension Development Host.
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
`bankstatementparser.serverCommand` (default `bankstatementparser-lsp`) is
|
|
215
|
+
exposed as a setting; the extension activates for `.mt940` / `.sta` files.
|
|
216
|
+
|
|
217
|
+
</details>
|
|
218
|
+
|
|
219
|
+
<details>
|
|
220
|
+
<summary>Helix / Emacs / generic LSP</summary>
|
|
221
|
+
|
|
222
|
+
Any client that can spawn a stdio language server will work. The
|
|
223
|
+
command is `bankstatementparser-lsp` and the documents are MT940
|
|
224
|
+
statement files (`.mt940` / `.sta`).
|
|
225
|
+
|
|
226
|
+
</details>
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## Using the helpers
|
|
231
|
+
|
|
232
|
+
Because the diagnostic engine is pure, you can call it directly — no
|
|
233
|
+
editor or server process required. This is exactly what the server runs
|
|
234
|
+
on each edit:
|
|
235
|
+
|
|
236
|
+
```python
|
|
237
|
+
from bankstatementparser_lsp.diagnostics import diagnostics_for_mt940
|
|
238
|
+
|
|
239
|
+
# A clean MT940 statement produces no diagnostics.
|
|
240
|
+
clean = (
|
|
241
|
+
":20:STARTUMS\n"
|
|
242
|
+
":25:1234567890\n"
|
|
243
|
+
":28C:00001/001\n"
|
|
244
|
+
":60F:C230101EUR1000,00\n"
|
|
245
|
+
":61:2301020102C500,00NTRFNONREF//abc\n"
|
|
246
|
+
":86:Salary payment\n"
|
|
247
|
+
":62F:C230102EUR1500,00"
|
|
248
|
+
)
|
|
249
|
+
assert diagnostics_for_mt940(clean) == []
|
|
250
|
+
|
|
251
|
+
# Missing mandatory tags surface as errors.
|
|
252
|
+
diagnostics = diagnostics_for_mt940(":20:ONLY\n:61:2301020102C5,00NTRF")
|
|
253
|
+
print(len(diagnostics), "issue(s)")
|
|
254
|
+
# -> e.g. "4 issue(s)"
|
|
255
|
+
|
|
256
|
+
# Each diagnostic carries a 0-based range, a severity, and a rule code.
|
|
257
|
+
for d in diagnostics:
|
|
258
|
+
print(d.line, d.code, d.message)
|
|
259
|
+
# -> 0 missing-tag Missing mandatory MT940 tag: :25:
|
|
260
|
+
# ...
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Each `Diagnostic` exposes `line`, `col_start`, `col_end`, `severity`
|
|
264
|
+
(a `Severity` enum matching the LSP numeric scale), `message`, and a
|
|
265
|
+
stable `code` — which the server maps to `lsprotocol.Diagnostic` before
|
|
266
|
+
publishing.
|
|
267
|
+
|
|
268
|
+
The runnable version of this snippet lives in
|
|
269
|
+
[`examples/01_lsp_helpers.py`](examples/01_lsp_helpers.py). See also
|
|
270
|
+
[`02_severity_filtering.py`](examples/02_severity_filtering.py) (grouping
|
|
271
|
+
by severity),
|
|
272
|
+
[`03_lsp_conversion.py`](examples/03_lsp_conversion.py) (the
|
|
273
|
+
`lsprotocol` conversion the server performs), and
|
|
274
|
+
[`04_server_publish.py`](examples/04_server_publish.py) (the server's
|
|
275
|
+
lint-and-publish path driven by a fake `LanguageServer`, so it runs
|
|
276
|
+
without an editor).
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## The bankstatementparser suite
|
|
281
|
+
|
|
282
|
+
`bankstatementparser-lsp` is part of a set of independently installable packages
|
|
283
|
+
built around the [`bankstatementparser`](https://github.com/sebastienrousseau/bankstatementparser)
|
|
284
|
+
library — pick whichever ones your stack needs:
|
|
285
|
+
|
|
286
|
+
| Package | Role |
|
|
287
|
+
| :--- | :--- |
|
|
288
|
+
| [`bankstatementparser`](https://pypi.org/project/bankstatementparser/) | Core library + CLI (MT940 / CAMT parsing) |
|
|
289
|
+
| [`bankstatementparser-lsp`](https://pypi.org/project/bankstatementparser-lsp/) | **Language Server Protocol server (this package)** |
|
|
290
|
+
|
|
291
|
+
```mermaid
|
|
292
|
+
flowchart LR
|
|
293
|
+
A["Editor (VS Code / Neovim / …)"] -->|LSP over stdio| B["bankstatementparser-lsp"]
|
|
294
|
+
B -->|diagnostics_for_mt940| C["diagnostic engine (MT940 tag patterns)"]
|
|
295
|
+
C -->|Diagnostic objects| B
|
|
296
|
+
B -->|publishDiagnostics| A
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## When not to use bankstatementparser-lsp
|
|
302
|
+
|
|
303
|
+
- **You're not editing MT940 statements.** The server targets the SWIFT
|
|
304
|
+
MT940 tag-and-line format (`.mt940` / `.sta`); for CAMT XML or other
|
|
305
|
+
formats use a format-appropriate language server.
|
|
306
|
+
- **You need full parsing, not editor diagnostics.** Use the core
|
|
307
|
+
[`bankstatementparser`](https://pypi.org/project/bankstatementparser/)
|
|
308
|
+
library to parse statements into structured records.
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## Development
|
|
313
|
+
|
|
314
|
+
`bankstatementparser-lsp` uses [Poetry](https://python-poetry.org/) and
|
|
315
|
+
[mise](https://mise.jdx.dev/).
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
git clone https://github.com/sebastienrousseau/bankstatementparser-lsp.git
|
|
319
|
+
cd bankstatementparser-lsp
|
|
320
|
+
mise install
|
|
321
|
+
poetry install
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
A `Makefile` orchestrates the quality gates (kept in lockstep with CI):
|
|
325
|
+
|
|
326
|
+
| Target | What it runs |
|
|
327
|
+
| :--- | :--- |
|
|
328
|
+
| `make check` | All gates (REQUIRED before commit) |
|
|
329
|
+
| `make test` | `pytest --cov=bankstatementparser_lsp --cov-branch --cov-fail-under=100` |
|
|
330
|
+
| `make lint` | `ruff check` + `ruff format --check` |
|
|
331
|
+
| `make type-check` | `mypy --strict` |
|
|
332
|
+
| `make examples` | Run the example scripts |
|
|
333
|
+
|
|
334
|
+
Current state (v0.0.10): **41 tests passing, 100% line + branch
|
|
335
|
+
coverage** against a 100% enforced floor, mypy `--strict` clean,
|
|
336
|
+
interrogate 100% docstring coverage. The suite includes documentation
|
|
337
|
+
and example regression tests
|
|
338
|
+
([`tests/test_docs_accuracy.py`](tests/test_docs_accuracy.py),
|
|
339
|
+
[`tests/test_regression_docs.py`](tests/test_regression_docs.py),
|
|
340
|
+
[`tests/test_regression_examples.py`](tests/test_regression_examples.py))
|
|
341
|
+
that execute every documented snippet and every `examples/*.py` script.
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
## Security
|
|
346
|
+
|
|
347
|
+
- **No filesystem writes.** The server reads from the editor's
|
|
348
|
+
in-memory document buffer; no scratch files, no temp directories.
|
|
349
|
+
- **MT940 parsing** is a pure-`re` line scanner over text from the
|
|
350
|
+
editor — no `eval`, no shelling out, no XML, no network.
|
|
351
|
+
- **Lint findings** are returned as `lsprotocol.Diagnostic` objects with
|
|
352
|
+
no stack traces, so the editor never sees an internal path or
|
|
353
|
+
exception message.
|
|
354
|
+
- **Dependencies** are pinned via `poetry.lock` and audited by
|
|
355
|
+
`pip-audit` and Bandit in CI.
|
|
356
|
+
|
|
357
|
+
To report a vulnerability, please use
|
|
358
|
+
[GitHub private vulnerability reporting](https://github.com/sebastienrousseau/bankstatementparser-lsp/security)
|
|
359
|
+
rather than a public issue.
|
|
360
|
+
|
|
361
|
+
---
|
|
362
|
+
|
|
363
|
+
## Documentation
|
|
364
|
+
|
|
365
|
+
- **Runnable examples:** [`examples/`](https://github.com/sebastienrousseau/bankstatementparser-lsp/tree/main/examples)
|
|
366
|
+
- **VS Code scaffold:** [`editors/vscode/`](https://github.com/sebastienrousseau/bankstatementparser-lsp/tree/main/editors/vscode)
|
|
367
|
+
- **Release history:** [CHANGELOG.md](https://github.com/sebastienrousseau/bankstatementparser-lsp/blob/main/CHANGELOG.md)
|
|
368
|
+
- **Core library docs:** [docs.bankstatementparser.com](https://docs.bankstatementparser.com)
|
|
369
|
+
- **LSP specification:** [microsoft.github.io/language-server-protocol](https://microsoft.github.io/language-server-protocol/)
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
## Contributing
|
|
374
|
+
|
|
375
|
+
Contributions are welcome — see the
|
|
376
|
+
[contributing instructions](https://github.com/sebastienrousseau/bankstatementparser-lsp/blob/main/CONTRIBUTING.md).
|
|
377
|
+
Thanks to all the
|
|
378
|
+
[contributors](https://github.com/sebastienrousseau/bankstatementparser-lsp/graphs/contributors)
|
|
379
|
+
who have helped build `bankstatementparser-lsp`.
|
|
380
|
+
|
|
381
|
+
---
|
|
382
|
+
|
|
383
|
+
## License
|
|
384
|
+
|
|
385
|
+
Licensed under the [Apache License, Version 2.0](https://opensource.org/license/apache-2-0/).
|
|
386
|
+
Built on [pygls](https://github.com/openlawlibrary/pygls) and
|
|
387
|
+
[lsprotocol](https://github.com/microsoft/lsprotocol) by the
|
|
388
|
+
[Open Law Library](https://github.com/openlawlibrary), and on the core
|
|
389
|
+
[`bankstatementparser`](https://github.com/sebastienrousseau/bankstatementparser) library that
|
|
390
|
+
powers the validators and schemas.
|
|
391
|
+
|
|
392
|
+
Any contribution submitted for inclusion shall be licensed as above,
|
|
393
|
+
without additional terms.
|
|
394
|
+
|
|
395
|
+
---
|
|
396
|
+
|
|
397
|
+
<p align="center">
|
|
398
|
+
<a href="https://bankstatementparser.com">bankstatementparser.com</a> ·
|
|
399
|
+
<a href="https://pypi.org/project/bankstatementparser-lsp/">PyPI</a> ·
|
|
400
|
+
<a href="https://github.com/sebastienrousseau/bankstatementparser-lsp">GitHub</a>
|
|
401
|
+
</p>
|
|
402
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
bankstatementparser_lsp/__init__.py,sha256=N3JO_lHdMHaplPW7I_ExZop9hdnOzTLwOqtGSQI3tSY,1076
|
|
2
|
+
bankstatementparser_lsp/diagnostics.py,sha256=a7IJDMT5ttPkWjY7CoG5BSMpJY23XXEEtJSPGYyACe4,5342
|
|
3
|
+
bankstatementparser_lsp/server.py,sha256=YxC0y-3ivSFv6oiMmlqmBUXvORl0wO28PdZpNWxLn4U,3292
|
|
4
|
+
bankstatementparser_lsp-0.0.10.dist-info/METADATA,sha256=6nkH8cIm76WUP6NFZ6sSvrUtvksrATwGDcJAJUMFB2s,15277
|
|
5
|
+
bankstatementparser_lsp-0.0.10.dist-info/WHEEL,sha256=eY7nduwzv-ldUxpzbRlxwvC693Hg6PX8bWDjEHjZ_dk,88
|
|
6
|
+
bankstatementparser_lsp-0.0.10.dist-info/entry_points.txt,sha256=msLoW6A0oN8BE-LojysRq7ZejdXzmUKj_Z1RJBCkaj0,79
|
|
7
|
+
bankstatementparser_lsp-0.0.10.dist-info/licenses/LICENSE,sha256=BhsQ65IVGLlScIgEHcMm2leCnoRbQqwPcLd7N2c8Gt0,10244
|
|
8
|
+
bankstatementparser_lsp-0.0.10.dist-info/RECORD,,
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work.
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
42
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
43
|
+
of this License, Derivative Works shall not include works that remain
|
|
44
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
45
|
+
the Work and Derivative Works thereof.
|
|
46
|
+
|
|
47
|
+
"Contribution" shall mean any work of authorship, including
|
|
48
|
+
the original version of the Work and any modifications or additions
|
|
49
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
50
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
51
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
52
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
53
|
+
means any form of electronic, verbal, or written communication sent
|
|
54
|
+
to the Licensor or its representatives, including but not limited to
|
|
55
|
+
communication on electronic mailing lists, source code control systems,
|
|
56
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
57
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
58
|
+
excluding communication that is conspicuously marked or otherwise
|
|
59
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
60
|
+
|
|
61
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
62
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
63
|
+
subsequently incorporated within the Work.
|
|
64
|
+
|
|
65
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
66
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
67
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
68
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
69
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
70
|
+
Work and such Derivative Works in Source or Object form.
|
|
71
|
+
|
|
72
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
73
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
74
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
75
|
+
(except as stated in this section) patent license to make, have made,
|
|
76
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
77
|
+
where such license applies only to those patent claims licensable
|
|
78
|
+
by such Contributor that are necessarily infringed by their
|
|
79
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
80
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
81
|
+
institute patent litigation against any entity (including a
|
|
82
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
83
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
84
|
+
or contributory patent infringement, then any patent licenses
|
|
85
|
+
granted to You under this License for that Work shall terminate
|
|
86
|
+
as of the date such litigation is filed.
|
|
87
|
+
|
|
88
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
89
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
90
|
+
modifications, and in Source or Object form, provided that You
|
|
91
|
+
meet the following conditions:
|
|
92
|
+
|
|
93
|
+
(a) You must give any other recipients of the Work or
|
|
94
|
+
Derivative Works a copy of this License; and
|
|
95
|
+
|
|
96
|
+
(b) You must cause any modified files to carry prominent notices
|
|
97
|
+
stating that You changed the files; and
|
|
98
|
+
|
|
99
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
100
|
+
that You distribute, all copyright, patent, trademark, and
|
|
101
|
+
attribution notices from the Source form of the Work,
|
|
102
|
+
excluding those notices that do not pertain to any part of
|
|
103
|
+
the Derivative Works; and
|
|
104
|
+
|
|
105
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
106
|
+
distribution, then any Derivative Works that You distribute must
|
|
107
|
+
include a readable copy of the attribution notices contained
|
|
108
|
+
within such NOTICE file, excluding any notices that do not
|
|
109
|
+
pertain to any part of the Derivative Works, in at least one
|
|
110
|
+
of the following places: within a NOTICE text file distributed
|
|
111
|
+
as part of the Derivative Works; within the Source form or
|
|
112
|
+
documentation, if provided along with the Derivative Works; or,
|
|
113
|
+
within a display generated by the Derivative Works, if and
|
|
114
|
+
wherever such third-party notices normally appear. The contents
|
|
115
|
+
of the NOTICE file are for informational purposes only and
|
|
116
|
+
do not modify the License. You may add Your own attribution
|
|
117
|
+
notices within Derivative Works that You distribute, alongside
|
|
118
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
119
|
+
that such additional attribution notices cannot be construed
|
|
120
|
+
as modifying the License.
|
|
121
|
+
|
|
122
|
+
You may add Your own copyright statement to Your modifications and
|
|
123
|
+
may provide additional or different license terms and conditions
|
|
124
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
125
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
126
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
127
|
+
the conditions stated in this License.
|
|
128
|
+
|
|
129
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
130
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
131
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
132
|
+
this License, without any additional terms or conditions.
|
|
133
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
134
|
+
the terms of any separate license agreement you may have executed
|
|
135
|
+
with Licensor regarding such Contributions.
|
|
136
|
+
|
|
137
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
138
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
139
|
+
except as required for reasonable and customary use in describing the
|
|
140
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
141
|
+
|
|
142
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
143
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
144
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
145
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
146
|
+
implied, including, without limitation, any warranties or conditions
|
|
147
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
148
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
149
|
+
appropriateness of using or redistributing the Work and assume any
|
|
150
|
+
risks associated with Your exercise of permissions under this License.
|
|
151
|
+
|
|
152
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
153
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
154
|
+
unless required by applicable law (such as deliberate and grossly
|
|
155
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
156
|
+
liable to You for damages, including any direct, indirect, special,
|
|
157
|
+
incidental, or consequential damages of any character arising as a
|
|
158
|
+
result of this License or out of the use or inability to use the
|
|
159
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
160
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
161
|
+
other commercial damages or losses), even if such Contributor
|
|
162
|
+
has been advised of the possibility of such damages.
|
|
163
|
+
|
|
164
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
165
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
166
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
167
|
+
or other liability obligations and/or rights consistent with this
|
|
168
|
+
License. However, in accepting such obligations, You may act only
|
|
169
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
170
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
171
|
+
defend, and hold each Contributor harmless for any liability
|
|
172
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
173
|
+
of your accepting any such warranty or additional liability.
|
|
174
|
+
|
|
175
|
+
END OF TERMS AND CONDITIONS
|
|
176
|
+
|
|
177
|
+
Copyright 2023-2026 Sebastien Rousseau
|
|
178
|
+
|
|
179
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
180
|
+
you may not use this file except in compliance with the License.
|
|
181
|
+
You may obtain a copy of the License at
|
|
182
|
+
|
|
183
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
184
|
+
|
|
185
|
+
Unless required by applicable law or agreed to in writing, software
|
|
186
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
187
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
188
|
+
See the License for the specific language governing permissions and
|
|
189
|
+
limitations under the License.
|