aboutsummaryrefslogtreecommitdiff
path: root/generalresearch/models/thl
diff options
context:
space:
mode:
Diffstat (limited to 'generalresearch/models/thl')
-rw-r--r--generalresearch/models/thl/contest/contest.py4
-rw-r--r--generalresearch/models/thl/contest/contest_entry.py2
-rw-r--r--generalresearch/models/thl/contest/examples.py7
-rw-r--r--generalresearch/models/thl/contest/io.py2
-rw-r--r--generalresearch/models/thl/contest/leaderboard.py2
-rw-r--r--generalresearch/models/thl/contest/milestone.py3
-rw-r--r--generalresearch/models/thl/contest/raffle.py2
-rw-r--r--generalresearch/models/thl/finance.py5
-rw-r--r--generalresearch/models/thl/ipinfo.py2
-rw-r--r--generalresearch/models/thl/ledger_example.py2
-rw-r--r--generalresearch/models/thl/offerwall/cache.py2
-rw-r--r--generalresearch/models/thl/payout_format.py12
-rw-r--r--generalresearch/models/thl/product.py2
-rw-r--r--generalresearch/models/thl/profiling/marketplace.py2
-rw-r--r--generalresearch/models/thl/profiling/upk_question.py2
-rw-r--r--generalresearch/models/thl/profiling/upk_question_answer.py2
-rw-r--r--generalresearch/models/thl/profiling/user_question_answer.py2
-rw-r--r--generalresearch/models/thl/session.py2
-rw-r--r--generalresearch/models/thl/survey/__init__.py3
-rw-r--r--generalresearch/models/thl/survey/buyer.py2
-rw-r--r--generalresearch/models/thl/survey/model.py2
-rw-r--r--generalresearch/models/thl/survey/penalty.py2
-rw-r--r--generalresearch/models/thl/task_adjustment.py2
-rw-r--r--generalresearch/models/thl/user.py2
-rw-r--r--generalresearch/models/thl/user_iphistory.py3
-rw-r--r--generalresearch/models/thl/wallet/payout.py2
26 files changed, 30 insertions, 45 deletions
diff --git a/generalresearch/models/thl/contest/contest.py b/generalresearch/models/thl/contest/contest.py
index 8c45f13..2a8853d 100644
--- a/generalresearch/models/thl/contest/contest.py
+++ b/generalresearch/models/thl/contest/contest.py
@@ -2,7 +2,7 @@ from __future__ import annotations
import json
from abc import ABC, abstractmethod
-from datetime import UTC, datetime, timezone
+from datetime import UTC, datetime
from typing import Any, Self
from uuid import uuid4
@@ -167,7 +167,7 @@ class Contest(ContestBase):
ended_at=datetime.now(tz=UTC),
end_reason=reason,
)
- return None
+ return
def model_dump_mysql(self, **kwargs) -> dict[str, Any]:
d = self.model_dump(mode="json", **kwargs)
diff --git a/generalresearch/models/thl/contest/contest_entry.py b/generalresearch/models/thl/contest/contest_entry.py
index 31ef317..bb3aef4 100644
--- a/generalresearch/models/thl/contest/contest_entry.py
+++ b/generalresearch/models/thl/contest/contest_entry.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from datetime import UTC, datetime, timezone
+from datetime import UTC, datetime
from uuid import uuid4
from pydantic import (
diff --git a/generalresearch/models/thl/contest/examples.py b/generalresearch/models/thl/contest/examples.py
index 1810e63..018f090 100644
--- a/generalresearch/models/thl/contest/examples.py
+++ b/generalresearch/models/thl/contest/examples.py
@@ -93,7 +93,6 @@ def _example_raffle(schema: dict) -> None:
product_id=EXAMPLE_PRODUCT_ID,
).model_dump(mode="json")
- return None
def _example_raffle_user_view(schema: dict[str, Any]) -> None:
@@ -144,7 +143,6 @@ def _example_raffle_user_view(schema: dict[str, Any]) -> None:
product_user_id="test-user",
).model_dump(mode="json")
- return None
def _example_milestone_create(schema: dict[str, Any]) -> None:
@@ -185,7 +183,6 @@ def _example_milestone_create(schema: dict[str, Any]) -> None:
terms_and_conditions=HttpUrl("https://www.example.com"),
).model_dump(mode="json")
- return None
def _example_milestone(schema: dict[str, Any]) -> None:
@@ -231,7 +228,6 @@ def _example_milestone(schema: dict[str, Any]) -> None:
win_count=12,
).model_dump(mode="json")
- return None
def _example_milestone_user_view(schema: dict[str, Any]) -> None:
@@ -277,7 +273,6 @@ def _example_milestone_user_view(schema: dict[str, Any]) -> None:
product_user_id="test-user",
).model_dump(mode="json")
- return None
def _example_leaderboard_contest_create(schema: dict[str, Any]) -> None:
@@ -322,7 +317,6 @@ def _example_leaderboard_contest_create(schema: dict[str, Any]) -> None:
leaderboard_key=f"leaderboard:{EXAMPLE_PRODUCT_ID}:us:weekly:2025-05-26:complete_count",
).model_dump(mode="json")
- return None
def _example_leaderboard_contest(schema: dict[str, Any]) -> None:
@@ -368,7 +362,6 @@ def _example_leaderboard_contest(schema: dict[str, Any]) -> None:
product_id=EXAMPLE_PRODUCT_ID,
).model_dump(mode="json")
- return None
def _example_leaderboard_contest_user_view(schema: dict[str, Any]) -> None:
diff --git a/generalresearch/models/thl/contest/io.py b/generalresearch/models/thl/contest/io.py
index c6af719..d11080f 100644
--- a/generalresearch/models/thl/contest/io.py
+++ b/generalresearch/models/thl/contest/io.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from datetime import UTC, datetime, timezone
+from datetime import UTC, datetime
from uuid import uuid4
from generalresearch.models.thl.contest.definitions import ContestType
diff --git a/generalresearch/models/thl/contest/leaderboard.py b/generalresearch/models/thl/contest/leaderboard.py
index c5e0626..696cdea 100644
--- a/generalresearch/models/thl/contest/leaderboard.py
+++ b/generalresearch/models/thl/contest/leaderboard.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from datetime import UTC, datetime, timedelta, timezone
+from datetime import UTC, datetime, timedelta
from typing import Any, Literal, Self
from pydantic import (
diff --git a/generalresearch/models/thl/contest/milestone.py b/generalresearch/models/thl/contest/milestone.py
index 8b74d50..8d96fcb 100644
--- a/generalresearch/models/thl/contest/milestone.py
+++ b/generalresearch/models/thl/contest/milestone.py
@@ -2,7 +2,7 @@ from __future__ import annotations
import logging
from datetime import timedelta
-from typing import Any, Literal
+from typing import Any, Literal, Self
from pydantic import (
BaseModel,
@@ -10,7 +10,6 @@ from pydantic import (
Field,
PositiveInt,
)
-from typing import Self
from generalresearch.models.custom_types import AwareDatetimeISO
from generalresearch.models.thl.contest.contest import (
diff --git a/generalresearch/models/thl/contest/raffle.py b/generalresearch/models/thl/contest/raffle.py
index b497a44..08243f4 100644
--- a/generalresearch/models/thl/contest/raffle.py
+++ b/generalresearch/models/thl/contest/raffle.py
@@ -3,7 +3,7 @@ from __future__ import annotations
import logging
import random
from collections import defaultdict
-from datetime import UTC, datetime, timezone
+from datetime import UTC, datetime
from typing import Any, Literal, Self
from pydantic import (
diff --git a/generalresearch/models/thl/finance.py b/generalresearch/models/thl/finance.py
index a992f78..0856825 100644
--- a/generalresearch/models/thl/finance.py
+++ b/generalresearch/models/thl/finance.py
@@ -1,7 +1,7 @@
from __future__ import annotations
import random
-from datetime import UTC, timezone
+from datetime import UTC
from typing import TYPE_CHECKING
from uuid import uuid4
@@ -28,8 +28,7 @@ payout_example = random.randint(150, 750 * 100)
adjustment_example = random.randint(-1_000, 50 * 100)
if TYPE_CHECKING:
- from generalresearch.managers.thl.product import ProductManager
- from generalresearch.models.thl.ledger import AccountType, Direction, LedgerAccount
+ from generalresearch.models.thl.ledger import LedgerAccount
class AdjustmentType(BaseModel):
diff --git a/generalresearch/models/thl/ipinfo.py b/generalresearch/models/thl/ipinfo.py
index 3f212cf..e327bae 100644
--- a/generalresearch/models/thl/ipinfo.py
+++ b/generalresearch/models/thl/ipinfo.py
@@ -1,7 +1,7 @@
from __future__ import annotations
import ipaddress
-from datetime import UTC, datetime, timezone
+from datetime import UTC, datetime
from typing import Any, Literal, Self
from faker import Faker
diff --git a/generalresearch/models/thl/ledger_example.py b/generalresearch/models/thl/ledger_example.py
index 92ad83d..0291691 100644
--- a/generalresearch/models/thl/ledger_example.py
+++ b/generalresearch/models/thl/ledger_example.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from datetime import UTC, datetime, timezone
+from datetime import UTC, datetime
from typing import Any
from uuid import uuid4
diff --git a/generalresearch/models/thl/offerwall/cache.py b/generalresearch/models/thl/offerwall/cache.py
index 82ab36d..97546b2 100644
--- a/generalresearch/models/thl/offerwall/cache.py
+++ b/generalresearch/models/thl/offerwall/cache.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from datetime import UTC, datetime, timezone
+from datetime import UTC, datetime
from typing import Any
from pydantic import BaseModel, Field
diff --git a/generalresearch/models/thl/payout_format.py b/generalresearch/models/thl/payout_format.py
index a7fc4fb..4d616b6 100644
--- a/generalresearch/models/thl/payout_format.py
+++ b/generalresearch/models/thl/payout_format.py
@@ -45,7 +45,7 @@ def format_payout_format(payout_format: str, payout_int: int) -> str:
try:
xform, formatstr = inside.split(":")
- except ValueError as e:
+ except ValueError:
raise ValueError(
"Payout format string must contain ':' to distinguish between transformations and formatting."
)
@@ -61,17 +61,17 @@ def format_payout_format(payout_format: str, payout_int: int) -> str:
payout = decimal.Decimal(eval(xform, {"payout": payout_int}))
- except NameError as e:
+ except NameError:
raise ValueError("Payout format string must contain 'payout' variable.")
- except ZeroDivisionError as e:
+ except ZeroDivisionError:
raise ValueError("Cannot divide by zero.")
- except TypeError as e:
+ except TypeError:
# "{payout()*1:}" - TypeError: 'int' object is not callable
raise ValueError("Invalid type reference.")
- except Exception as e:
- raise ValueError(f"Invalid payout transformation")
+ except Exception:
+ raise ValueError("Invalid payout transformation")
formatstr = f"{{:{formatstr}}}"
diff --git a/generalresearch/models/thl/product.py b/generalresearch/models/thl/product.py
index 5b7ab9a..76a8e83 100644
--- a/generalresearch/models/thl/product.py
+++ b/generalresearch/models/thl/product.py
@@ -77,7 +77,6 @@ if TYPE_CHECKING:
from generalresearch.models.thl.payout import (
BrokerageProductPayoutEvent,
)
- from generalresearch.models.thl.user import User
# fmt: off
@@ -1088,7 +1087,6 @@ class Product(BaseModel, validate_assignment=True):
from generalresearch.incite.schemas.mergers.pop_ledger import (
numerical_col_names,
)
- from generalresearch.models.thl.ledger import LedgerAccount
account: LedgerAccount = thl_lm.get_account_or_create_bp_wallet(product=self)
assert self.id == account.reference_uuid
diff --git a/generalresearch/models/thl/profiling/marketplace.py b/generalresearch/models/thl/profiling/marketplace.py
index 9038cf6..ad4ce80 100644
--- a/generalresearch/models/thl/profiling/marketplace.py
+++ b/generalresearch/models/thl/profiling/marketplace.py
@@ -1,7 +1,7 @@
from __future__ import annotations
from abc import ABC, abstractmethod
-from datetime import UTC, datetime, timezone
+from datetime import UTC, datetime
from functools import cached_property
from typing import Any
diff --git a/generalresearch/models/thl/profiling/upk_question.py b/generalresearch/models/thl/profiling/upk_question.py
index 08ea350..77bba6f 100644
--- a/generalresearch/models/thl/profiling/upk_question.py
+++ b/generalresearch/models/thl/profiling/upk_question.py
@@ -367,7 +367,7 @@ class UpkQuestion(BaseModel):
self.choices is None
), f"No `choices` are allowed for type `{self.type}`"
else:
- assert self.choices is not None, f"`choices` must be set"
+ assert self.choices is not None, "`choices` must be set"
return self
@model_validator(mode="after")
diff --git a/generalresearch/models/thl/profiling/upk_question_answer.py b/generalresearch/models/thl/profiling/upk_question_answer.py
index c59d99d..d8323ad 100644
--- a/generalresearch/models/thl/profiling/upk_question_answer.py
+++ b/generalresearch/models/thl/profiling/upk_question_answer.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from datetime import UTC, datetime, timezone
+from datetime import UTC, datetime
from typing import Any, Self
from uuid import uuid4
diff --git a/generalresearch/models/thl/profiling/user_question_answer.py b/generalresearch/models/thl/profiling/user_question_answer.py
index a55b205..2db07b7 100644
--- a/generalresearch/models/thl/profiling/user_question_answer.py
+++ b/generalresearch/models/thl/profiling/user_question_answer.py
@@ -2,7 +2,7 @@ from __future__ import annotations
import json
from collections.abc import Iterator
-from datetime import UTC, datetime, timedelta, timezone
+from datetime import UTC, datetime, timedelta
from typing import Any, Literal, Self
from pydantic import (
diff --git a/generalresearch/models/thl/session.py b/generalresearch/models/thl/session.py
index c8e681c..fe7194a 100644
--- a/generalresearch/models/thl/session.py
+++ b/generalresearch/models/thl/session.py
@@ -2,7 +2,7 @@ from __future__ import annotations
import json
import logging
-from datetime import UTC, datetime, timedelta, timezone
+from datetime import UTC, datetime, timedelta
from decimal import Decimal
from typing import TYPE_CHECKING, Annotated, Any, Self
from uuid import uuid4
diff --git a/generalresearch/models/thl/survey/__init__.py b/generalresearch/models/thl/survey/__init__.py
index bc3d699..6e6b475 100644
--- a/generalresearch/models/thl/survey/__init__.py
+++ b/generalresearch/models/thl/survey/__init__.py
@@ -111,7 +111,6 @@ class MarketplaceTask(BaseModel, ABC):
"""
The Condition Model for this survey class
"""
- pass
@property
@abstractmethod
@@ -119,7 +118,6 @@ class MarketplaceTask(BaseModel, ABC):
"""
The age question ID
"""
- pass
@property
@abstractmethod
@@ -129,7 +127,6 @@ class MarketplaceTask(BaseModel, ABC):
"""
Mapping of generic Gender to the marketplace condition for that gender
"""
- pass
@property
def marketplace_age_groups(
diff --git a/generalresearch/models/thl/survey/buyer.py b/generalresearch/models/thl/survey/buyer.py
index 384bab4..b888007 100644
--- a/generalresearch/models/thl/survey/buyer.py
+++ b/generalresearch/models/thl/survey/buyer.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from datetime import UTC, datetime, timezone
+from datetime import UTC, datetime
from decimal import Decimal
from math import log
from typing import Annotated
diff --git a/generalresearch/models/thl/survey/model.py b/generalresearch/models/thl/survey/model.py
index 57bcbe2..2eed8f7 100644
--- a/generalresearch/models/thl/survey/model.py
+++ b/generalresearch/models/thl/survey/model.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from datetime import UTC, datetime, timezone
+from datetime import UTC, datetime
from decimal import Decimal
from typing import Annotated, Any
diff --git a/generalresearch/models/thl/survey/penalty.py b/generalresearch/models/thl/survey/penalty.py
index 05153fe..04f8e20 100644
--- a/generalresearch/models/thl/survey/penalty.py
+++ b/generalresearch/models/thl/survey/penalty.py
@@ -1,7 +1,7 @@
from __future__ import annotations
import abc
-from datetime import UTC, datetime, timezone
+from datetime import UTC, datetime
from typing import Annotated, Literal
from pydantic import BaseModel, ConfigDict, Field, TypeAdapter
diff --git a/generalresearch/models/thl/task_adjustment.py b/generalresearch/models/thl/task_adjustment.py
index 1834898..27c47d4 100644
--- a/generalresearch/models/thl/task_adjustment.py
+++ b/generalresearch/models/thl/task_adjustment.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from datetime import UTC, datetime, timezone
+from datetime import UTC, datetime
from decimal import Decimal
from uuid import uuid4
diff --git a/generalresearch/models/thl/user.py b/generalresearch/models/thl/user.py
index 55bbd18..11e0d67 100644
--- a/generalresearch/models/thl/user.py
+++ b/generalresearch/models/thl/user.py
@@ -3,7 +3,7 @@ from __future__ import annotations
import json
import logging
import re
-from datetime import UTC, datetime, timezone
+from datetime import UTC, datetime
from typing import TYPE_CHECKING, Annotated, Self
from uuid import UUID, uuid4
diff --git a/generalresearch/models/thl/user_iphistory.py b/generalresearch/models/thl/user_iphistory.py
index 469f8ba..257c41a 100644
--- a/generalresearch/models/thl/user_iphistory.py
+++ b/generalresearch/models/thl/user_iphistory.py
@@ -1,7 +1,7 @@
from __future__ import annotations
import ipaddress
-from datetime import UTC, datetime, timedelta, timezone
+from datetime import UTC, datetime, timedelta
from typing import Self
from faker import Faker
@@ -204,7 +204,6 @@ class UserIPHistory(BaseModel):
if res.get(x.ip):
x.information = res[x.ip]
- return None
def collapse_ip_records(self):
"""
diff --git a/generalresearch/models/thl/wallet/payout.py b/generalresearch/models/thl/wallet/payout.py
index cbb37fe..42530b3 100644
--- a/generalresearch/models/thl/wallet/payout.py
+++ b/generalresearch/models/thl/wallet/payout.py
@@ -2,7 +2,7 @@ from __future__ import annotations
import json
from collections.abc import Collection
-from datetime import UTC, datetime, timezone
+from datetime import UTC, datetime
from typing import Any
from uuid import uuid4