Skip to content

Commit 1b76ed3

Browse files
Language lint/sphinx (#34263)
* conversations pylint/sphinx * questionanswering pylint/sphinx * strict_sphinx enable * regen after update
1 parent f13310d commit 1b76ed3

File tree

20 files changed

+194
-668
lines changed

20 files changed

+194
-668
lines changed

sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_operations/_operations.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,6 @@ def analyze_conversation(self, task: Union[JSON, IO[bytes]], **kwargs: Any) -> J
299299
:param task: A single conversational task to execute. Is either a JSON type or a IO[bytes]
300300
type. Required.
301301
:type task: JSON or IO[bytes]
302-
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
303-
Default value is None.
304-
:paramtype content_type: str
305302
:return: JSON object
306303
:rtype: JSON
307304
:raises ~azure.core.exceptions.HttpResponseError:
@@ -550,13 +547,6 @@ def begin_conversation_analysis(
550547
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
551548
Default value is "application/json".
552549
:paramtype content_type: str
553-
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
554-
:keyword polling: By default, your polling method will be LROBasePolling. Pass in False for
555-
this operation to not poll, or pass in your own initialized polling object for a personal
556-
polling strategy.
557-
:paramtype polling: bool or ~azure.core.polling.PollingMethod
558-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
559-
Retry-After header is present.
560550
:return: An instance of LROPoller that returns JSON object
561551
:rtype: ~azure.core.polling.LROPoller[JSON]
562552
:raises ~azure.core.exceptions.HttpResponseError:
@@ -675,13 +665,6 @@ def begin_conversation_analysis(
675665
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
676666
Default value is "application/json".
677667
:paramtype content_type: str
678-
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
679-
:keyword polling: By default, your polling method will be LROBasePolling. Pass in False for
680-
this operation to not poll, or pass in your own initialized polling object for a personal
681-
polling strategy.
682-
:paramtype polling: bool or ~azure.core.polling.PollingMethod
683-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
684-
Retry-After header is present.
685668
:return: An instance of LROPoller that returns JSON object
686669
:rtype: ~azure.core.polling.LROPoller[JSON]
687670
:raises ~azure.core.exceptions.HttpResponseError:
@@ -783,16 +766,6 @@ def begin_conversation_analysis(self, task: Union[JSON, IO[bytes]], **kwargs: An
783766
:param task: Collection of conversations to analyze and one or more tasks to execute. Is either
784767
a JSON type or a IO[bytes] type. Required.
785768
:type task: JSON or IO[bytes]
786-
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
787-
Default value is None.
788-
:paramtype content_type: str
789-
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
790-
:keyword polling: By default, your polling method will be LROBasePolling. Pass in False for
791-
this operation to not poll, or pass in your own initialized polling object for a personal
792-
polling strategy.
793-
:paramtype polling: bool or ~azure.core.polling.PollingMethod
794-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
795-
Retry-After header is present.
796769
:return: An instance of LROPoller that returns JSON object
797770
:rtype: ~azure.core.polling.LROPoller[JSON]
798771
:raises ~azure.core.exceptions.HttpResponseError:

sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_serialization.py

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]],
170170
return None
171171

172172

173-
try:
174-
basestring # type: ignore
175-
unicode_str = unicode # type: ignore
176-
except NameError:
177-
basestring = str
178-
unicode_str = str
179-
180173
_LOGGER = logging.getLogger(__name__)
181174

182175
try:
@@ -545,7 +538,7 @@ class Serializer(object):
545538
"multiple": lambda x, y: x % y != 0,
546539
}
547540

548-
def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
541+
def __init__(self, classes: Optional[Mapping[str, type]] = None):
549542
self.serialize_type = {
550543
"iso-8601": Serializer.serialize_iso,
551544
"rfc-1123": Serializer.serialize_rfc,
@@ -561,7 +554,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
561554
"[]": self.serialize_iter,
562555
"{}": self.serialize_dict,
563556
}
564-
self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {}
557+
self.dependencies: Dict[str, type] = dict(classes) if classes else {}
565558
self.key_transformer = full_restapi_key_transformer
566559
self.client_side_validation = True
567560

@@ -649,7 +642,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
649642
else: # That's a basic type
650643
# Integrate namespace if necessary
651644
local_node = _create_xml_node(xml_name, xml_prefix, xml_ns)
652-
local_node.text = unicode_str(new_attr)
645+
local_node.text = str(new_attr)
653646
serialized.append(local_node) # type: ignore
654647
else: # JSON
655648
for k in reversed(keys): # type: ignore
@@ -994,7 +987,7 @@ def serialize_object(self, attr, **kwargs):
994987
return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs)
995988
if obj_type is _long_type:
996989
return self.serialize_long(attr)
997-
if obj_type is unicode_str:
990+
if obj_type is str:
998991
return self.serialize_unicode(attr)
999992
if obj_type is datetime.datetime:
1000993
return self.serialize_iso(attr)
@@ -1370,7 +1363,7 @@ class Deserializer(object):
13701363

13711364
valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?")
13721365

1373-
def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
1366+
def __init__(self, classes: Optional[Mapping[str, type]] = None):
13741367
self.deserialize_type = {
13751368
"iso-8601": Deserializer.deserialize_iso,
13761369
"rfc-1123": Deserializer.deserialize_rfc,
@@ -1390,7 +1383,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
13901383
"duration": (isodate.Duration, datetime.timedelta),
13911384
"iso-8601": (datetime.datetime),
13921385
}
1393-
self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {}
1386+
self.dependencies: Dict[str, type] = dict(classes) if classes else {}
13941387
self.key_extractors = [rest_key_extractor, xml_key_extractor]
13951388
# Additional properties only works if the "rest_key_extractor" is used to
13961389
# extract the keys. Making it to work whatever the key extractor is too much
@@ -1443,7 +1436,7 @@ def _deserialize(self, target_obj, data):
14431436

14441437
response, class_name = self._classify_target(target_obj, data)
14451438

1446-
if isinstance(response, basestring):
1439+
if isinstance(response, str):
14471440
return self.deserialize_data(data, response)
14481441
elif isinstance(response, type) and issubclass(response, Enum):
14491442
return self.deserialize_enum(data, response)
@@ -1514,14 +1507,14 @@ def _classify_target(self, target, data):
15141507
if target is None:
15151508
return None, None
15161509

1517-
if isinstance(target, basestring):
1510+
if isinstance(target, str):
15181511
try:
15191512
target = self.dependencies[target]
15201513
except KeyError:
15211514
return target, target
15221515

15231516
try:
1524-
target = target._classify(data, self.dependencies)
1517+
target = target._classify(data, self.dependencies) # type: ignore
15251518
except AttributeError:
15261519
pass # Target is not a Model, no classify
15271520
return target, target.__class__.__name__ # type: ignore
@@ -1577,7 +1570,7 @@ def _unpack_content(raw_data, content_type=None):
15771570
if hasattr(raw_data, "_content_consumed"):
15781571
return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers)
15791572

1580-
if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"):
1573+
if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"):
15811574
return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore
15821575
return raw_data
15831576

@@ -1699,7 +1692,7 @@ def deserialize_object(self, attr, **kwargs):
16991692
if isinstance(attr, ET.Element):
17001693
# Do no recurse on XML, just return the tree as-is
17011694
return attr
1702-
if isinstance(attr, basestring):
1695+
if isinstance(attr, str):
17031696
return self.deserialize_basic(attr, "str")
17041697
obj_type = type(attr)
17051698
if obj_type in self.basic_types:
@@ -1756,7 +1749,7 @@ def deserialize_basic(self, attr, data_type):
17561749
if data_type == "bool":
17571750
if attr in [True, False, 1, 0]:
17581751
return bool(attr)
1759-
elif isinstance(attr, basestring):
1752+
elif isinstance(attr, str):
17601753
if attr.lower() in ["true", "1"]:
17611754
return True
17621755
elif attr.lower() in ["false", "0"]:

sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_operations/_operations.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,6 @@ async def analyze_conversation(self, task: Union[JSON, IO[bytes]], **kwargs: Any
253253
:param task: A single conversational task to execute. Is either a JSON type or a IO[bytes]
254254
type. Required.
255255
:type task: JSON or IO[bytes]
256-
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
257-
Default value is None.
258-
:paramtype content_type: str
259256
:return: JSON object
260257
:rtype: JSON
261258
:raises ~azure.core.exceptions.HttpResponseError:
@@ -504,13 +501,6 @@ async def begin_conversation_analysis(
504501
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
505502
Default value is "application/json".
506503
:paramtype content_type: str
507-
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
508-
:keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False
509-
for this operation to not poll, or pass in your own initialized polling object for a personal
510-
polling strategy.
511-
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
512-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
513-
Retry-After header is present.
514504
:return: An instance of AsyncLROPoller that returns JSON object
515505
:rtype: ~azure.core.polling.AsyncLROPoller[JSON]
516506
:raises ~azure.core.exceptions.HttpResponseError:
@@ -629,13 +619,6 @@ async def begin_conversation_analysis(
629619
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
630620
Default value is "application/json".
631621
:paramtype content_type: str
632-
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
633-
:keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False
634-
for this operation to not poll, or pass in your own initialized polling object for a personal
635-
polling strategy.
636-
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
637-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
638-
Retry-After header is present.
639622
:return: An instance of AsyncLROPoller that returns JSON object
640623
:rtype: ~azure.core.polling.AsyncLROPoller[JSON]
641624
:raises ~azure.core.exceptions.HttpResponseError:
@@ -737,16 +720,6 @@ async def begin_conversation_analysis(self, task: Union[JSON, IO[bytes]], **kwar
737720
:param task: Collection of conversations to analyze and one or more tasks to execute. Is either
738721
a JSON type or a IO[bytes] type. Required.
739722
:type task: JSON or IO[bytes]
740-
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
741-
Default value is None.
742-
:paramtype content_type: str
743-
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
744-
:keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False
745-
for this operation to not poll, or pass in your own initialized polling object for a personal
746-
polling strategy.
747-
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
748-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
749-
Retry-After header is present.
750723
:return: An instance of AsyncLROPoller that returns JSON object
751724
:rtype: ~azure.core.polling.AsyncLROPoller[JSON]
752725
:raises ~azure.core.exceptions.HttpResponseError:

0 commit comments

Comments
 (0)