File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change
1
+ import warnings
1
2
from collections .abc import Callable
2
3
from inspect import Parameter , signature
3
4
@@ -113,3 +114,16 @@ def validate_field_function(function: Callable) -> None:
113
114
f"Received field function { function } with invalid signature. "
114
115
f"Expected { nokeyword } to be allowed as a keyword argument."
115
116
)
117
+
118
+ defaults = tuple (
119
+ name
120
+ for name in ("data" , "field" )
121
+ if name in fparams and fparams [name ].default is not Parameter .empty
122
+ )
123
+ if defaults :
124
+ warnings .warn (
125
+ f"Received field function { function } with default values for parameters { defaults !r} . "
126
+ "These default values will never be used. Drop them to avoid this warning." ,
127
+ UserWarning ,
128
+ stacklevel = 2 ,
129
+ )
You can’t perform that action at this time.
0 commit comments