fix(typing): Resolve LSP violation for ChartType.data#3740
Merged
dangotbanned merged 2 commits intomainfrom Jan 2, 2025
Merged
fix(typing): Resolve LSP violation for ChartType.data#3740dangotbanned merged 2 commits intomainfrom
ChartType.data#3740dangotbanned merged 2 commits intomainfrom
Conversation
- https://en.wikipedia.org/wiki/Liskov_substitution_principle An alternative would be using the [`Any` trick](https://github.com/python/typeshed/blob/main/CONTRIBUTING.md#using-any-and-object)
This file contains hidden or 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
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.
Liskov substitution principle (LSP)
Examples
In addition to the changes this allowed in
api.py; this PR also removes warnings we currently get for a few examples usingalt.LookupData:mainchart-data-typeNote
An alternative solution would be using the
Anytrick.In this case though, I think adding another alias (e.g.
_ChartDataType) might become more confusing as we already have:altair/altair/vegalite/v5/api.py
Line 201 in 709bbdf
altair/altair/utils/data.py
Lines 54 to 56 in 709bbdf
altair/altair/vegalite/v5/api.py
Lines 5184 to 5189 in 709bbdf