@@ -262,7 +262,6 @@ def test_types_assign() -> None:
262262 df = pd .DataFrame (data = {"col1" : [1 , 2 ], "col2" : [3 , 4 ]})
263263
264264 check (
265- # pyrefly: ignore[implicit-any-lambda]
266265 assert_type (df .assign (col3 = lambda frame : frame .sum (axis = 1 )), pd .DataFrame ),
267266 pd .DataFrame ,
268267 )
@@ -272,11 +271,8 @@ def test_types_assign() -> None:
272271 check (
273272 assert_type (
274273 df .assign (
275- # pyrefly: ignore[implicit-any-lambda]
276274 b = lambda df : range (len (df )),
277- # pyrefly: ignore[implicit-any-lambda]
278275 c = lambda _ : [10 , 20 , 30 ],
279- # pyrefly: ignore[implicit-any-lambda]
280276 d = lambda _ : (10 , 20 , 30 ),
281277 ),
282278 pd .DataFrame ,
@@ -301,10 +297,7 @@ def test_assign() -> None:
301297 df = pd .DataFrame ({"a" : [1 , 2 , 3 ], 1 : [4 , 5 , 6 ]})
302298
303299 my_unnamed_func = ( # pyright: ignore[reportUnknownVariableType]
304- lambda df : df [ # pyright: ignore[reportUnknownLambdaType] # pyrefly: ignore[implicit-any-lambda]
305- "a"
306- ]
307- * 2
300+ lambda df : df ["a" ] * 2 # pyright: ignore[reportUnknownLambdaType]
308301 )
309302
310303 def my_named_func_1 (df : pd .DataFrame ) -> pd .Series [str ]:
@@ -313,20 +306,16 @@ def my_named_func_1(df: pd.DataFrame) -> pd.Series[str]:
313306 def my_named_func_2 (df : pd .DataFrame ) -> pd .Series :
314307 return df ["a" ]
315308
316- # pyrefly: ignore[implicit-any-lambda]
317309 check (assert_type (df .assign (c = lambda df : df ["a" ] * 2 ), pd .DataFrame ), pd .DataFrame )
318310 check (
319- # pyrefly: ignore[implicit-any-lambda]
320311 assert_type (df .assign (c = lambda df : df ["a" ].index ), pd .DataFrame ),
321312 pd .DataFrame ,
322313 )
323314 check (
324- # pyrefly: ignore[implicit-any-lambda]
325315 assert_type (df .assign (c = lambda df : df ["a" ].to_numpy ()), pd .DataFrame ),
326316 pd .DataFrame ,
327317 )
328318 check (
329- # pyrefly: ignore[implicit-any-lambda]
330319 assert_type (df .assign (c = lambda df : df ["a" ].max ()), pd .DataFrame ),
331320 pd .DataFrame ,
332321 )
@@ -345,7 +334,6 @@ def my_named_func_2(df: pd.DataFrame) -> pd.Series:
345334 check (assert_type (df .assign (c = my_named_func_2 ), pd .DataFrame ), pd .DataFrame )
346335 check (assert_type (df .assign (c = None ), pd .DataFrame ), pd .DataFrame )
347336 check (
348- # pyrefly: ignore[implicit-any-lambda]
349337 assert_type (df .assign (foo = lambda df : df .get ("abc" , None )), pd .DataFrame ),
350338 pd .DataFrame ,
351339 )
@@ -508,7 +496,6 @@ def test_types_sort_index() -> None:
508496def test_types_sort_index_with_key () -> None :
509497 df = pd .DataFrame (data = {"col1" : [1 , 2 , 3 , 4 ]}, index = ["a" , "b" , "C" , "d" ])
510498 check (
511- # pyrefly: ignore[implicit-any-lambda]
512499 assert_type (df .sort_index (key = lambda k : k .str .lower ()), pd .DataFrame ),
513500 pd .DataFrame ,
514501 )
@@ -598,7 +585,6 @@ def test_types_sort_values_with_key() -> None:
598585 # This was added in 1.1.0 https://pandas.pydata.org/docs/whatsnew/v1.1.0.html
599586 df = pd .DataFrame (data = {"col1" : [2 , 1 ], "col2" : [3 , 4 ]})
600587 check (
601- # pyrefly: ignore[implicit-any-lambda]
602588 assert_type (df .sort_values (by = "col1" , key = lambda k : - k ), pd .DataFrame ),
603589 pd .DataFrame ,
604590 )
@@ -1356,7 +1342,6 @@ def test_types_map() -> None:
13561342 check (
13571343 assert_type (
13581344 df .map (
1359- # pyrefly: ignore[implicit-any-lambda]
13601345 lambda x : x # pyright: ignore[reportUnknownArgumentType,reportUnknownLambdaType]
13611346 ** 2
13621347 ),
@@ -2697,7 +2682,6 @@ def test_types_rename() -> None:
26972682 check (assert_type (df .rename (columns = {None : "b" }), pd .DataFrame ), pd .DataFrame )
26982683 check (assert_type (df .rename (columns = {"" : "b" }), pd .DataFrame ), pd .DataFrame )
26992684 check (
2700- # pyrefly: ignore[implicit-any-lambda]
27012685 assert_type (df .rename (columns = lambda s : s .upper ()), pd .DataFrame ),
27022686 pd .DataFrame ,
27032687 )
@@ -2756,9 +2740,7 @@ def test_types_rename_axis() -> None:
27562740 check (
27572741 assert_type (
27582742 df .rename_axis (
2759- # pyrefly: ignore[implicit-any-lambda]
27602743 index = lambda name : name .upper (), # pyright: ignore[reportUnknownArgumentType,reportUnknownLambdaType,reportUnknownMemberType]
2761- # pyrefly: ignore[implicit-any-lambda]
27622744 columns = lambda name : name .upper (), # pyright: ignore[reportUnknownArgumentType,reportUnknownLambdaType,reportUnknownMemberType]
27632745 ),
27642746 pd .DataFrame ,
@@ -4168,7 +4150,7 @@ def test_transpose() -> None:
41684150def test_combine () -> None :
41694151 df1 = pd .DataFrame ({"A" : [0 , 0 ], "B" : [4 , 4 ]})
41704152 df2 = pd .DataFrame ({"A" : [1 , 1 ], "B" : [3 , 3 ]})
4171- # pyrefly: ignore[implicit-any-lambda]
4153+
41724154 take_smaller = lambda s1 , s2 : ( # pyright: ignore[reportUnknownLambdaType,reportUnknownVariableType]
41734155 s1 if s1 .sum () < s2 .sum () else s2 # pyright: ignore[reportUnknownMemberType]
41744156 )
@@ -4560,14 +4542,12 @@ def func_e(x: pd.DataFrame, k: int) -> pd.Series:
45604542 return x .max () - k * x .min ()
45614543
45624544 check (
4563- # pyrefly: ignore[implicity-any-lambda]
45644545 assert_type (df .rolling (2 ).pipe (lambda x : x .min () - x .max ()), pd .DataFrame ),
45654546 pd .DataFrame ,
45664547 )
45674548 check (assert_type (df .rolling (2 ).pipe (func_r , k = 2 ), pd .DataFrame ), pd .DataFrame )
45684549
45694550 check (
4570- # pyrefly: ignore[implicity-any-lambda]
45714551 assert_type (df .expanding ().pipe (lambda x : x .min () - x .max ()), pd .DataFrame ),
45724552 pd .DataFrame ,
45734553 )
0 commit comments