Skip to content

Commit

Permalink
mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
aspicer committed Dec 19, 2024
1 parent 0b59911 commit 7ba2f4c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
12 changes: 5 additions & 7 deletions posthog/hogql/query.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import dataclasses
from typing import Optional, Union, cast
from typing import Optional, Union, cast, ClassVar

from posthog.clickhouse.client.connection import Workload
from posthog.errors import ExposedCHQueryError
Expand Down Expand Up @@ -48,15 +48,13 @@ class HogQLQueryExecutor:
settings: Optional[HogQLGlobalSettings] = None
modifiers: Optional[HogQLQueryModifiers] = None
limit_context: Optional[LimitContext] = LimitContext.QUERY
timings: Optional[HogQLTimings] = None
timings: HogQLTimings = dataclasses.field(default_factory=HogQLTimings)
pretty: Optional[bool] = True
context: Optional[HogQLContext] = None
__uninitialized_context: ClassVar[HogQLContext] = HogQLContext()
context: HogQLContext = dataclasses.field(default_factory=lambda: HogQLQueryExecutor.__uninitialized_context)

def __post_init__(self):
if self.timings is None:
self.timings = HogQLTimings()

if self.context is None:
if self.context is self.__uninitialized_context:
self.context = HogQLContext(team_id=self.team.pk)

self.query_modifiers = create_default_modifiers_for_team(self.team, self.modifiers)
Expand Down
4 changes: 2 additions & 2 deletions posthog/models/cohort/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,10 @@ def _recalculate_cohortpeople_for_team(

def _recalculate_cohortpeople_for_team_hogql(
cohort: Cohort, pending_version: int, team: Team, *, initiating_user_id: Optional[int]
) -> Optional[int]:
):
# No need to do anything here, as we're only testing hogql
if cohort.is_static or not cohort.properties.values:
return None
return

from posthog.hogql_queries.hogql_cohort_query import HogQLCohortQuery
from posthog.hogql.query import HogQLQueryExecutor
Expand Down

0 comments on commit 7ba2f4c

Please sign in to comment.