chore(nodes): remove deprecation logic for nodes API

This commit is contained in:
psychedelicious 2024-02-11 09:43:36 +11:00 committed by Brandon Rising
parent 17ed6cc82f
commit 54d92cb246

View File

@ -1,7 +1,6 @@
from dataclasses import dataclass from dataclasses import dataclass
from typing import TYPE_CHECKING, Optional from typing import TYPE_CHECKING, Optional
from deprecated import deprecated
from PIL.Image import Image from PIL.Image import Image
from torch import Tensor from torch import Tensor
@ -334,30 +333,6 @@ class UtilInterface(InvocationContextInterface):
) )
deprecation_version = "3.7.0"
removed_version = "3.8.0"
def get_deprecation_reason(property_name: str, alternative: Optional[str] = None) -> str:
msg = f"{property_name} is deprecated as of v{deprecation_version}. It will be removed in v{removed_version}."
if alternative is not None:
msg += f" Use {alternative} instead."
msg += " See PLACEHOLDER_URL for details."
return msg
# Deprecation docstrings template. I don't think we can implement these programmatically with
# __doc__ because the IDE won't see them.
"""
**DEPRECATED as of v3.7.0**
PROPERTY_NAME will be removed in v3.8.0. Use ALTERNATIVE instead. See PLACEHOLDER_URL for details.
OG_DOCSTRING
"""
class InvocationContext: class InvocationContext:
""" """
The `InvocationContext` provides access to various services and data for the current invocation. The `InvocationContext` provides access to various services and data for the current invocation.
@ -397,93 +372,6 @@ class InvocationContext:
self._services = services self._services = services
"""Provides access to the full application services. This is an internal API and may change without warning.""" """Provides access to the full application services. This is an internal API and may change without warning."""
@property
@deprecated(version=deprecation_version, reason=get_deprecation_reason("`context.services`"))
def services(self) -> InvocationServices:
"""
**DEPRECATED as of v3.7.0**
`context.services` will be removed in v3.8.0. See PLACEHOLDER_URL for details.
The invocation services.
"""
return self._services
@property
@deprecated(
version=deprecation_version,
reason=get_deprecation_reason("`context.graph_execution_state_id", "`context._data.session_id`"),
)
def graph_execution_state_id(self) -> str:
"""
**DEPRECATED as of v3.7.0**
`context.graph_execution_state_api` will be removed in v3.8.0. Use `context._data.session_id` instead. See PLACEHOLDER_URL for details.
The ID of the session (aka graph execution state).
"""
return self._data.session_id
@property
@deprecated(
version=deprecation_version,
reason=get_deprecation_reason("`context.queue_id`", "`context._data.queue_id`"),
)
def queue_id(self) -> str:
"""
**DEPRECATED as of v3.7.0**
`context.queue_id` will be removed in v3.8.0. Use `context._data.queue_id` instead. See PLACEHOLDER_URL for details.
The ID of the queue.
"""
return self._data.queue_id
@property
@deprecated(
version=deprecation_version,
reason=get_deprecation_reason("`context.queue_item_id`", "`context._data.queue_item_id`"),
)
def queue_item_id(self) -> int:
"""
**DEPRECATED as of v3.7.0**
`context.queue_item_id` will be removed in v3.8.0. Use `context._data.queue_item_id` instead. See PLACEHOLDER_URL for details.
The ID of the queue item.
"""
return self._data.queue_item_id
@property
@deprecated(
version=deprecation_version,
reason=get_deprecation_reason("`context.queue_batch_id`", "`context._data.batch_id`"),
)
def queue_batch_id(self) -> str:
"""
**DEPRECATED as of v3.7.0**
`context.queue_batch_id` will be removed in v3.8.0. Use `context._data.batch_id` instead. See PLACEHOLDER_URL for details.
The ID of the batch.
"""
return self._data.batch_id
@property
@deprecated(
version=deprecation_version,
reason=get_deprecation_reason("`context.workflow`", "`context._data.workflow`"),
)
def workflow(self) -> Optional[WorkflowWithoutID]:
"""
**DEPRECATED as of v3.7.0**
`context.workflow` will be removed in v3.8.0. Use `context._data.workflow` instead. See PLACEHOLDER_URL for details.
The workflow associated with this queue item, if any.
"""
return self._data.workflow
def build_invocation_context( def build_invocation_context(
services: InvocationServices, services: InvocationServices,