Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abstract pexpect.SpawnBase has no send/sendline/write/writelines stubs #11914

Open
cdleonard opened this issue May 14, 2024 · 1 comment
Open

Comments

@cdleonard
Copy link

The actual implementation of pexpect.SpawnBase does not contain these functions but it is an abstract class and all children have these write methods.

Since almost all interesting pexpect code does some form of writing it is impractical to use SpawnBase as an annotation. The only viable solution seem to be annotating with PopenSpawn or maybe an union if you actually want to be generic?

Perhaps it would be acceptable to add these stubs to SpawnBase despite what is written in the implementation.

@srittau
Copy link
Collaborator

srittau commented May 19, 2024

I'm generally not a fan of diverging from the implementation when it can be avoided, but I see some merit in this case. An alternative would be to define a stubs-only type alias with all the alternatives, or maybe even better a stubs-only protocol that defines all the methods required by clients.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants