-
Notifications
You must be signed in to change notification settings - Fork 17
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
Fix typing errors and set up mypy
workflow action
#176
Merged
Merged
Changes from all commits
Commits
Show all changes
72 commits
Select commit
Hold shift + click to select a range
0101d98
Address mypy errors
bwohlberg 1f3af74
Change action name
bwohlberg 296c1f6
Add mypy github action
bwohlberg 68f3406
Fix typing errors
bwohlberg 7c67fec
Fix typing errors
bwohlberg 837214c
Fix typing errors
bwohlberg 9de6723
Correct job name
bwohlberg ecef089
Merge branch 'main' into brendt/typing
bwohlberg 7cbea48
Fix typing errors
bwohlberg 9f8667d
Fix typing errors
bwohlberg efcd355
Merge remote-tracking branch 'origin/main' into brendt/typing
Michael-T-McCann ea327ec
Merge branch 'brendt/typing' of github.com:lanl/scico into brendt/typing
bwohlberg f81b40b
Fix typing error
bwohlberg 5ce49eb
Merge branch 'main' into brendt/typing
bwohlberg 0e47246
Merge branch 'main' into brendt/typing
bwohlberg de30803
Merge branch 'main' into brendt/typing
bwohlberg 55ce354
Fix merge error
bwohlberg 126a422
Merge branch 'main' into brendt/typing
bwohlberg 3681a34
Merge branch 'main' into brendt/typing
bwohlberg ec3fd93
Address test failure
bwohlberg 7c6c0a9
Merge branch 'main' into brendt/typing
bwohlberg 1ff915b
Fix typing errors
bwohlberg 0ca1c88
Fix typing errors and clean up itstat default mechanism
bwohlberg 06b6613
Fix a bug and some typing errors
bwohlberg b537927
Exclude modules with dynamically generated functions
bwohlberg 36cfab2
Make docstring phrasing imperative
bwohlberg acda6d8
Suppress typing errors
bwohlberg 6910348
Fix typing error and clean up
bwohlberg 665fdc5
Fix typing errors
bwohlberg cf43c14
Fix or suppress typing errors
bwohlberg 8d2b0cc
Typo fix
bwohlberg 99cedad
Merge branch 'main' into brendt/typing
bwohlberg 67e6b24
Revert erroneous attempt to resolve typing error
bwohlberg 58ad1dd
Typing annotation fix and suppress some spurious typing errors
bwohlberg 3457d75
Merge branch 'main' into brendt/typing
bwohlberg 08f078a
Address typing error and rephrase error messages
bwohlberg 5d91e85
Merge branch 'main' into brendt/typing
bwohlberg abb30e6
Merge branch 'main' into brendt/typing
bwohlberg 4abb593
Merge branch 'main' into brendt/typing
bwohlberg 9bfeb3c
Fix some typing errors
bwohlberg ebc4392
Supress some typing errors
bwohlberg f9b6cda
Address typing error
bwohlberg 3ef307b
Fix typing errors and docstring style issues
bwohlberg 88100e5
Address test failure
bwohlberg a08ddf8
Merge branch 'main' into brendt/typing
bwohlberg 0c58b90
Merge branch 'main' into brendt/typing
bwohlberg 60cc81a
Suppress/address some typing errors
bwohlberg 04bbe11
Merge branch 'main' into brendt/typing
bwohlberg ca7b609
Merge branch 'main' into brendt/typing
bwohlberg 9205279
Fix merge error
bwohlberg e5c7f2c
Merge branch 'main' into brendt/typing
bwohlberg a87af57
Merge branch 'main' into brendt/typing
bwohlberg 6e62734
Merge branch 'main' into brendt/typing
bwohlberg 22c8882
Merge branch 'main' into brendt/typing
bwohlberg f1aec60
Fix merge error
bwohlberg 6f02f7b
Improve code style
bwohlberg 6ab90d0
Resolve mypy errors
bwohlberg feb1830
Resolve mypy errors
bwohlberg 07537c5
Resolve mypy errors
bwohlberg d0edf91
Modify mypy configuration in workflow
bwohlberg 8e48de4
Trivial edit
bwohlberg 72d2cd4
Bug fix
bwohlberg 9fbf68d
Consistency improvement
bwohlberg 68d2850
Address CodeFactor complex function
Michael-T-McCann 7c61e25
Fix type error
Michael-T-McCann 2f5b14c
Switch back to ignore, can't solve this problem without code bloat
Michael-T-McCann 1fa46bb
Fixed extra 's' in `LinearOperator`s string.
FernandoDavis e3d8974
Trivial edit
bwohlberg 52eba3b
Use type guard rather than type ignore
bwohlberg 14f1450
Merge branch 'brendt/typing' of github.com:lanl/scico into brendt/typing
bwohlberg 9bd0214
Fix EllipsisType import
bwohlberg 61779ff
Minor edits for docs style
bwohlberg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Install and run mypy | ||
|
||
name: mypy | ||
|
||
# Controls when the workflow will run | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the main branch | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
mypy: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- name: Install Python 3 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies | ||
run: | | ||
pip install mypy | ||
- name: Run mypy | ||
run: | | ||
mypy --follow-imports=skip --ignore-missing-imports --exclude "(numpy|test)" scico/ |
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type ignore used to suppress error
Signature of "prox" incompatible with supertype "Functional"
. Is there any way of restructuring the code to avoid this violation of the Liskov substitution principle?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A proposal:
Union[JaxArray, BlockArray]
is used whenever a vector is expected. If the operator/functional can't deal with inputs of a certain shape (including not dealing with BlockArrays of any shape), that's a runtime error.By analogy, a function may take a float and then throw a runtime error if it is negative. We don't try to change the type annotation to
positive_float
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or, we do something at the subclass level, maybe making
prox
andeval
abstract (or not defined at all?). That helps with Liskov substitution because a genericFunctional
would have no useful behavior at all.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC, our code has quite a few Liskov violations, so that would be worth considering. On "A proposal", that's a reasonable analogy, but "mypy" doesn't see it that way: the type narrowing was introduced to address other typing complaints.