Skip to content

Commit a1990db

Browse files
author
Saurabh Badenkal
committed
Address Copilot review round 4: unused imports, type annotations, docs
- Remove unused imports in test_batch_scenarios.py (json, _RecordCreate, _RecordDelete, _RecordUpdate, _QuerySql, _CRLF, BatchRequest) - Remove unused imports in test_batch_dataframe.py (patch, BatchRecordOperations) - Remove unused import in test_batch_edge_cases.py (patch) - Fix BatchRequest._items type annotation: list -> List[Any] - Fix example GUID: nonexistent-guid -> 00000000-0000-0000-0000-000000000000 - Fix SKILL.md docs: entity_ids includes creates AND updates, not just creates
1 parent 0d0a5a2 commit a1990db

7 files changed

Lines changed: 6 additions & 14 deletions

File tree

.claude/skills/dataverse-sdk-use/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ print(f"Succeeded: {len(result.succeeded)}, Failed: {len(result.failed)}")
407407
- `result.succeeded` -- responses with 2xx status codes
408408
- `result.failed` -- responses with non-2xx status codes
409409
- `result.has_errors` -- True if any response failed
410-
- `result.entity_ids` -- GUIDs from successful create operations
410+
- `result.entity_ids` -- GUIDs from OData-EntityId headers (creates and updates)
411411

412412
**Batch limitations:**
413413
- Maximum 1000 operations per batch

examples/advanced/batch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
print("\n[INFO] Example 6: Continue on error")
167167

168168
batch = client.batch.new()
169-
batch.records.get("account", "nonexistent-guid-1111-1111-111111111111")
169+
batch.records.get("account", "00000000-0000-0000-0000-000000000000")
170170
batch.query.sql("SELECT TOP 1 name FROM account")
171171

172172
result = batch.execute(continue_on_error=True)

src/PowerPlatform/Dataverse/claude_skill/dataverse-sdk-use/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ print(f"Succeeded: {len(result.succeeded)}, Failed: {len(result.failed)}")
407407
- `result.succeeded` -- responses with 2xx status codes
408408
- `result.failed` -- responses with non-2xx status codes
409409
- `result.has_errors` -- True if any response failed
410-
- `result.entity_ids` -- GUIDs from successful create operations
410+
- `result.entity_ids` -- GUIDs from OData-EntityId headers (creates and updates)
411411

412412
**Batch limitations:**
413413
- Maximum 1000 operations per batch

src/PowerPlatform/Dataverse/operations/batch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ class BatchRequest:
756756

757757
def __init__(self, client: "DataverseClient") -> None:
758758
self._client = client
759-
self._items: list = []
759+
self._items: List[Any] = []
760760
self._content_id_counter: List[int] = [1] # shared across all changesets
761761
self.records = BatchRecordOperations(self)
762762
self.tables = BatchTableOperations(self)

tests/unit/data/test_batch_edge_cases.py

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

1111
import json
1212
import unittest
13-
from unittest.mock import MagicMock, patch
13+
from unittest.mock import MagicMock
1414

1515
from PowerPlatform.Dataverse.data._batch import (
1616
_BatchClient,

tests/unit/test_batch_dataframe.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
"""Unit tests for BatchDataFrameOperations."""
55

66
import unittest
7-
from unittest.mock import MagicMock, patch
7+
from unittest.mock import MagicMock
88

99
import pandas as pd
1010

1111
from PowerPlatform.Dataverse.operations.batch import (
1212
BatchDataFrameOperations,
13-
BatchRecordOperations,
1413
BatchRequest,
1514
)
1615
from PowerPlatform.Dataverse.data._batch import _RecordCreate, _RecordUpdate, _RecordDelete

tests/unit/test_batch_scenarios.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,17 @@
99
These tests serve as executable documentation for SDK consumers.
1010
"""
1111

12-
import json
1312
import unittest
1413
from unittest.mock import MagicMock
1514

1615
from PowerPlatform.Dataverse.data._batch import (
1716
_BatchClient,
1817
_ChangeSet,
19-
_RecordCreate,
20-
_RecordDelete,
2118
_RecordGet,
22-
_RecordUpdate,
23-
_QuerySql,
24-
_CRLF,
2519
)
2620
from PowerPlatform.Dataverse.core.errors import ValidationError
2721
from PowerPlatform.Dataverse.data._raw_request import _RawRequest
2822
from PowerPlatform.Dataverse.models.batch import BatchItemResponse, BatchResult
29-
from PowerPlatform.Dataverse.operations.batch import BatchRequest
3023

3124

3225
def _make_od():

0 commit comments

Comments
 (0)