Skip to content

Commit

Permalink
Remove unused Collection.parents attribute. (#2192)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdilauro authored Nov 26, 2024
1 parent 307a727 commit 6f25265
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 29 deletions.
14 changes: 0 additions & 14 deletions src/palace/manager/sqlalchemy/model/collection.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

from collections.abc import Generator
from typing import TYPE_CHECKING, Any, TypeVar

from dependency_injector.wiring import Provide, inject
Expand Down Expand Up @@ -451,19 +450,6 @@ def data_source(self, new_value: DataSource | str) -> None:
**{Collection.DATA_SOURCE_NAME_SETTING: new_datasource_name}
)

@property
def parents(self) -> Generator[Collection]:
if not self.parent_id:
return None

_db = Session.object_session(self)
parent = Collection.by_id(_db, self.parent_id)
if parent is None:
return None

yield parent
yield from parent.parents

@property
def pools_with_no_delivery_mechanisms(self) -> Query[LicensePool]:
"""Find all LicensePools in this Collection that have no delivery
Expand Down
15 changes: 0 additions & 15 deletions tests/manager/sqlalchemy/model/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,21 +118,6 @@ def test_by_protocol(self, example_collection_fixture: ExampleCollectionFixture)
c1.marked_for_deletion = True
assert [test_collection] == Collection.by_protocol(db.session, overdrive).all()

def test_parents(self, example_collection_fixture: ExampleCollectionFixture):
db = example_collection_fixture.database_fixture

# Collections can return all their parents recursively.
c1 = db.collection()
assert [] == list(c1.parents)

c2 = db.collection()
c2.parent_id = c1.id
assert [c1] == list(c2.parents)

c3 = db.collection()
c3.parent_id = c2.id
assert [c2, c1] == list(c3.parents)

def test_get_protocol(self, db: DatabaseTransactionFixture):
test_collection = db.collection()
integration = test_collection.integration_configuration
Expand Down

0 comments on commit 6f25265

Please sign in to comment.