Skip to content

Commit 4a301c7

Browse files
authored
Merge pull request #82 from networktocode/dga-202112-lock
Update lock file with latest version
2 parents 53d6095 + 681cdf4 commit 4a301c7

File tree

13 files changed

+409
-429
lines changed

13 files changed

+409
-429
lines changed

diffsync/helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ def diff_object_list(self, src: List["DiffSyncModel"], dst: List["DiffSyncModel"
125125

126126
self.validate_objects_for_diff(combined_dict.values())
127127

128-
for uid in combined_dict:
129-
src_obj, dst_obj = combined_dict[uid]
128+
for uid, value in combined_dict.items():
129+
src_obj, dst_obj = value
130130
diff_element = self.diff_object_pair(src_obj, dst_obj)
131131

132132
if diff_element:

examples/01-multiple-data-sources/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Site(DiffSyncModel):
2828
_children = {"device": "devices"}
2929

3030
name: str
31-
devices: List = list()
31+
devices: List = []
3232

3333

3434
class Device(DiffSyncModel):
@@ -42,7 +42,7 @@ class Device(DiffSyncModel):
4242
name: str
4343
site_name: Optional[str] # note that this attribute is NOT included in _attributes
4444
role: Optional[str] # note that this attribute is NOT included in _attributes
45-
interfaces: List = list()
45+
interfaces: List = []
4646

4747

4848
class Interface(DiffSyncModel):

examples/03-remote-system/local_adapter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class LocalAdapter(DiffSync):
2929

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

3535
# Load all regions first

examples/03-remote-system/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Region(DiffSyncModel):
1616

1717
slug: str
1818
name: str
19-
countries: List[str] = list()
19+
countries: List[str] = []
2020

2121

2222
class Country(DiffSyncModel):

examples/04-get-update-instantiate/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ class Device(DiffSyncModel):
4040
name: str
4141
site_name: Optional[str] # note that this attribute is NOT included in _attributes
4242
role: Optional[str] # note that this attribute is NOT included in _attributes
43-
interfaces: List = list()
44-
sites: List = list()
43+
interfaces: List = []
44+
sites: List = []
4545

4646

4747
class Interface(DiffSyncModel):

examples/05-nautobot-peeringdb/adapter_nautobot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def update(self, attrs):
4646
data["description"] = attrs["description"]
4747
if "parent_name" in attrs:
4848
if attrs["parent_name"]:
49-
data["parent"] = str(self.get(self.region, attrs["parent_name"]).pk)
49+
data["parent"] = str(self.diffsync.get(self.diffsync.region, attrs["parent_name"]).pk)
5050
else:
5151
data["parent"] = None
5252
self.diffsync.patch(f"/api/dcim/regions/{self.pk}/", data)

0 commit comments

Comments
 (0)