from __future__ import annotations

import abc
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from gaphor.core.modeling import Element
    from gaphor.diagram.diagramtoolbox import ToolboxDefinition


class Service(metaclass=abc.ABCMeta):
    """Base interface for all services in Gaphor."""

    @abc.abstractmethod
    def shutdown(self) -> None:
        """Shutdown the services, free resources."""


class ActionProvider(metaclass=abc.ABCMeta):
    """An action provider is a special service that provides actions (see
    gaphor/action.py)."""


class ModelingLanguage(metaclass=abc.ABCMeta):
    """A model provider is a special service that provides an entrypoint to a
    model implementation, such as UML, SysML, RAAML."""

    @abc.abstractproperty
    def name(self) -> str:
        """Human readable name of the model."""

    @abc.abstractproperty
    def toolbox_definition(self) -> ToolboxDefinition:
        """Get structure for the toolbox."""

    @abc.abstractmethod
    def lookup_element(self, name: str) -> type[Element] | None:
        """Look up a model element type (class) by name."""

from __future__ import annotations

from abc import ABCMeta, abstractmethod
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from gaphor.core.modeling import Element
    from gaphor.diagram.diagramtoolbox import ToolboxDefinition


class Service(metaclass=ABCMeta):
    """Base interface for all services in Gaphor."""

    @abstractmethod
    def shutdown(self) -> None:
        """Shutdown the services, free resources."""


class ActionProvider(metaclass=ABCMeta):
    """An action provider is a special service that provides actions (see
    gaphor/action.py)."""


class ModelingLanguage(metaclass=ABCMeta):
    """A model provider is a special service that provides an entrypoint to a
    model implementation, such as UML, SysML, RAAML."""

    @property
    @abstractmethod
    def name(self) -> str:
        """Human readable name of the model."""

    @property
    @abstractmethod
    def toolbox_definition(self) -> ToolboxDefinition:
        """Get structure for the toolbox."""

    @abstractmethod
    def lookup_element(self, name: str) -> type[Element] | None:
        """Look up a model element type (class) by name."""

Remove use of deprecated abstractproperty
Remove use of deprecated abstractproperty

Signed-off-by: Dan Yeaw <2591e5f46f28d303f9dc027d475a5c60d8dea17a@yeaw.me>

  from __future__ import annotations
  
- import abc
+ from abc import ABCMeta, abstractmethod
  from typing import TYPE_CHECKING
  
  if TYPE_CHECKING:
      from gaphor.core.modeling import Element
      from gaphor.diagram.diagramtoolbox import ToolboxDefinition
  
  
- class Service(metaclass=abc.ABCMeta):
+ class Service(metaclass=ABCMeta):
      """Base interface for all services in Gaphor."""
  
-     @abc.abstractmethod
+     @abstractmethod
      def shutdown(self) -> None:
          """Shutdown the services, free resources."""
  
  
- class ActionProvider(metaclass=abc.ABCMeta):
+ class ActionProvider(metaclass=ABCMeta):
      """An action provider is a special service that provides actions (see
      gaphor/action.py)."""
  
  
- class ModelingLanguage(metaclass=abc.ABCMeta):
+ class ModelingLanguage(metaclass=ABCMeta):
      """A model provider is a special service that provides an entrypoint to a
      model implementation, such as UML, SysML, RAAML."""
  
-     @abc.abstractproperty
+     @property
+     @abstractmethod
      def name(self) -> str:
          """Human readable name of the model."""
  
-     @abc.abstractproperty
+     @property
+     @abstractmethod
      def toolbox_definition(self) -> ToolboxDefinition:
          """Get structure for the toolbox."""
  
-     @abc.abstractmethod
+     @abstractmethod
      def lookup_element(self, name: str) -> type[Element] | None:
          """Look up a model element type (class) by name."""
  
Remove use of deprecated abstractproperty
## Code Before:
from __future__ import annotations

import abc
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from gaphor.core.modeling import Element
    from gaphor.diagram.diagramtoolbox import ToolboxDefinition


class Service(metaclass=abc.ABCMeta):
    """Base interface for all services in Gaphor."""

    @abc.abstractmethod
    def shutdown(self) -> None:
        """Shutdown the services, free resources."""


class ActionProvider(metaclass=abc.ABCMeta):
    """An action provider is a special service that provides actions (see
    gaphor/action.py)."""


class ModelingLanguage(metaclass=abc.ABCMeta):
    """A model provider is a special service that provides an entrypoint to a
    model implementation, such as UML, SysML, RAAML."""

    @abc.abstractproperty
    def name(self) -> str:
        """Human readable name of the model."""

    @abc.abstractproperty
    def toolbox_definition(self) -> ToolboxDefinition:
        """Get structure for the toolbox."""

    @abc.abstractmethod
    def lookup_element(self, name: str) -> type[Element] | None:
        """Look up a model element type (class) by name."""

## Instruction:
Remove use of deprecated abstractproperty
## Code After:
from __future__ import annotations

from abc import ABCMeta, abstractmethod
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from gaphor.core.modeling import Element
    from gaphor.diagram.diagramtoolbox import ToolboxDefinition


class Service(metaclass=ABCMeta):
    """Base interface for all services in Gaphor."""

    @abstractmethod
    def shutdown(self) -> None:
        """Shutdown the services, free resources."""


class ActionProvider(metaclass=ABCMeta):
    """An action provider is a special service that provides actions (see
    gaphor/action.py)."""


class ModelingLanguage(metaclass=ABCMeta):
    """A model provider is a special service that provides an entrypoint to a
    model implementation, such as UML, SysML, RAAML."""

    @property
    @abstractmethod
    def name(self) -> str:
        """Human readable name of the model."""

    @property
    @abstractmethod
    def toolbox_definition(self) -> ToolboxDefinition:
        """Get structure for the toolbox."""

    @abstractmethod
    def lookup_element(self, name: str) -> type[Element] | None:
        """Look up a model element type (class) by name."""
