Skip to content

Commit 77cf5db

Browse files
authored
bump versions for next-* pylint/pyright/mypy (#9276)
1 parent b8e1441 commit 77cf5db

File tree

5 files changed

+17
-9
lines changed

5 files changed

+17
-9
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
changeKind: internal
3+
packages:
4+
- "@typespec/http-client-python"
5+
---
6+
7+
internal dependency bump

packages/http-client-python/eng/scripts/ci/dev_requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
pyright==1.1.405
2-
pylint==3.2.7
1+
pyright==1.1.407
2+
pylint==4.0.4
33
tox==4.16.0
4-
mypy==1.18.1
4+
mypy==1.19.1
55
colorama==0.4.6
66
debugpy==1.8.2
77
pytest==8.3.2

packages/http-client-python/eng/scripts/ci/pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ enable=useless-suppression
1717
# too-many-arguments: Due to the nature of the CLI many commands have large arguments set which reflect in large arguments set in corresponding methods.
1818
# too-many-lines: Due to code generation many files end up with too many lines.
1919
# Let's black deal with bad-continuation
20-
disable=missing-docstring,locally-disabled,fixme,cyclic-import,too-many-arguments,invalid-name,duplicate-code,too-few-public-methods,consider-using-f-string,super-with-arguments,redefined-builtin,import-outside-toplevel,client-suffix-needed,unnecessary-dunder-call,unnecessary-ellipsis,disallowed-name,consider-using-max-builtin,unknown-option-value,file-needs-copyright-header
20+
disable=missing-docstring,locally-disabled,fixme,cyclic-import,too-many-arguments,invalid-name,duplicate-code,too-few-public-methods,consider-using-f-string,super-with-arguments,redefined-builtin,import-outside-toplevel,client-suffix-needed,unnecessary-dunder-call,unnecessary-ellipsis,disallowed-name,consider-using-max-builtin,unknown-option-value,file-needs-copyright-header,too-many-positional-arguments
2121

2222
[FORMAT]
2323
max-line-length=120

packages/http-client-python/generator/pygen/codegen/models/response.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def get_no_polling_method_path(async_mode: bool) -> str:
233233

234234
def get_no_polling_method(self, async_mode: bool) -> str:
235235
"""Get the default no polling method"""
236-
return self.get_no_polling_method_path(async_mode).split(".")[-1]
236+
return self.get_no_polling_method_path(async_mode).rsplit(".", maxsplit=1)[-1]
237237

238238
@staticmethod
239239
def get_base_polling_method_path(async_mode: bool) -> str:
@@ -242,7 +242,7 @@ def get_base_polling_method_path(async_mode: bool) -> str:
242242

243243
def get_base_polling_method(self, async_mode: bool) -> str:
244244
"""Get the base polling method."""
245-
return self.get_base_polling_method_path(async_mode).split(".")[-1]
245+
return self.get_base_polling_method_path(async_mode).rsplit(".", maxsplit=1)[-1]
246246

247247
def type_annotation(self, **kwargs: Any) -> str:
248248
return f"{self.get_poller(kwargs.get('async_mode', False))}[{super().type_annotation(**kwargs)}]"

packages/http-client-python/generator/pygen/codegen/templates/model_base.py.jinja2

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"]
3636

3737
TZ_UTC = timezone.utc
3838
_T = typing.TypeVar("_T")
39+
_NONE_TYPE = type(None)
3940

4041
{% if code_model.has_external_type %}
4142
TYPE_HANDLER_REGISTRY = TypeHandlerRegistry()
@@ -916,16 +917,16 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur
916917

917918
# is it optional?
918919
try:
919-
if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore
920+
if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore
920921
if len(annotation.__args__) <= 2: # pyright: ignore
921922
if_obj_deserializer = _get_deserialize_callable_from_annotation(
922-
next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore
923+
next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore
923924
)
924925

925926
return functools.partial(_deserialize_with_optional, if_obj_deserializer)
926927
# the type is Optional[Union[...]], we need to remove the None type from the Union
927928
annotation_copy = copy.copy(annotation)
928-
annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore
929+
annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore
929930
return _get_deserialize_callable_from_annotation(annotation_copy, module, rf)
930931
except AttributeError:
931932
pass

0 commit comments

Comments
 (0)