Skip to content

Commit 35dbbfa

Browse files
authored
Merge pull request #1253 from datajoint/feat/plugins
Feat/plugins - deprecate otumate and old plugins
2 parents ff320ff + 8631da4 commit 35dbbfa

File tree

8 files changed

+203
-172
lines changed

8 files changed

+203
-172
lines changed

.devcontainer/devcontainer.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
8080,
2525
9000
2626
],
27+
"mounts": [
28+
"type=bind,source=${env:SSH_AUTH_SOCK},target=/ssh-agent"
29+
],
30+
"containerEnv": {
31+
"SSH_AUTH_SOCK": "/ssh-agent"
32+
},
2733
// Uncomment the next line if you want start specific services in your Docker Compose config.
2834
// "runServices": [],
2935
// Uncomment the next line if you want to keep your containers running after VS Code shuts down.

datajoint/attribute_adapter.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import re
22

33
from .errors import DataJointError, _support_adapted_types
4-
from .plugin import type_plugins
54

65

76
class AttributeAdapter:
@@ -44,11 +43,7 @@ def get_adapter(context, adapter_name):
4443
raise DataJointError("Support for Adapted Attribute types is disabled.")
4544
adapter_name = adapter_name.lstrip("<").rstrip(">")
4645
try:
47-
adapter = (
48-
context[adapter_name]
49-
if adapter_name in context
50-
else type_plugins[adapter_name]["object"].load()
51-
)
46+
adapter = context[adapter_name]
5247
except KeyError:
5348
raise DataJointError(
5449
"Attribute adapter '{adapter_name}' is not defined.".format(

datajoint/connection.py

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
from .blob import pack, unpack
1717
from .dependencies import Dependencies
1818
from .hash import uuid_from_buffer
19-
from .plugin import connection_plugins
2019
from .settings import config
2120
from .version import __version__
2221

@@ -27,34 +26,6 @@
2726
cache_key = "query_cache" # the key to lookup the query_cache folder in dj.config
2827

2928

30-
def get_host_hook(host_input):
31-
if "://" in host_input:
32-
plugin_name = host_input.split("://")[0]
33-
try:
34-
return connection_plugins[plugin_name]["object"].load().get_host(host_input)
35-
except KeyError:
36-
raise errors.DataJointError(
37-
"Connection plugin '{}' not found.".format(plugin_name)
38-
)
39-
else:
40-
return host_input
41-
42-
43-
def connect_host_hook(connection_obj):
44-
if "://" in connection_obj.conn_info["host_input"]:
45-
plugin_name = connection_obj.conn_info["host_input"].split("://")[0]
46-
try:
47-
connection_plugins[plugin_name]["object"].load().connect_host(
48-
connection_obj
49-
)
50-
except KeyError:
51-
raise errors.DataJointError(
52-
"Connection plugin '{}' not found.".format(plugin_name)
53-
)
54-
else:
55-
connection_obj.connect()
56-
57-
5829
def translate_query_error(client_error, query):
5930
"""
6031
Take client error and original query and return the corresponding DataJoint exception.
@@ -177,7 +148,6 @@ class Connection:
177148
"""
178149

179150
def __init__(self, host, user, password, port=None, init_fun=None, use_tls=None):
180-
host_input, host = (host, get_host_hook(host))
181151
if ":" in host:
182152
# the port in the hostname overrides the port argument
183153
host, port = host.split(":")
@@ -190,11 +160,10 @@ def __init__(self, host, user, password, port=None, init_fun=None, use_tls=None)
190160
use_tls if isinstance(use_tls, dict) else {"ssl": {}}
191161
)
192162
self.conn_info["ssl_input"] = use_tls
193-
self.conn_info["host_input"] = host_input
194163
self.init_fun = init_fun
195164
self._conn = None
196165
self._query_cache = None
197-
connect_host_hook(self)
166+
self.connect()
198167
if self.is_connected:
199168
logger.info(
200169
"DataJoint {version} connected to {user}@{host}:{port}".format(
@@ -232,7 +201,7 @@ def connect(self):
232201
**{
233202
k: v
234203
for k, v in self.conn_info.items()
235-
if k not in ["ssl_input", "host_input"]
204+
if k not in ["ssl_input"]
236205
},
237206
)
238207
except client.err.InternalError:
@@ -245,7 +214,7 @@ def connect(self):
245214
k: v
246215
for k, v in self.conn_info.items()
247216
if not (
248-
k in ["ssl_input", "host_input"]
217+
k == "ssl_input"
249218
or k == "ssl"
250219
and self.conn_info["ssl_input"] is None
251220
)
@@ -352,7 +321,7 @@ def query(
352321
if not reconnect:
353322
raise
354323
logger.warning("Reconnecting to MySQL server.")
355-
connect_host_hook(self)
324+
self.connect()
356325
if self._in_transaction:
357326
self.cancel_transaction()
358327
raise errors.LostConnectionError(

datajoint/errors.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,12 @@
55
import os
66

77

8-
# --- Unverified Plugin Check ---
9-
class PluginWarning(Exception):
10-
pass
11-
12-
138
# --- Top Level ---
149
class DataJointError(Exception):
1510
"""
1611
Base class for errors specific to DataJoint internal operation.
1712
"""
1813

19-
def __init__(self, *args):
20-
from .plugin import connection_plugins, type_plugins
21-
22-
self.__cause__ = (
23-
PluginWarning("Unverified DataJoint plugin detected.")
24-
if any(
25-
[
26-
any([not plugins[k]["verified"] for k in plugins])
27-
for plugins in [connection_plugins, type_plugins]
28-
if plugins
29-
]
30-
)
31-
else None
32-
)
33-
3414
def suggest(self, *args):
3515
"""
3616
regenerate the exception with additional arguments

datajoint/plugin.py

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)