-
Notifications
You must be signed in to change notification settings - Fork 9
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
Get rid of DUMMY_NONEXISTING_PATH #479
Conversation
15e63d4
to
c06dc52
Compare
@adamjanovsky What do you think about this? It gets rid of the |
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.
Sure, that's a step in a good direction. I provided some individual comments. I also think that a release would be nice once you're finished with these tiny-refactoring PRs.
@@ -65,7 +65,7 @@ def __init__( | |||
self.name = name if name else type(self).__name__ | |||
self.description = description if description else datetime.now().strftime("%d/%m/%Y %H:%M:%S") | |||
self.state = state if state else self.DatasetInternalState() | |||
self.root_dir = Path(root_dir) | |||
self.root_dir = Path(root_dir) if root_dir is not None else None # type: ignore |
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.
Why is the # type: ignore
required? Shouldn't self.root_dir
expect Path | None
assignments?
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.
Well, it should, because that is what the setter of the property takes. However, since the getter is annotated with just Path
mypy is not happy here no matter what I do...
@@ -30,8 +29,8 @@ class AuxiliaryDatasetHandler(ABC): | |||
aux_datasets_dir: Path |
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.
Just set this to Path | None
to avoid the type warnings?
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.
Well, we need to lie here as well I think. The same way we are lying in the Dataset.root_dir
property claiming that it is never None
and only protecting it via the only_backed
decorator. Otherwise, typewise it just all goes wrong and every access to any attribute derived from root_dir
needs to be checked and guarded.
Fixes #290.