This repository was archived by the owner on Jul 13, 2022. It is now read-only.
Conversation
ssantana-ns
reviewed
Mar 17, 2022
|
|
||
| def is_valid_uuid(string: str) -> bool: | ||
| """Check if a string is a valid UUID | ||
| def is_valid_uuid(obj: Any) -> TypeGuard["UUID_STR"]: |
Collaborator
There was a problem hiding this comment.
what does TypeGuard do? The return here is still bool
|
|
||
| The false positives are due to a limitation of python's type hint system that | ||
| doesn't allow for dynamic class modification. The current workaround is to use | ||
| the `BaseModel_database_model_hint` class provided by Pynocular, which is |
Collaborator
There was a problem hiding this comment.
That class name doesn't follow Python convention and is also very wordy. We shouldn't have to do this in order get mypy to work. If the issue is the dynamic class modification we should look into fixing that first before patching over it
pynocular/database_model.py
Outdated
| raise ValueError("invalid UUID string") | ||
|
|
||
|
|
||
| SelfType = TypeVar("SelfType", bound="DatabaseModel") |
Collaborator
There was a problem hiding this comment.
whats the purpose of this? A comment would be helpful
bgimby-ns
commented
Mar 21, 2022
| other: int = 0 | ||
|
|
||
| class NestedModel(DatabaseModel, table_name = "table2", database_info=DBInfo("type")): | ||
| if TYPE_CHECKING: |
Author
There was a problem hiding this comment.
This is a way to get the nested models to have type checking/IDE support, but it's not needed if you don't care about that
Open
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Overview of changes