Skip to content

Commit efd36a7

Browse files
committed
Reenable pylint on the examples folder
1 parent c91eeb5 commit efd36a7

File tree

9 files changed

+17
-14
lines changed

9 files changed

+17
-14
lines changed

examples/example1/backend_a.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
# pylint: disable=wrong-import-order
1919
from diffsync import DiffSync
20-
from models import Site, Device, Interface
20+
from models import Site, Device, Interface # pylint: disable=no-name-in-module
2121

2222
DATA = {
2323
"nyc": {

examples/example1/backend_b.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
# pylint: disable=wrong-import-order
1919
from diffsync import DiffSync
20-
from models import Site, Device, Interface
20+
from models import Site, Device, Interface # pylint: disable=no-name-in-module
2121

2222
DATA = {
2323
"atl": {

examples/example1/backend_c.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
# pylint: disable=wrong-import-order
1919
from diffsync import DiffSync
20-
from models import Site, Device, Interface
20+
from models import Site, Device, Interface # pylint: disable=no-name-in-module
2121

2222
DATA = {
2323
"nyc": {

examples/example3/diff.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class AlphabeticalOrderDiff(Diff):
88
@classmethod
99
def order_children_default(cls, children):
1010
"""Simple diff to return all children in alphabetical order."""
11-
for child_name, child in sorted(children.items()):
11+
for child in sorted(children.values()):
1212

1313
# it's possible to access additional information about the object
1414
# like child.action can be "update", "create" or "delete"

examples/example3/local_adapter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class LocalAdapter(DiffSync):
2727
# mainly used when doing a diff to indicate where each data is coming from
2828
type = "Local"
2929

30-
def load(self, filename=COUNTRIES_FILE):
30+
def load(self, filename=COUNTRIES_FILE): # pylint: disable=arguments-differ
3131
"""Load all regions and countries from a local JSON file."""
3232
with open(filename, "r") as data_file:
3333
countries = json.load(data_file)

examples/example3/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
import sys
44
import argparse
55

6-
from diffsync.enum import DiffSyncFlags
7-
from diffsync.logging import enable_console_logging
8-
96
from local_adapter import LocalAdapter
107
from nautobot_adapter import NautobotAdapter
118
from diff import AlphabeticalOrderDiff
129

10+
from diffsync.enum import DiffSyncFlags
11+
from diffsync.logging import enable_console_logging
12+
1313

1414
def main():
1515
"""Demonstrate DiffSync behavior using the example backends provided."""

examples/example3/nautobot_adapter.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from diffsync import DiffSync
88

9+
# pylint: disable=attribute-defined-outside-init
910

1011
NAUTOBOT_URL = os.getenv("NAUTOBOT_URL", "https://demo.nautobot.com")
1112
NAUTOBOT_TOKEN = os.getenv("NAUTOBOT_TOKEN", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
@@ -44,9 +45,7 @@ def load(self):
4445
"""Load all data from Nautobot into the internal cache after transformation."""
4546
# Initialize pynautobot to interact with Nautobot and store it within the adapter
4647
# to reuse it later
47-
self.nautobot = pynautobot.api(
48-
url=NAUTOBOT_URL, token=NAUTOBOT_TOKEN
49-
) # pylint: disable=attribute-defined-outside-init
48+
self.nautobot = pynautobot.api(url=NAUTOBOT_URL, token=NAUTOBOT_TOKEN)
5049

5150
# Pull all regions from Nautobot, which includes all regions and all countries
5251
regions = self.nautobot.dcim.regions.all()
@@ -76,7 +75,7 @@ def load(self):
7675
self.add(item)
7776
parent.add_child(item)
7877

79-
def sync_from(self, *args, **kwargs):
78+
def sync_from(self, *args, **kwargs): # pylint: disable=signature-differs
8079
"""Sync the data with Nautobot but first ensure that all the required Custom fields are present in Nautobot."""
8180
# Check if all required custom fields exist, create them if they don't
8281
for custom_field in CUSTOM_FIELDS:

examples/example3/nautobot_models.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
"""Extension of the Base model for the Nautobot DiffSync Adapter to manage the CRUD operations."""
22
import pynautobot
33

4-
from diffsync import DiffSync
54
from models import Region, Country
65

6+
from diffsync import DiffSync
7+
8+
9+
# pylint: disable=no-member
10+
711

812
class NautobotRegion(Region):
913
"""Extend the Region object to store Nautobot specific information.

tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def pylint(context, name=NAME, image_ver=IMAGE_VER, local=INVOKE_LOCAL):
213213
"""
214214
# pty is set to true to properly run the docker commands due to the invocation process of docker
215215
# https://docs.pyinvoke.org/en/latest/api/runners.html - Search for pty for more information
216-
exec_cmd = 'find . -name "*.py" -not -path "*/examples/*" -not -path "*/docs/*" | xargs pylint'
216+
exec_cmd = 'find . -name "*.py" | xargs pylint'
217217
run_cmd(context, exec_cmd, name, image_ver, local)
218218

219219

0 commit comments

Comments
 (0)