Skip to content
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

DM-24807: Add type annotations to datastore #280

Merged
merged 5 commits into from May 17, 2020
Merged

DM-24807: Add type annotations to datastore #280

merged 5 commits into from May 17, 2020

Conversation

timj
Copy link
Member

@timj timj commented May 12, 2020

No description provided.

@timj timj force-pushed the tickets/DM-24807 branch 3 times, most recently from 7ade7b4 to e209181 Compare May 15, 2020 18:53
@timj timj marked this pull request as ready for review May 15, 2020 19:39
Copy link
Member

@TallJimbo TallJimbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of very minor comments, none of them critical. Overall this is of course a very nice cleanup.

python/lsst/daf/butler/core/datasets/ref.py Outdated Show resolved Hide resolved
python/lsst/daf/butler/core/datastore.py Outdated Show resolved Hide resolved
python/lsst/daf/butler/core/datastore.py Outdated Show resolved Hide resolved
@@ -667,12 +687,13 @@ def export(self, refs: Iterable[DatasetRef], *,
raise NotImplementedError(f"Transfer mode {transfer} not supported.")

@abstractmethod
def validateConfiguration(self, entities, logFailures=False):
def validateConfiguration(self, entities: Iterable[Union[DatasetRef, DatasetType, StorageClass]],
logFailures: bool = False) -> None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Entity" might merit an alias.

python/lsst/daf/butler/core/storageClass.py Outdated Show resolved Hide resolved
python/lsst/daf/butler/datastores/fileLikeDatastore.py Outdated Show resolved Hide resolved
python/lsst/daf/butler/datastores/fileLikeDatastore.py Outdated Show resolved Hide resolved
python/lsst/daf/butler/datastores/posixDatastore.py Outdated Show resolved Hide resolved
python/lsst/daf/butler/core/datastore.py Outdated Show resolved Hide resolved
python/mypy.ini Show resolved Hide resolved
timj added 3 commits May 16, 2020 14:03
This simplifies the case where we only want the
refs for a single ref. Also makes type annotations
easier.
Rather than using __post_init__ (which is very hard
to use type annotations with) instead force the
dataclass to be frozen but also replace with
our own __init__
A mutable list is not what we wanted for something
that should not be changed by the caller.
Also added annotations for related classes called
by datastores.

Mypy has been enabled for some core classes.
@timj timj merged commit ea07b93 into master May 17, 2020
@timj timj deleted the tickets/DM-24807 branch May 17, 2020 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants