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

datajoint / datajoint-python / #12880

pending completion
#12880

push

travis-ci

web-flow
Merge pull request #1067 from CBroz1/master

Add support for insert CSV

4 of 4 new or added lines in 1 file covered. (100.0%)

3102 of 3424 relevant lines covered (90.6%)

0.91 hits per line

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

48.0
/datajoint/plugin.py
1
from .settings import config
1✔
2
import pkg_resources
1✔
3
from pathlib import Path
1✔
4
from cryptography.exceptions import InvalidSignature
1✔
5
from otumat import hash_pkg, verify
1✔
6
import logging
1✔
7

8
logger = logging.getLogger(__name__.split(".")[0])
1✔
9

10

11
def _update_error_stack(plugin_name):
1✔
12
    try:
×
13
        base_name = "datajoint"
×
14
        base_meta = pkg_resources.get_distribution(base_name)
×
15
        plugin_meta = pkg_resources.get_distribution(plugin_name)
×
16

17
        data = hash_pkg(pkgpath=str(Path(plugin_meta.module_path, plugin_name)))
×
18
        signature = plugin_meta.get_metadata(f"{plugin_name}.sig")
×
19
        pubkey_path = str(Path(base_meta.egg_info, f"{base_name}.pub"))
×
20
        verify(pubkey_path=pubkey_path, data=data, signature=signature)
×
21
        logger.info(f"DataJoint verified plugin `{plugin_name}` detected.")
×
22
        return True
×
23
    except (FileNotFoundError, InvalidSignature):
×
24
        logger.warning(f"Unverified plugin `{plugin_name}` detected.")
×
25
        return False
×
26

27

28
def _import_plugins(category):
1✔
29
    return {
1✔
30
        entry_point.name: dict(
31
            object=entry_point,
32
            verified=_update_error_stack(entry_point.module_name.split(".")[0]),
33
        )
34
        for entry_point in pkg_resources.iter_entry_points(
35
            "datajoint_plugins.{}".format(category)
36
        )
37
        if "plugin" not in config
38
        or category not in config["plugin"]
39
        or entry_point.module_name.split(".")[0] in config["plugin"][category]
40
    }
41

42

43
connection_plugins = _import_plugins("connection")
1✔
44
type_plugins = _import_plugins("datatype")
1✔
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

© 2025 Coveralls, Inc