Skip to content

Commit

Permalink
mv GroupID to models_library.groups
Browse files Browse the repository at this point in the history
  • Loading branch information
pcrespov committed Dec 11, 2024
1 parent 825c22a commit 85f17ae
Show file tree
Hide file tree
Showing 50 changed files with 82 additions and 62 deletions.
2 changes: 1 addition & 1 deletion api/specs/web-server/_projects_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
ServiceResourcesDict,
)
from models_library.generics import Envelope
from models_library.groups import GroupID
from models_library.projects import ProjectID
from models_library.projects_nodes_io import NodeID
from models_library.users import GroupID
from simcore_service_webserver._meta import API_VTAG
from simcore_service_webserver.projects._crud_handlers import ProjectPathParams
from simcore_service_webserver.projects._nodes_handlers import (
Expand Down
2 changes: 1 addition & 1 deletion api/specs/web-server/_wallets.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
WalletPaymentInitiated,
)
from models_library.generics import Envelope
from models_library.groups import GroupID
from models_library.rest_pagination import Page, PageQueryParameters
from models_library.users import GroupID
from models_library.wallets import WalletID
from simcore_service_webserver._meta import API_VTAG
from simcore_service_webserver.wallets._groups_api import WalletGroupGet
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pydantic import BaseModel

from ..groups import GroupID
from ..services import ServiceKey, ServiceVersion
from ..users import GroupID


class ServiceAccessRightsGet(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from ..boot_options import BootOptions
from ..emails import LowerCaseEmailStr
from ..groups import GroupID
from ..services_access import ServiceAccessRights, ServiceGroupAccessRightsV2
from ..services_authoring import Author
from ..services_enums import ServiceType
Expand All @@ -18,7 +19,6 @@
)
from ..services_resources import ServiceResourcesDict
from ..services_types import ServiceKey, ServiceVersion
from ..users import GroupID
from ..utils.change_case import snake_to_camel


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

from models_library.basic_types import IDStr
from models_library.folders import FolderID
from models_library.groups import GroupID
from models_library.projects_access import AccessRights
from models_library.users import GroupID
from models_library.utils.common_validators import null_or_none_str_to_none_validator
from pydantic import ConfigDict, PositiveInt, field_validator

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from ..access_rights import AccessRights
from ..basic_types import IDStr
from ..folders import FolderID
from ..users import GroupID
from ..groups import GroupID
from ..utils.common_validators import null_or_none_str_to_none_validator
from ..workspaces import WorkspaceID
from ._base import InputSchema, OutputSchema
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from ..basic_types import IDStr
from ..users import GroupID, UserID
from ..groups import GroupID
from ..users import UserID


class SocketIORoomStr(IDStr):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pydantic import ConfigDict, Field, HttpUrl, ValidationInfo, field_validator

from ..basic_types import AmountDecimal, IDStr, NonNegativeDecimal
from ..users import GroupID
from ..groups import GroupID
from ..wallets import WalletID, WalletStatus
from ._base import InputSchema, OutputSchema

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import NamedTuple

from models_library.basic_types import IDStr
from models_library.users import GroupID
from models_library.groups import GroupID
from models_library.workspaces import WorkspaceID
from pydantic import ConfigDict, PositiveInt

Expand Down
2 changes: 1 addition & 1 deletion packages/models-library/src/models_library/clusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pydantic import AnyUrl, BaseModel, ConfigDict, Field, HttpUrl, field_validator
from pydantic.types import NonNegativeInt

from .users import GroupID
from .groups import GroupID
from .utils.common_validators import create_enums_pre_validator
from .utils.enums import StrAutoEnum

Expand Down
3 changes: 2 additions & 1 deletion packages/models-library/src/models_library/folders.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
)

from .access_rights import AccessRights
from .users import GroupID, UserID
from .groups import GroupID
from .users import UserID
from .utils.enums import StrAutoEnum
from .workspaces import WorkspaceID

Expand Down
4 changes: 3 additions & 1 deletion packages/models-library/src/models_library/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
from typing_extensions import TypedDict

from .basic_types import IDStr
from .users import GroupID, UserID
from .users import UserID
from .utils.common_validators import create_enums_pre_validator

EVERYONE_GROUP_ID: Final[int] = 1

GroupID: TypeAlias = PositiveInt


class GroupTypeInModel(str, enum.Enum):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from pydantic import BaseModel, ConfigDict, Field

from .users import GroupID
from .groups import GroupID
from .utils.change_case import snake_to_camel


Expand Down
1 change: 0 additions & 1 deletion packages/models-library/src/models_library/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

UserID: TypeAlias = PositiveInt
UserNameID: TypeAlias = IDStr
GroupID: TypeAlias = PositiveInt


FirstNameStr: TypeAlias = Annotated[
Expand Down
3 changes: 2 additions & 1 deletion packages/models-library/src/models_library/workspaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
)

from .access_rights import AccessRights
from .users import GroupID, UserID
from .groups import GroupID
from .users import UserID
from .utils.enums import StrAutoEnum

WorkspaceID: TypeAlias = PositiveInt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import pytest
from faker import Faker
from models_library.api_schemas_webserver.socketio import SocketIORoomStr
from models_library.users import GroupID, UserID
from models_library.groups import GroupID
from models_library.users import UserID


@pytest.fixture
Expand Down
3 changes: 2 additions & 1 deletion packages/notifications-library/tests/with_db/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
import pytest
import sqlalchemy as sa
from models_library.basic_types import IDStr
from models_library.groups import GroupID
from models_library.products import ProductName
from models_library.users import GroupID, UserID
from models_library.users import UserID
from notifications_library._templates import get_default_named_templates
from pydantic import validate_call
from simcore_postgres_database.models.jinja2_templates import jinja2_templates
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sqlalchemy as sa
from aiohttp import web
from models_library.users import GroupID
from models_library.groups import GroupID
from models_library.workspaces import WorkspaceID
from simcore_postgres_database.models.workspaces_access_rights import (
workspaces_access_rights,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
WalletGetWithAvailableCredits as _WalletGetWithAvailableCredits,
)
from models_library.basic_types import IDStr, NonNegativeDecimal
from models_library.groups import GroupID
from models_library.resource_tracker import (
PricingPlanClassification,
PricingPlanId,
PricingUnitId,
UnitExtraInfo,
)
from models_library.users import GroupID
from models_library.wallets import WalletID, WalletStatus
from pydantic import (
BaseModel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
from models_library.api_schemas_catalog.services_specifications import (
ServiceSpecifications,
)
from models_library.groups import GroupAtDB, GroupTypeInModel
from models_library.groups import GroupAtDB, GroupID, GroupTypeInModel
from models_library.products import ProductName
from models_library.services import ServiceKey, ServiceVersion
from models_library.users import GroupID, UserID
from models_library.users import UserID
from psycopg2.errors import ForeignKeyViolation
from pydantic import PositiveInt, TypeAdapter, ValidationError
from simcore_postgres_database.utils_services import create_select_latest_services_query
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from models_library.api_schemas_catalog.services_specifications import (
ServiceSpecifications,
)
from models_library.groups import GroupID
from models_library.services import ServiceKey, ServiceVersion
from models_library.users import GroupID
from pydantic import ConfigDict


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sqlalchemy as sa
from models_library.api_schemas_webserver.wallets import PaymentID
from models_library.users import GroupID, UserID
from models_library.groups import GroupID
from models_library.users import UserID
from simcore_postgres_database.models.payments_transactions import payments_transactions
from simcore_postgres_database.models.products import products
from simcore_postgres_database.models.users import users
Expand Down
2 changes: 1 addition & 1 deletion services/payments/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import pytest
import simcore_service_payments
from faker import Faker
from models_library.users import GroupID
from models_library.groups import GroupID
from pydantic import TypeAdapter
from pytest_simcore.helpers.monkeypatch_envs import setenvs_from_dict
from pytest_simcore.helpers.typing_env import EnvVarsDict
Expand Down
3 changes: 2 additions & 1 deletion services/payments/tests/unit/test_db_payments_users_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

import pytest
from fastapi import FastAPI
from models_library.users import GroupID, UserID
from models_library.groups import GroupID
from models_library.users import UserID
from pytest_simcore.helpers.monkeypatch_envs import setenvs_from_dict
from pytest_simcore.helpers.postgres_tools import insert_and_get_row_lifespan
from pytest_simcore.helpers.typing_env import EnvVarsDict
Expand Down
3 changes: 2 additions & 1 deletion services/payments/tests/unit/test_services_notifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
)
from models_library.api_schemas_webserver.socketio import SocketIORoomStr
from models_library.api_schemas_webserver.wallets import PaymentTransaction
from models_library.users import GroupID, UserID
from models_library.groups import GroupID
from models_library.users import UserID
from pydantic import TypeAdapter
from pytest_mock import MockerFixture
from pytest_simcore.helpers.faker_factories import random_payment_transaction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@
import sqlalchemy as sa
from aiopg.sa.connection import SAConnection
from aiopg.sa.result import ResultProxy, RowProxy
from models_library.groups import GroupID
from models_library.projects import ProjectID
from models_library.projects_nodes_io import StorageFileID
from models_library.users import GroupID, UserID
from models_library.users import UserID
from simcore_postgres_database.models.project_to_groups import project_to_groups
from simcore_postgres_database.models.projects import projects
from simcore_postgres_database.models.workspaces_access_rights import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
FolderScope,
UserFolderAccessRightsDB,
)
from models_library.groups import GroupID
from models_library.products import ProductName
from models_library.projects import ProjectID
from models_library.rest_ordering import OrderBy, OrderDirection
from models_library.users import GroupID, UserID
from models_library.users import UserID
from models_library.workspaces import WorkspaceID, WorkspaceQuery, WorkspaceScope
from pydantic import NonNegativeInt
from simcore_postgres_database.models.folders_v2 import folders_v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import asyncpg.exceptions
from aiohttp import web
from models_library.groups import Group, GroupTypeInModel
from models_library.groups import Group, GroupID, GroupTypeInModel
from models_library.projects import ProjectID
from models_library.users import GroupID, UserID
from models_library.users import UserID
from simcore_postgres_database.errors import DatabaseError

from ..groups.api import get_group_from_gid
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from typing import Literal

from models_library.groups import GroupID
from models_library.rest_base import RequestParameters, StrictRequestParameters
from models_library.users import GroupID, UserID
from models_library.users import UserID
from pydantic import Field

from ..._constants import RQ_PRODUCT_KEY, RQT_USERID_KEY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
from models_library.groups import (
AccessRightsDict,
Group,
GroupID,
GroupMember,
GroupsByTypeTuple,
StandardGroupCreate,
StandardGroupUpdate,
)
from models_library.products import ProductName
from models_library.users import GroupID, UserID
from models_library.users import UserID
from pydantic import EmailStr

from ..users.api import get_user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
from models_library.groups import (
AccessRightsDict,
Group,
GroupID,
GroupInfoTuple,
GroupMember,
GroupsByTypeTuple,
StandardGroupCreate,
StandardGroupUpdate,
)
from models_library.users import GroupID, UserID
from models_library.users import UserID
from simcore_postgres_database.errors import UniqueViolation
from simcore_postgres_database.models.groups import GroupType
from simcore_postgres_database.utils_products import execute_get_or_create_product_group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import Final

from aiohttp import web
from models_library.groups import GroupID
from models_library.rabbitmq_messages import (
EventRabbitMessage,
LoggerRabbitMessage,
Expand All @@ -12,7 +13,6 @@
WalletCreditsMessage,
)
from models_library.socketio import SocketMessageDict
from models_library.users import GroupID
from pydantic import TypeAdapter
from servicelib.logging_utils import log_catch, log_context
from servicelib.rabbitmq import RabbitMQClient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
from datetime import datetime

from aiohttp import web
from models_library.groups import GroupID
from models_library.products import ProductName
from models_library.projects import ProjectID
from models_library.users import GroupID, UserID
from models_library.users import UserID
from pydantic import BaseModel

from ..users import api as users_api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from datetime import datetime

from aiohttp import web
from models_library.groups import GroupID
from models_library.projects import ProjectID
from models_library.users import GroupID
from pydantic import BaseModel, ConfigDict, TypeAdapter
from simcore_postgres_database.models.project_to_groups import project_to_groups
from simcore_postgres_database.utils_repos import transaction_context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import logging

from aiohttp import web
from models_library.groups import GroupID
from models_library.projects import ProjectID
from models_library.users import GroupID
from pydantic import ConfigDict, BaseModel
from pydantic import BaseModel, ConfigDict
from servicelib.aiohttp import status
from servicelib.aiohttp.requests_validation import (
parse_request_body_as,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@
NodePatch,
NodeRetrieve,
)
from models_library.groups import EVERYONE_GROUP_ID, Group, GroupTypeInModel
from models_library.groups import EVERYONE_GROUP_ID, Group, GroupID, GroupTypeInModel
from models_library.projects import Project, ProjectID
from models_library.projects_nodes_io import NodeID, NodeIDStr
from models_library.services import ServiceKeyVersion
from models_library.services_resources import ServiceResourcesDict
from models_library.users import GroupID
from models_library.utils.fastapi_encoders import jsonable_encoder
from pydantic import BaseModel, Field
from servicelib.aiohttp import status
Expand Down
Loading

0 comments on commit 85f17ae

Please sign in to comment.