Skip to content

Update lock file with latest version #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions diffsync/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ def diff_object_list(self, src: List["DiffSyncModel"], dst: List["DiffSyncModel"

self.validate_objects_for_diff(combined_dict.values())

for uid in combined_dict:
src_obj, dst_obj = combined_dict[uid]
for uid, value in combined_dict.items():
src_obj, dst_obj = value
diff_element = self.diff_object_pair(src_obj, dst_obj)

if diff_element:
Expand Down
4 changes: 2 additions & 2 deletions examples/01-multiple-data-sources/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Site(DiffSyncModel):
_children = {"device": "devices"}

name: str
devices: List = list()
devices: List = []


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


class Interface(DiffSyncModel):
Expand Down
2 changes: 1 addition & 1 deletion examples/03-remote-system/local_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class LocalAdapter(DiffSync):

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

# Load all regions first
Expand Down
2 changes: 1 addition & 1 deletion examples/03-remote-system/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Region(DiffSyncModel):

slug: str
name: str
countries: List[str] = list()
countries: List[str] = []


class Country(DiffSyncModel):
Expand Down
4 changes: 2 additions & 2 deletions examples/04-get-update-instantiate/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class Device(DiffSyncModel):
name: str
site_name: Optional[str] # note that this attribute is NOT included in _attributes
role: Optional[str] # note that this attribute is NOT included in _attributes
interfaces: List = list()
sites: List = list()
interfaces: List = []
sites: List = []


class Interface(DiffSyncModel):
Expand Down
2 changes: 1 addition & 1 deletion examples/05-nautobot-peeringdb/adapter_nautobot.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def update(self, attrs):
data["description"] = attrs["description"]
if "parent_name" in attrs:
if attrs["parent_name"]:
data["parent"] = str(self.get(self.region, attrs["parent_name"]).pk)
data["parent"] = str(self.diffsync.get(self.diffsync.region, attrs["parent_name"]).pk)
else:
data["parent"] = None
self.diffsync.patch(f"/api/dcim/regions/{self.pk}/", data)
Expand Down
Loading