Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
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
1 change: 1 addition & 0 deletions changes/346.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Reverted addition of __new__ method to Adapter class to resolve instantiation issues.
14 changes: 0 additions & 14 deletions diffsync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"""

import sys
from copy import deepcopy
from inspect import isclass
from typing import (
Any,
Expand Down Expand Up @@ -482,19 +481,6 @@ def __init_subclass__(cls) -> None:
if not isclass(value) or not issubclass(value, DiffSyncModel):
raise AttributeError(f'top_level references attribute "{name}" but it is not a DiffSyncModel subclass!')

def __new__(cls, **kwargs): # type: ignore[no-untyped-def]
"""Document keyword arguments that were used to initialize Adapter."""
meta_kwargs = {}
for key, value in kwargs.items():
try:
meta_kwargs[key] = deepcopy(value)
except Exception: # pylint: disable=broad-exception-caught
# Some objects (e.g. Kafka Consumer, DB connections) cannot be deep copied
meta_kwargs[key] = value
instance = super().__new__(cls)
instance._meta_kwargs = meta_kwargs
return instance

def __str__(self) -> StrType:
"""String representation of an Adapter."""
if self.type != self.name:
Expand Down
Loading