Skip to content

Commit 03ce5f0

Browse files
author
Saurabh Badenkal
committed
Fix docstring type annotations for Microsoft Learn compatibility
Replace Sphinx-style ':class:\list\ of :class:\str\' patterns with Python bracket notation (list[str], dict[str, Any], etc.) in :type: and :rtype: directives. The Learn doc pipeline treats each word between :class: references as a separate cross-reference (<xref:word>), causing connector words like 'of', 'mapping', and 'to' to produce broken <xref:of>, <xref:mapping>, <xref:to> links that cannot be resolved. Files fixed: - client.py (14 occurrences) - operations/records.py (14 occurrences) - operations/tables.py (7 occurrences) - operations/dataframe.py (3 occurrences) - operations/query.py (1 occurrence) - models/table_info.py (3 occurrences) This reverts to the bracket notation style that was originally used before the Sphinx docstring conversion in commit f0e8987.
1 parent eebee60 commit 03ce5f0

6 files changed

Lines changed: 44 additions & 47 deletions

File tree

src/PowerPlatform/Dataverse/client.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,10 @@ def create(self, table_schema_name: str, records: Union[Dict[str, Any], List[Dic
208208
:type table_schema_name: :class:`str`
209209
:param records: A single record dictionary or a list of record dictionaries.
210210
Each dictionary should contain column schema names as keys.
211-
:type records: :class:`dict` or :class:`list` of :class:`dict`
211+
:type records: dict or list[dict]
212212
213213
:return: List of created record GUIDs. Returns a single-element list for a single input.
214-
:rtype: :class:`list` of :class:`str`
214+
:rtype: list[str]
215215
216216
:raises TypeError: If ``records`` is not a dict or list[dict], or if the internal
217217
client returns an unexpected type.
@@ -260,12 +260,12 @@ def update(
260260
:param table_schema_name: Schema name of the table (e.g. ``"account"`` or ``"new_MyTestTable"``).
261261
:type table_schema_name: :class:`str`
262262
:param ids: Single GUID string or list of GUID strings to update.
263-
:type ids: :class:`str` or :class:`list` of :class:`str`
263+
:type ids: str or list[str]
264264
:param changes: Dictionary of changes for single/broadcast mode, or list of dictionaries
265265
for paired mode. When ``ids`` is a list and ``changes`` is a single dict,
266266
the same changes are broadcast to all records. When both are lists, they must
267267
have equal length for one-to-one mapping.
268-
:type changes: :class:`dict` or :class:`list` of :class:`dict`
268+
:type changes: dict or list[dict]
269269
270270
:raises TypeError: If ``ids`` is not str or list[str], or if ``changes`` type doesn't match usage pattern.
271271
@@ -312,7 +312,7 @@ def delete(
312312
:param table_schema_name: Schema name of the table (e.g. ``"account"`` or ``"new_MyTestTable"``).
313313
:type table_schema_name: :class:`str`
314314
:param ids: Single GUID string or list of GUID strings to delete.
315-
:type ids: :class:`str` or :class:`list` of :class:`str`
315+
:type ids: str or list[str]
316316
:param use_bulk_delete: When ``True`` (default) and ``ids`` is a list, execute the BulkDelete action and
317317
return its async job identifier. When ``False`` each record is deleted sequentially.
318318
:type use_bulk_delete: :class:`bool`
@@ -367,21 +367,21 @@ def get(
367367
:param record_id: Optional GUID to fetch a specific record. If None, queries multiple records.
368368
:type record_id: :class:`str` or None
369369
:param select: Optional list of attribute logical names to retrieve. Column names are case-insensitive and automatically lowercased (e.g. ``["new_Title", "new_Amount"]`` becomes ``"new_title,new_amount"``).
370-
:type select: :class:`list` of :class:`str` or None
370+
:type select: list[str] or None
371371
:param filter: Optional OData filter string, e.g. ``"name eq 'Contoso'"`` or ``"new_quantity gt 5"``. Column names in filter expressions must use exact lowercase logical names (e.g. ``"new_quantity"``, not ``"new_Quantity"``). The filter string is passed directly to the Dataverse Web API without transformation.
372372
:type filter: :class:`str` or None
373373
:param orderby: Optional list of attributes to sort by, e.g. ``["name asc", "createdon desc"]``. Column names are automatically lowercased.
374-
:type orderby: :class:`list` of :class:`str` or None
374+
:type orderby: list[str] or None
375375
:param top: Optional maximum number of records to return.
376376
:type top: :class:`int` or None
377377
:param expand: Optional list of navigation properties to expand, e.g. ``["primarycontactid"]``. Navigation property names are case-sensitive and must match the server-defined names exactly. These are NOT automatically transformed. Consult entity metadata for correct casing.
378-
:type expand: :class:`list` of :class:`str` or None
378+
:type expand: list[str] or None
379379
:param page_size: Optional number of records per page for pagination.
380380
:type page_size: :class:`int` or None
381381
382382
:return: Single record dict if ``record_id`` is provided, otherwise a generator
383383
yielding lists of record dictionaries (one list per page).
384-
:rtype: :class:`dict` or :class:`collections.abc.Iterable` of :class:`list` of :class:`dict`
384+
:rtype: dict or collections.abc.Iterable[list[dict]]
385385
386386
:raises TypeError: If ``record_id`` is provided but not a string.
387387
@@ -456,7 +456,7 @@ def query_sql(self, sql: str) -> List[Dict[str, Any]]:
456456
:type sql: :class:`str`
457457
458458
:return: List of result row dictionaries. Returns an empty list if no rows match.
459-
:rtype: :class:`list` of :class:`dict`
459+
:rtype: list[dict]
460460
461461
:raises ~PowerPlatform.Dataverse.core.errors.SQLParseError: If the SQL query uses unsupported syntax.
462462
:raises ~PowerPlatform.Dataverse.core.errors.HttpError: If the Web API returns an error.
@@ -545,7 +545,7 @@ class ItemStatus(IntEnum):
545545
1036: {"Active": "Actif", "Inactive": "Inactif"}
546546
}
547547
548-
:type columns: :class:`dict` mapping :class:`str` to :class:`typing.Any`
548+
:type columns: dict[str, typing.Any]
549549
:param solution_unique_name: Optional solution unique name that should own the new table. When omitted the table is created in the default solution.
550550
:type solution_unique_name: :class:`str` or None
551551
:param primary_column_schema_name: Optional primary name column schema name with customization prefix value (e.g. ``"new_MyTestTable"``). If not provided, defaults to ``"{customization prefix value}_Name"``.
@@ -634,7 +634,7 @@ def list_tables(self) -> list[dict[str, Any]]:
634634
List all non-private tables in the Dataverse environment.
635635
636636
:return: List of EntityDefinition metadata dictionaries.
637-
:rtype: :class:`list` of :class:`dict`
637+
:rtype: list[dict]
638638
639639
Example:
640640
List all non-private tables and print their logical names::
@@ -666,9 +666,9 @@ def create_columns(
666666
:param columns: Mapping of column schema names (with customization prefix value) to supported types. All custom column names must include the customization prefix value** (e.g. ``"new_Notes"``). Primitive types include
667667
``"string"`` (alias: ``"text"``), ``"int"`` (alias: ``"integer"``), ``"decimal"`` (alias: ``"money"``), ``"float"`` (alias: ``"double"``), ``"datetime"`` (alias: ``"date"``), ``"bool"`` (alias: ``"boolean"``), and ``"file"``. Enum subclasses (IntEnum preferred)
668668
generate a local option set and can specify localized labels via ``__labels__``.
669-
:type columns: :class:`dict` mapping :class:`str` to :class:`typing.Any`
669+
:type columns: dict[str, typing.Any]
670670
:returns: Schema names for the columns that were created.
671-
:rtype: :class:`list` of :class:`str`
671+
:rtype: list[str]
672672
Example:
673673
Create multiple columns on the custom table::
674674
@@ -703,9 +703,9 @@ def delete_columns(
703703
:param table_schema_name: Schema name of the table (e.g. ``"new_MyTestTable"``).
704704
:type table_schema_name: :class:`str`
705705
:param columns: Column name or list of column names to remove. Must include customization prefix value (e.g. ``"new_TestColumn"``).
706-
:type columns: :class:`str` or :class:`list` of :class:`str`
706+
:type columns: str or list[str]
707707
:returns: Schema names for the columns that were removed.
708-
:rtype: :class:`list` of :class:`str`
708+
:rtype: list[str]
709709
Example:
710710
Remove two custom columns by schema name:
711711

src/PowerPlatform/Dataverse/models/table_info.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ class TableInfo:
9797
:param description: Table description.
9898
:type description: :class:`str` or None
9999
:param columns: Column metadata (when retrieved).
100-
:type columns: :class:`list` of :class:`ColumnInfo` or None
100+
:type columns: list[ColumnInfo] or None
101101
:param columns_created: Column schema names created with the table.
102-
:type columns_created: :class:`list` of :class:`str` or None
102+
:type columns_created: list[str] or None
103103
104104
Example::
105105
@@ -241,7 +241,7 @@ class AlternateKeyInfo:
241241
:param schema_name: Key schema name.
242242
:type schema_name: :class:`str`
243243
:param key_attributes: List of column logical names that compose the key.
244-
:type key_attributes: :class:`list` of :class:`str`
244+
:type key_attributes: list[str]
245245
:param status: Index creation status (``"Active"``, ``"Pending"``, ``"InProgress"``, ``"Failed"``).
246246
:type status: :class:`str`
247247
"""

src/PowerPlatform/Dataverse/operations/dataframe.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ def get(
7575
:param record_id: Optional GUID to fetch a specific record. If None, queries multiple records.
7676
:type record_id: :class:`str` or None
7777
:param select: Optional list of attribute logical names to retrieve.
78-
:type select: :class:`list` of :class:`str` or None
78+
:type select: list[str] or None
7979
:param filter: Optional OData filter string. Column names must use exact lowercase logical names.
8080
:type filter: :class:`str` or None
8181
:param orderby: Optional list of attributes to sort by.
82-
:type orderby: :class:`list` of :class:`str` or None
82+
:type orderby: list[str] or None
8383
:param top: Optional maximum number of records to return.
8484
:type top: :class:`int` or None
8585
:param expand: Optional list of navigation properties to expand (case-sensitive).
86-
:type expand: :class:`list` of :class:`str` or None
86+
:type expand: list[str] or None
8787
:param page_size: Optional number of records per page for pagination.
8888
:type page_size: :class:`int` or None
8989

src/PowerPlatform/Dataverse/operations/query.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ def sql(self, sql: str) -> List[Record]:
5151
5252
:return: List of :class:`~PowerPlatform.Dataverse.models.record.Record`
5353
objects. Returns an empty list when no rows match.
54-
:rtype: :class:`list` of
55-
:class:`~PowerPlatform.Dataverse.models.record.Record`
54+
:rtype: list[~PowerPlatform.Dataverse.models.record.Record]
5655
5756
:raises ~PowerPlatform.Dataverse.core.errors.ValidationError:
5857
If ``sql`` is not a string or is empty.

src/PowerPlatform/Dataverse/operations/records.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ def create(
6969
:type table: :class:`str`
7070
:param data: A single record dictionary or a list of record dictionaries.
7171
Each dictionary maps column schema names to values.
72-
:type data: :class:`dict` or :class:`list` of :class:`dict`
72+
:type data: dict or list[dict]
7373
7474
:return: A single GUID string for a single record, or a list of GUID
7575
strings for bulk creation.
76-
:rtype: :class:`str` or :class:`list` of :class:`str`
76+
:rtype: str or list[str]
7777
7878
:raises TypeError: If ``data`` is not a dict or list[dict].
7979
@@ -127,10 +127,10 @@ def update(
127127
:param table: Schema name of the table (e.g. ``"account"``).
128128
:type table: :class:`str`
129129
:param ids: A single GUID string, or a list of GUID strings.
130-
:type ids: :class:`str` or :class:`list` of :class:`str`
130+
:type ids: str or list[str]
131131
:param changes: A dictionary of field changes (single/broadcast), or a
132132
list of dictionaries (paired, one per ID).
133-
:type changes: :class:`dict` or :class:`list` of :class:`dict`
133+
:type changes: dict or list[dict]
134134
135135
:raises TypeError: If ``ids`` is not str or list[str], or if ``changes``
136136
does not match the expected pattern.
@@ -187,7 +187,7 @@ def delete(
187187
:param table: Schema name of the table (e.g. ``"account"``).
188188
:type table: :class:`str`
189189
:param ids: A single GUID string, or a list of GUID strings.
190-
:type ids: :class:`str` or :class:`list` of :class:`str`
190+
:type ids: str or list[str]
191191
:param use_bulk_delete: When True (default) and ``ids`` is a list, use
192192
the BulkDelete action and return its async job ID. When False, delete
193193
records one at a time.
@@ -241,7 +241,7 @@ def get(
241241
:type record_id: :class:`str`
242242
:param select: Optional list of column logical names to include in the
243243
response.
244-
:type select: :class:`list` of :class:`str` or None
244+
:type select: list[str] or None
245245
246246
:return: Typed record with dict-like access for backward compatibility.
247247
:rtype: :class:`~PowerPlatform.Dataverse.models.record.Record`
@@ -282,29 +282,28 @@ def get(
282282
:type table: :class:`str`
283283
:param select: Optional list of column logical names to include.
284284
Column names are automatically lowercased.
285-
:type select: :class:`list` of :class:`str` or None
285+
:type select: list[str] or None
286286
:param filter: Optional OData ``$filter`` expression (e.g.
287287
``"name eq 'Contoso'"``). Column names in filter expressions must
288288
use exact lowercase logical names.
289289
:type filter: :class:`str` or None
290290
:param orderby: Optional list of sort expressions (e.g.
291291
``["name asc", "createdon desc"]``). Column names are automatically
292292
lowercased.
293-
:type orderby: :class:`list` of :class:`str` or None
293+
:type orderby: list[str] or None
294294
:param top: Optional maximum total number of records to return.
295295
:type top: :class:`int` or None
296296
:param expand: Optional list of navigation properties to expand (e.g.
297297
``["primarycontactid"]``). Case-sensitive; must match server-defined
298298
names exactly.
299-
:type expand: :class:`list` of :class:`str` or None
299+
:type expand: list[str] or None
300300
:param page_size: Optional per-page size hint sent via
301301
``Prefer: odata.maxpagesize``.
302302
:type page_size: :class:`int` or None
303303
304304
:return: Generator yielding pages, where each page is a list of
305305
:class:`~PowerPlatform.Dataverse.models.record.Record` objects.
306-
:rtype: :class:`collections.abc.Iterable` of :class:`list` of
307-
:class:`~PowerPlatform.Dataverse.models.record.Record`
306+
:rtype: collections.abc.Iterable[list[~PowerPlatform.Dataverse.models.record.Record]]
308307
309308
Example:
310309
Fetch with filtering and pagination::
@@ -356,7 +355,7 @@ def get(
356355
:type record_id: :class:`str` or None
357356
:param select: Optional list of column logical names to include.
358357
Column names are automatically lowercased.
359-
:type select: :class:`list` of :class:`str` or None
358+
:type select: list[str] or None
360359
:param filter: Optional OData ``$filter`` expression (e.g.
361360
``"name eq 'Contoso'"``). Column names in filter expressions must
362361
use exact lowercase logical names. Only used for multi-record
@@ -365,23 +364,22 @@ def get(
365364
:param orderby: Optional list of sort expressions (e.g.
366365
``["name asc", "createdon desc"]``). Column names are
367366
automatically lowercased. Only used for multi-record queries.
368-
:type orderby: :class:`list` of :class:`str` or None
367+
:type orderby: list[str] or None
369368
:param top: Optional maximum total number of records to return. Only
370369
used for multi-record queries.
371370
:type top: :class:`int` or None
372371
:param expand: Optional list of navigation properties to expand (e.g.
373372
``["primarycontactid"]``). Case-sensitive; must match
374373
server-defined names exactly. Only used for multi-record queries.
375-
:type expand: :class:`list` of :class:`str` or None
374+
:type expand: list[str] or None
376375
:param page_size: Optional per-page size hint sent via
377376
``Prefer: odata.maxpagesize``. Only used for multi-record queries.
378377
:type page_size: :class:`int` or None
379378
380379
:return: A single record dict when ``record_id`` is provided, or a
381380
generator yielding pages (lists of record dicts) when fetching
382381
multiple records.
383-
:rtype: :class:`dict` or :class:`collections.abc.Iterable` of
384-
:class:`list` of :class:`dict`
382+
:rtype: dict or collections.abc.Iterable[list[dict]]
385383
386384
:raises TypeError: If ``record_id`` is provided but not a string.
387385
:raises ValueError: If query parameters are provided alongside

src/PowerPlatform/Dataverse/operations/tables.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,10 @@ def list(
213213
``["LogicalName", "SchemaName", "DisplayName"]``).
214214
When ``None`` (the default) or an empty list, all properties are
215215
returned.
216-
:type select: :class:`list` of :class:`str` or None
216+
:type select: list[str] or None
217217
218218
:return: List of EntityDefinition metadata dictionaries.
219-
:rtype: :class:`list` of :class:`dict`
219+
:rtype: list[dict]
220220
221221
Example::
222222
@@ -255,7 +255,7 @@ def add_columns(
255255
:type columns: :class:`dict`
256256
257257
:return: Schema names of the columns that were created.
258-
:rtype: :class:`list` of :class:`str`
258+
:rtype: list[str]
259259
260260
:raises ~PowerPlatform.Dataverse.core.errors.MetadataError:
261261
If the table does not exist.
@@ -285,10 +285,10 @@ def remove_columns(
285285
:param columns: Column schema name or list of column schema names to
286286
remove. Must include the customization prefix (e.g.
287287
``"new_TestColumn"``).
288-
:type columns: :class:`str` or :class:`list` of :class:`str`
288+
:type columns: str or list[str]
289289
290290
:return: Schema names of the columns that were removed.
291-
:rtype: :class:`list` of :class:`str`
291+
:rtype: list[str]
292292
293293
:raises ~PowerPlatform.Dataverse.core.errors.MetadataError:
294294
If the table or a specified column does not exist.
@@ -612,7 +612,7 @@ def create_alternate_key(
612612
:type key_name: :class:`str`
613613
:param columns: List of column logical names that compose the key
614614
(e.g. ``["new_productcode"]``).
615-
:type columns: :class:`list` of :class:`str`
615+
:type columns: list[str]
616616
:param display_name: Display name for the key. Defaults to
617617
``key_name`` if not provided.
618618
:type display_name: :class:`str` or None
@@ -660,7 +660,7 @@ def get_alternate_keys(self, table: str) -> List[AlternateKeyInfo]:
660660
661661
:return: List of alternate key metadata objects. May be empty if no
662662
alternate keys are defined.
663-
:rtype: :class:`list` of :class:`~PowerPlatform.Dataverse.models.table_info.AlternateKeyInfo`
663+
:rtype: list[~PowerPlatform.Dataverse.models.table_info.AlternateKeyInfo]
664664
665665
:raises ~PowerPlatform.Dataverse.core.errors.MetadataError:
666666
If the table does not exist.

0 commit comments

Comments
 (0)