Skip to content

Fix Command stubtest errors - #788

Merged
amoffat merged 2 commits into
amoffat:developfrom
jorenham:typing/Command-stubtest-fixes
Jul 22, 2026
Merged

amoffat merged 2 commits into
amoffat:developfrom
jorenham:typing/Command-stubtest-fixes

Conversation

@jorenham

Copy link
Copy Markdown
Contributor

Following #787, here's the next batch of stubtest fixes. This time for the sh.Command class.

before:

$ stubtest sh
<errors omitted for sanity>
Found 34 errors (checked 1 module)

after:

$ stubtest sh
<errors omitted for sanity>
Found 25 errors (checked 1 module)

There's one place where I deviated from runtime, which is for the return type of __class_getitem__. At runtime it directly returns cls, but it's better to have it return a types.GenericAlias so that e.g. print(Command[str]) will be printed as Command[str]. Currently it also allows nonsensical expressions like Command[str][str][str], which won't be possible anymore if we'dd change that to return a GenericAlias.
Do you want me to take care of that as well? And if so, should I put it in here, or in a separate PR?

@amoffat

amoffat commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Sure you can put it in this PR if it's easier. Also, given that I had never heard about stubtest before, is it reasonable to have another lint CI step for it?

@jorenham

Copy link
Copy Markdown
Contributor Author

given that I had never heard about stubtest before,

FWIW; It's used by typeshed itself, and we also use it at NumPy, for example, so it's pretty decent stuff.

is it reasonable to have another lint CI step for it?

Yea that's indeed what I was planning on after fixing the errors :)

@jorenham
jorenham force-pushed the typing/Command-stubtest-fixes branch from 7949238 to 43d8c7f Compare July 22, 2026 20:57
@amoffat
amoffat merged commit 79e4070 into amoffat:develop Jul 22, 2026
23 checks passed
@jorenham
jorenham deleted the typing/Command-stubtest-fixes branch July 22, 2026 21:45
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

Successfully merging this pull request may close these issues.

2 participants