• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kedder / ofxstatement / 15469557513

05 Jun 2025 02:22PM UTC coverage: 95.087% (-0.7%) from 95.791%
15469557513

Pull #346

github

web-flow
Merge 93911324c into 01ae49451
Pull Request #346: Add support for INVEXPENSE

80 of 87 new or added lines in 4 files covered. (91.95%)

3 existing lines in 3 files now uncovered.

987 of 1038 relevant lines covered (95.09%)

3.8 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/src/ofxstatement/plugin.py
1
"""Plugin framework.
2

3
Plugins are objects that configures and coordinates conversion machinery.
4
"""
5

6
from typing import List, Tuple, Type
4✔
7
from collections.abc import MutableMapping
4✔
8
import sys
4✔
9

10
if sys.version_info < (3, 10):
4✔
UNCOV
11
    from importlib_metadata import entry_points
×
12
else:
13
    from importlib.metadata import entry_points
4✔
14

15
from ofxstatement.ui import UI
4✔
16
from ofxstatement.parser import AbstractStatementParser
4✔
17

18

19
def get_plugin(name: str, ui: UI, settings: MutableMapping) -> "Plugin":
4✔
20
    plugins = entry_points(name=name)
4✔
21
    if not plugins:
4✔
22
        raise PluginNotRegistered(name)
4✔
23
    if len(plugins) > 1:
4✔
24
        raise PluginNameConflict(plugins)
4✔
25
    plugin = plugins[name].load()
4✔
26
    return plugin(ui, settings)
4✔
27

28

29
def list_plugins() -> List[Tuple[str, Type["Plugin"]]]:
4✔
30
    """Return list of all plugin classes registered as a list of tuples:
31

32
    [(name, plugin_class)]
33
    """
34
    plugin_eps = entry_points(group="ofxstatement")
×
35
    return sorted((ep.name, ep.load()) for ep in plugin_eps)
×
36

37

38
class PluginNotRegistered(Exception):
4✔
39
    """Raised on attempt to get plugin, missing from the registry."""
40

41

42
class PluginNameConflict(Exception):
4✔
43
    """Raised when there are more than one plugins registered with the same
44
    name
45
    """
46

47

48
class Plugin:
4✔
49
    ui: UI
4✔
50

51
    def __init__(self, ui: UI, settings: MutableMapping) -> None:
4✔
52
        self.ui = ui
4✔
53
        self.settings = settings
4✔
54

55
    def get_parser(self, filename: str) -> AbstractStatementParser:
4✔
56
        raise NotImplementedError()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc