-
Notifications
You must be signed in to change notification settings - Fork 843
[type validation] skip unresolved forward ref #3376
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
Changes from 6 commits
801f561
58a5a0f
5495150
2eb6314
4b80e1a
f5223d0
f83df9f
addfb33
3718dee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of modifying existing tests I would prefer that you keep everything as it is + add a new class So can you create a config like this: @strict
@dataclass
class ConfigWithForwardRef:
explicitForwardRef: ForwardRef("torch.dtype")
implicitForwardRef: "torch.dtype"and test both cases? |
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.
The clause above,
isinstance(expected_type, type), isTruewhenexpected_typeisstr. This meansor isinstance(expected_type, str)can be removed, correct?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.
not really. The above clause is triggered if
exp_type = <string>and the one I added is for cases such asexp_type = "torch.tensor"In other words, the type is not resolved and remains in string version
Uh oh!
There was an error while loading. Please reload this page.
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.
ah, derp, of course --
expected_typeis a string instance here, not the typestring🤦