Skip to content

Commit

Permalink
SE-1356 Black formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
medhatphq committed Jul 16, 2024
1 parent c0f5a44 commit 521d502
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions predicthq/endpoints/v1/features/endpoint.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
import inspect

from predicthq.endpoints.base import UserBaseEndpoint
from predicthq.endpoints.decorators import accepts, returns

from .schemas import FeatureResultSet


class FeaturesEndpoint(UserBaseEndpoint):

BASE_FEATURE_CRITERIA = {"stats": [["sum", "count"]], "phq_rank": [None]}
FIELDS_TO_MUTATE = frozenset([
"phq_attendance_",
"phq_viewership_",
"phq_impact_",
"phq_spend_"
])
FIELDS_TO_MUTATE = frozenset(
[
"phq_attendance_",
"phq_viewership_",
"phq_impact_",
"phq_spend_",
]
)

@classmethod
def mutate_bool_to_default_for_type(cls, user_request_spec):
for key, val in user_request_spec.items():
if any(key.startswith(x) for x in cls.FIELDS_TO_MUTATE):
user_request_spec[key] = [cls.BASE_FEATURE_CRITERIA if isinstance(v, bool) else v for v in val]
user_request_spec[key] = [
cls.BASE_FEATURE_CRITERIA if isinstance(v, bool) else v for v in val
]

@accepts(query_string=False)
@returns(FeatureResultSet)
Expand Down

0 comments on commit 521d502

Please sign in to comment.