Skip to content

Commit 36f35fc

Browse files
committed
Adding dunder new to Adapter to copy meta kwargs to instance for later retrieval
1 parent c58590d commit 36f35fc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

diffsync/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"""
1717

1818
import sys
19+
from copy import deepcopy
1920
from inspect import isclass
2021
from typing import (
2122
Any,
@@ -480,6 +481,13 @@ def __init_subclass__(cls) -> None:
480481
if not isclass(value) or not issubclass(value, DiffSyncModel):
481482
raise AttributeError(f'top_level references attribute "{name}" but it is not a DiffSyncModel subclass!')
482483

484+
def __new__(cls, **kwargs):
485+
""""""
486+
meta_kwargs = deepcopy(kwargs)
487+
instance = super().__new__(cls)
488+
instance._meta_kwargs = meta_kwargs
489+
return instance
490+
483491
def __str__(self) -> StrType:
484492
"""String representation of an Adapter."""
485493
if self.type != self.name:

0 commit comments

Comments
 (0)