Skip to content

Commit

Permalink
remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
abyesilyurt committed Sep 19, 2024
1 parent 5b362ba commit 4e3f245
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 35 deletions.
8 changes: 2 additions & 6 deletions packages/syft/src/syft/service/migration/migration_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,10 @@ def create_migrated_objects(
migrated_objects: list[SyftObject],
ignore_existing: bool = True,
) -> SyftSuccess:
return self._create_migrated_objects(
self._create_migrated_objects(
context, migrated_objects, ignore_existing=ignore_existing
).unwrap()
return SyftSuccess(message="Created migration objects!")

@as_result(SyftException)
def _create_migrated_objects(
Expand Down Expand Up @@ -311,11 +312,6 @@ def _migrate_objects(
) -> list[SyftObject]:
migrated_objects = []

# def get_sorting_key_migration(klass):
# canonical_name = klass.__canonical_name__
# latest_version = SyftObjectRegistry.get_latest_version(canonical_name)
# return getattr(latest_version, "__migration_priority__", 0)

for klass, objects in migration_objects.items():
canonical_name = klass.__canonical_name__
latest_version = SyftObjectRegistry.get_latest_version(canonical_name)
Expand Down
29 changes: 0 additions & 29 deletions packages/syft/src/syft/service/migration/object_migration_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from typing import Any

# third party
import sqlalchemy
from typing_extensions import Self
import yaml

Expand All @@ -17,7 +16,6 @@
from ...server.credentials import SyftSigningKey
from ...server.credentials import SyftVerifyKey
from ...store.db.stash import ObjectStash
from ...store.db.stash import with_session
from ...store.document_store import PartitionKey
from ...store.document_store_errors import NotFoundException
from ...types.blob_storage import BlobStorageEntry
Expand All @@ -34,9 +32,7 @@
from ...types.transforms import make_set_default
from ...types.uid import UID
from ...util.util import prompt_warning_message
from ..context import AuthedServiceContext
from ..response import SyftSuccess
from ..user.user import User
from ..worker.utils import DEFAULT_WORKER_POOL_NAME
from ..worker.worker_image import SyftWorkerImage
from ..worker.worker_pool import SyftWorker
Expand Down Expand Up @@ -82,31 +78,6 @@ def get_by_name(
filters={"canonical_name": canonical_name},
).unwrap()

@as_result(SyftException)
@with_session
def update_root_user(
self,
context: AuthedServiceContext,
root_user: User,
session: sqlalchemy.orm.session,
) -> SyftSuccess:
user_stash = context.server.services.user.stash
existing_user = user_stash.get_by_verify_key(
context.credentials, root_user.verify_key
).unwrap()
stmt = user_stash.table.update().where(
user_stash.table.c.id == existing_user.id
)
stmt = stmt.values(id=root_user.id)
result = session.execute(stmt)
session.commit()
if result.rowcount == 0:
raise NotFoundException(
f"User: {root_user.id} not found or no permission to update."
)

return user_stash.update(context.credentials, obj=root_user).unwrap()


@serializable()
class StoreMetadata(SyftBaseObject):
Expand Down

0 comments on commit 4e3f245

Please sign in to comment.