-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add type annotations for screens.components subpackage #19
Open
pbugnion
wants to merge
61
commits into
order-files-by-size-diff-screen
Choose a base branch
from
add-mypy-annotations-components
base: order-files-by-size-diff-screen
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add type annotations for screens.components subpackage #19
pbugnion
wants to merge
61
commits into
order-files-by-size-diff-screen
from
add-mypy-annotations-components
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Previously, this was just done in a simple tuple. That harmed readability.
This will let us render more than just the path.
This will help structure the file list, sizes and mtimes.
This allows embedding the table container in HSplits and VSplits.
Allows embedding table in {H,V}Splits.
Running mypy in project root now passes. Many of the dependencies on external libraries remain ignored.
Now that we use to_container, we don't need to have a bunch of methods that just proxy to window.
We now use mypy in strict mode on the sml_sync.screens.components subpackage.
pbugnion
changed the title
Add mypy annotations for screens.components subpackage
Add type annotations for screens.components subpackage
Jun 3, 2018
Open
pbugnion
force-pushed
the
order-files-by-size-diff-screen
branch
from
June 5, 2018 05:28
6db9504
to
11bc160
Compare
pbugnion
force-pushed
the
order-files-by-size-diff-screen
branch
from
June 16, 2018 10:38
38eb083
to
cbaae62
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an attempt at introducing greater rigour in how we use mypy types. This PR is mostly supposed to be a starting point for discussions, not necessarily useful in itself.
The
sml_sync.screens.components
subpackage now has full typechecking, including on all private methods. This subpackage heavily dependent on prompt_toolkit, which doesn't have type annotations, so I've written some stubs by just reading the code on GitHub.This exercise has lead to some tidying of import structures (we were frequently importing classes from
prompt_toolkit.layout.containers
orprompt_toolkit.layout.controls
, instead of directly fromprompt_toolkit.layout
, for instance), so it's been somewhat beneficial for the codebase. Nevertheless, type annotations do add complexity, so I'm open to deciding we don't want these.If we do decide to merge this, we should test it in Travis.
To reproduce, run: