From 32ded805cc85b948672f484c9aa1a726714b66f4 Mon Sep 17 00:00:00 2001 From: Courtney Holcomb Date: Tue, 24 Sep 2024 08:34:37 -0700 Subject: [PATCH] Upgrade black --- .pre-commit-config.yaml | 2 +- dbt-metricflow/dbt_metricflow/cli/main.py | 4 +++- .../metricflow_semantics/model/spec_converters.py | 1 + .../query/resolver_inputs/query_resolver_inputs.py | 1 + metricflow/dataflow/builder/dataflow_plan_builder.py | 12 ++++++------ .../plan_conversion/sql_expression_builders.py | 1 + .../validation/data_warehouse_model_validator.py | 6 +++--- 7 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2f59b237d7..18680f1a72 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ repos: args: [--fix, --exit-non-zero-on-fix] - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 24.3.0 hooks: - id: black verbose: true diff --git a/dbt-metricflow/dbt_metricflow/cli/main.py b/dbt-metricflow/dbt_metricflow/cli/main.py index c59ad93435..1202cdbbde 100644 --- a/dbt-metricflow/dbt_metricflow/cli/main.py +++ b/dbt-metricflow/dbt_metricflow/cli/main.py @@ -645,7 +645,9 @@ def validate_configs( ).validate_semantic_manifest(semantic_manifest) if not model_issues.has_blocking_issues: - semantic_spinner.succeed(f"🎉 Successfully validated the semantics of built manifest ({model_issues.summary()})") + semantic_spinner.succeed( + f"🎉 Successfully validated the semantics of built manifest ({model_issues.summary()})" + ) else: semantic_spinner.fail( f"Breaking issues found when checking semantics of built manifest ({model_issues.summary()})" diff --git a/metricflow-semantics/metricflow_semantics/model/spec_converters.py b/metricflow-semantics/metricflow_semantics/model/spec_converters.py index 88cd1d9f9e..e3ddb7df20 100644 --- a/metricflow-semantics/metricflow_semantics/model/spec_converters.py +++ b/metricflow-semantics/metricflow_semantics/model/spec_converters.py @@ -8,6 +8,7 @@ classes, rather than the perhaps more natural approach of adding a to_spec() method on the model objects. These shims likely point to the need for a bit of an internal refactor, but that's a concern for another time. """ + from __future__ import annotations from dbt_semantic_interfaces.protocols.measure import Measure diff --git a/metricflow-semantics/metricflow_semantics/query/resolver_inputs/query_resolver_inputs.py b/metricflow-semantics/metricflow_semantics/query/resolver_inputs/query_resolver_inputs.py index 45a02b49b3..ddbc933a7d 100644 --- a/metricflow-semantics/metricflow_semantics/query/resolver_inputs/query_resolver_inputs.py +++ b/metricflow-semantics/metricflow_semantics/query/resolver_inputs/query_resolver_inputs.py @@ -3,6 +3,7 @@ The naming of these classes is a little odd as they have the "For.." suffix. But using the "*ResolverInput" leads to some confusing names like "ResolverInputForQuery" -> "QueryResolverInput". Improved naming for these classes is TBD. """ + from __future__ import annotations from dataclasses import dataclass diff --git a/metricflow/dataflow/builder/dataflow_plan_builder.py b/metricflow/dataflow/builder/dataflow_plan_builder.py index 88f1dee73b..9cac5696e4 100644 --- a/metricflow/dataflow/builder/dataflow_plan_builder.py +++ b/metricflow/dataflow/builder/dataflow_plan_builder.py @@ -1613,12 +1613,12 @@ def _build_aggregated_measure_from_measure_source_node( non_additive_dimension_grain = self._semantic_model_lookup.get_defined_time_granularity( TimeDimensionReference(non_additive_dimension_spec.name) ) - queried_time_dimension_spec: Optional[ - TimeDimensionSpec - ] = self._find_non_additive_dimension_in_linkable_specs( - agg_time_dimension=agg_time_dimension, - linkable_specs=queried_linkable_specs.as_tuple, - non_additive_dimension_spec=non_additive_dimension_spec, + queried_time_dimension_spec: Optional[TimeDimensionSpec] = ( + self._find_non_additive_dimension_in_linkable_specs( + agg_time_dimension=agg_time_dimension, + linkable_specs=queried_linkable_specs.as_tuple, + non_additive_dimension_spec=non_additive_dimension_spec, + ) ) time_dimension_spec = TimeDimensionSpec( # The NonAdditiveDimensionSpec name property is a plain element name diff --git a/metricflow/plan_conversion/sql_expression_builders.py b/metricflow/plan_conversion/sql_expression_builders.py index e5ed18d463..0912962963 100644 --- a/metricflow/plan_conversion/sql_expression_builders.py +++ b/metricflow/plan_conversion/sql_expression_builders.py @@ -1,4 +1,5 @@ """Utility module for building sql expressions from inputs derived from dataflow plan or other nodes.""" + from __future__ import annotations from typing import List, Sequence diff --git a/metricflow/validation/data_warehouse_model_validator.py b/metricflow/validation/data_warehouse_model_validator.py index ffc0e89190..1d9c8d1b34 100644 --- a/metricflow/validation/data_warehouse_model_validator.py +++ b/metricflow/validation/data_warehouse_model_validator.py @@ -389,9 +389,9 @@ def gen_measure_tasks( source_node_by_measure_spec.update({measure_spec: source_node for measure_spec in measure_specs}) measure_specs_source_node_pair.append((measure_specs, source_node)) - source_node_to_sub_task: DefaultDict[ - DataflowPlanNode, List[DataWarehouseValidationTask] - ] = collections.defaultdict(list) + source_node_to_sub_task: DefaultDict[DataflowPlanNode, List[DataWarehouseValidationTask]] = ( + collections.defaultdict(list) + ) for spec in semantic_model_specs: obtained_source_node = source_node_by_measure_spec.get(spec) assert obtained_source_node, f"Unable to find generated source node for measure: {spec.element_name}"