Skip to content

Commit 8c5ac8d

Browse files
author
Abel Milash
committed
Run black on PR files
1 parent 6e81eb1 commit 8c5ac8d

4 files changed

Lines changed: 15 additions & 40 deletions

File tree

examples/advanced/walkthrough.py

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -377,13 +377,7 @@ def _run_walkthrough(client):
377377
print("Querying accounts with primary contact expanded...")
378378
try:
379379
expanded_records = list(
380-
backoff(
381-
lambda: client.query.builder("account")
382-
.select("name")
383-
.expand("primarycontactid")
384-
.top(3)
385-
.execute()
386-
)
380+
backoff(lambda: client.query.builder("account").select("name").expand("primarycontactid").top(3).execute())
387381
)
388382
print(f"[OK] Found {len(expanded_records)} accounts with expanded contact:")
389383
for rec in expanded_records:
@@ -398,19 +392,10 @@ def _run_walkthrough(client):
398392
print("Querying accounts with nested expand options on tasks...")
399393
try:
400394
tasks_opt = (
401-
ExpandOption("Account_Tasks")
402-
.select("subject", "createdon")
403-
.order_by("createdon", descending=True)
404-
.top(3)
395+
ExpandOption("Account_Tasks").select("subject", "createdon").order_by("createdon", descending=True).top(3)
405396
)
406397
nested_records = list(
407-
backoff(
408-
lambda: client.query.builder("account")
409-
.select("name")
410-
.expand(tasks_opt)
411-
.top(3)
412-
.execute()
413-
)
398+
backoff(lambda: client.query.builder("account").select("name").expand(tasks_opt).top(3).execute())
414399
)
415400
print(f"[OK] Found {len(nested_records)} accounts with nested task expansion:")
416401
for rec in nested_records:

src/PowerPlatform/Dataverse/models/filters.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,7 @@ def to_odata(self) -> str:
230230
# PropertyValues is Collection(Edm.String)
231231
parts = [f'"{_format_value(v).strip("'")}"' for v in self.values]
232232
formatted = ",".join(parts)
233-
return (
234-
f"Microsoft.Dynamics.CRM.In"
235-
f"(PropertyName='{self.column}',PropertyValues=[{formatted}])"
236-
)
233+
return f"Microsoft.Dynamics.CRM.In" f"(PropertyName='{self.column}',PropertyValues=[{formatted}])"
237234

238235

239236
class _NotInFilter(FilterExpression):
@@ -251,10 +248,7 @@ def to_odata(self) -> str:
251248
# Same Collection(Edm.String) rules as _InFilter.
252249
parts = [f'"{_format_value(v).strip("'")}"' for v in self.values]
253250
formatted = ",".join(parts)
254-
return (
255-
f"Microsoft.Dynamics.CRM.NotIn"
256-
f"(PropertyName='{self.column}',PropertyValues=[{formatted}])"
257-
)
251+
return f"Microsoft.Dynamics.CRM.NotIn" f"(PropertyName='{self.column}',PropertyValues=[{formatted}])"
258252

259253

260254
class _RawFilter(FilterExpression):

src/PowerPlatform/Dataverse/models/query_builder.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,7 @@ def filter_in(self, column: str, values: Collection[Any]) -> QueryBuilder:
335335
self._filter_parts.append(filters.filter_in(column, values))
336336
return self
337337

338-
def filter_not_in(
339-
self, column: str, values: Collection[Any]
340-
) -> QueryBuilder:
338+
def filter_not_in(self, column: str, values: Collection[Any]) -> QueryBuilder:
341339
"""Add a ``not in`` filter using ``Microsoft.Dynamics.CRM.NotIn``.
342340
343341
:param column: Column name (will be lowercased).
@@ -370,9 +368,7 @@ def filter_between(self, column: str, low: Any, high: Any) -> QueryBuilder:
370368
self._filter_parts.append(filters.between(column, low, high))
371369
return self
372370

373-
def filter_not_between(
374-
self, column: str, low: Any, high: Any
375-
) -> QueryBuilder:
371+
def filter_not_between(self, column: str, low: Any, high: Any) -> QueryBuilder:
376372
"""Add a not-between filter: ``not (column ge low and column le high)``.
377373
378374
:param column: Column name (will be lowercased).

tests/unit/models/test_query_builder.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -478,11 +478,13 @@ def test_expand_with_expand_option(self):
478478
def test_expand_option_with_filter_and_orderby(self):
479479
from PowerPlatform.Dataverse.models.query_builder import ExpandOption
480480

481-
opt = (ExpandOption("Account_Tasks")
482-
.select("subject")
483-
.filter("contains(subject,'Task')")
484-
.order_by("createdon", descending=True)
485-
.top(10))
481+
opt = (
482+
ExpandOption("Account_Tasks")
483+
.select("subject")
484+
.filter("contains(subject,'Task')")
485+
.order_by("createdon", descending=True)
486+
.top(10)
487+
)
486488
self.assertEqual(
487489
opt.to_odata(),
488490
"Account_Tasks($select=subject;$filter=contains(subject,'Task');$orderby=createdon desc;$top=10)",
@@ -536,9 +538,7 @@ def test_include_annotations_default_wildcard(self):
536538
self.assertEqual(qb.build()["include_annotations"], "*")
537539

538540
def test_include_annotations_custom(self):
539-
qb = QueryBuilder("account").include_annotations(
540-
"Microsoft.Dynamics.CRM.lookuplogicalname"
541-
)
541+
qb = QueryBuilder("account").include_annotations("Microsoft.Dynamics.CRM.lookuplogicalname")
542542
self.assertEqual(
543543
qb.build()["include_annotations"],
544544
"Microsoft.Dynamics.CRM.lookuplogicalname",

0 commit comments

Comments
 (0)