44# license information.
55# --------------------------------------------------------------------------
66from enum import Enum
7+ from typing import TYPE_CHECKING
8+
79from azure .core .exceptions import HttpResponseError
810from azure .core .paging import PageIterator
911
2224from ._error import _process_table_error
2325from ._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
2633class 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
478489class 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):
541557class 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
0 commit comments