File: hooks.py

package info (click to toggle)
python-xsdata 24.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,936 kB
  • sloc: python: 29,257; xml: 404; makefile: 27; sh: 6
file content (13 lines) | stat: -rw-r--r-- 338 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
from importlib import metadata


def load_entry_points(name: str):
    entry_points = metadata.entry_points()

    if hasattr(entry_points, "select"):
        plugins = entry_points.select(group=name)  # type: ignore
    else:
        plugins = entry_points.get(name, [])  # type: ignore

    for plugin in plugins:
        plugin.load()