Skip to content

Commit

Permalink
refactor(paths): Remove unused filter mixins (#19286)
Browse files Browse the repository at this point in the history
  • Loading branch information
Twixes authored Dec 15, 2023
1 parent f899e2f commit c81d897
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 42 deletions.
37 changes: 1 addition & 36 deletions posthog/models/filters/mixins/paths.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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]:
Expand Down
6 changes: 0 additions & 6 deletions posthog/models/filters/path_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from .mixins.groups import GroupsAggregationMixin
from .mixins.interval import IntervalMixin
from .mixins.paths import (
ComparatorDerivedMixin,
EndPointMixin,
FunnelPathsMixin,
LocalPathCleaningFiltersMixin,
Expand All @@ -34,9 +33,7 @@
PathPersonsMixin,
PathReplacementMixin,
PathStepLimitMixin,
PropTypeDerivedMixin,
StartPointMixin,
TargetEventDerivedMixin,
TargetEventsMixin,
PathsHogQLExpressionMixin,
)
Expand All @@ -47,9 +44,6 @@
class PathFilter(
StartPointMixin,
EndPointMixin,
TargetEventDerivedMixin,
ComparatorDerivedMixin,
PropTypeDerivedMixin,
PropertyMixin,
IntervalMixin,
InsightMixin,
Expand Down

0 comments on commit c81d897

Please sign in to comment.