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

Add property provided_dtypes to Context #404

Merged
merged 5 commits into from
Mar 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions strax/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -1469,6 +1469,18 @@ def _get_source_sf(self, run_id, target, should_exist=False):
raise ValueError('This cannot happen, we just checked that this '
'run should be stored?!?')

def provided_dtypes(self, runid='0'):
"""
Summarize useful dtype information provided by this context
:return: dictionary of provided dtypes with their corresponding lineage hash, save_when, version
"""
hashes = set([(d, self.key_for(runid, d).lineage_hash, p.save_when, p.__version__)
for p in self._plugin_class_registry.values()
for d in p.provides])

return {dtype: dict(hash=h, save_when=save_when.name, version=version)
for dtype, h, save_when, version in hashes}

@classmethod
def add_method(cls, f):
"""Add f as a new Context method"""
Expand Down