Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
remove old plugins
  • Loading branch information
dimitri-yatsenko committed Jul 28, 2025
commit ad22ece289c53941d3dc7e82353d3d46ea6c4820
7 changes: 1 addition & 6 deletions datajoint/attribute_adapter.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import re

from .errors import DataJointError, _support_adapted_types
from .plugin import type_plugins


class AttributeAdapter:
Expand Down Expand Up @@ -44,11 +43,7 @@ def get_adapter(context, adapter_name):
raise DataJointError("Support for Adapted Attribute types is disabled.")
adapter_name = adapter_name.lstrip("<").rstrip(">")
try:
adapter = (
context[adapter_name]
if adapter_name in context
else type_plugins[adapter_name]["object"].load()
)
adapter = context[adapter_name]
except KeyError:
raise DataJointError(
"Attribute adapter '{adapter_name}' is not defined.".format(
Expand Down
37 changes: 3 additions & 34 deletions datajoint/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from .blob import pack, unpack
from .dependencies import Dependencies
from .hash import uuid_from_buffer
from .plugin import connection_plugins
from .settings import config
from .version import __version__

Expand All @@ -27,33 +26,6 @@
cache_key = "query_cache" # the key to lookup the query_cache folder in dj.config


def get_host_hook(host_input):
if "://" in host_input:
plugin_name = host_input.split("://")[0]
try:
return connection_plugins[plugin_name]["object"].load().get_host(host_input)
except KeyError:
raise errors.DataJointError(
"Connection plugin '{}' not found.".format(plugin_name)
)
else:
return host_input


def connect_host_hook(connection_obj):
if "://" in connection_obj.conn_info["host_input"]:
plugin_name = connection_obj.conn_info["host_input"].split("://")[0]
try:
connection_plugins[plugin_name]["object"].load().connect_host(
connection_obj
)
except KeyError:
raise errors.DataJointError(
"Connection plugin '{}' not found.".format(plugin_name)
)
else:
connection_obj.connect()


def translate_query_error(client_error, query):
"""
Expand Down Expand Up @@ -177,7 +149,6 @@ class Connection:
"""

def __init__(self, host, user, password, port=None, init_fun=None, use_tls=None):
Copy link

Copilot AI Jul 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable assignment host_input, host = (host, get_host_hook(host)) was removed but the original host parameter is being overwritten without preserving the original value. This could break functionality that depends on the original host value.

Copilot uses AI. Check for mistakes.
host_input, host = (host, get_host_hook(host))
if ":" in host:
# the port in the hostname overrides the port argument
host, port = host.split(":")
Expand All @@ -190,11 +161,9 @@ def __init__(self, host, user, password, port=None, init_fun=None, use_tls=None)
use_tls if isinstance(use_tls, dict) else {"ssl": {}}
)
self.conn_info["ssl_input"] = use_tls
self.conn_info["host_input"] = host_input
self.init_fun = init_fun
self._conn = None
self._query_cache = None
connect_host_hook(self)
if self.is_connected:
logger.info(
"DataJoint {version} connected to {user}@{host}:{port}".format(
Expand Down Expand Up @@ -232,7 +201,7 @@ def connect(self):
**{
k: v
for k, v in self.conn_info.items()
if k not in ["ssl_input", "host_input"]
if k not in ["ssl_input"]
},
)
except client.err.InternalError:
Expand All @@ -245,7 +214,7 @@ def connect(self):
k: v
for k, v in self.conn_info.items()
if not (
k in ["ssl_input", "host_input"]
k in ["ssl_input"]
or k == "ssl"
and self.conn_info["ssl_input"] is None
)
Expand Down Expand Up @@ -352,7 +321,7 @@ def query(
if not reconnect:
raise
logger.warning("Reconnecting to MySQL server.")
connect_host_hook(self)
self.connect()
if self._in_transaction:
self.cancel_transaction()
raise errors.LostConnectionError(
Expand Down
20 changes: 0 additions & 20 deletions datajoint/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,12 @@
import os


# --- Unverified Plugin Check ---
class PluginWarning(Exception):
pass


# --- Top Level ---
class DataJointError(Exception):
"""
Base class for errors specific to DataJoint internal operation.
"""

def __init__(self, *args):
from .plugin import connection_plugins, type_plugins

self.__cause__ = (
PluginWarning("Unverified DataJoint plugin detected.")
if any(
[
any([not plugins[k]["verified"] for k in plugins])
for plugins in [connection_plugins, type_plugins]
if plugins
]
)
else None
)

def suggest(self, *args):
"""
regenerate the exception with additional arguments
Expand Down
46 changes: 0 additions & 46 deletions datajoint/plugin.py

This file was deleted.

4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@ dependencies = [
"pydot",
"minio>=7.0.0",
"matplotlib",
"otumat",
"faker",
"cryptography",
"urllib3",
"setuptools",
]
requires-python = ">=3.9,<4.0"
authors = [
{name = "Dimitri Yatsenko", email = "[email protected]"},
{name = "Thinh Nguen", email = "[email protected]"}
{name = "Thinh Nguen", email = "[email protected]"},
{name = "Raphael Guzman"},
{name = "Edgar Walker"},
{name = "DataJoint Contributors", email = "[email protected]"},
Expand Down
62 changes: 0 additions & 62 deletions tests/test_plugin.py

This file was deleted.