File tree 1 file changed +42
-1
lines changed
1 file changed +42
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## Next Release
4
4
5
- ...
5
+ ### Different Property Getter and Setter Types
6
+
7
+ Mypy now supports using different types for property getter and setter.
8
+ ``` python
9
+ class A :
10
+ value: int
11
+
12
+ @ property
13
+ def f (self ) -> int :
14
+ return self .value
15
+ @f.setter
16
+ def f (self , x : str | int ) -> None :
17
+ try :
18
+ self .value = int (x)
19
+ except ValueError :
20
+ raise Exception (f " ' { x} ' is not a valid value for 'f' " )
21
+ ```
22
+
23
+ Contributed by Ivan Levkivskyi (PR [ 18510] ( https://github.com/python/mypy/pull/18510 ) )
24
+
25
+ ### Selectively Disable Deprecated Warnings
26
+
27
+ It's now possible to selectively disable warnings generated from
28
+ [ ` warnings.deprecated ` ] ( https://docs.python.org/3/library/warnings.html#warnings.deprecated )
29
+ using the [ ` --deprecated-calls-exclude ` ] ( https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-deprecated-calls-exclude )
30
+ option.
31
+
32
+ ``` python
33
+ # mypy --enable-error-code deprecated
34
+ # --deprecated-calls-exclude=foo.A
35
+ import foo
36
+
37
+ foo.A().func() # OK, the deprecated warning is ignored
38
+
39
+ # file foo.py
40
+ from typing_extensions import deprecated
41
+ class A :
42
+ @deprecated (" Use A.func2 instead" )
43
+ def func (self ): pass
44
+ ```
45
+
46
+ Contributed by Marc Mueller (PR [ 18641] ( https://github.com/python/mypy/pull/18641 ) )
6
47
7
48
## Mypy 1.15
8
49
You can’t perform that action at this time.
0 commit comments