Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
thmsobrmlr committed Mar 26, 2024
1 parent f4fef22 commit a2e298b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
5 changes: 0 additions & 5 deletions mypy-baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,6 @@ posthog/hogql_queries/utils/query_date_range.py:0: error: Incompatible default f
posthog/hogql_queries/utils/query_date_range.py:0: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
posthog/hogql_queries/utils/query_date_range.py:0: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
posthog/hogql_queries/utils/query_date_range.py:0: error: Item "None" of "IntervalType | None" has no attribute "name" [union-attr]
posthog/hogql_queries/legacy_compatibility/filter_to_query.py:0: error: Argument 1 to "filter" has incompatible type "Callable[[Any], bool]"; expected "Callable[[Any], TypeGuard[bool]]" [arg-type]
posthog/hogql_queries/legacy_compatibility/filter_to_query.py:0: error: Argument 1 to "filter" has incompatible type "Callable[[Any], bool]"; expected "Callable[[Any], TypeGuard[Any]]" [arg-type]
posthog/hogql_queries/legacy_compatibility/filter_to_query.py:0: error: Argument 2 to "filter" has incompatible type "Any | None"; expected "Iterable[Any]" [arg-type]
posthog/hogql_queries/legacy_compatibility/filter_to_query.py:0: error: Argument 2 to "map" has incompatible type "Any | None"; expected "Iterable[Any]" [arg-type]
posthog/hogql_queries/legacy_compatibility/filter_to_query.py:0: error: Argument 2 to "map" has incompatible type "Any | None"; expected "Iterable[Any]" [arg-type]
posthog/hogql_queries/legacy_compatibility/filter_to_query.py:0: error: Dict entry 4 has incompatible type "str": "Literal[0, 1, 2, 3, 4] | None"; expected "str": "str | None" [dict-item]
posthog/hogql_queries/legacy_compatibility/filter_to_query.py:0: error: Item "None" of "Any | None" has no attribute "__iter__" (not iterable) [union-attr]
posthog/hogql_queries/legacy_compatibility/filter_to_query.py:0: error: Argument 1 to "float" has incompatible type "Any | None"; expected "str | Buffer | SupportsFloat | SupportsIndex" [arg-type]
Expand Down
4 changes: 2 additions & 2 deletions posthog/hogql_queries/insights/trends/test/test_trends.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunner
from posthog.hogql_queries.legacy_compatibility.filter_to_query import (
clean_entity_properties,
clean_properties,
clean_global_properties,
)
from posthog.models import (
Action,
Expand Down Expand Up @@ -118,7 +118,7 @@ def _props(dict: Dict):
"values": [{"type": "AND", "values": [props]}],
}

return PropertyGroupFilter(**clean_properties(raw_properties))
return PropertyGroupFilter(**clean_global_properties(raw_properties))


def convert_filter_to_trends_query(filter: Filter) -> TrendsQuery:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def clean_property(property: dict):

# remove none from values
if isinstance(cleaned_property.get("value"), list):
cleaned_property["value"] = list(filter(lambda x: x is not None, cleaned_property.get("value")))
cleaned_property["value"] = list(filter(lambda x: x is not None, cleaned_property.get("value"))) # type: ignore

# remove keys without concrete value
cleaned_property = {key: value for key, value in cleaned_property.items() if value is not None}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class TestCleanGlobalProperties(BaseTest):
def test_handles_empty_properties(self):
properties = {}
properties: dict = {}

result = clean_global_properties(properties)

Expand Down Expand Up @@ -101,7 +101,7 @@ def test_handles_property_group_filters_values(self):

class TestCleanEntityProperties(BaseTest):
def test_handles_empty_properties(self):
properties = {}
properties: dict = {}

result = clean_entity_properties(properties)

Expand Down

0 comments on commit a2e298b

Please sign in to comment.