From 186f5e47536673fde05aa6c3e0025f915e77e6a0 Mon Sep 17 00:00:00 2001 From: Max Nanis Date: Tue, 1 Sep 2026 15:36:12 -0700 Subject: Circular resolved. Working on GR Model tests --- generalresearch/grliq/managers/forensic_data.py | 3 +- generalresearch/grliq/managers/forensic_events.py | 3 +- generalresearch/grliq/utils.py | 1 - generalresearch/managers/events.py | 2 +- generalresearch/managers/gr/authentication.py | 3 +- generalresearch/managers/gr/business.py | 3 +- generalresearch/managers/gr/team.py | 3 +- generalresearch/managers/network/label.py | 5 ++- generalresearch/managers/thl/category.py | 2 +- generalresearch/managers/thl/contest_manager.py | 2 +- .../managers/thl/ledger_manager/conditions.py | 2 +- .../managers/thl/ledger_manager/ledger.py | 4 +-- .../managers/thl/ledger_manager/thl_ledger.py | 3 +- generalresearch/managers/thl/payout.py | 2 +- generalresearch/managers/thl/product.py | 3 +- generalresearch/managers/thl/session.py | 3 +- generalresearch/managers/thl/survey_penalty.py | 5 ++- generalresearch/managers/thl/task_adjustment.py | 3 +- generalresearch/managers/thl/user_compensate.py | 3 +- .../thl/user_manager/mysql_user_manager.py | 3 +- .../managers/thl/user_manager/user_manager.py | 2 +- generalresearch/managers/thl/wall.py | 2 +- generalresearch/models/admin/request.py | 5 ++- generalresearch/models/cint/question.py | 2 +- generalresearch/models/cint/survey.py | 11 +++--- generalresearch/models/dynata/question.py | 6 ++-- generalresearch/models/dynata/survey.py | 15 ++++---- generalresearch/models/events.py | 12 ++++--- generalresearch/models/gr/__init__.py | 22 ++++++------ generalresearch/models/gr/authentication.py | 6 ++-- generalresearch/models/gr/business.py | 5 ++- generalresearch/models/gr/team.py | 10 +++--- generalresearch/models/innovate/survey.py | 13 +++---- generalresearch/models/legacy/bucket.py | 14 ++++---- generalresearch/models/legacy/offerwall.py | 3 +- generalresearch/models/legacy/questions.py | 2 +- generalresearch/models/lucid/survey.py | 12 +++---- generalresearch/models/morning/survey.py | 9 ++--- generalresearch/models/network/mtr/execute.py | 5 +-- generalresearch/models/network/nmap/execute.py | 5 +-- generalresearch/models/network/rdns/execute.py | 5 +-- generalresearch/models/network/tool_run.py | 12 ++++--- generalresearch/models/precision/survey.py | 14 ++++---- generalresearch/models/prodege/survey.py | 15 ++++---- generalresearch/models/repdata/question.py | 2 +- generalresearch/models/repdata/survey.py | 14 ++++---- generalresearch/models/spectrum/survey.py | 18 +++++----- generalresearch/models/thl/__init__.py | 40 ++++++++++++---------- generalresearch/models/thl/contest/__init__.py | 2 +- generalresearch/models/thl/contest/contest.py | 2 +- .../models/thl/contest/contest_entry.py | 2 +- generalresearch/models/thl/contest/milestone.py | 6 ++-- generalresearch/models/thl/finance.py | 23 ++----------- generalresearch/models/thl/ledger.py | 12 +++---- generalresearch/models/thl/offerwall/base.py | 2 +- generalresearch/models/thl/offerwall/cache.py | 3 +- generalresearch/models/thl/payout.py | 18 +++++----- .../models/thl/profiling/marketplace.py | 13 +++---- generalresearch/models/thl/profiling/question.py | 13 +++---- .../models/thl/profiling/upk_property.py | 2 +- .../models/thl/profiling/upk_question_answer.py | 14 ++++---- generalresearch/models/thl/profiling/user_info.py | 3 +- generalresearch/models/thl/session.py | 12 +++---- generalresearch/models/thl/survey/buyer.py | 14 ++++---- generalresearch/models/thl/survey/model.py | 15 ++++---- generalresearch/models/thl/survey/penalty.py | 10 +++--- generalresearch/models/thl/task_adjustment.py | 2 +- generalresearch/models/thl/task_status.py | 11 +++--- generalresearch/models/thl/user.py | 2 +- generalresearch/models/thl/user_profile.py | 3 +- generalresearch/models/thl/user_quality_event.py | 2 +- .../models/thl/wallet/cashout_method.py | 13 +++---- generalresearch/models/thl/wallet/payout.py | 12 +++---- test_utils/models/gr/conftest.py | 3 +- test_utils/models/thl/conftest.py | 10 +++--- tests/managers/thl/test_ledger/test_lm_accounts.py | 4 +-- tests/models/custom_types/test_aware_datetime.py | 4 +-- tests/models/custom_types/test_uuid_str.py | 4 +-- tests/models/thl/test_product.py | 4 +-- 79 files changed, 278 insertions(+), 301 deletions(-) diff --git a/generalresearch/grliq/managers/forensic_data.py b/generalresearch/grliq/managers/forensic_data.py index 0f8534c..f523b6e 100644 --- a/generalresearch/grliq/managers/forensic_data.py +++ b/generalresearch/grliq/managers/forensic_data.py @@ -14,9 +14,10 @@ from generalresearch.grliq.models.forensic_result import ( GrlIqForensicCategoryResult, Phase, ) +from generalresearch.models.custom_types import UUIDStr if TYPE_CHECKING: - from generalresearch.models.custom_types import UUIDStr + from generalresearch.models.thl.user import User from generalresearch.pg_helper import PostgresConfig diff --git a/generalresearch/grliq/managers/forensic_events.py b/generalresearch/grliq/managers/forensic_events.py index a97a9c2..fc1ae3e 100644 --- a/generalresearch/grliq/managers/forensic_events.py +++ b/generalresearch/grliq/managers/forensic_events.py @@ -14,9 +14,10 @@ from generalresearch.grliq.models.events import ( PointerMove, TimingData, ) +from generalresearch.models.custom_types import UUIDStr if TYPE_CHECKING: - from generalresearch.models.custom_types import UUIDStr + from generalresearch.pg_helper import PostgresConfig diff --git a/generalresearch/grliq/utils.py b/generalresearch/grliq/utils.py index bceaa30..711e562 100644 --- a/generalresearch/grliq/utils.py +++ b/generalresearch/grliq/utils.py @@ -5,7 +5,6 @@ from datetime import UTC, datetime from pathlib import Path from uuid import UUID -# from generalresearch.config import from generalresearch.models.custom_types import UUIDStr diff --git a/generalresearch/managers/events.py b/generalresearch/managers/events.py index 30cec0c..4a2afb2 100644 --- a/generalresearch/managers/events.py +++ b/generalresearch/managers/events.py @@ -12,6 +12,7 @@ from redis.client import PubSub, Redis from generalresearch.incite.base import LOG from generalresearch.managers.base import RedisManager +from generalresearch.models.custom_types import UUIDStr from generalresearch.models.definitions import Source from generalresearch.models.events import ( AggregateBySource, @@ -32,7 +33,6 @@ from generalresearch.models.thl.definitions import Status if TYPE_CHECKING: from influxdb import InfluxDBClient - from generalresearch.models.custom_types import UUIDStr from generalresearch.models.events import ServerToClientMessage from generalresearch.models.thl.session import Session, Wall from generalresearch.models.thl.user import User diff --git a/generalresearch/managers/gr/authentication.py b/generalresearch/managers/gr/authentication.py index ca56467..f1ac2de 100644 --- a/generalresearch/managers/gr/authentication.py +++ b/generalresearch/managers/gr/authentication.py @@ -10,9 +10,10 @@ from psycopg import sql from pydantic import AnyHttpUrl, PositiveInt from generalresearch.managers.base import PostgresManager, PostgresManagerWithRedis +from generalresearch.models.custom_types import UUIDStr if TYPE_CHECKING: - from generalresearch.models.custom_types import UUIDStr + from generalresearch.models.gr.authentication import GRToken, GRUser from generalresearch.pg_helper import PostgresConfig from generalresearch.redis_helper import RedisConfig diff --git a/generalresearch/managers/gr/business.py b/generalresearch/managers/gr/business.py index 9bf6ef2..9338f03 100644 --- a/generalresearch/managers/gr/business.py +++ b/generalresearch/managers/gr/business.py @@ -11,6 +11,7 @@ from generalresearch.managers.base import ( PostgresManager, PostgresManagerWithRedis, ) +from generalresearch.models.custom_types import UUIDStr from generalresearch.models.gr.business import ( Business, BusinessBankAccount, @@ -18,7 +19,7 @@ from generalresearch.models.gr.business import ( from generalresearch.models.gr.definitions import BusinessType, TransferMethod if TYPE_CHECKING: - from generalresearch.models.custom_types import UUIDStr + from generalresearch.models.gr.business import ( BusinessAddress, ) diff --git a/generalresearch/managers/gr/team.py b/generalresearch/managers/gr/team.py index 3283467..e551f85 100644 --- a/generalresearch/managers/gr/team.py +++ b/generalresearch/managers/gr/team.py @@ -11,13 +11,14 @@ from generalresearch.managers.base import ( PostgresManager, PostgresManagerWithRedis, ) +from generalresearch.models.custom_types import UUIDStr from generalresearch.models.gr.team import ( Membership, MembershipPrivilege, ) if TYPE_CHECKING: - from generalresearch.models.custom_types import UUIDStr + from generalresearch.models.gr.authentication import GRUser from generalresearch.models.gr.business import Business from generalresearch.models.gr.team import Team diff --git a/generalresearch/managers/network/label.py b/generalresearch/managers/network/label.py index aed5ff6..cdea016 100644 --- a/generalresearch/managers/network/label.py +++ b/generalresearch/managers/network/label.py @@ -9,6 +9,7 @@ from pydantic import TypeAdapter from generalresearch.managers.base import PostgresManager from generalresearch.models.custom_types import ( + AwareDatetimeISO, IPvAnyAddressStr, IPvAnyNetwork, IPvAnyNetworkStr, @@ -16,9 +17,7 @@ from generalresearch.models.custom_types import ( from generalresearch.models.network.label import IPLabel if TYPE_CHECKING: - from generalresearch.models.custom_types import ( - AwareDatetimeISO, - ) + from generalresearch.models.network.label import IPLabelKind, IPLabelSource diff --git a/generalresearch/managers/thl/category.py b/generalresearch/managers/thl/category.py index e6a091b..67c812a 100644 --- a/generalresearch/managers/thl/category.py +++ b/generalresearch/managers/thl/category.py @@ -4,11 +4,11 @@ from collections.abc import Collection from typing import TYPE_CHECKING from generalresearch.managers.base import PostgresManager +from generalresearch.models.custom_types import UUIDStr from generalresearch.models.thl.category import Category if TYPE_CHECKING: from generalresearch.managers.base import Permission - from generalresearch.models.custom_types import UUIDStr from generalresearch.pg_helper import PostgresConfig diff --git a/generalresearch/managers/thl/contest_manager.py b/generalresearch/managers/thl/contest_manager.py index 68b2cf0..b0aa505 100644 --- a/generalresearch/managers/thl/contest_manager.py +++ b/generalresearch/managers/thl/contest_manager.py @@ -10,6 +10,7 @@ from pydantic import NonNegativeInt, PositiveInt from redis import Redis from generalresearch.managers.base import PostgresManager +from generalresearch.models.custom_types import UUIDStr from generalresearch.models.thl.contest import ( ContestPrize, ContestWinner, @@ -49,7 +50,6 @@ if TYPE_CHECKING: from generalresearch.managers.thl.user_manager.user_manager import ( UserManager, ) - from generalresearch.models.custom_types import UUIDStr from generalresearch.models.thl.contest.contest import ( Contest, ContestUserView, diff --git a/generalresearch/managers/thl/ledger_manager/conditions.py b/generalresearch/managers/thl/ledger_manager/conditions.py index 7dd3021..38398b1 100644 --- a/generalresearch/managers/thl/ledger_manager/conditions.py +++ b/generalresearch/managers/thl/ledger_manager/conditions.py @@ -7,6 +7,7 @@ from typing import TYPE_CHECKING from generalresearch.config import JAMES_BILLINGS_BPID, JAMES_BILLINGS_TX_CUTOFF from generalresearch.currency import USDCent +from generalresearch.models.custom_types import UUIDStr if TYPE_CHECKING: @@ -16,7 +17,6 @@ if TYPE_CHECKING: from generalresearch.managers.thl.ledger_manager.thl_ledger import ( ThlLedgerManager, ) - from generalresearch.models.custom_types import UUIDStr from generalresearch.models.thl.product import Product from generalresearch.models.thl.session import Session, Wall from generalresearch.models.thl.user import User diff --git a/generalresearch/managers/thl/ledger_manager/ledger.py b/generalresearch/managers/thl/ledger_manager/ledger.py index f2455d4..bbf7bfa 100644 --- a/generalresearch/managers/thl/ledger_manager/ledger.py +++ b/generalresearch/managers/thl/ledger_manager/ledger.py @@ -28,7 +28,7 @@ from generalresearch.managers.thl.ledger_manager.exceptions import ( LedgerTransactionReleaseLockError, ) from generalresearch.managers.utils import parse_order_by -from generalresearch.models.custom_types import check_valid_uuid +from generalresearch.models.custom_types import UUIDStr, check_valid_uuid from generalresearch.models.thl.ledger import ( LedgerAccount, LedgerEntry, @@ -37,7 +37,7 @@ from generalresearch.models.thl.ledger import ( ) if TYPE_CHECKING: - from generalresearch.models.custom_types import UUIDStr + from generalresearch.models.thl.ledger import UserLedgerTransactionType from generalresearch.pg_helper import PostgresConfig from generalresearch.redis_helper import RedisConfig diff --git a/generalresearch/managers/thl/ledger_manager/thl_ledger.py b/generalresearch/managers/thl/ledger_manager/thl_ledger.py index bd27acf..0f8c6d3 100644 --- a/generalresearch/managers/thl/ledger_manager/thl_ledger.py +++ b/generalresearch/managers/thl/ledger_manager/thl_ledger.py @@ -29,6 +29,7 @@ from generalresearch.managers.thl.ledger_manager.conditions import ( from generalresearch.managers.thl.ledger_manager.ledger import ( LedgerManager, ) +from generalresearch.models.custom_types import UUIDStr from generalresearch.models.thl.contest.definitions import ( ContestPrizeKind, ContestType, @@ -55,7 +56,7 @@ from generalresearch.models.thl.session import Status from generalresearch.models.thl.wallet.definitions import PayoutType if TYPE_CHECKING: - from generalresearch.models.custom_types import UUIDStr + from generalresearch.models.thl.contest.contest import Contest, ContestWinner from generalresearch.models.thl.contest.raffle import ( ContestEntry, diff --git a/generalresearch/managers/thl/payout.py b/generalresearch/managers/thl/payout.py index 1749783..5397ff4 100644 --- a/generalresearch/managers/thl/payout.py +++ b/generalresearch/managers/thl/payout.py @@ -19,6 +19,7 @@ from generalresearch.managers.base import ( from generalresearch.managers.thl.ledger_manager.exceptions import ( LedgerTransactionConditionFailedError, ) +from generalresearch.models.custom_types import AwareDatetimeISO, UUIDStr from generalresearch.models.thl.definitions import PayoutStatus from generalresearch.models.thl.ledger import ( Direction, @@ -42,7 +43,6 @@ if TYPE_CHECKING: ThlLedgerManager, ) from generalresearch.managers.thl.product import ProductManager - from generalresearch.models.custom_types import AwareDatetimeISO, UUIDStr from generalresearch.models.gr.business import Business from generalresearch.models.thl.ledger import LedgerAccount from generalresearch.models.thl.product import Product diff --git a/generalresearch/managers/thl/product.py b/generalresearch/managers/thl/product.py index 535e566..66dd131 100644 --- a/generalresearch/managers/thl/product.py +++ b/generalresearch/managers/thl/product.py @@ -20,13 +20,12 @@ from generalresearch.decorators import LOG from generalresearch.managers.base import ( PostgresManager, ) -from generalresearch.models.custom_types import is_valid_uuid +from generalresearch.models.custom_types import UUIDStr, is_valid_uuid if TYPE_CHECKING: from generalresearch.managers.base import ( Permission, ) - from generalresearch.models.custom_types import UUIDStr from generalresearch.models.thl.product import ( PayoutConfig, Product, diff --git a/generalresearch/managers/thl/session.py b/generalresearch/managers/thl/session.py index 41d3893..5007f43 100644 --- a/generalresearch/managers/thl/session.py +++ b/generalresearch/managers/thl/session.py @@ -16,6 +16,7 @@ from generalresearch.managers.base import ( ) from generalresearch.managers.thl.product import ProductManager from generalresearch.managers.utils import parse_order_by +from generalresearch.models.custom_types import UUIDStr from generalresearch.models.legacy.bucket import Bucket from generalresearch.models.thl.session import ( Session, @@ -28,7 +29,7 @@ from generalresearch.models.thl.task_status import ( from generalresearch.models.thl.user import User if TYPE_CHECKING: - from generalresearch.models.custom_types import UUIDStr + from generalresearch.models.definitions import DeviceType from generalresearch.models.thl.definitions import ( SessionStatusCode2, diff --git a/generalresearch/managers/thl/survey_penalty.py b/generalresearch/managers/thl/survey_penalty.py index 08f8649..f176e8d 100644 --- a/generalresearch/managers/thl/survey_penalty.py +++ b/generalresearch/managers/thl/survey_penalty.py @@ -10,12 +10,11 @@ from cachetools import TTLCache, cachedmethod from generalresearch.decorators import LOG from generalresearch.managers.base import RedisManager +from generalresearch.models.custom_types import UUIDStr from generalresearch.models.thl.survey.penalty import PenaltyListAdapter if TYPE_CHECKING: - from generalresearch.models.custom_types import ( - UUIDStr, - ) + from generalresearch.models.thl.survey.penalty import ( BPSurveyPenalty, Penalty, diff --git a/generalresearch/managers/thl/task_adjustment.py b/generalresearch/managers/thl/task_adjustment.py index d0d83cb..91d914f 100644 --- a/generalresearch/managers/thl/task_adjustment.py +++ b/generalresearch/managers/thl/task_adjustment.py @@ -12,6 +12,7 @@ from generalresearch.managers.base import ( from generalresearch.managers.thl.session import SessionManager from generalresearch.managers.thl.wall import WallManager from generalresearch.managers.utils import parse_order_by +from generalresearch.models.custom_types import UUIDStr from generalresearch.models.thl.definitions import ( Status, WallAdjustedStatus, @@ -25,7 +26,7 @@ if TYPE_CHECKING: from generalresearch.managers.thl.ledger_manager.thl_ledger import ( ThlLedgerManager, ) - from generalresearch.models.custom_types import UUIDStr + logging.basicConfig() logger = logging.getLogger(__name__) diff --git a/generalresearch/managers/thl/user_compensate.py b/generalresearch/managers/thl/user_compensate.py index 3f0f3ec..a3cad90 100644 --- a/generalresearch/managers/thl/user_compensate.py +++ b/generalresearch/managers/thl/user_compensate.py @@ -7,11 +7,12 @@ from uuid import uuid4 from pydantic import NonNegativeInt +from generalresearch.models.custom_types import UUIDStr + if TYPE_CHECKING: from generalresearch.managers.thl.ledger_manager.thl_ledger import ( ThlLedgerManager, ) - from generalresearch.models.custom_types import UUIDStr from generalresearch.models.thl.user import User diff --git a/generalresearch/managers/thl/user_manager/mysql_user_manager.py b/generalresearch/managers/thl/user_manager/mysql_user_manager.py index 2af23dc..0b4b8a4 100644 --- a/generalresearch/managers/thl/user_manager/mysql_user_manager.py +++ b/generalresearch/managers/thl/user_manager/mysql_user_manager.py @@ -10,10 +10,11 @@ from uuid import uuid4 import psycopg from psycopg import sql +from generalresearch.models.custom_types import UUIDStr from generalresearch.models.thl.user import User if TYPE_CHECKING: - from generalresearch.models.custom_types import UUIDStr + from generalresearch.pg_helper import PostgresConfig logging.basicConfig() diff --git a/generalresearch/managers/thl/user_manager/user_manager.py b/generalresearch/managers/thl/user_manager/user_manager.py index 907a030..52e0567 100644 --- a/generalresearch/managers/thl/user_manager/user_manager.py +++ b/generalresearch/managers/thl/user_manager/user_manager.py @@ -22,12 +22,12 @@ from generalresearch.managers.thl.user_manager.rate_limit import ( from generalresearch.managers.thl.user_manager.redis_user_manager import ( RedisUserManager, ) +from generalresearch.models.custom_types import UUIDStr from generalresearch.utils.copying_cache import deepcopy_return if TYPE_CHECKING: from generalresearch.managers.thl.userhealth import AuditLogManager - from generalresearch.models.custom_types import UUIDStr from generalresearch.models.thl.product import Product from generalresearch.models.thl.user import User from generalresearch.models.thl.userhealth import AuditLog diff --git a/generalresearch/managers/thl/wall.py b/generalresearch/managers/thl/wall.py index 83697f5..bffd4c8 100644 --- a/generalresearch/managers/thl/wall.py +++ b/generalresearch/managers/thl/wall.py @@ -19,6 +19,7 @@ from generalresearch.managers.base import ( PostgresManagerWithRedis, ) from generalresearch.managers.utils import parse_order_by +from generalresearch.models.custom_types import SurveyKey, UUIDStr from generalresearch.models.definitions import Source from generalresearch.models.thl.definitions import ( WallAdjustedStatus, @@ -35,7 +36,6 @@ if TYPE_CHECKING: from generalresearch.managers.base import ( Permission, ) - from generalresearch.models.custom_types import SurveyKey, UUIDStr from generalresearch.models.thl.definitions import ( ReportValue, Status, diff --git a/generalresearch/models/admin/request.py b/generalresearch/models/admin/request.py index f128e1b..6112786 100644 --- a/generalresearch/models/admin/request.py +++ b/generalresearch/models/admin/request.py @@ -2,13 +2,12 @@ from __future__ import annotations from datetime import UTC, datetime, timedelta from enum import Enum -from typing import TYPE_CHECKING, Literal +from typing import Literal import pandas as pd from pydantic import BaseModel, Field, computed_field, model_validator -if TYPE_CHECKING: - from generalresearch.models.custom_types import AwareDatetimeISO +from generalresearch.models.custom_types import AwareDatetimeISO class ReportType(Enum): diff --git a/generalresearch/models/cint/question.py b/generalresearch/models/cint/question.py index ab46653..5f703ee 100644 --- a/generalresearch/models/cint/question.py +++ b/generalresearch/models/cint/question.py @@ -8,6 +8,7 @@ from uuid import UUID from pydantic import BaseModel, Field, field_validator, model_validator +from generalresearch.models.custom_types import AwareDatetimeISO from generalresearch.models.definitions import Source, string_utils from generalresearch.models.thl.profiling.marketplace import ( MarketplaceQuestion, @@ -16,7 +17,6 @@ from generalresearch.models.thl.profiling.marketplace import ( if TYPE_CHECKING: from generalresearch.models.cint import CintQuestionIdType - from generalresearch.models.custom_types import AwareDatetimeISO from generalresearch.models.thl.profiling.upk_question import ( UpkQuestion, ) diff --git a/generalresearch/models/cint/survey.py b/generalresearch/models/cint/survey.py index ebba09e..cd429dd 100644 --- a/generalresearch/models/cint/survey.py +++ b/generalresearch/models/cint/survey.py @@ -18,6 +18,11 @@ from pydantic import ( ) from generalresearch.locales import Localelator +from generalresearch.models.custom_types import ( + AlphaNumStr, + AwareDatetimeISO, + CoercedStr, +) from generalresearch.models.definitions import Source, TaskCalculationType from generalresearch.models.thl.demographics import Gender from generalresearch.models.thl.survey import MarketplaceTask @@ -28,11 +33,7 @@ from generalresearch.models.thl.survey.condition import ( if TYPE_CHECKING: from generalresearch.models.cint import CintQuestionIdType - from generalresearch.models.custom_types import ( - AlphaNumStr, - AwareDatetimeISO, - CoercedStr, - ) + logging.basicConfig() logger = logging.getLogger() diff --git a/generalresearch/models/dynata/question.py b/generalresearch/models/dynata/question.py index 60c7366..cbd5d86 100644 --- a/generalresearch/models/dynata/question.py +++ b/generalresearch/models/dynata/question.py @@ -7,16 +7,14 @@ import re from datetime import timedelta from enum import StrEnum from functools import cached_property -from typing import TYPE_CHECKING, Any, Literal +from typing import Any, Literal from pydantic import BaseModel, Field, PositiveInt, field_validator, model_validator +from generalresearch.models.custom_types import AwareDatetimeISO from generalresearch.models.definitions import MAX_INT32, Source from generalresearch.models.thl.profiling.marketplace import MarketplaceQuestion -if TYPE_CHECKING: - from generalresearch.models.custom_types import AwareDatetimeISO - logging.basicConfig() logger = logging.getLogger() logger.setLevel(logging.INFO) diff --git a/generalresearch/models/dynata/survey.py b/generalresearch/models/dynata/survey.py index 4174d31..491157b 100644 --- a/generalresearch/models/dynata/survey.py +++ b/generalresearch/models/dynata/survey.py @@ -19,6 +19,13 @@ from pydantic import ( ) from generalresearch.locales import Localelator +from generalresearch.models.custom_types import ( + AlphaNumStr, + AlphaNumStrSet, + AwareDatetimeISO, + CoercedStr, + DeviceTypes, +) from generalresearch.models.definitions import Source from generalresearch.models.dynata import DynataStatus from generalresearch.models.thl.demographics import ( @@ -31,13 +38,7 @@ from generalresearch.models.thl.survey.condition import ( ) if TYPE_CHECKING: - from generalresearch.models.custom_types import ( - AlphaNumStr, - AlphaNumStrSet, - AwareDatetimeISO, - CoercedStr, - DeviceTypes, - ) + from generalresearch.models.definitions import TaskCalculationType logging.basicConfig() diff --git a/generalresearch/models/events.py b/generalresearch/models/events.py index 34f6be8..7014d22 100644 --- a/generalresearch/models/events.py +++ b/generalresearch/models/events.py @@ -13,12 +13,14 @@ from pydantic import ( model_validator, ) +from generalresearch.models.custom_types import ( + AwareDatetimeISO, + CountryISOLike, + UUIDStr, +) + if TYPE_CHECKING: - from generalresearch.models.custom_types import ( - AwareDatetimeISO, - CountryISOLike, - UUIDStr, - ) + from generalresearch.models.definitions import Source from generalresearch.models.thl.definitions import ( SessionStatusCode2, diff --git a/generalresearch/models/gr/__init__.py b/generalresearch/models/gr/__init__.py index 79f05d3..7e1516b 100644 --- a/generalresearch/models/gr/__init__.py +++ b/generalresearch/models/gr/__init__.py @@ -1,13 +1,13 @@ -# from generalresearch.models.gr.authentication import GRToken, GRUser -# from generalresearch.models.gr.business import Business -# from generalresearch.models.gr.team import Team -# from generalresearch.models.thl.finance import BusinessBalances -# from generalresearch.models.thl.payout import BrokerageProductPayoutEvent -# from generalresearch.models.thl.product import Product +from generalresearch.models.gr.authentication import GRToken, GRUser +from generalresearch.models.gr.business import Business +from generalresearch.models.gr.team import Team +from generalresearch.models.thl.finance import BusinessBalances +from generalresearch.models.thl.payout import BrokerageProductPayoutEvent +from generalresearch.models.thl.product import Product -# _ = Business, Product, BrokerageProductPayoutEvent, BusinessBalances +_ = Business, Product, BrokerageProductPayoutEvent, BusinessBalances -# GRUser.model_rebuild() -# GRToken.model_rebuild() -# Business.model_rebuild() -# Team.model_rebuild() +GRUser.model_rebuild() +GRToken.model_rebuild() +Business.model_rebuild() +Team.model_rebuild() diff --git a/generalresearch/models/gr/authentication.py b/generalresearch/models/gr/authentication.py index 21ece8c..41c3eaa 100644 --- a/generalresearch/models/gr/authentication.py +++ b/generalresearch/models/gr/authentication.py @@ -17,9 +17,9 @@ from pydantic import ( ) from generalresearch.decorators import LOG +from generalresearch.models.custom_types import AwareDatetimeISO, UUIDStr if TYPE_CHECKING: - from generalresearch.models.custom_types import AwareDatetimeISO, UUIDStr from generalresearch.models.gr.business import Business from generalresearch.models.gr.team import Team from generalresearch.models.thl.product import Product @@ -164,8 +164,8 @@ class GRUser(BaseModel): self.prefetch_businesses(pg_config=pg_config, redis_config=redis_config) self.prefetch_teams(pg_config=pg_config, redis_config=redis_config) - business_uuids = self.business_uuids - team_uuids = self.team_uuids + business_uuids = self.business_uuids or [] + team_uuids = self.team_uuids or [] if len(business_uuids + team_uuids) == 0: self.products = [] diff --git a/generalresearch/models/gr/business.py b/generalresearch/models/gr/business.py index c6d3468..b01c902 100644 --- a/generalresearch/models/gr/business.py +++ b/generalresearch/models/gr/business.py @@ -31,13 +31,12 @@ from generalresearch.models.custom_types import ( from generalresearch.models.gr.definitions import BusinessType, TransferMethod from generalresearch.models.gr.team import Team from generalresearch.models.thl.finance import BusinessBalances, POPFinancial -from generalresearch.models.thl.ledger import OrderBy +from generalresearch.models.thl.ledger import LedgerAccount, OrderBy +from generalresearch.models.thl.payout import BusinessPayoutEvent from generalresearch.utils.aggregation import group_by_year if TYPE_CHECKING: from generalresearch.incite.mergers.pop_ledger import PopLedgerMerge - from generalresearch.models.thl.ledger import LedgerAccount - from generalresearch.models.thl.payout import BusinessPayoutEvent from generalresearch.pg_helper import PostgresConfig from generalresearch.redis_helper import RedisConfig diff --git a/generalresearch/models/gr/team.py b/generalresearch/models/gr/team.py index b36ac4c..b1553e2 100644 --- a/generalresearch/models/gr/team.py +++ b/generalresearch/models/gr/team.py @@ -23,6 +23,11 @@ from pydantic.json_schema import SkipJsonSchema from generalresearch.decorators import LOG from generalresearch.models.admin.request import ReportRequest, ReportType +from generalresearch.models.custom_types import ( + AwareDatetimeISO, + UUIDStr, + UUIDStrCoerce, +) from generalresearch.utils.enum import ReprEnumMeta if TYPE_CHECKING: @@ -39,11 +44,6 @@ if TYPE_CHECKING: from generalresearch.managers.gr.business import BusinessManager from generalresearch.managers.gr.team import MembershipManager from generalresearch.managers.thl.product import ProductManager - from generalresearch.models.custom_types import ( - AwareDatetimeISO, - UUIDStr, - UUIDStrCoerce, - ) from generalresearch.models.gr.authentication import GRUser from generalresearch.models.gr.business import Business from generalresearch.models.thl.product import Product diff --git a/generalresearch/models/innovate/survey.py b/generalresearch/models/innovate/survey.py index e718dda..7232228 100644 --- a/generalresearch/models/innovate/survey.py +++ b/generalresearch/models/innovate/survey.py @@ -24,6 +24,12 @@ from pydantic import ( ) from generalresearch.locales import Localelator +from generalresearch.models.custom_types import ( + AlphaNumStrSet, + AwareDatetimeISO, + CoercedStr, + DeviceTypes, +) from generalresearch.models.definitions import ( LogicalOperator, Source, @@ -41,12 +47,7 @@ from generalresearch.models.thl.survey.condition import ( ) if TYPE_CHECKING: - from generalresearch.models.custom_types import ( - AlphaNumStrSet, - AwareDatetimeISO, - CoercedStr, - DeviceTypes, - ) + from generalresearch.models.definitions import ( TaskCalculationType, ) diff --git a/generalresearch/models/legacy/bucket.py b/generalresearch/models/legacy/bucket.py index 5f53b89..23eeb38 100644 --- a/generalresearch/models/legacy/bucket.py +++ b/generalresearch/models/legacy/bucket.py @@ -4,7 +4,7 @@ import logging import math from datetime import timedelta from decimal import Decimal -from typing import TYPE_CHECKING, Any, Literal, Self +from typing import Any, Literal, Self from pydantic import ( BaseModel, @@ -15,16 +15,14 @@ from pydantic import ( model_validator, ) +from generalresearch.models.custom_types import ( + HttpsUrl, + PropertyCode, + UUIDStr, +) from generalresearch.models.definitions import Source from generalresearch.models.thl.stats import StatisticalSummary -if TYPE_CHECKING: - from generalresearch.models.custom_types import ( - HttpsUrl, - PropertyCode, - UUIDStr, - ) - logger = logging.getLogger() Eligibility = Literal["conditional", "unconditional", "ineligible"] diff --git a/generalresearch/models/legacy/offerwall.py b/generalresearch/models/legacy/offerwall.py index c150dcb..013b506 100644 --- a/generalresearch/models/legacy/offerwall.py +++ b/generalresearch/models/legacy/offerwall.py @@ -4,13 +4,14 @@ from typing import TYPE_CHECKING from pydantic import BaseModel, ConfigDict, Field, NonNegativeInt +from generalresearch.models.custom_types import UUIDStr from generalresearch.models.legacy.definitions import OfferwallReason from generalresearch.models.thl.payout_format import ( PayoutFormatField, ) if TYPE_CHECKING: - from generalresearch.models.custom_types import UUIDStr + from generalresearch.models.legacy.bucket import ( BucketBase, MarketplaceBucket, diff --git a/generalresearch/models/legacy/questions.py b/generalresearch/models/legacy/questions.py index c333804..e6803f0 100644 --- a/generalresearch/models/legacy/questions.py +++ b/generalresearch/models/legacy/questions.py @@ -15,6 +15,7 @@ from pydantic import ( ) from sentry_sdk import capture_exception +from generalresearch.models.custom_types import UUIDStr from generalresearch.models.legacy.api_status import StatusResponse if TYPE_CHECKING: @@ -22,7 +23,6 @@ if TYPE_CHECKING: UserManager, ) from generalresearch.managers.thl.wall import WallManager - from generalresearch.models.custom_types import UUIDStr from generalresearch.models.thl.profiling.upk_question import ( UpkQuestionOut, ) diff --git a/generalresearch/models/lucid/survey.py b/generalresearch/models/lucid/survey.py index a04e529..02b31ab 100644 --- a/generalresearch/models/lucid/survey.py +++ b/generalresearch/models/lucid/survey.py @@ -4,6 +4,12 @@ from typing import TYPE_CHECKING, Any, Self from pydantic import BaseModel, ConfigDict, Field, NonNegativeInt +from generalresearch.models.custom_types import ( + AwareDatetimeISO, + BigAutoInteger, + CoercedStr, + UUIDStr, +) from generalresearch.models.definitions import Source from generalresearch.models.thl.survey.condition import ( ConditionValueType, @@ -11,12 +17,6 @@ from generalresearch.models.thl.survey.condition import ( ) if TYPE_CHECKING: - from generalresearch.models.custom_types import ( - AwareDatetimeISO, - BigAutoInteger, - CoercedStr, - UUIDStr, - ) from generalresearch.models.thl.locales import CountryISO, LanguageISO diff --git a/generalresearch/models/morning/survey.py b/generalresearch/models/morning/survey.py index 25accb6..01cc4ff 100644 --- a/generalresearch/models/morning/survey.py +++ b/generalresearch/models/morning/survey.py @@ -25,6 +25,10 @@ from pydantic import ( ) from generalresearch.locales import Localelator +from generalresearch.models.custom_types import ( + AwareDatetimeISO, + UUIDStrCoerce, +) from generalresearch.models.definitions import Source from generalresearch.models.morning import MorningStatus from generalresearch.models.thl.demographics import Gender @@ -35,10 +39,7 @@ from generalresearch.models.thl.survey.condition import ( ) if TYPE_CHECKING: - from generalresearch.models.custom_types import ( - AwareDatetimeISO, - UUIDStrCoerce, - ) + from generalresearch.models.morning import MorningQuestionID from generalresearch.models.morning.question import MorningQuestion from generalresearch.models.thl.locales import ( diff --git a/generalresearch/models/network/mtr/execute.py b/generalresearch/models/network/mtr/execute.py index 1a7c963..5ab7632 100644 --- a/generalresearch/models/network/mtr/execute.py +++ b/generalresearch/models/network/mtr/execute.py @@ -1,9 +1,9 @@ from __future__ import annotations from datetime import UTC, datetime -from typing import TYPE_CHECKING from uuid import uuid4 +from generalresearch.models.custom_types import UUIDStr from generalresearch.models.network.definitions import IPProtocol from generalresearch.models.network.mtr.command import ( get_mtr_version, @@ -21,9 +21,6 @@ from generalresearch.models.network.tool_run_command import ( ) from generalresearch.models.network.utils import get_source_ip -if TYPE_CHECKING: - from generalresearch.models.custom_types import UUIDStr - def execute_mtr( ip: str, diff --git a/generalresearch/models/network/nmap/execute.py b/generalresearch/models/network/nmap/execute.py index e3610d9..09ec28b 100644 --- a/generalresearch/models/network/nmap/execute.py +++ b/generalresearch/models/network/nmap/execute.py @@ -1,8 +1,8 @@ from __future__ import annotations -from typing import TYPE_CHECKING from uuid import uuid4 +from generalresearch.models.custom_types import UUIDStr from generalresearch.models.network.nmap.command import run_nmap from generalresearch.models.network.tool_run import ( NmapRun, @@ -15,9 +15,6 @@ from generalresearch.models.network.tool_run_command import ( NmapRunCommandOptions, ) -if TYPE_CHECKING: - from generalresearch.models.custom_types import UUIDStr - def execute_nmap( ip: str, diff --git a/generalresearch/models/network/rdns/execute.py b/generalresearch/models/network/rdns/execute.py index 6c14f77..d6de84b 100644 --- a/generalresearch/models/network/rdns/execute.py +++ b/generalresearch/models/network/rdns/execute.py @@ -1,9 +1,9 @@ from __future__ import annotations from datetime import UTC, datetime -from typing import TYPE_CHECKING from uuid import uuid4 +from generalresearch.models.custom_types import UUIDStr from generalresearch.models.network.rdns.command import ( get_dig_version, run_rdns, @@ -19,9 +19,6 @@ from generalresearch.models.network.tool_run_command import ( RDNSRunCommandOptions, ) -if TYPE_CHECKING: - from generalresearch.models.custom_types import UUIDStr - def execute_rdns(ip: str, scan_group_id: UUIDStr | None = None): started_at = datetime.now(tz=UTC) diff --git a/generalresearch/models/network/tool_run.py b/generalresearch/models/network/tool_run.py index 8479f15..9088fe3 100644 --- a/generalresearch/models/network/tool_run.py +++ b/generalresearch/models/network/tool_run.py @@ -6,12 +6,14 @@ from uuid import uuid4 from pydantic import BaseModel, Field, PositiveInt +from generalresearch.models.custom_types import ( + AwareDatetimeISO, + IPvAnyAddressStr, + UUIDStr, +) + if TYPE_CHECKING: - from generalresearch.models.custom_types import ( - AwareDatetimeISO, - IPvAnyAddressStr, - UUIDStr, - ) + from generalresearch.models.network.mtr.result import MTRResult from generalresearch.models.network.nmap.result import NmapResult from generalresearch.models.network.rdns.result import RDNSResult diff --git a/generalresearch/models/precision/survey.py b/generalresearch/models/precision/survey.py index a9e34e6..b77a365 100644 --- a/generalresearch/models/precision/survey.py +++ b/generalresearch/models/precision/survey.py @@ -15,6 +15,13 @@ from pydantic import ( model_validator, ) +from generalresearch.models.custom_types import ( + AlphaNumStrSet, + AwareDatetimeISO, + CoercedStr, + DeviceTypes, + UUIDStrCoerce, +) from generalresearch.models.definitions import Source from generalresearch.models.precision import PrecisionStatus from generalresearch.models.thl.demographics import Gender @@ -25,13 +32,6 @@ from generalresearch.models.thl.survey.condition import ( ) if TYPE_CHECKING: - from generalresearch.models.custom_types import ( - AlphaNumStrSet, - AwareDatetimeISO, - CoercedStr, - DeviceTypes, - UUIDStrCoerce, - ) from generalresearch.models.precision import PrecisionQuestionID diff --git a/generalresearch/models/prodege/survey.py b/generalresearch/models/prodege/survey.py index e3c765e..26898d0 100644 --- a/generalresearch/models/prodege/survey.py +++ b/generalresearch/models/prodege/survey.py @@ -20,6 +20,13 @@ from pydantic import ( ) from generalresearch.locales import Localelator +from generalresearch.models.custom_types import ( + AlphaNumStrSet, + AwareDatetimeISO, + CoercedStr, + InclExcl, + UUIDStr, +) from generalresearch.models.definitions import ( LogicalOperator, Source, @@ -38,13 +45,7 @@ from generalresearch.models.thl.survey.condition import ( ) if TYPE_CHECKING: - from generalresearch.models.custom_types import ( - AlphaNumStrSet, - AwareDatetimeISO, - CoercedStr, - InclExcl, - UUIDStr, - ) + from generalresearch.models.prodege import ( ProdegeQuestionIdType, ProdgeRedirectStatus, diff --git a/generalresearch/models/repdata/question.py b/generalresearch/models/repdata/question.py index a578741..0ec102b 100644 --- a/generalresearch/models/repdata/question.py +++ b/generalresearch/models/repdata/question.py @@ -17,11 +17,11 @@ from pydantic import ( model_validator, ) +from generalresearch.models.custom_types import AwareDatetimeISO, UUIDStr from generalresearch.models.definitions import MAX_INT32, Source from generalresearch.models.thl.profiling.marketplace import MarketplaceQuestion if TYPE_CHECKING: - from generalresearch.models.custom_types import AwareDatetimeISO, UUIDStr from generalresearch.models.thl.profiling.upk_question import ( UpkQuestion, ) diff --git a/generalresearch/models/repdata/survey.py b/generalresearch/models/repdata/survey.py index fc1b649..a69a54b 100644 --- a/generalresearch/models/repdata/survey.py +++ b/generalresearch/models/repdata/survey.py @@ -6,7 +6,7 @@ import logging from datetime import UTC, datetime from decimal import Decimal from functools import cached_property -from typing import TYPE_CHECKING, Any, Literal, Self +from typing import Any, Literal, Self from uuid import UUID from pydantic import ( @@ -21,6 +21,11 @@ from pydantic import ( from generalresearch.grpc import timestamp_from_datetime from generalresearch.locales import Localelator +from generalresearch.models.custom_types import ( + AwareDatetimeISO, + CoercedStr, + UUIDStr, +) from generalresearch.models.definitions import ( DeviceType, LogicalOperator, @@ -35,13 +40,6 @@ from generalresearch.models.thl.survey.condition import ( MarketplaceCondition, ) -if TYPE_CHECKING: - from generalresearch.models.custom_types import ( - AwareDatetimeISO, - CoercedStr, - UUIDStr, - ) - logging.basicConfig() logger = logging.getLogger() logger.setLevel(logging.INFO) diff --git a/generalresearch/models/spectrum/survey.py b/generalresearch/models/spectrum/survey.py index a02c510..6689d27 100644 --- a/generalresearch/models/spectrum/survey.py +++ b/generalresearch/models/spectrum/survey.py @@ -4,12 +4,19 @@ import json import logging from datetime import UTC from decimal import Decimal -from typing import TYPE_CHECKING, Any, Literal, Self +from typing import Any, Literal, Self from more_itertools import flatten from pydantic import BaseModel, ConfigDict, Field, computed_field, model_validator from generalresearch.locales import Localelator +from generalresearch.models.custom_types import ( + AlphaNumStr, + AlphaNumStrSet, + AwareDatetimeISO, + CoercedStr, + UUIDStrSet, +) from generalresearch.models.definitions import Source, TaskCalculationType from generalresearch.models.spectrum import SpectrumStatus from generalresearch.models.thl.demographics import Gender @@ -19,15 +26,6 @@ from generalresearch.models.thl.survey.condition import ( MarketplaceCondition, ) -if TYPE_CHECKING: - from generalresearch.models.custom_types import ( - AlphaNumStr, - AlphaNumStrSet, - AwareDatetimeISO, - CoercedStr, - UUIDStrSet, - ) - logging.basicConfig() logger = logging.getLogger() logger.setLevel(logging.INFO) diff --git a/generalresearch/models/thl/__init__.py b/generalresearch/models/thl/__init__.py index 45278f8..d0791e4 100644 --- a/generalresearch/models/thl/__init__.py +++ b/generalresearch/models/thl/__init__.py @@ -1,21 +1,23 @@ -# from generalresearch.models.thl.finance import ( -# POPFinancial, -# ProductBalances, -# ) -# from generalresearch.models.thl.payout import ( -# # BrokerageProductPayoutEvent, -# PayoutEvent, -# ) -# from generalresearch.models.thl.product import Product +from generalresearch.models.thl.finance import ( + POPFinancial, + ProductBalances, +) +from generalresearch.models.thl.ledger import LedgerAccount +from generalresearch.models.thl.payout import ( + BrokerageProductPayoutEvent, + PayoutEvent, +) +from generalresearch.models.thl.product import Product -# _ = ( -# Product, -# PayoutEvent, -# BrokerageProductPayoutEvent, -# ProductBalances, -# POPFinancial, -# ) +_ = ( + Product, + PayoutEvent, + BrokerageProductPayoutEvent, + ProductBalances, + POPFinancial, +) -# Product.model_rebuild() -# PayoutEvent.model_rebuild() -# BrokerageProductPayoutEvent.model_rebuild() +Product.model_rebuild() +LedgerAccount.model_rebuild() +PayoutEvent.model_rebuild() +BrokerageProductPayoutEvent.model_rebuild() diff --git a/generalresearch/models/thl/contest/__init__.py b/generalresearch/models/thl/contest/__init__.py index f243ce4..c8342b3 100644 --- a/generalresearch/models/thl/contest/__init__.py +++ b/generalresearch/models/thl/contest/__init__.py @@ -12,11 +12,11 @@ from pydantic import ( model_validator, ) +from generalresearch.models.custom_types import AwareDatetimeISO, UUIDStr from generalresearch.models.thl.contest.definitions import ContestPrizeKind if TYPE_CHECKING: from generalresearch.currency import USDCent - from generalresearch.models.custom_types import AwareDatetimeISO, UUIDStr from generalresearch.models.thl.user import User diff --git a/generalresearch/models/thl/contest/contest.py b/generalresearch/models/thl/contest/contest.py index 173d486..5e30778 100644 --- a/generalresearch/models/thl/contest/contest.py +++ b/generalresearch/models/thl/contest/contest.py @@ -15,6 +15,7 @@ from pydantic import ( model_validator, ) +from generalresearch.models.custom_types import AwareDatetimeISO, UUIDStr from generalresearch.models.thl.contest import ( ContestEndCondition, ContestPrize, @@ -26,7 +27,6 @@ from generalresearch.models.thl.contest.definitions import ( ) if TYPE_CHECKING: - from generalresearch.models.custom_types import AwareDatetimeISO, UUIDStr from generalresearch.models.thl.contest import ( ContestWinner, ) diff --git a/generalresearch/models/thl/contest/contest_entry.py b/generalresearch/models/thl/contest/contest_entry.py index 17b288b..261b3fc 100644 --- a/generalresearch/models/thl/contest/contest_entry.py +++ b/generalresearch/models/thl/contest/contest_entry.py @@ -12,12 +12,12 @@ from pydantic import ( ) from generalresearch.currency import USDCent +from generalresearch.models.custom_types import AwareDatetimeISO, UUIDStr from generalresearch.models.thl.contest.definitions import ( ContestEntryType, ) if TYPE_CHECKING: - from generalresearch.models.custom_types import AwareDatetimeISO, UUIDStr from generalresearch.models.thl.user import User diff --git a/generalresearch/models/thl/contest/milestone.py b/generalresearch/models/thl/contest/milestone.py index e2ff2bc..db5ba2f 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 TYPE_CHECKING, Any, Literal, Self +from typing import Any, Literal, Self from pydantic import ( BaseModel, @@ -13,6 +13,7 @@ from pydantic import ( ) from generalresearch.currency import USDCent +from generalresearch.models.custom_types import AwareDatetimeISO from generalresearch.models.thl.contest import ( ContestPrize, ) @@ -31,9 +32,6 @@ from generalresearch.models.thl.contest.definitions import ( ContestType, ) -if TYPE_CHECKING: - from generalresearch.models.custom_types import AwareDatetimeISO - logging.basicConfig() LOG = logging.getLogger() LOG.setLevel(logging.INFO) diff --git a/generalresearch/models/thl/finance.py b/generalresearch/models/thl/finance.py index 9e7d2c3..f012cbf 100644 --- a/generalresearch/models/thl/finance.py +++ b/generalresearch/models/thl/finance.py @@ -18,6 +18,7 @@ from pydantic import ( from pydantic.json_schema import SkipJsonSchema from generalresearch.config import is_debug +from generalresearch.currency import USDCent from generalresearch.decorators import LOG from generalresearch.models.custom_types import AwareDatetimeISO, UUIDStr from generalresearch.models.thl.definitions import SessionAdjustedStatus @@ -26,7 +27,7 @@ payout_example = random.randint(150, 750 * 100) adjustment_example = random.randint(-1_000, 50 * 100) if TYPE_CHECKING: - from generalresearch.currency import USDCent + from generalresearch.managers.thl.product import ProductManager from generalresearch.models.thl.ledger import LedgerAccount from generalresearch.models.thl.product import Product @@ -324,8 +325,6 @@ class ProductBalances(BaseModel): ) @property def payout_usd_str(self) -> str: - from generalresearch.currency import USDCent - return USDCent(self.payout).to_usd_str() @computed_field( @@ -384,8 +383,6 @@ class ProductBalances(BaseModel): ) @property def payment_usd_str(self): - from generalresearch.currency import USDCent - return USDCent(self.payment).to_usd_str() @computed_field( @@ -427,8 +424,6 @@ class ProductBalances(BaseModel): ) @property def retainer_usd_str(self) -> str: - from generalresearch.currency import USDCent - return USDCent(self.retainer).to_usd_str() @computed_field( @@ -460,8 +455,6 @@ class ProductBalances(BaseModel): ) @property def available_balance_usd_str(self) -> str: - from generalresearch.currency import USDCent - return USDCent(self.available_balance).to_usd_str() @computed_field( @@ -477,8 +470,6 @@ class ProductBalances(BaseModel): ) @property def recoup(self) -> USDCent: - from generalresearch.currency import USDCent - if self.balance >= 0: return USDCent(0) @@ -578,8 +569,6 @@ class BusinessBalances(BaseModel): ) @property def payout_usd_str(self) -> str: - from generalresearch.currency import USDCent - return USDCent(self.payout).to_usd_str() @computed_field( @@ -681,8 +670,6 @@ class BusinessBalances(BaseModel): ) @property def payment_usd_str(self) -> str: - from generalresearch.currency import USDCent - return USDCent(self.payment).to_usd_str() @computed_field( @@ -730,8 +717,6 @@ class BusinessBalances(BaseModel): ) @property def retainer_usd_str(self) -> str: - from generalresearch.currency import USDCent - return USDCent(self.retainer).to_usd_str() @computed_field( @@ -763,8 +748,6 @@ class BusinessBalances(BaseModel): ) @property def available_balance_usd_str(self) -> str: - from generalresearch.currency import USDCent - return USDCent(self.available_balance).to_usd_str() # --- Properties: account related --- @@ -799,8 +782,6 @@ class BusinessBalances(BaseModel): """Returns the sum of this Business' recouped amount from any children Products. """ - from generalresearch.currency import USDCent - return USDCent(sum([i.recoup for i in self.product_balances])) @computed_field( diff --git a/generalresearch/models/thl/ledger.py b/generalresearch/models/thl/ledger.py index fbfb6bb..af9d042 100644 --- a/generalresearch/models/thl/ledger.py +++ b/generalresearch/models/thl/ledger.py @@ -16,7 +16,12 @@ from pydantic import ( model_validator, ) -from generalresearch.models.custom_types import check_valid_uuid +from generalresearch.models.custom_types import ( + AwareDatetimeISO, + HttpsUrlStr, + UUIDStr, + check_valid_uuid, +) from generalresearch.models.thl.pagination import Page from generalresearch.models.thl.payout_format import ( PayoutFormatType, @@ -25,11 +30,6 @@ from generalresearch.models.thl.payout_format import ( from generalresearch.utils.enum import ReprEnumMeta if TYPE_CHECKING: - from generalresearch.models.custom_types import ( - AwareDatetimeISO, - HttpsUrlStr, - UUIDStr, - ) from generalresearch.models.thl.payout_format import ( PayoutFormatType, ) diff --git a/generalresearch/models/thl/offerwall/base.py b/generalresearch/models/thl/offerwall/base.py index fb0bc77..c99df16 100644 --- a/generalresearch/models/thl/offerwall/base.py +++ b/generalresearch/models/thl/offerwall/base.py @@ -19,6 +19,7 @@ from pydantic import ( model_validator, ) +from generalresearch.models.custom_types import HttpsUrl, UUIDStr from generalresearch.models.definitions import Source from generalresearch.models.legacy.bucket import ( Bucket as LegacyBucket, @@ -38,7 +39,6 @@ from generalresearch.models.thl.offerwall.bucket import ( from generalresearch.models.thl.soft_pair import SoftPairResultType if TYPE_CHECKING: - from generalresearch.models.custom_types import HttpsUrl, UUIDStr from generalresearch.models.legacy.bucket import ( CategoryAssociation, Eligibility, diff --git a/generalresearch/models/thl/offerwall/cache.py b/generalresearch/models/thl/offerwall/cache.py index 2a733c9..9b2f462 100644 --- a/generalresearch/models/thl/offerwall/cache.py +++ b/generalresearch/models/thl/offerwall/cache.py @@ -5,8 +5,9 @@ from typing import TYPE_CHECKING, Any from pydantic import BaseModel, Field +from generalresearch.models.custom_types import AwareDatetimeISO, UUIDStr + if TYPE_CHECKING: - from generalresearch.models.custom_types import AwareDatetimeISO, UUIDStr from generalresearch.models.definitions import Source from generalresearch.models.thl.offerwall import OfferWallRequest from generalresearch.models.thl.offerwall.base import ( diff --git a/generalresearch/models/thl/payout.py b/generalresearch/models/thl/payout.py index 128723b..8759cd4 100644 --- a/generalresearch/models/thl/payout.py +++ b/generalresearch/models/thl/payout.py @@ -17,19 +17,17 @@ from pydantic import ( from pydantic.json_schema import SkipJsonSchema from generalresearch.currency import USDCent +from generalresearch.models.custom_types import ( + AwareDatetimeISO, + UUIDStr, + UUIDStrCoerce, +) from generalresearch.models.thl.definitions import PayoutStatus +from generalresearch.models.thl.wallet.cashout_method import ( + CashMailOrderData, +) from generalresearch.models.thl.wallet.definitions import PayoutType -if TYPE_CHECKING: - from generalresearch.models.custom_types import ( - AwareDatetimeISO, - UUIDStr, - UUIDStrCoerce, - ) - from generalresearch.models.thl.wallet.cashout_method import ( - CashMailOrderData, - ) - class PayoutEvent(BaseModel): """Base Pydantic Model to represent the `event_payout` table diff --git a/generalresearch/models/thl/profiling/marketplace.py b/generalresearch/models/thl/profiling/marketplace.py index 23501e3..19d45d6 100644 --- a/generalresearch/models/thl/profiling/marketplace.py +++ b/generalresearch/models/thl/profiling/marketplace.py @@ -7,15 +7,16 @@ from typing import TYPE_CHECKING, Any from pydantic import BaseModel, ConfigDict, Field, PositiveInt, computed_field +from generalresearch.models.custom_types import ( + AwareDatetimeISO, + CountryISOLike, + LanguageISOLike, + UUIDStr, +) from generalresearch.models.definitions import MAX_INT32 if TYPE_CHECKING: - from generalresearch.models.custom_types import ( - AwareDatetimeISO, - CountryISOLike, - LanguageISOLike, - UUIDStr, - ) + from generalresearch.models.definitions import Source from generalresearch.models.thl.locales import CountryISO, LanguageISO diff --git a/generalresearch/models/thl/profiling/question.py b/generalresearch/models/thl/profiling/question.py index 920dd3a..ea6a3c9 100644 --- a/generalresearch/models/thl/profiling/question.py +++ b/generalresearch/models/thl/profiling/question.py @@ -9,13 +9,14 @@ from pydantic import ( computed_field, ) +from generalresearch.models.custom_types import ( + AwareDatetimeISO, + CountryISOLike, + LanguageISOLike, + UUIDStr, +) + if TYPE_CHECKING: - from generalresearch.models.custom_types import ( - AwareDatetimeISO, - CountryISOLike, - LanguageISOLike, - UUIDStr, - ) from generalresearch.models.thl.profiling.upk_question import UpkQuestion diff --git a/generalresearch/models/thl/profiling/upk_property.py b/generalresearch/models/thl/profiling/upk_property.py index 922f5a4..96f1b4c 100644 --- a/generalresearch/models/thl/profiling/upk_property.py +++ b/generalresearch/models/thl/profiling/upk_property.py @@ -7,10 +7,10 @@ from uuid import uuid4 from pydantic import BaseModel, ConfigDict, Field, TypeAdapter +from generalresearch.models.custom_types import CountryISOLike, UUIDStr from generalresearch.utils.enum import ReprEnumMeta if TYPE_CHECKING: - from generalresearch.models.custom_types import CountryISOLike, UUIDStr from generalresearch.models.thl.category import Category diff --git a/generalresearch/models/thl/profiling/upk_question_answer.py b/generalresearch/models/thl/profiling/upk_question_answer.py index 4d07970..f25baa7 100644 --- a/generalresearch/models/thl/profiling/upk_question_answer.py +++ b/generalresearch/models/thl/profiling/upk_question_answer.py @@ -1,7 +1,7 @@ from __future__ import annotations from datetime import UTC, datetime -from typing import TYPE_CHECKING, Any, Self +from typing import Any, Self from uuid import uuid4 from pydantic import ( @@ -13,19 +13,17 @@ from pydantic import ( model_validator, ) +from generalresearch.models.custom_types import ( + AwareDatetimeISO, + CountryISOLike, + UUIDStr, +) from generalresearch.models.definitions import MAX_INT32 from generalresearch.models.thl.profiling.upk_property import ( Cardinality, PropertyType, ) -if TYPE_CHECKING: - from generalresearch.models.custom_types import ( - AwareDatetimeISO, - CountryISOLike, - UUIDStr, - ) - class UpkQuestionAnswer(BaseModel): diff --git a/generalresearch/models/thl/profiling/user_info.py b/generalresearch/models/thl/profiling/user_info.py index 40b4b17..5124d17 100644 --- a/generalresearch/models/thl/profiling/user_info.py +++ b/generalresearch/models/thl/profiling/user_info.py @@ -5,8 +5,9 @@ from typing import TYPE_CHECKING from pydantic import BaseModel, ConfigDict, Field from pydantic.json_schema import SkipJsonSchema +from generalresearch.models.custom_types import AwareDatetimeISO + if TYPE_CHECKING: - from generalresearch.models.custom_types import AwareDatetimeISO from generalresearch.models.definitions import Source from generalresearch.models.thl.profiling.user_question_answer import ( MarketplaceResearchProfileQuestion, diff --git a/generalresearch/models/thl/session.py b/generalresearch/models/thl/session.py index 65b885e..5812c75 100644 --- a/generalresearch/models/thl/session.py +++ b/generalresearch/models/thl/session.py @@ -18,6 +18,12 @@ from pydantic import ( model_validator, ) +from generalresearch.models.custom_types import ( + AwareDatetimeISO, + EnumNameSerializer, + IPvAnyAddressStr, + UUIDStr, +) from generalresearch.models.definitions import Source from generalresearch.models.thl.definitions import ( WALL_ALLOWED_STATUS_CODE_1_2, @@ -37,12 +43,6 @@ if TYPE_CHECKING: from generalresearch.managers.thl.ledger_manager.thl_ledger import ( ThlLedgerManager, ) - from generalresearch.models.custom_types import ( - AwareDatetimeISO, - EnumNameSerializer, - IPvAnyAddressStr, - UUIDStr, - ) from generalresearch.models.definitions import DeviceType from generalresearch.models.legacy.bucket import Bucket from generalresearch.models.thl.definitions import ( diff --git a/generalresearch/models/thl/survey/buyer.py b/generalresearch/models/thl/survey/buyer.py index ef309d1..6a67ed7 100644 --- a/generalresearch/models/thl/survey/buyer.py +++ b/generalresearch/models/thl/survey/buyer.py @@ -3,7 +3,7 @@ from __future__ import annotations from datetime import UTC, datetime from decimal import Decimal from math import log -from typing import TYPE_CHECKING, Annotated +from typing import Annotated from pydantic import ( BaseModel, @@ -16,15 +16,13 @@ from pydantic import ( ) from scipy.stats import beta as beta_dist +from generalresearch.models.custom_types import ( + AwareDatetimeISO, + CountryISOLike, + UUIDStr, +) from generalresearch.models.definitions import Source -if TYPE_CHECKING: - from generalresearch.models.custom_types import ( - AwareDatetimeISO, - CountryISOLike, - UUIDStr, - ) - class Buyer(BaseModel): """ diff --git a/generalresearch/models/thl/survey/model.py b/generalresearch/models/thl/survey/model.py index 8986e4d..f8e5083 100644 --- a/generalresearch/models/thl/survey/model.py +++ b/generalresearch/models/thl/survey/model.py @@ -17,17 +17,18 @@ from pydantic import ( ) from generalresearch.managers.thl.buyer import Buyer +from generalresearch.models.custom_types import ( + AwareDatetimeISO, + CountryISOLike, + EnumNameSerializer, + PropertyCode, + SurveyKey, +) from generalresearch.models.thl.definitions import StatusCode1 from generalresearch.models.thl.pagination import Page if TYPE_CHECKING: - from generalresearch.models.custom_types import ( - AwareDatetimeISO, - CountryISOLike, - EnumNameSerializer, - PropertyCode, - SurveyKey, - ) + from generalresearch.models.definitions import Source from generalresearch.models.thl.category import Category from generalresearch.models.thl.definitions import Status diff --git a/generalresearch/models/thl/survey/penalty.py b/generalresearch/models/thl/survey/penalty.py index 25e07cf..e989bff 100644 --- a/generalresearch/models/thl/survey/penalty.py +++ b/generalresearch/models/thl/survey/penalty.py @@ -6,11 +6,13 @@ from typing import TYPE_CHECKING, Annotated, Literal from pydantic import BaseModel, ConfigDict, Field, TypeAdapter +from generalresearch.models.custom_types import ( + AwareDatetimeISO, + UUIDStr, +) + if TYPE_CHECKING: - from generalresearch.models.custom_types import ( - AwareDatetimeISO, - UUIDStr, - ) + from generalresearch.models.definitions import Source diff --git a/generalresearch/models/thl/task_adjustment.py b/generalresearch/models/thl/task_adjustment.py index fee2007..6e5a935 100644 --- a/generalresearch/models/thl/task_adjustment.py +++ b/generalresearch/models/thl/task_adjustment.py @@ -7,13 +7,13 @@ from uuid import uuid4 from pydantic import BaseModel, ConfigDict, Field, PositiveInt, model_validator +from generalresearch.models.custom_types import AwareDatetimeISO, UUIDStr from generalresearch.models.definitions import MAX_INT32 from generalresearch.models.thl.definitions import ( WallAdjustedStatus, ) if TYPE_CHECKING: - from generalresearch.models.custom_types import AwareDatetimeISO, UUIDStr from generalresearch.models.definitions import Source diff --git a/generalresearch/models/thl/task_status.py b/generalresearch/models/thl/task_status.py index 6cff884..16ad66f 100644 --- a/generalresearch/models/thl/task_status.py +++ b/generalresearch/models/thl/task_status.py @@ -13,6 +13,11 @@ from pydantic import ( model_validator, ) +from generalresearch.models.custom_types import ( + AwareDatetimeISO, + EnumNameSerializer, + UUIDStr, +) from generalresearch.models.thl.definitions import ( SessionAdjustedStatus, SessionStatusCode2, @@ -27,11 +32,7 @@ from generalresearch.models.thl.session import WallOut from generalresearch.models.thl.utils import decimal_to_int_cents if TYPE_CHECKING: - from generalresearch.models.custom_types import ( - AwareDatetimeISO, - EnumNameSerializer, - UUIDStr, - ) + from generalresearch.models.thl.payout_format import ( PayoutFormatType, ) diff --git a/generalresearch/models/thl/user.py b/generalresearch/models/thl/user.py index 1f88dc6..4f94270 100644 --- a/generalresearch/models/thl/user.py +++ b/generalresearch/models/thl/user.py @@ -20,6 +20,7 @@ from pydantic import ( ) from sentry_sdk import set_tag, set_user +from generalresearch.models.custom_types import AwareDatetimeISO, UUIDStr from generalresearch.models.definitions import MAX_INT32 if TYPE_CHECKING: @@ -27,7 +28,6 @@ if TYPE_CHECKING: ThlLedgerManager, ) from generalresearch.managers.thl.userhealth import AuditLogManager - from generalresearch.models.custom_types import AwareDatetimeISO, UUIDStr from generalresearch.models.thl.ipinfo import GeoIPInformation from generalresearch.models.thl.ledger import LedgerTransaction from generalresearch.models.thl.product import Product diff --git a/generalresearch/models/thl/user_profile.py b/generalresearch/models/thl/user_profile.py index c47c6f2..11dfca1 100644 --- a/generalresearch/models/thl/user_profile.py +++ b/generalresearch/models/thl/user_profile.py @@ -13,10 +13,11 @@ from pydantic import ( ) from pydantic.json_schema import SkipJsonSchema +from generalresearch.models.custom_types import UUIDStr from generalresearch.models.definitions import MAX_INT32, Source if TYPE_CHECKING: - from generalresearch.models.custom_types import UUIDStr + from generalresearch.models.thl.user import User from generalresearch.models.thl.user_streak import UserStreak diff --git a/generalresearch/models/thl/user_quality_event.py b/generalresearch/models/thl/user_quality_event.py index 8c2e25f..4d5db9d 100644 --- a/generalresearch/models/thl/user_quality_event.py +++ b/generalresearch/models/thl/user_quality_event.py @@ -7,11 +7,11 @@ from typing import TYPE_CHECKING, Literal from pydantic import BaseModel, Field, PositiveInt +from generalresearch.models.custom_types import AwareDatetimeISO, UUIDStr from generalresearch.models.definitions import MAX_INT32, Source from generalresearch.utils.enum import ReprEnumMeta if TYPE_CHECKING: - from generalresearch.models.custom_types import AwareDatetimeISO, UUIDStr from generalresearch.models.thl.definitions import WallAdjustedStatus from generalresearch.models.thl.user import BPUIDStr diff --git a/generalresearch/models/thl/wallet/cashout_method.py b/generalresearch/models/thl/wallet/cashout_method.py index 9383c36..286a126 100644 --- a/generalresearch/models/thl/wallet/cashout_method.py +++ b/generalresearch/models/thl/wallet/cashout_method.py @@ -17,18 +17,19 @@ from pydantic import ( model_validator, ) +from generalresearch.currency import USDCent +from generalresearch.models.custom_types import ( + AwareDatetimeISO, + HttpsUrlStr, + UUIDStr, +) from generalresearch.models.legacy.api_status import StatusResponse from generalresearch.models.thl.definitions import PayoutStatus from generalresearch.models.thl.wallet.definitions import PayoutType from generalresearch.utils.enum import ReprEnumMeta if TYPE_CHECKING: - from generalresearch.currency import USDCent - from generalresearch.models.custom_types import ( - AwareDatetimeISO, - HttpsUrlStr, - UUIDStr, - ) + from generalresearch.models.thl.locales import CountryISO from generalresearch.models.thl.user import BPUIDStr, User from generalresearch.models.thl.wallet.definitions import Currency diff --git a/generalresearch/models/thl/wallet/payout.py b/generalresearch/models/thl/wallet/payout.py index 79c50e1..1fc0f77 100644 --- a/generalresearch/models/thl/wallet/payout.py +++ b/generalresearch/models/thl/wallet/payout.py @@ -3,7 +3,7 @@ from __future__ import annotations import json from collections.abc import Collection from datetime import UTC, datetime -from typing import TYPE_CHECKING, Any +from typing import Any from uuid import uuid4 from pydantic import ( @@ -15,15 +15,13 @@ from pydantic import ( ) from generalresearch.currency import USDCent +from generalresearch.models.custom_types import AwareDatetimeISO, UUIDStr from generalresearch.models.thl.definitions import PayoutStatus +from generalresearch.models.thl.wallet.cashout_method import ( + CashMailOrderData, +) from generalresearch.models.thl.wallet.definitions import PayoutType -if TYPE_CHECKING: - from generalresearch.models.custom_types import AwareDatetimeISO, UUIDStr - from generalresearch.models.thl.wallet.cashout_method import ( - CashMailOrderData, - ) - class PayoutEvent(BaseModel, validate_assignment=True): """A user has requested to be paid from their wallet balance.""" diff --git a/test_utils/models/gr/conftest.py b/test_utils/models/gr/conftest.py index e493f20..b87f3bb 100644 --- a/test_utils/models/gr/conftest.py +++ b/test_utils/models/gr/conftest.py @@ -9,6 +9,8 @@ import pytest from pydantic import PositiveInt from pydantic_extra_types.phone_numbers import PhoneNumber +from generalresearch.models.custom_types import UUIDStr + if TYPE_CHECKING: from generalresearch.managers.gr.authentication import GRTokenManager, GRUserManager from generalresearch.managers.gr.business import ( @@ -17,7 +19,6 @@ if TYPE_CHECKING: BusinessManager, ) from generalresearch.managers.gr.team import MembershipManager, TeamManager - from generalresearch.models.custom_types import UUIDStr from generalresearch.models.gr.authentication import GRToken, GRUser from generalresearch.models.gr.business import ( Business, diff --git a/test_utils/models/thl/conftest.py b/test_utils/models/thl/conftest.py index 3c77e27..3545509 100644 --- a/test_utils/models/thl/conftest.py +++ b/test_utils/models/thl/conftest.py @@ -13,6 +13,11 @@ import pytest from grip_client.enums import AccessType from pydantic import PositiveInt +from generalresearch.models.custom_types import ( + AwareDatetimeISO, + IPvAnyAddressStr, + UUIDStr, +) from generalresearch.models.thl.definitions import PayoutStatus from generalresearch.models.thl.session import ( Source, @@ -33,11 +38,6 @@ if TYPE_CHECKING: from generalresearch.managers.thl.user_manager.user_manager import UserManager from generalresearch.managers.thl.userhealth import AuditLogManager, IPRecordManager from generalresearch.managers.thl.wall import WallManager - from generalresearch.models.custom_types import ( - AwareDatetimeISO, - IPvAnyAddressStr, - UUIDStr, - ) from generalresearch.models.definitions import DeviceType from generalresearch.models.legacy.bucket import Bucket from generalresearch.models.thl.ipinfo import IPGeoname, IPInformation diff --git a/tests/managers/thl/test_ledger/test_lm_accounts.py b/tests/managers/thl/test_ledger/test_lm_accounts.py index cdef99a..57a2261 100644 --- a/tests/managers/thl/test_ledger/test_lm_accounts.py +++ b/tests/managers/thl/test_ledger/test_lm_accounts.py @@ -14,14 +14,14 @@ from generalresearch.managers.thl.ledger_manager.exceptions import ( LedgerAccountDoesntExistError, ) from generalresearch.managers.thl.ledger_manager.ledger import LedgerManager -from generalresearch.models.custom_types import AccountType, Direction +from generalresearch.models.custom_types import AccountType, Direction, UUIDStr from generalresearch.models.thl.ledger import ( LedgerAccount, LedgerEntry, ) if TYPE_CHECKING: - from generalresearch.models.custom_types import UUIDStr + from generalresearch.models.thl.ledger import ( LedgerTransaction, ) diff --git a/tests/models/custom_types/test_aware_datetime.py b/tests/models/custom_types/test_aware_datetime.py index 54a5d9b..e8a5aa3 100644 --- a/tests/models/custom_types/test_aware_datetime.py +++ b/tests/models/custom_types/test_aware_datetime.py @@ -2,14 +2,12 @@ from __future__ import annotations import logging from datetime import UTC, datetime -from typing import TYPE_CHECKING import pytest import pytz from pydantic import BaseModel, Field, ValidationError -if TYPE_CHECKING: - from generalresearch.models.custom_types import AwareDatetimeISO +from generalresearch.models.custom_types import AwareDatetimeISO logger = logging.getLogger() diff --git a/tests/models/custom_types/test_uuid_str.py b/tests/models/custom_types/test_uuid_str.py index 92489a0..02e6a8b 100644 --- a/tests/models/custom_types/test_uuid_str.py +++ b/tests/models/custom_types/test_uuid_str.py @@ -1,13 +1,11 @@ from __future__ import annotations -from typing import TYPE_CHECKING from uuid import uuid4 import pytest from pydantic import BaseModel, Field, ValidationError -if TYPE_CHECKING: - from generalresearch.models.custom_types import UUIDStr +from generalresearch.models.custom_types import UUIDStr class UUIDStrModel(BaseModel): diff --git a/tests/models/thl/test_product.py b/tests/models/thl/test_product.py index a1b3688..446b59f 100644 --- a/tests/models/thl/test_product.py +++ b/tests/models/thl/test_product.py @@ -631,8 +631,6 @@ class TestProductFinancials: create_main_accounts() delete_df_collection(coll=ledger_collection) - from generalresearch.currency import USDCent - p1: Product = product_factory(business=gr_business) u1: User = user_factory(product=p1) bp_wallet = thl_ledger_manager.get_account_or_create_bp_wallet(product=p1) @@ -714,6 +712,8 @@ class TestProductFinancials: # -- Now pay them out... + from generalresearch.currency import USDCent + bp_payout_factory( product=p1, amount=USDCent(50), -- cgit v1.2.3