From 5d0c768419fe0cd709a01a41c879b8732775f539 Mon Sep 17 00:00:00 2001 From: Courtney Holcomb Date: Fri, 22 Mar 2024 10:19:59 -0700 Subject: [PATCH] Lint --- .../model/semantics/linkable_spec_resolver.py | 8 ++++---- metricflow/specs/specs.py | 14 +++++++------- .../model/semantics/test_linkable_spec_resolver.py | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/metricflow/model/semantics/linkable_spec_resolver.py b/metricflow/model/semantics/linkable_spec_resolver.py index f1ae1600bb..7cc47966ad 100644 --- a/metricflow/model/semantics/linkable_spec_resolver.py +++ b/metricflow/model/semantics/linkable_spec_resolver.py @@ -98,7 +98,7 @@ def path_key(self) -> ElementPathKey: # noqa: D102 ) @property - def reference(self) -> EntityReference: # noqa: D + def reference(self) -> EntityReference: # noqa: D102 return EntityReference(element_name=self.element_name) @@ -114,7 +114,7 @@ class LinkableMetric: join_path: Tuple[SemanticModelJoinPathElement, ...] @property - def path_key(self) -> ElementPathKey: # noqa: D + def path_key(self) -> ElementPathKey: # noqa: D102 return ElementPathKey( element_name=self.element_name, entity_links=self.entity_links, @@ -123,7 +123,7 @@ def path_key(self) -> ElementPathKey: # noqa: D ) @property - def reference(self) -> MetricReference: # noqa: D + def reference(self) -> MetricReference: # noqa: D102 return MetricReference(element_name=self.element_name) @@ -459,7 +459,7 @@ class SemanticModelJoinPath: path_elements: Tuple[SemanticModelJoinPathElement, ...] @property - def last_path_element(self) -> SemanticModelJoinPathElement: # noqa: D + def last_path_element(self) -> SemanticModelJoinPathElement: # noqa: D102 assert len(self.path_elements) > 0 return self.path_elements[-1] diff --git a/metricflow/specs/specs.py b/metricflow/specs/specs.py index a76c8f8185..dfa0399674 100644 --- a/metricflow/specs/specs.py +++ b/metricflow/specs/specs.py @@ -245,32 +245,32 @@ class GroupByMetricSpec(LinkableInstanceSpec, SerializableDataclass): """Metric used in group by or where filter.""" @property - def without_first_entity_link(self) -> GroupByMetricSpec: # noqa: D + def without_first_entity_link(self) -> GroupByMetricSpec: # noqa: D102 assert len(self.entity_links) > 0, f"Spec does not have any entity links: {self}" return GroupByMetricSpec(element_name=self.element_name, entity_links=self.entity_links[1:]) @property - def without_entity_links(self) -> GroupByMetricSpec: # noqa: D + def without_entity_links(self) -> GroupByMetricSpec: # noqa: D102 return GroupByMetricSpec(element_name=self.element_name, entity_links=()) @staticmethod - def from_name(name: str) -> GroupByMetricSpec: # noqa: D + def from_name(name: str) -> GroupByMetricSpec: # noqa: D102 structured_name = StructuredLinkableSpecName.from_name(name) return GroupByMetricSpec( entity_links=tuple(EntityReference(idl) for idl in structured_name.entity_link_names), element_name=structured_name.element_name, ) - def __eq__(self, other: Any) -> bool: # type: ignore[misc] # noqa: D + def __eq__(self, other: Any) -> bool: # type: ignore[misc] # noqa: D105 if not isinstance(other, GroupByMetricSpec): return False return self.element_name == other.element_name and self.entity_links == other.entity_links - def __hash__(self) -> int: # noqa: D + def __hash__(self) -> int: # noqa: D105 return hash((self.element_name, self.entity_links)) @property - def reference(self) -> MetricReference: # noqa: D + def reference(self) -> MetricReference: # noqa: D102 return MetricReference(element_name=self.element_name) @property @@ -278,7 +278,7 @@ def reference(self) -> MetricReference: # noqa: D def as_spec_set(self) -> InstanceSpecSet: return InstanceSpecSet(group_by_metric_specs=(self,)) - def accept(self, visitor: InstanceSpecVisitor[VisitorOutputT]) -> VisitorOutputT: # noqa: D + def accept(self, visitor: InstanceSpecVisitor[VisitorOutputT]) -> VisitorOutputT: # noqa: D102 return visitor.visit_group_by_metric_spec(self) diff --git a/tests/model/semantics/test_linkable_spec_resolver.py b/tests/model/semantics/test_linkable_spec_resolver.py index c40994f037..ae8d2eaa36 100644 --- a/tests/model/semantics/test_linkable_spec_resolver.py +++ b/tests/model/semantics/test_linkable_spec_resolver.py @@ -127,7 +127,7 @@ def test_cyclic_join_manifest( # noqa: D103 ) -def test_create_linkable_element_set_from_join_path( # noqa: D +def test_create_linkable_element_set_from_join_path( # noqa: D103 request: FixtureRequest, mf_test_configuration: MetricFlowTestConfiguration, simple_model_spec_resolver: ValidLinkableSpecResolver, @@ -150,7 +150,7 @@ def test_create_linkable_element_set_from_join_path( # noqa: D ) -def test_create_linkable_element_set_from_join_path_multi_hop( # noqa: D +def test_create_linkable_element_set_from_join_path_multi_hop( # noqa: D103 request: FixtureRequest, mf_test_configuration: MetricFlowTestConfiguration, simple_model_spec_resolver: ValidLinkableSpecResolver,