python / typeshed

Collection of library stubs for Python, with static types
Other
4.25k stars 1.72k forks source link

"tcgetattr" is not a known attribute of module "tty" #12249

Closed powellnorma closed 1 month ago

powellnorma commented 1 month ago

Example code:

import tty
mode = tty.tcgetattr(1)

I believe this stems from tty.py using: from termios import * - Pyright warns about this with Wildcard import from a library not allowed.

srittau commented 1 month ago

Indeed, the stubs don't replicate the star import from the runtime. This is deliberate. tty.tcgetattr is not documented, you should use the documented termios.tcgetattr instead of the re-export from tty.