Warn on `Callable[<parameter_list>, None]` and `Callable[<parameter_list>, Any]` as parameter annotations
Fixes #237. The error code is disabled by default, due to the risk of false positive errors. However, it's possible that this check is too noisy even for a disabled-by-default error code.
Here's the output I get if I run flake8 stubs stdlib --extend-select=Y091 with this PR branch on my local clone of typeshed:
stdlib\_ctypes.pyi:114:45: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\_dummy_threading.pyi:164:55: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stdlib\_json.pyi:26:27: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\_posixsubprocess.pyi:30:32: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stdlib\_weakref.pyi:23:52: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\_weakref.pyi:36:46: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\_weakref.pyi:38:46: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\asyncio\base_events.pyi:403:69: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\asyncio\base_events.pyi:405:69: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\asyncio\base_events.pyi:419:63: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\asyncio\base_futures.pyi:19:51: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stdlib\asyncio\events.pyi:543:69: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\asyncio\events.pyi:547:69: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\asyncio\subprocess.pyi:60:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\asyncio\subprocess.pyi:92:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\asyncio\subprocess.pyi:126:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\asyncio\subprocess.pyi:157:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\asyncio\subprocess.pyi:191:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\asyncio\subprocess.pyi:222:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\builtins.pyi:1216:24: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\builtins.pyi:1217:24: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stdlib\builtins.pyi:1218:24: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stdlib\builtins.pyi:1221:39: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\builtins.pyi:1222:39: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stdlib\builtins.pyi:1223:40: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stdlib\builtins.pyi:1392:45: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\codecs.pyi:216:56: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\codecs.pyi:230:56: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\concurrent\futures\process.pyi:68:51: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\doctest.pyi:209:25: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\doctest.pyi:210:28: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\email\contentmanager.pyi:8:59: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\email\contentmanager.pyi:9:64: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\inspect.pyi:207:43: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\inspect.pyi:223:46: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\inspect.pyi:231:46: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\inspect.pyi:243:42: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\inspect.pyi:251:45: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\inspect.pyi:503:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\inspect.pyi:512:27: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\inspect.pyi:512:56: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\inspect.pyi:512:66: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\json\__init__.pyi:23:23: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\json\__init__.pyi:38:23: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\json\__init__.pyi:46:27: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\json\__init__.pyi:47:27: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\json\__init__.pyi:48:25: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\json\__init__.pyi:49:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\json\__init__.pyi:50:33: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\json\__init__.pyi:57:27: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\json\__init__.pyi:58:27: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\json\__init__.pyi:59:25: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\json\__init__.pyi:60:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\json\__init__.pyi:61:33: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\json\decoder.pyi:24:31: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\json\decoder.pyi:25:31: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\json\decoder.pyi:26:29: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\json\decoder.pyi:27:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\json\decoder.pyi:29:37: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\json\decoder.pyi:31:43: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\json\encoder.pyi:34:27: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\multiprocessing\managers.pyi:126:50: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\os\__init__.pyi:995:26: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\os\__init__.pyi:996:35: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\os\__init__.pyi:997:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:109:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:143:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:177:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:211:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:246:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:280:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:317:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:350:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:383:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:416:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:450:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:483:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:519:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:551:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:583:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:615:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:648:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:680:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:714:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:742:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:770:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:798:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:827:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:855:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:886:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:917:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:947:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:975:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1001:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1032:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1062:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1090:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1115:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1146:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1177:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1208:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1240:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1271:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1305:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1335:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1365:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1395:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1426:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1456:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1489:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1518:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1547:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1576:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1606:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1635:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1666:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1691:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1716:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1741:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1767:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1792:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1863:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1894:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1925:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1957:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:1988:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:2019:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:2052:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:2082:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:2112:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:2143:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:2173:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:2203:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:2235:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:2264:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:2293:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:2323:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:2352:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:2381:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:2411:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:2436:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:2461:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:2487:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:2512:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\subprocess.pyi:2537:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\sys.pyi:332:37: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\threading.pyi:194:55: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stdlib\tomllib.pyi:9:62: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\tomllib.pyi:10:46: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\types.pyi:443:41: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\typing.pyi:844:54: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\typing_extensions.pyi:173:19: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\typing_extensions.pyi:273:54: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\unittest\case.pyi:55:47: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\unittest\case.pyi:138:28: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\unittest\case.pyi:151:28: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\unittest\case.pyi:163:28: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\unittest\case.pyi:176:28: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\unittest\case.pyi:243:74: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stdlib\unittest\case.pyi:258:51: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\unittest\case.pyi:260:49: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\unittest\case.pyi:268:55: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\unittest\case.pyi:301:28: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\unittest\case.pyi:302:25: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\unittest\case.pyi:303:28: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\unittest\mock.pyi:208:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\unittest\mock.pyi:223:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\weakref.pyi:90:50: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\weakref.pyi:91:51: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stdlib\weakref.pyi:131:56: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\Deprecated\deprecated\classic.pyi:18:52: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\PyYAML\yaml\__init__.pyi:404:37: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\PyYAML\yaml\__init__.pyi:407:53: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\PyYAML\yaml\__init__.pyi:410:50: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\PyYAML\yaml\__init__.pyi:414:50: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\PyYAML\yaml\constructor.pyi:40:62: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\aws-xray-sdk\aws_xray_sdk\core\recorder.pyi:74:27: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\boltons\boltons\debugutils.pyi:8:37: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\boltons\boltons\formatutils.pyi:30:39: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\boltons\boltons\statsutils.pyi:10:50: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\boltons\boltons\statsutils.pyi:61:77: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\cffi\_cffi_backend.pyi:150:27: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stubs\cffi\_cffi_backend.pyi:158:27: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stubs\cffi\_cffi_backend.pyi:162:68: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\cffi\_cffi_backend.pyi:180:53: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\cffi\_cffi_backend.pyi:187:40: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\cffi\_cffi_backend.pyi:200:61: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\cffi\_cffi_backend.pyi:215:25: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stubs\cffi\_cffi_backend.pyi:233:49: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\cffi\cffi\api.pyi:43:24: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\cffi\cffi\api.pyi:66:27: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stubs\cffi\cffi\api.pyi:74:27: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stubs\cffi\cffi\api.pyi:78:53: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\cffi\cffi\api.pyi:100:40: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\console-menu\consolemenu\items\function_item.pyi:16:28: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\decorator\decorator.pyi:36:24: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\decorator\decorator.pyi:62:44: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\decorator\decorator.pyi:63:33: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\decorator\decorator.pyi:65:22: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\decorator\decorator.pyi:65:49: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\first\first.pyi:15:62: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\first\first.pyi:17:52: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\invoke\invoke\tasks.pyi:33:24: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\keyboard\keyboard\__init__.pyi:35:29: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stubs\keyboard\keyboard\__init__.pyi:36:75: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stubs\keyboard\keyboard\mouse.pyi:48:24: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stubs\keyboard\keyboard\mouse.pyi:55:33: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stubs\keyboard\keyboard\mouse.pyi:56:40: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stubs\keyboard\keyboard\mouse.pyi:57:39: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stubs\keyboard\keyboard\mouse.pyi:58:40: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stubs\mock\mock\mock.pyi:180:26: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\paho-mqtt\paho\mqtt\subscribe.pyi:7:24: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stubs\protobuf\google\protobuf\internal\containers.pyi:22:37: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\protobuf\google\protobuf\service.pyi:17:24: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stubs\protobuf\google\protobuf\service.pyi:29:49: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stubs\protobuf\google\protobuf\service.pyi:38:24: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stubs\pynput\pynput\keyboard\__init__.pyi:30:61: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stubs\pynput\pynput\keyboard\_base.pyi:127:28: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stubs\pynput\pynput\keyboard\_base.pyi:128:30: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stubs\pyserial\serial\rfc2217.pyi:128:39: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\python-xlib\Xlib\display.pyi:81:79: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\python-xlib\Xlib\ext\record.pyi:98:28: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\python-xlib\Xlib\ext\record.pyi:106:73: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\redis\redis\asyncio\client.pyi:163:67: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\redis\redis\asyncio\client.pyi:555:35: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\redis\redis\asyncio\client.pyi:559:105: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\redis\redis\asyncio\client.pyi:690:35: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\redis\redis\asyncio\client.pyi:718:35: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stubs\redis\redis\asyncio\client.pyi:746:35: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\redis\redis\asyncio\client.pyi:754:102: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stubs\redis\redis\asyncio\client.pyi:760:101: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\redis\redis\asyncio\client.pyi:786:35: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stubs\redis\redis\asyncio\client.pyi:801:35: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\redis\redis\asyncio\client.pyi:813:35: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\redis\redis\asyncio\client.pyi:828:35: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\redis\redis\client.pyi:366:58: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stubs\redis\redis\client.pyi:368:57: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "None"
stubs\redis\redis\client.pyi:593:106: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\redis\redis\client.pyi:667:35: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\redis\redis\client.pyi:682:35: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\redis\redis\client.pyi:690:101: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\redis\redis\client.pyi:700:35: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\redis\redis\commands\core.pyi:1088:35: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\redis\redis\commands\core.pyi:1107:101: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\redis\redis\commands\core.pyi:1152:35: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\redis\redis\commands\core.pyi:1179:35: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\redis\redis\commands\core.pyi:1291:35: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\redis\redis\commands\core.pyi:1310:101: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\redis\redis\commands\core.pyi:1355:35: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\redis\redis\commands\core.pyi:1382:35: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\requests\requests\models.pyi:154:31: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\requests\requests\models.pyi:155:31: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\requests\requests\models.pyi:156:29: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\requests\requests\models.pyi:157:34: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
stubs\requests\requests\models.pyi:158:37: Y091 "Callable" in argument annotations should generally have "object" for the second parameter, not "Any"
This change has no effect on typeshed. 🤖🎉
This change has no effect on typeshed. 🤖🎉
This change has no effect on typeshed. 🤖🎉
This change has no effect on typeshed. 🤖🎉
I'd personally split these two cases. None is probably always a mistake, while I can imagine use cases for Any.
Noneis probably always a mistake
IIRC from when I did the analysis a few months ago, there were still enough false positives even with just Callable[<parameter_list>, None] that it would probably have to be a disabled-by-default error code :/
But it was a while back when I looked at it; I might be misremembering. And there were lots of instances of Callable[<parameter_list>, None] or Callable[<parameter_list>, Any] in typeshed that I just wasn't sure about. It's possible that we could safely switch some of them to Callable[<parameter_list>, object] -- I just don't know!
I recently ran into a bug in internal code which would have been caught by a type checker if the callback had been annotated as Callable[..., None]: something like callback=lambda: x.some_method instead of callback=lambda x.some_method().
In typeshed we probably should still aim for reducing false positives instead of false negatives, and that means using object. However, perhaps we should use some alias like _typeshed.Unused, which could enable type checkers to special-case this name if they like and enforce that callbacks return None.