Skip to content

Commit a57ad36

Browse files
committed
Replace mentions of deprecated DiffSync class
At least the ones I found, there are probably some more.
1 parent 315b5e9 commit a57ad36

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

diffsync/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ def __init_subclass__(cls) -> None:
480480
raise AttributeError(f'top_level references attribute "{name}" but it is not a DiffSyncModel subclass!')
481481

482482
def __str__(self) -> StrType:
483-
"""String representation of a DiffSync."""
483+
"""String representation of an Adapter."""
484484
if self.type != self.name:
485485
return f'{self.type} "{self.name}"'
486486
return self.type
@@ -526,7 +526,7 @@ def dict(self, exclude_defaults: bool = True, **kwargs: Any) -> Dict[str, Dict[s
526526
return data
527527

528528
def str(self, indent: int = 0) -> StrType:
529-
"""Build a detailed string representation of this DiffSync."""
529+
"""Build a detailed string representation of this Adapter."""
530530
margin = " " * indent
531531
output = ""
532532
for modelname in self.top_level:

docs/source/core_engine/01-flags.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ diff = nautobot.diff_from(local, flags=flags)
2424
| Name | Description | Binary Value |
2525
|---|---|---|
2626
| CONTINUE_ON_FAILURE | Continue synchronizing even if failures are encountered when syncing individual models. | 0b1 |
27-
| SKIP_UNMATCHED_SRC | Ignore objects that only exist in the source/"from" DiffSync when determining diffs and syncing. If this flag is set, no new objects will be created in the target/"to" DiffSync. | 0b10 |
28-
| SKIP_UNMATCHED_DST | Ignore objects that only exist in the target/"to" DiffSync when determining diffs and syncing. If this flag is set, no objects will be deleted from the target/"to" DiffSync. | 0b100 |
27+
| SKIP_UNMATCHED_SRC | Ignore objects that only exist in the source/"from" adapter when determining diffs and syncing. If this flag is set, no new objects will be created in the target/"to" adapter. | 0b10 |
28+
| SKIP_UNMATCHED_DST | Ignore objects that only exist in the target/"to" adapter when determining diffs and syncing. If this flag is set, no objects will be deleted from the target/"to" adapter. | 0b100 |
2929
| SKIP_UNMATCHED_BOTH | Convenience value combining both SKIP_UNMATCHED_SRC and SKIP_UNMATCHED_DST into a single flag | 0b110 |
3030
| LOG_UNCHANGED_RECORDS | If this flag is set, a log message will be generated during synchronization for each model, even unchanged ones. | 0b1000 |
3131

@@ -57,8 +57,8 @@ class MyAdapter(Adapter):
5757
|---|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
5858
| IGNORE | Do not render diffs containing this model; do not make any changes to this model when synchronizing. Can be used to indicate a model instance that exists but should not be changed by DiffSync. | 0b1 |
5959
| SKIP_CHILDREN_ON_DELETE | When deleting this model, do not recursively delete its children. Can be used for the case where deletion of a model results in the automatic deletion of all its children. | 0b10 |
60-
| SKIP_UNMATCHED_SRC | Ignore the model if it only exists in the source/"from" DiffSync when determining diffs and syncing. If this flag is set, no new model will be created in the target/"to" DiffSync. | 0b100 |
61-
| SKIP_UNMATCHED_DST | Ignore the model if it only exists in the target/"to" DiffSync when determining diffs and syncing. If this flag is set, the model will not be deleted from the target/"to" DiffSync. | 0b1000 |
60+
| SKIP_UNMATCHED_SRC | Ignore the model if it only exists in the source/"from" adapter when determining diffs and syncing. If this flag is set, no new model will be created in the target/"to" adapter. | 0b100 |
61+
| SKIP_UNMATCHED_DST | Ignore the model if it only exists in the target/"to" adapter when determining diffs and syncing. If this flag is set, the model will not be deleted from the target/"to" adapter. | 0b1000 |
6262
| SKIP_UNMATCHED_BOTH | Convenience value combining both SKIP_UNMATCHED_SRC and SKIP_UNMATCHED_DST into a single flag | 0b1100 |
6363
| NATURAL_DELETION_ORDER | When deleting, delete children before instances of this model. | 0b10000 |
6464

docs/source/core_engine/03-store.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The `store` is a class attribute in the `Adapter` class, but all the store opera
66

77
## Use the `LocalStore` Backend
88

9-
When you initialize the `Diffsync` Adapter class, there is an optional keyed-argument, `internal_storage_engine`, defaulting to the `LocalStore` class.
9+
When you initialize the `Adapter` class, there is an optional keyed-argument, `internal_storage_engine`, defaulting to the `LocalStore` class.
1010

1111
```python
1212
>> > from diffsync import Adapter

docs/source/getting_started/01-getting-started.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class Cable(DiffSyncModel):
9797
[...]
9898

9999

100-
class Nautobot(DiffSync):
100+
class Nautobot(Adapter):
101101
site = Site
102102
device = Device
103103
interface = Interface
@@ -121,15 +121,15 @@ Would result in processing in the following order for each element until there i
121121
- ip_address
122122
- cable
123123

124-
> Note: This applies to the actual diff sync (`Diffsync.sync_from/Diffsync.sync_to`), and not the loading of the data (`Diffsync.load`), which is up to the developer to determine the order.
124+
> Note: This applies to the actual diff sync (`Adapter.sync_from` and `Adapter.sync_to`), and not the loading of the data (`Adapter.load`), which is up to the developer to determine the order.
125125
126126
This can be visualized here in the included diagram.
127127

128128
![Preorder Tree Traversal](../../images/preorder-tree-traversal.drawio.png "Preorder Tree Traversal")
129129

130130
### Mapping Tree Traversal with `get_tree_traversal` method
131131

132-
For your convenience, there is a helper method that will provide a mapping of the order. The `DiffSync.get_tree_traversal()` class method will return a tree-like string, or optionally a dictionary when passing the `as_dict=True` parameter.
132+
For your convenience, there is a helper method that will provide a mapping of the order. The `Adapter.get_tree_traversal()` class method will return a tree-like string, or optionally a dictionary when passing the `as_dict=True` parameter.
133133

134134
```python
135135
>>> from nautobot_device_onboarding.network_importer.adapters.network_device.adapter import NetworkImporterAdapter
@@ -150,7 +150,7 @@ NetworkImporterAdapter
150150
To add a site to the local cache/store, you need to pass a valid `DiffSyncModel` object to the `add()` function.
151151

152152
```python
153-
class BackendA(DiffSync):
153+
class BackendA(Adapter):
154154
[...]
155155

156156
def load(self):
@@ -203,14 +203,14 @@ class Device(DiffSyncModel):
203203
If you prefer to update the entire remote system with the final state after performing all individual create/update/delete operations (as might be the case if your "remote system" is a single YAML or JSON file), the easiest place to implement this logic is in the `sync_complete()` callback method that is automatically invoked by DiffSync upon completion of a sync operation.
204204

205205
```python
206-
class BackendA(DiffSync):
206+
class BackendA(Adapter):
207207
[...]
208208

209-
def sync_complete(self, source: DiffSync, diff: Diff, flags: DiffSyncFlags, logger: structlog.BoundLogger):
209+
def sync_complete(self, source: Adapter, diff: Diff, flags: DiffSyncFlags, logger: structlog.BoundLogger):
210210
## TODO add your own logic to update the remote system now.
211211
# The various parameters passed to this method are for your convenience in implementing more complex logic, and
212212
# can be ignored if you do not need them.
213213
#
214-
# The default DiffSync.sync_complete() method does nothing, but it's always a good habit to call super():
214+
# The default Adapter.sync_complete() method does nothing, but it's always a good habit to call super():
215215
super().sync_complete(source, diff, flags, logger)
216216
```

0 commit comments

Comments
 (0)