Skip to content

Commit 24c75af

Browse files
[Tables] Updates for apiview & sphinx docs (Azure#18134)
1 parent 7b7b334 commit 24c75af

File tree

12 files changed

+224
-224
lines changed

12 files changed

+224
-224
lines changed

sdk/tables/azure-data-tables/azure/data/tables/_entity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def __getattr__(self, name):
4444
:param name:name of entity entry
4545
:type name: str
4646
:return: TableEntity dictionary
47-
:rtype: dict[str,str]
47+
:rtype: Dict[str,str]
4848
"""
4949
try:
5050
return self[name]

sdk/tables/azure-data-tables/azure/data/tables/_models.py

Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# license information.
55
# --------------------------------------------------------------------------
66
from enum import Enum
7+
from typing import TYPE_CHECKING
8+
79
from azure.core.exceptions import HttpResponseError
810
from azure.core.paging import PageIterator
911

@@ -22,6 +24,11 @@
2224
from ._error import _process_table_error
2325
from ._constants import NEXT_PARTITION_KEY, NEXT_ROW_KEY, NEXT_TABLE_NAME
2426

27+
if TYPE_CHECKING:
28+
from ._generated.models import TableQueryResponse
29+
from azure.core.pipeline.transport import HttpResponse
30+
from typing import Any, Dict, List
31+
2532

2633
class TableServiceStats(GenTableServiceStats):
2734
"""Stats for the service
@@ -133,7 +140,7 @@ class Metrics(GeneratedMetrics):
133140
134141
:keyword str version: The version of Storage Analytics to configure.
135142
:keyword bool enabled: Required. Indicates whether metrics are enabled for the service.
136-
:keyword bool include_ap_is: Indicates whether metrics should generate summary
143+
:keyword bool include_apis: Indicates whether metrics should generate summary
137144
statistics for called API operations.
138145
:keyword ~azure.data.tables.RetentionPolicy retention_policy: Required.
139146
The retention policy for the metrics.
@@ -150,7 +157,7 @@ def __init__( # pylint: disable=super-init-not-called
150157

151158
@classmethod
152159
def _from_generated(cls, generated):
153-
# type: (...) -> cls
160+
# type: (...) -> Metrics
154161
"""A summary of request statistics grouped by API in hour or minute aggregates.
155162
156163
:param Metrics generated: generated Metrics
@@ -194,7 +201,7 @@ def __init__( # pylint: disable=super-init-not-called
194201

195202
@classmethod
196203
def _from_generated(cls, generated, **kwargs): # pylint: disable=unused-argument
197-
# type: (...) -> cls
204+
# type: (GeneratedRetentionPolicy, Dict[str, Any]) -> RetentionPolicy
198205
"""The retention policy which determines how long the associated data should
199206
persist.
200207
@@ -400,12 +407,15 @@ def __init__(
400407
self.delete = kwargs.pop("delete", None) or ("d" in _str)
401408

402409
def __or__(self, other):
410+
# type: (TableSasPermissions) -> TableSasPermissions
403411
return TableSasPermissions(_str=str(self) + str(other))
404412

405413
def __add__(self, other):
414+
# type: (TableSasPermissions) -> TableSasPermissions
406415
return TableSasPermissions(_str=str(self) + str(other))
407416

408417
def __str__(self):
418+
# type: () -> TableSasPermissions
409419
return (
410420
("r" if self.read else "")
411421
+ ("a" if self.add else "")
@@ -416,9 +426,10 @@ def __str__(self):
416426
@classmethod
417427
def from_string(
418428
cls,
419-
permission, # type: str
429+
permission,
420430
**kwargs
421431
):
432+
# Type: (str, Dict[str, Any]) -> AccountSasPermissions
422433
"""Create AccountSasPermissions from a string.
423434
424435
To specify read, write, delete, etc. permissions you need only to
@@ -428,8 +439,8 @@ def from_string(
428439
:param str permission: Specify permissions in
429440
the string with the first letter of the word.
430441
:keyword callable cls: A custom type or function that will be passed the direct response
431-
:return: A AccountSasPermissions object
432-
:rtype: ~azure.data.tables.AccountSasPermissions
442+
:return: An AccountSasPermissions object
443+
:rtype: :class:`~azure.data.tables.AccountSasPermissions`
433444
"""
434445
p_read = "r" in permission
435446
p_add = "a" in permission
@@ -477,23 +488,28 @@ def service_properties_deserialize(generated):
477488

478489
class TableItem(object):
479490
"""
480-
Represents an Azure TableItem. Returned by TableServiceClient.list_tables
481-
and TableServiceClient.query_tables.
491+
Represents an Azure TableItem.
492+
Returned by TableServiceClient.list_tables and TableServiceClient.query_tables.
482493
483-
:param str name: The name of the table.
494+
:ivar str name: The name of the table.
484495
:ivar str api_version: The API version included in the service call
485496
:ivar str date: The date the service call was made
486497
"""
487498

488499
def __init__(self, name, **kwargs):
489-
# type: (str, **Any) -> None
500+
# type: (str, Dict[str, Any]) -> None
501+
"""
502+
:param str name: Name of the Table
503+
:keyword str api_version: The API version included in the service call
504+
:keyword str date: The date the service call was made
505+
"""
490506
self.name = name
491507
self.api_version = kwargs.get("version")
492508
self.date = kwargs.get("date") or kwargs.get("Date")
493509

494510
@classmethod
495511
def _from_generated(cls, generated, **kwargs):
496-
# type: (obj, **Any) -> cls
512+
# type: (TableQueryResponse, Dict[str, Any]) -> TableItem
497513
return cls(generated.table_name, **kwargs)
498514

499515

@@ -541,12 +557,18 @@ class SASProtocol(str, Enum):
541557
class BatchErrorException(HttpResponseError):
542558
"""There is a failure in batch operations.
543559
544-
:param str message: The message of the exception.
560+
:param message: The message of the exception.
561+
:type message: str
545562
:param response: Server response to be deserialized.
546-
:param list parts: A list of the parts in multipart response.
563+
:type response: str
564+
:param parts: A list of the parts in multipart response.
565+
:type parts: ~azure.core.pipeline.transport.HttpResponse
566+
:param args: Args to be passed through
567+
:type args: List[:class:`~azure.core.pipeline.transport.HttpResponse`]
547568
"""
548569

549570
def __init__(self, message, response, parts, *args, **kwargs):
571+
# type: (str, str, HttpResponse, List[HttpResponse], Dict[str, Any]) -> None
550572
self.parts = parts
551573
super(BatchErrorException, self).__init__(
552574
message=message, response=response, *args, **kwargs
@@ -577,9 +599,8 @@ class ResourceTypes(object):
577599
Access to object-level APIs for tables (e.g. Get/Create/Query Entity etc.)
578600
"""
579601

580-
def __init__(
581-
self, service=False, object=False
582-
): # pylint: disable=redefined-builtin
602+
def __init__(self, service=False, object=False): # pylint: disable=redefined-builtin
603+
# type: (bool, bool) -> None
583604
self.service = service
584605
self.object = object
585606
self._str = ("s" if self.service else "") + ("o" if self.object else "")
@@ -589,6 +610,7 @@ def __str__(self):
589610

590611
@classmethod
591612
def from_string(cls, string):
613+
# type: (str) -> ResourceTypes
592614
"""Create a ResourceTypes from a string.
593615
594616
To specify service, container, or object you need only to
@@ -598,7 +620,7 @@ def from_string(cls, string):
598620
:param str string: Specify service, container, or object in
599621
in the string with the first letter of the word.
600622
:return: A ResourceTypes object
601-
:rtype: ~azure.data.tables.ResourceTypes
623+
:rtype: :class:`~azure.data.tables.ResourceTypes`
602624
"""
603625
res_service = "s" in string
604626
res_object = "o" in string
@@ -664,17 +686,18 @@ def __str__(self):
664686

665687
@classmethod
666688
def from_string(cls, permission, **kwargs):
689+
# type: (str, Dict[str]) -> AccountSasPermissions
667690
"""Create AccountSasPermissions from a string.
668691
669692
To specify read, write, delete, etc. permissions you need only to
670693
include the first letter of the word in the string. E.g. for read and write
671694
permissions you would provide a string "rw".
672695
673-
:param str permission: Specify permissions in
674-
the string with the first letter of the word.
696+
:param permission: Specify permissions in the string with the first letter of the word.
697+
:type permission: str
675698
:keyword callable cls: A custom type or function that will be passed the direct response
676-
:return: A AccountSasPermissions object
677-
:rtype: ~azure.data.tables.AccountSasPermissions
699+
:return: An AccountSasPermissions object
700+
:rtype: :class:`~azure.data.tables.AccountSasPermissions`
678701
"""
679702
p_read = "r" in permission
680703
p_write = "w" in permission

sdk/tables/azure-data-tables/azure/data/tables/_policies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def send(self, request):
184184
:param request: The PipelineRequest object
185185
:type request: ~azure.core.pipeline.PipelineRequest
186186
:return: Returns the PipelineResponse or raises error if maximum retries exceeded.
187-
:rtype: ~azure.core.pipeline.PipelineResponse
187+
:rtype: :class:`~azure.core.pipeline.PipelineResponse`
188188
:raises: ~azure.core.exceptions.AzureError if maximum retries exceeded.
189189
:raises: ~azure.core.exceptions.ClientAuthenticationError if authentication
190190
"""

sdk/tables/azure-data-tables/azure/data/tables/_serialize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def _parameter_filter_substitution(parameters, query_filter):
5656
# type: (Dict[str, str], str) -> str
5757
"""Replace user defined parameter in filter
5858
:param parameters: User defined parameters
59-
:param filter: Filter for querying
59+
:param str query_filter: Filter for querying
6060
"""
6161
if parameters:
6262
filter_strings = query_filter.split(' ')

sdk/tables/azure-data-tables/azure/data/tables/_table_batch.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def create_entity(
8686
:param entity: The properties for the table entity.
8787
:type entity: TableEntity or dict[str,str]
8888
:return: None
89+
:rtype: None
8990
:raises ValueError:
9091
9192
.. admonition:: Example:
@@ -212,8 +213,10 @@ def update_entity(
212213
:param mode: Merge or Replace entity
213214
:type mode: ~azure.data.tables.UpdateMode
214215
:keyword str etag: Etag of the entity
215-
:keyword ~azure.core.MatchConditions match_condition: MatchCondition
216+
:keyword match_condition: MatchCondition
217+
:paramtype match_condition: ~azure.core.MatchCondition
216218
:return: None
219+
:rtype: None
217220
:raises ValueError:
218221
219222
.. admonition:: Example:
@@ -298,7 +301,6 @@ def _batch_update_entity(
298301
:type query_options: ~azure.data.tables.models.QueryOptions
299302
:return: None
300303
:rtype: None
301-
:raises ~azure.core.exceptions.HttpResponseError:
302304
"""
303305

304306
_format = None
@@ -406,7 +408,6 @@ def _batch_merge_entity(
406408
:type query_options: ~azure.data.tables.models.QueryOptions
407409
:return: None
408410
:rtype: None
409-
:raises ~azure.core.exceptions.HttpResponseError:
410411
"""
411412

412413
_format = None
@@ -492,7 +493,8 @@ def delete_entity(
492493
:param row_key: The row key of the entity.
493494
:type row_key: str
494495
:keyword str etag: Etag of the entity
495-
:keyword ~azure.core.MatchConditions match_condition: MatchCondition
496+
:keyword match_condition: MatchCondition
497+
:paramtype match_condition: ~azure.core.MatchCondition
496498
:raises ValueError:
497499
498500
.. admonition:: Example:
@@ -561,7 +563,6 @@ def _batch_delete_entity(
561563
:type query_options: ~azure.data.tables.models.QueryOptions
562564
:return: None
563565
:rtype: None
564-
:raises ~azure.core.exceptions.HttpResponseError:
565566
"""
566567

567568
_format = None
@@ -632,7 +633,7 @@ def upsert_entity(
632633
633634
:param entity: The properties for the table entity.
634635
:type entity: TableEntity or dict[str,str]
635-
:param mode: Merge or Replace and Insert on fail
636+
:param mode: Merge or Replace entity
636637
:type mode: ~azure.data.tables.UpdateMode
637638
:raises ValueError:
638639

0 commit comments

Comments
 (0)