Skip to content

Is it possible to modify how run() is typed so the result isn't potentially None? #1027

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

Open
red8888 opened this issue Mar 21, 2025 · 0 comments

Comments

@red8888
Copy link

red8888 commented Mar 21, 2025

This is a semi ignore question, but I want to know if this is possible and if I could open a PR to fix.

This is kind of an annoy behavior:
def run(self, command: str, **kwargs: Any) -> Optional["Result"]:

It means I always have to check if its not None, but from what I understand the only case where it will return None is if disown is set to True right?

Is there a way to refactor so the response is always expected to return unless disown is set to true?

Maybe just a super simple class hierarchy where the base Runner class has everything but there are two children:
DisownedRunner and OwnedRunner?

And then DisownedRunner runner is the only one that is potentially None?

Thanks! I'm asking more what it would take to fix so I can open a PR more than just asking for this to be fixed, I'd like to contribute!

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

1 participant