@@ -36,7 +36,6 @@ class MyTable(dj.Manual):
3636from __future__ import annotations
3737
3838import logging
39- import warnings
4039from abc import ABC , abstractmethod
4140from typing import Any
4241
@@ -179,80 +178,10 @@ def validate(self, value: Any) -> None:
179178 """
180179 pass
181180
182- # =========================================================================
183- # Backward compatibility properties
184- # =========================================================================
185-
186- @property
187- def type_name (self ) -> str | None :
188- """Backward compatibility alias for `name`."""
189- return self .name
190-
191- @property
192- def dtype (self ) -> str :
193- """
194- Backward compatibility property.
195-
196- Deprecated: Use get_dtype(is_external) instead.
197- """
198- warnings .warn (
199- "Codec.dtype property is deprecated. Use get_dtype(is_external) instead." ,
200- DeprecationWarning ,
201- stacklevel = 2 ,
202- )
203- return self .get_dtype (is_external = False )
204-
205181 def __repr__ (self ) -> str :
206182 return f"<{ self .__class__ .__name__ } (name={ self .name !r} )>"
207183
208184
209- # Backward compatibility alias
210- AttributeType = Codec
211-
212-
213- def register_type (cls : type [Codec ]) -> type [Codec ]:
214- """
215- Register a codec with DataJoint.
216-
217- Deprecated: Codecs now auto-register when subclassed. This function
218- is kept for backward compatibility but is no longer needed.
219-
220- Args:
221- cls: A Codec subclass to register.
222-
223- Returns:
224- The same class, unmodified.
225- """
226- warnings .warn (
227- "@dj.register_type is deprecated. Codecs auto-register when subclassed. "
228- "Just inherit from dj.Codec and set the 'name' class attribute." ,
229- DeprecationWarning ,
230- stacklevel = 2 ,
231- )
232-
233- if not isinstance (cls , type ) or not issubclass (cls , Codec ):
234- raise TypeError (f"register_type requires a Codec subclass, got { cls !r} " )
235-
236- # Check if already registered
237- if cls .name and cls .name in _codec_registry :
238- existing = _codec_registry [cls .name ]
239- if type (existing ) is not cls :
240- raise DataJointError (
241- f"Codec <{ cls .name } > already registered by " f"{ type (existing ).__module__ } .{ type (existing ).__name__ } "
242- )
243- return cls # Same class, idempotent
244-
245- # Manual registration for classes that didn't auto-register
246- if cls .name :
247- _codec_registry [cls .name ] = cls ()
248-
249- return cls
250-
251-
252- # Backward compatibility alias
253- codec = register_type
254-
255-
256185def parse_type_spec (spec : str ) -> tuple [str , str | None ]:
257186 """
258187 Parse a type specification into type name and optional store parameter.
@@ -299,10 +228,6 @@ def unregister_codec(name: str) -> None:
299228 del _codec_registry [name ]
300229
301230
302- # Backward compatibility alias
303- unregister_type = unregister_codec
304-
305-
306231def get_codec (name : str ) -> Codec :
307232 """
308233 Retrieve a registered codec by name.
@@ -338,10 +263,6 @@ def get_codec(name: str) -> Codec:
338263 )
339264
340265
341- # Backward compatibility alias
342- get_type = get_codec
343-
344-
345266def list_codecs () -> list [str ]:
346267 """
347268 List all registered codec names.
@@ -353,10 +274,6 @@ def list_codecs() -> list[str]:
353274 return sorted (_codec_registry .keys ())
354275
355276
356- # Backward compatibility alias
357- list_types = list_codecs
358-
359-
360277def is_codec_registered (name : str ) -> bool :
361278 """
362279 Check if a codec name is registered.
@@ -374,10 +291,6 @@ def is_codec_registered(name: str) -> bool:
374291 return type_name in _codec_registry
375292
376293
377- # Backward compatibility alias
378- is_type_registered = is_codec_registered
379-
380-
381294def _load_entry_points () -> None :
382295 """
383296 Load codecs from installed packages via entry points.
0 commit comments