Skip to content

Commit 7ca0950

Browse files
author
Samson Gebre
committed
fix format with black
1 parent aa1e7c7 commit 7ca0950

3 files changed

Lines changed: 7 additions & 14 deletions

File tree

src/PowerPlatform/Dataverse/data/_odata.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -447,20 +447,19 @@ def _upsert_multiple(
447447
"""
448448
if len(alternate_keys) != len(records):
449449
raise ValueError(
450-
f"alternate_keys and records must have the same length "
451-
f"({len(alternate_keys)} != {len(records)})"
450+
f"alternate_keys and records must have the same length " f"({len(alternate_keys)} != {len(records)})"
452451
)
453452
logical_name = table_schema_name.lower()
454453
targets: List[Dict[str, Any]] = []
455454
for alt_key, record in zip(alternate_keys, records):
456455
alt_key_lower = self._lowercase_keys(alt_key)
457456
record_processed = self._lowercase_keys(record)
458457
record_processed = self._convert_labels_to_ints(table_schema_name, record_processed)
459-
conflicting = {k for k in set(alt_key_lower) & set(record_processed) if alt_key_lower[k] != record_processed[k]}
458+
conflicting = {
459+
k for k in set(alt_key_lower) & set(record_processed) if alt_key_lower[k] != record_processed[k]
460+
}
460461
if conflicting:
461-
raise ValueError(
462-
f"record payload conflicts with alternate_key on fields: {sorted(conflicting)!r}"
463-
)
462+
raise ValueError(f"record payload conflicts with alternate_key on fields: {sorted(conflicting)!r}")
464463
combined: Dict[str, Any] = {**alt_key_lower, **record_processed}
465464
if "@odata.type" not in combined:
466465
combined["@odata.type"] = f"Microsoft.Dynamics.CRM.{logical_name}"

src/PowerPlatform/Dataverse/operations/records.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,7 @@ def upsert(self, table: str, items: List[Union[UpsertItem, Dict[str, Any]]]) ->
343343
for i in items:
344344
if isinstance(i, UpsertItem):
345345
normalized.append(i)
346-
elif (
347-
isinstance(i, dict)
348-
and isinstance(i.get("alternate_key"), dict)
349-
and isinstance(i.get("record"), dict)
350-
):
346+
elif isinstance(i, dict) and isinstance(i.get("alternate_key"), dict) and isinstance(i.get("record"), dict):
351347
normalized.append(UpsertItem(alternate_key=i["alternate_key"], record=i["record"]))
352348
else:
353349
raise TypeError("Each item must be a UpsertItem or a dict with 'alternate_key' and 'record' keys")

tests/unit/data/test_odata_internal.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,7 @@ def test_single_int_value(self):
9696

9797
def test_composite_key_string_and_string(self):
9898
"""Composite key with two string values produces comma-separated pairs."""
99-
result = self.od._build_alternate_key_str(
100-
{"accountnumber": "ACC-001", "address1_postalcode": "98052"}
101-
)
99+
result = self.od._build_alternate_key_str({"accountnumber": "ACC-001", "address1_postalcode": "98052"})
102100
self.assertEqual(result, "accountnumber='ACC-001',address1_postalcode='98052'")
103101

104102
def test_composite_key_string_and_int(self):

0 commit comments

Comments
 (0)