Skip to content

Commit 0561dee

Browse files
Abel Milashclaude
andcommitted
Move _BatchContext Protocol from _batch_base to operations/batch
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6e80756 commit 0561dee

2 files changed

Lines changed: 19 additions & 20 deletions

File tree

src/PowerPlatform/Dataverse/data/_batch_base.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import re
1313
import uuid
1414
from dataclasses import dataclass, field
15-
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Protocol, Tuple, Union
15+
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
1616

1717
from ..core.errors import HttpError, ValidationError
1818
from ..core._error_codes import _http_subcode
@@ -235,23 +235,6 @@ class _ChangeSetBatchItem:
235235
requests: List[_RawRequest]
236236

237237

238-
# ---------------------------------------------------------------------------
239-
# Shared interface for batch operation namespaces
240-
# ---------------------------------------------------------------------------
241-
242-
243-
class _BatchContext(Protocol):
244-
"""Structural interface required by batch operation namespaces.
245-
246-
Both :class:`~PowerPlatform.Dataverse.operations.batch.BatchRequest` and
247-
:class:`~PowerPlatform.Dataverse.aio.operations.async_batch.AsyncBatchRequest`
248-
satisfy this protocol — no explicit inheritance needed on either class.
249-
"""
250-
251-
_items: List[Any]
252-
records: Any # used by BatchDataFrameOperations to delegate create/update/delete
253-
254-
255238
# ---------------------------------------------------------------------------
256239
# Batch base: pure serialisation and pure table resolvers
257240
# ---------------------------------------------------------------------------

src/PowerPlatform/Dataverse/operations/batch.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66
from __future__ import annotations
77

88
import warnings
9-
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
9+
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Protocol, Union
1010

1111
import pandas as pd
1212

1313
from ..core.errors import ValidationError
1414
from ..core._error_codes import VALIDATION_SQL_EMPTY
15-
from ..data._batch_base import _BatchContext
1615
from ..data._batch import (
1716
_BatchClient,
1817
_ChangeSet,
@@ -60,6 +59,23 @@
6059
]
6160

6261

62+
# ---------------------------------------------------------------------------
63+
# Shared interface for batch operation namespaces
64+
# ---------------------------------------------------------------------------
65+
66+
67+
class _BatchContext(Protocol):
68+
"""Structural interface required by batch operation namespaces.
69+
70+
Both :class:`~PowerPlatform.Dataverse.operations.batch.BatchRequest` and
71+
:class:`~PowerPlatform.Dataverse.aio.operations.async_batch.AsyncBatchRequest`
72+
satisfy this protocol — no explicit inheritance needed on either class.
73+
"""
74+
75+
_items: List[Any]
76+
records: Any # used by BatchDataFrameOperations to delegate create/update/delete
77+
78+
6379
# ---------------------------------------------------------------------------
6480
# Changeset namespaces
6581
# ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)