-
Notifications
You must be signed in to change notification settings - Fork 14
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
Finalize validations for custom granularities #370
Changes from 1 commit
a968ffd
2083a24
00abab6
9151740
825622c
e0fa2b1
99c6043
cbdef95
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,8 +120,10 @@ def validate_manifest(cls, semantic_manifest: SemanticManifestT) -> Sequence[Val | |
) | ||
|
||
if window: | ||
issues += cls.validate_metric_time_window( | ||
metric_context=metric_context, window=window, custom_granularities=custom_granularity_names | ||
issues.extend( | ||
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. I don't know why the typechecker would accept one of these and not the other, but tbh, I prefer extend here anyway so I'm not going to complain :P 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. you can't do |
||
cls.validate_metric_time_window( | ||
metric_context=metric_context, window=window, custom_granularities=custom_granularity_names | ||
) | ||
) | ||
|
||
return issues | ||
|
@@ -167,7 +169,7 @@ class DerivedMetricRule(SemanticManifestValidationRule[SemanticManifestT], Gener | |
|
||
@staticmethod | ||
@validate_safely(whats_being_done="checking that the alias set are not unique and distinct") | ||
def _validate_alias_collision(metric: Metric) -> List[ValidationIssue]: | ||
def _validate_alias_collision(metric: Metric) -> Sequence[ValidationIssue]: | ||
issues: List[ValidationIssue] = [] | ||
|
||
if metric.type == MetricType.DERIVED: | ||
|
@@ -193,7 +195,7 @@ def _validate_alias_collision(metric: Metric) -> List[ValidationIssue]: | |
|
||
@staticmethod | ||
@validate_safely(whats_being_done="checking that the input metrics exist") | ||
def _validate_input_metrics_exist(semantic_manifest: SemanticManifest) -> List[ValidationIssue]: | ||
def _validate_input_metrics_exist(semantic_manifest: SemanticManifest) -> Sequence[ValidationIssue]: | ||
issues: List[ValidationIssue] = [] | ||
|
||
all_metrics = {m.name for m in semantic_manifest.metrics} | ||
|
@@ -264,7 +266,7 @@ def _validate_time_offset_params(metric: Metric, custom_granularities: Set[str]) | |
|
||
@staticmethod | ||
@validate_safely(whats_being_done="checking that the expr field uses the input metrics") | ||
def _validate_expr(metric: Metric) -> List[ValidationIssue]: | ||
def _validate_expr(metric: Metric) -> Sequence[ValidationIssue]: | ||
issues: List[ValidationIssue] = [] | ||
|
||
if metric.type == MetricType.DERIVED: | ||
|
@@ -346,7 +348,7 @@ def _validate_type_params( | |
@validate_safely(whats_being_done="checks that the entity exists in the base/conversion semantic model") | ||
def _validate_entity_exists( | ||
metric: Metric, entity: str, base_semantic_model: SemanticModel, conversion_semantic_model: SemanticModel | ||
) -> List[ValidationIssue]: | ||
) -> Sequence[ValidationIssue]: | ||
issues: List[ValidationIssue] = [] | ||
|
||
if entity not in {entity.name for entity in base_semantic_model.entities}: | ||
|
@@ -376,7 +378,7 @@ def _validate_entity_exists( | |
@validate_safely(whats_being_done="checks that the provided measures are valid for conversion metrics") | ||
def _validate_measures( | ||
metric: Metric, base_semantic_model: SemanticModel, conversion_semantic_model: SemanticModel | ||
) -> List[ValidationIssue]: | ||
) -> Sequence[ValidationIssue]: | ||
issues: List[ValidationIssue] = [] | ||
|
||
def _validate_measure( | ||
|
@@ -438,7 +440,7 @@ def _validate_measure( | |
@validate_safely(whats_being_done="checks that the provided constant properties are valid") | ||
def _validate_constant_properties( | ||
metric: Metric, base_semantic_model: SemanticModel, conversion_semantic_model: SemanticModel | ||
) -> List[ValidationIssue]: | ||
) -> Sequence[ValidationIssue]: | ||
issues: List[ValidationIssue] = [] | ||
|
||
def _elements_in_model(references: List[str], semantic_model: SemanticModel) -> None: | ||
|
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.
<3 this