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

Remove unneeded protocols for lookup classes #1137

Merged
merged 4 commits into from
Apr 15, 2024
Merged

Conversation

courtneyholcomb
Copy link
Contributor

Description

Deletes protocols used for SemanticModelLookup and MetricLookup in an effort to reduce boilerplate code and improve developer experience when working with these classes. Discussed with @tlento here.
Also copies over any missing docstrings from the base classes so that we won't lose that context.

@tlento tlento linked an issue Apr 15, 2024 that may be closed by this pull request
Copy link
Contributor

@tlento tlento left a comment

Choose a reason for hiding this comment

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

Huh. That was easier than I thought it would be. See inline about some added method cleanup. Fine to do a separate PR or just layer on a new commit for them, either way. Thanks!

from metricflow.specs.specs import TimeDimensionSpec

logger = logging.getLogger(__name__)


class MetricLookup(MetricAccessor):
class MetricLookup:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the add_metric method here is the only "write" method in this class, and it's not called anywhere. Mind just renaming it to _add_metric so we don't have any "write" methods in the public interface?

"""Tracks semantic information for semantic models held in a set of SemanticModelContainers.

This implements the SemanticModelAccessors protocol, the interface type we use throughout the codebase.
This implements the SemanticModelLookups protocol, the interface type we use throughout the codebase.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit - remove this line and the next, they're outdated.

@courtneyholcomb courtneyholcomb enabled auto-merge (squash) April 15, 2024 19:49
@courtneyholcomb courtneyholcomb merged commit 5ad161b into main Apr 15, 2024
13 checks passed
@courtneyholcomb courtneyholcomb deleted the court/clean1 branch April 15, 2024 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SL-2009] Remove SemanticModelAccessor and MetricAccessor protocols
2 participants