From c81d8979ede92227434537ae1727bd1906a0f17c Mon Sep 17 00:00:00 2001 From: Michael Matloka Date: Fri, 15 Dec 2023 17:09:50 +0000 Subject: [PATCH] refactor(paths): Remove unused filter mixins (#19286) --- posthog/models/filters/mixins/paths.py | 37 +------------------------- posthog/models/filters/path_filter.py | 6 ----- 2 files changed, 1 insertion(+), 42 deletions(-) diff --git a/posthog/models/filters/mixins/paths.py b/posthog/models/filters/mixins/paths.py index 3d9c914a0d972..393b1f7140a70 100644 --- a/posthog/models/filters/mixins/paths.py +++ b/posthog/models/filters/mixins/paths.py @@ -1,5 +1,5 @@ import json -from typing import Dict, List, Literal, Optional, Tuple, cast +from typing import Dict, List, Literal, Optional from posthog.constants import ( CUSTOM_EVENT, @@ -69,41 +69,6 @@ def end_point_to_dict(self): return {"end_point": self.end_point} if self.end_point else {} -class PropTypeDerivedMixin(PathTypeMixin): - @cached_property - def prop_type(self) -> str: - if self.path_type == SCREEN_EVENT: - return "properties->> '$screen_name'" - elif self.path_type == CUSTOM_EVENT: - return "event" - elif self.path_type == HOGQL: - return "event" - else: - return "properties->> '$current_url'" - - -class ComparatorDerivedMixin(PropTypeDerivedMixin): - @cached_property - def comparator(self) -> str: - if self.path_type == SCREEN_EVENT: - return "{} =".format(self.prop_type) - elif self.path_type == CUSTOM_EVENT: - return "event =" - else: - return "{} =".format(self.prop_type) - - -class TargetEventDerivedMixin(PropTypeDerivedMixin): - @cached_property - def target_event(self) -> Tuple[Optional[PathType], Dict[str, str]]: - if self.path_type == SCREEN_EVENT: - return cast(PathType, SCREEN_EVENT), {"event": SCREEN_EVENT} - elif self.path_type == HOGQL or self.path_type == CUSTOM_EVENT: - return None, {} - else: - return cast(PathType, PAGEVIEW_EVENT), {"event": PAGEVIEW_EVENT} - - class PathsHogQLExpressionMixin(PathTypeMixin): @cached_property def paths_hogql_expression(self) -> Optional[str]: diff --git a/posthog/models/filters/path_filter.py b/posthog/models/filters/path_filter.py index 4373092b91520..5ef9395d82da4 100644 --- a/posthog/models/filters/path_filter.py +++ b/posthog/models/filters/path_filter.py @@ -25,7 +25,6 @@ from .mixins.groups import GroupsAggregationMixin from .mixins.interval import IntervalMixin from .mixins.paths import ( - ComparatorDerivedMixin, EndPointMixin, FunnelPathsMixin, LocalPathCleaningFiltersMixin, @@ -34,9 +33,7 @@ PathPersonsMixin, PathReplacementMixin, PathStepLimitMixin, - PropTypeDerivedMixin, StartPointMixin, - TargetEventDerivedMixin, TargetEventsMixin, PathsHogQLExpressionMixin, ) @@ -47,9 +44,6 @@ class PathFilter( StartPointMixin, EndPointMixin, - TargetEventDerivedMixin, - ComparatorDerivedMixin, - PropTypeDerivedMixin, PropertyMixin, IntervalMixin, InsightMixin,