Skip to content

Commit

Permalink
[#147] Renamed the references to stalker.models.link module to `sta…
Browse files Browse the repository at this point in the history
…lker.models.file`.
  • Loading branch information
eoyilmaz committed Jan 13, 2025
1 parent cdc5058 commit f9bd304
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 27 deletions.
5 changes: 3 additions & 2 deletions docs/source/inheritance_diagram.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ Inheritance Diagram
stalker.models.entity.Entity
stalker.models.entity.EntityGroup
stalker.models.entity.SimpleEntity
stalker.models.file.File
stalker.models.format.ImageFormat
stalker.models.link.Link
stalker.models.message.Message
stalker.models.mixins.ACLMixin
stalker.models.mixins.CodeMixin
Expand All @@ -48,7 +48,7 @@ Inheritance Diagram
stalker.models.repository.Repository
stalker.models.review.Review
stalker.models.review.Daily
stalker.models.review.DailyLink
stalker.models.review.DailyFile
stalker.models.scene.Scene
stalker.models.schedulers.SchedulerBase
stalker.models.schedulers.TaskJugglerScheduler
Expand All @@ -69,6 +69,7 @@ Inheritance Diagram
stalker.models.ticket.TicketLog
stalker.models.type.EntityType
stalker.models.type.Type
stalker.models.variant.Variant
stalker.models.version.Version
stalker.models.wiki.Page
:parts: 1
5 changes: 3 additions & 2 deletions docs/source/summary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Summary
stalker.models.entity.Entity
stalker.models.entity.EntityGroup
stalker.models.entity.SimpleEntity
stalker.models.file.File
stalker.models.format.ImageFormat
stalker.models.link.Link
stalker.models.message.Message
stalker.models.mixins.ACLMixin
stalker.models.mixins.CodeMixin
Expand All @@ -55,7 +55,7 @@ Summary
stalker.models.repository.Repository
stalker.models.review.Review
stalker.models.review.Daily
stalker.models.review.DailyLink
stalker.models.review.DailyFile
stalker.models.scene.Scene
stalker.models.schedulers.SchedulerBase
stalker.models.schedulers.TaskJugglerScheduler
Expand All @@ -75,5 +75,6 @@ Summary
stalker.models.ticket.TicketLog
stalker.models.type.EntityType
stalker.models.type.Type
stalker.models.variant.Variant
stalker.models.version.Version
stalker.models.wiki.Page
2 changes: 1 addition & 1 deletion src/stalker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from stalker.models.department import Department, DepartmentUser
from stalker.models.entity import Entity, EntityGroup, SimpleEntity
from stalker.models.format import ImageFormat
from stalker.models.link import File
from stalker.models.file import File
from stalker.models.message import Message
from stalker.models.mixins import (
ACLMixin,
Expand Down
4 changes: 2 additions & 2 deletions src/stalker/models/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

if TYPE_CHECKING: # pragma: no cover
from stalker.models.auth import User
from stalker.models.link import File
from stalker.models.file import File
from stalker.models.note import Note
from stalker.models.tag import Tag
from stalker.models.type import Type
Expand Down Expand Up @@ -637,7 +637,7 @@ def _validate_thumbnail(self, key: str, thumb: "File") -> "File":
if not isinstance(thumb, File):
raise TypeError(
f"{self.__class__.__name__}.thumbnail should be a "
"stalker.models.link.File instance, "
"stalker.models.file.File instance, "
f"not {thumb.__class__.__name__}: '{thumb}'"
)
return thumb
Expand Down
8 changes: 4 additions & 4 deletions src/stalker/models/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
from stalker.models.auth import Permission
from stalker.models.project import Project
from stalker.models.status import Status, StatusList
from stalker.models.link import File
from stalker.models.file import File
from stalker.models.studio import WorkingHours


Expand Down Expand Up @@ -1042,7 +1042,7 @@ def _validate_project(self, key: str, project: "Project") -> "Project":
class ReferenceMixin(object):
"""Adds reference capabilities to the mixed in class.
References are :class:`stalker.models.link.File` instances or anything
References are :class:`stalker.models.file.File` instances or anything
derived from it, which adds information to the attached objects. The aim of
the References are generally to give more info to direct the evolution of
the object.
Expand Down Expand Up @@ -1099,13 +1099,13 @@ def _validate_references(self, key: str, reference: "File") -> "File":
Returns:
File: The validated reference value.
"""
from stalker.models.link import File
from stalker.models.file import File

# all the items should be instance of stalker.models.entity.Entity
if not isinstance(reference, File):
raise TypeError(
f"All the items in the {self.__class__.__name__}.references should "
"be stalker.models.link.File instances, "
"be stalker.models.file.File instances, "
f"not {reference.__class__.__name__}: '{reference}'"
)
return reference
Expand Down
6 changes: 3 additions & 3 deletions src/stalker/models/review.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from stalker.log import get_logger
from stalker.models.entity import Entity, SimpleEntity
from stalker.models.enum import DependencyTarget, TimeUnit, TraversalDirection
from stalker.models.link import File
from stalker.models.file import File
from stalker.models.mixins import (
ProjectMixin,
ScheduleMixin,
Expand Down Expand Up @@ -510,7 +510,7 @@ class DailyFile(Base):
)
file: Mapped[File] = relationship(
primaryjoin="DailyFile.file_id==File.file_id",
doc="""stalker.models.link.File instances related to the Daily instance.
doc="""stalker.models.file.File instances related to the Daily instance.
Attach the same :class:`.File` instances that are linked as an output
to a certain :class:`.Version` s instance to this attribute.
Expand Down Expand Up @@ -558,7 +558,7 @@ def _validate_file(self, key: str, file: Union[None, File]) -> Union[None, File]
if file is not None and not isinstance(file, File):
raise TypeError(
f"{self.__class__.__name__}.file should be an instance of "
"stalker.models.link.File instance, "
"stalker.models.file.File instance, "
f"not {file.__class__.__name__}: '{file}'"
)

Expand Down
6 changes: 3 additions & 3 deletions src/stalker/models/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from stalker.db.session import DBSession
from stalker.log import get_logger
from stalker.models.enum import TraversalDirection
from stalker.models.link import File
from stalker.models.file import File
from stalker.models.mixins import DAGMixin
from stalker.models.review import Review
from stalker.models.task import Task
Expand Down Expand Up @@ -417,7 +417,7 @@ def _validate_inputs(self, key, input_):
if not isinstance(input_, File):
raise TypeError(
"All elements in {}.inputs should be all "
"stalker.models.link.File instances, not {}: '{}'".format(
"stalker.models.file.File instances, not {}: '{}'".format(
self.__class__.__name__, input_.__class__.__name__, input_
)
)
Expand All @@ -441,7 +441,7 @@ def _validate_outputs(self, key, output) -> File:
if not isinstance(output, File):
raise TypeError(
"All elements in {}.outputs should be all "
"stalker.models.link.File instances, not {}: '{}'".format(
"stalker.models.file.File instances, not {}: '{}'".format(
self.__class__.__name__, output.__class__.__name__, output
)
)
Expand Down
4 changes: 2 additions & 2 deletions tests/mixins/test_reference_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def test_references_attribute_accepting_only_lists_of_file_instances(

assert str(cm.value) == (
"All the items in the RefMixFooClass.references should be "
"stalker.models.link.File instances, not int: '1'"
"stalker.models.file.File instances, not int: '1'"
)


Expand All @@ -126,7 +126,7 @@ def test_references_attribute_elements_accepts_files_only(setup_reference_mixin_

assert str(cm.value) == (
"All the items in the RefMixFooClass.references should be "
"stalker.models.link.File instances, not Entity: '<Test Entity 1 (Entity)>'"
"stalker.models.file.File instances, not Entity: '<Test Entity 1 (Entity)>'"
)


Expand Down
4 changes: 2 additions & 2 deletions tests/models/test_daily.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def test_files_argument_is_not_a_list_instance(setup_daily_tests):

assert (
str(cm.value) == "DailyFile.file should be an instance of "
"stalker.models.link.File instance, not str: 'n'"
"stalker.models.file.File instance, not str: 'n'"
)


Expand All @@ -177,7 +177,7 @@ def test_files_argument_is_not_a_list_of_file_instances(setup_daily_tests):
)

assert str(cm.value) == (
"DailyFile.file should be an instance of stalker.models.link.File instance, "
"DailyFile.file should be an instance of stalker.models.file.File instance, "
"not str: 'not'"
)

Expand Down
4 changes: 2 additions & 2 deletions tests/models/test_simple_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ def test_thumbnail_arg_is_not_a_file_instance(setup_simple_entity_tests):
SimpleEntity(**data["kwargs"])

assert str(cm.value) == (
"SimpleEntity.thumbnail should be a stalker.models.link.File instance, "
"SimpleEntity.thumbnail should be a stalker.models.file.File instance, "
"not str: 'not a File'"
)

Expand All @@ -677,7 +677,7 @@ def test_thumbnail_attr_is_not_a_file_instance(setup_simple_entity_tests):
data["test_simple_entity"].thumbnail = "not a File"

assert str(cm.value) == (
"SimpleEntity.thumbnail should be a stalker.models.link.File instance, "
"SimpleEntity.thumbnail should be a stalker.models.file.File instance, "
"not str: 'not a File'"
)

Expand Down
8 changes: 4 additions & 4 deletions tests/models/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ def test_inputs_argument_is_not_a_list_of_file_instances(setup_version_db_tests)

assert (
str(cm.value) == "All elements in Version.inputs should be all "
"stalker.models.link.File instances, not int: '132'"
"stalker.models.file.File instances, not int: '132'"
)


Expand All @@ -605,7 +605,7 @@ def test_inputs_attribute_is_not_a_list_of_file_instances(setup_version_db_tests

assert (
str(cm.value) == "All elements in Version.inputs should be all "
"stalker.models.link.File instances, not int: '132'"
"stalker.models.file.File instances, not int: '132'"
)


Expand Down Expand Up @@ -656,7 +656,7 @@ def test_outputs_argument_is_not_a_list_of_file_instances(setup_version_db_tests

assert (
str(cm.value) == "All elements in Version.outputs should be all "
"stalker.models.link.File instances, not int: '132'"
"stalker.models.file.File instances, not int: '132'"
)


Expand All @@ -669,7 +669,7 @@ def test_outputs_attribute_is_not_a_list_of_file_instances(setup_version_db_test

assert (
str(cm.value) == "All elements in Version.outputs should be all "
"stalker.models.link.File instances, not int: '132'"
"stalker.models.file.File instances, not int: '132'"
)


Expand Down

0 comments on commit f9bd304

Please sign in to comment.