Skip to content

Commit 1371de1

Browse files
committed
docs: 📝 Fix docstrings and comments
1 parent 8f33103 commit 1371de1

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

diffsync/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ def sync_from( # pylint: disable=too-many-arguments,R0917,too-many-locals
722722
)
723723
result = syncer.perform_sync()
724724
if result:
725-
# Feature 4: Pass operations summary to sync_complete
725+
# Pass operations summary to sync_complete
726726
try:
727727
self.sync_complete(source, diff, flags, syncer.base_logger, operations=syncer.operations)
728728
except TypeError:

diffsync/helpers.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ def __init__( # pylint: disable=too-many-arguments,R0917
6161
self.callback = callback
6262
self.diff: Optional[Diff] = None
6363

64-
# Feature 6: Model-type scoping
64+
# Model-type scoping
6565
self.model_types = model_types
66-
# Feature 5: Attribute-based query predicates
66+
# Attribute-based query predicates
6767
self.filters = filters
68-
# Feature 7: Attribute-scoped syncing
68+
# Attribute-scoped syncing
6969
self.sync_attrs = sync_attrs
7070
self.exclude_attrs = exclude_attrs
7171

@@ -100,7 +100,7 @@ def calculate_diffs(self) -> Diff:
100100
self.incr_models_processed(len(self.src_diffsync.get_all(skipped_type)))
101101

102102
top_level_types = intersection(self.dst_diffsync.top_level, self.src_diffsync.top_level)
103-
# Feature 6: Model-type scoping
103+
# Model-type scoping
104104
if self.model_types is not None:
105105
top_level_types = [t for t in top_level_types if t in self.model_types]
106106

@@ -228,7 +228,7 @@ def diff_object_pair( # pylint: disable=too-many-return-statements, too-many-br
228228
self.incr_models_processed()
229229
return None
230230

231-
# Feature 5: Attribute-based query predicates
231+
# Attribute-based query predicates
232232
if self.filters and model in self.filters:
233233
predicate = self.filters[model]
234234
obj_to_check = src_obj or dst_obj
@@ -269,7 +269,7 @@ def diff_object_pair( # pylint: disable=too-many-return-statements, too-many-br
269269
def _filter_attrs(self, model_type: str, attrs: Dict) -> Dict:
270270
"""Filter attributes based on sync_attrs and exclude_attrs settings.
271271
272-
Feature 7: Attribute-scoped syncing.
272+
Apply sync_attrs whitelist first, then exclude_attrs blacklist.
273273
"""
274274
if self.sync_attrs and model_type in self.sync_attrs:
275275
attrs = {k: v for k, v in attrs.items() if k in self.sync_attrs[model_type]}
@@ -312,7 +312,7 @@ def diff_child_objects(
312312
raise RuntimeError("Called with neither src_obj nor dest_obj??")
313313

314314
for child_type, child_fieldname in children_mapping.items():
315-
# Feature 6: Model-type scoping — skip child types not in model_types
315+
# Model-type scoping — skip child types not in model_types
316316
if self.model_types is not None and child_type not in self.model_types:
317317
continue
318318

@@ -355,18 +355,18 @@ def __init__( # pylint: disable=too-many-arguments,R0917
355355
self.flags = flags
356356
self.callback = callback
357357

358-
# Feature 9: Callback-based sync interceptor
358+
# Callback-based sync interceptor
359359
self.sync_filter = sync_filter
360360

361-
# Feature 2: Chunked/batched sync execution
361+
# Chunked/batched sync execution
362362
self.batch_size = batch_size
363363

364-
# Feature 3: Parallel sync of independent subtrees
364+
# Parallel sync of independent subtrees
365365
self.concurrent = concurrent
366366
self.max_workers = max_workers
367367
self.sync_stages = sync_stages
368368

369-
# Feature 4: Structured operations summary
369+
# Structured operations summary
370370
self.operations: Dict[str, Dict[str, List[Dict]]] = {}
371371
self._operations_lock = threading.Lock()
372372

@@ -397,7 +397,7 @@ def perform_sync(self) -> bool:
397397
changed = False
398398
self.base_logger.info("Beginning sync")
399399

400-
# Feature 3: Parallel sync of independent subtrees
400+
# Parallel sync of independent subtrees
401401
if self.concurrent:
402402
if self.sync_stages:
403403
# Staged concurrent execution: process each stage sequentially,
@@ -520,7 +520,7 @@ def sync_model( # pylint: disable=too-many-branches, unused-argument
520520
self.log_sync_status(self._local.action, status, message)
521521
return (False, dst_model)
522522

523-
# Feature 9: Callback-based sync interceptor
523+
# Callback-based sync interceptor
524524
if self.sync_filter:
525525
model_type = self._local.model_class.get_type()
526526
if not self.sync_filter(self._local.action, model_type, ids, attrs):
@@ -564,7 +564,7 @@ def sync_model( # pylint: disable=too-many-branches, unused-argument
564564

565565
self.log_sync_status(self._local.action, status, message)
566566

567-
# Feature 4: Track operations for structured sync_complete
567+
# Track operations for structured sync_complete
568568
if self._local.action is not None and status == DiffSyncStatus.SUCCESS:
569569
with self._operations_lock:
570570
model_type = self._local.model_class.get_type()

0 commit comments

Comments
 (0)