Skip to content

Commit 93c4502

Browse files
committed
test: 🚨 Address linter complaints
1 parent b4e3998 commit 93c4502

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

diffsync/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class DiffSyncModel(BaseModel):
7070
be included in **at most** one of these three tuples.
7171
"""
7272

73-
_modelname: ClassVar[str] = "diffsyncmodel"
73+
_modelname: ClassVar[str] = "diffsyncmodel" # pylint: disable=used-before-assignment
7474
"""Name of this model, used by DiffSync to store and look up instances of this model or its equivalents.
7575
7676
Lowercase by convention; typically corresponds to the class name, but that is not enforced.
@@ -432,7 +432,7 @@ class Adapter: # pylint: disable=too-many-public-methods
432432
# modelname1 = MyModelClass1
433433
# modelname2 = MyModelClass2
434434

435-
type: Optional[str] = None
435+
type: Optional[str] = None # pylint: disable=used-before-assignment
436436
"""Type of the object, will default to the name of the class if not provided."""
437437

438438
top_level: ClassVar[List[str]] = []
@@ -558,7 +558,7 @@ def load_from_dict(self, data: Dict) -> None:
558558
# Synchronization between DiffSync instances
559559
# ------------------------------------------------------------------------------
560560

561-
def sync_from( # pylint: disable=too-many-arguments
561+
def sync_from( # pylint: disable=too-many-arguments, too-many-positional-arguments
562562
self,
563563
source: "Adapter",
564564
diff_class: Type[Diff] = Diff,
@@ -602,7 +602,7 @@ def sync_from( # pylint: disable=too-many-arguments
602602

603603
return diff
604604

605-
def sync_to( # pylint: disable=too-many-arguments
605+
def sync_to( # pylint: disable=too-many-arguments, too-many-positional-arguments
606606
self,
607607
target: "Adapter",
608608
diff_class: Type[Diff] = Diff,

diffsync/diff.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ def order_children_default(cls, children: Dict[StrType, "DiffElement"]) -> Itera
105105
106106
Since children is already an OrderedDefaultDict, this method is not doing anything special.
107107
"""
108-
for child in children.values(): # pylint: disable=use-yield-from
109-
yield child
108+
yield from children.values()
110109

111110
def summary(self) -> Dict[StrType, int]:
112111
"""Build a dict summary of this Diff and its child DiffElements."""
@@ -161,7 +160,7 @@ def dict(self) -> Dict[StrType, Dict[StrType, Dict]]:
161160
class DiffElement: # pylint: disable=too-many-instance-attributes
162161
"""DiffElement object, designed to represent a single item/object that may or may not have any diffs."""
163162

164-
def __init__(
163+
def __init__( # pylint: disable=too-many-positional-arguments
165164
self,
166165
obj_type: StrType,
167166
name: StrType,

diffsync/helpers.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@
1515
limitations under the License.
1616
"""
1717

18-
from collections.abc import Iterable as ABCIterable, Mapping as ABCMapping
19-
from typing import Callable, List, Optional, Tuple, Type, TYPE_CHECKING, Dict, Iterable
18+
from collections.abc import Iterable as ABCIterable
19+
from collections.abc import Mapping as ABCMapping
20+
from typing import TYPE_CHECKING, Callable, Dict, Iterable, List, Optional, Tuple, Type
2021

2122
import structlog # type: ignore
2223

2324
from .diff import Diff, DiffElement
24-
from .enum import DiffSyncModelFlags, DiffSyncFlags, DiffSyncStatus, DiffSyncActions
25-
from .exceptions import ObjectNotFound, ObjectNotCreated, ObjectNotUpdated, ObjectNotDeleted, ObjectCrudException
25+
from .enum import DiffSyncActions, DiffSyncFlags, DiffSyncModelFlags, DiffSyncStatus
26+
from .exceptions import ObjectCrudException, ObjectNotCreated, ObjectNotDeleted, ObjectNotFound, ObjectNotUpdated
2627
from .utils import intersection, symmetric_difference
2728

2829
if TYPE_CHECKING: # pragma: no cover
@@ -36,7 +37,7 @@ class DiffSyncDiffer: # pylint: disable=too-many-instance-attributes
3637
Independent from Diff and DiffElement as those classes are purely data objects, while this stores some state.
3738
"""
3839

39-
def __init__( # pylint: disable=too-many-arguments
40+
def __init__( # pylint: disable=too-many-arguments, too-many-positional-arguments
4041
self,
4142
src_diffsync: "Adapter",
4243
dst_diffsync: "Adapter",
@@ -115,9 +116,9 @@ def diff_object_list(self, src: List["DiffSyncModel"], dst: List["DiffSyncModel"
115116

116117
combined_dict = {}
117118
for uid in dict_src:
118-
combined_dict[uid] = (dict_src.get(uid), dict_dst.get(uid))
119+
combined_dict[uid] = (dict_src.get(uid), dict_dst.get(uid)) # type: ignore
119120
for uid in dict_dst:
120-
combined_dict[uid] = (dict_src.get(uid), dict_dst.get(uid))
121+
combined_dict[uid] = (dict_src.get(uid), dict_dst.get(uid)) # type: ignore
121122
else:
122123
# In the future we might support set, etc...
123124
raise TypeError(f"Type combination {type(src)}/{type(dst)} is not supported... for now")
@@ -138,7 +139,7 @@ def diff_object_list(self, src: List["DiffSyncModel"], dst: List["DiffSyncModel"
138139

139140
@staticmethod
140141
def validate_objects_for_diff(
141-
object_pairs: Iterable[Tuple[Optional["DiffSyncModel"], Optional["DiffSyncModel"]]]
142+
object_pairs: Iterable[Tuple[Optional["DiffSyncModel"], Optional["DiffSyncModel"]]],
142143
) -> None:
143144
"""Check whether all DiffSyncModels in the given dictionary are valid for comparison to one another.
144145
@@ -286,7 +287,7 @@ class DiffSyncSyncer: # pylint: disable=too-many-instance-attributes
286287
Independent from DiffSync and DiffSyncModel as those classes are purely data objects, while this stores some state.
287288
"""
288289

289-
def __init__( # pylint: disable=too-many-arguments
290+
def __init__( # pylint: disable=too-many-arguments, too-many-positional-arguments
290291
self,
291292
diff: Diff,
292293
src_diffsync: "Adapter",

tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def run_cmd(context, exec_cmd, name=NAME, image_ver=IMAGE_VER, local=INVOKE_LOCA
8686
@task
8787
def build(
8888
context, name=NAME, python_ver=PYTHON_VER, image_ver=IMAGE_VER, nocache=False, forcerm=False
89-
): # pylint: disable=too-many-arguments
89+
): # pylint: disable=too-many-arguments, too-many-positional-arguments
9090
"""This will build an image with the provided name and python version.
9191
9292
Args:

0 commit comments

Comments
 (0)