当前位置: 首页>>代码示例>>Python>>正文


Python KarmaManager.register方法代码示例

本文整理汇总了Python中karma.manager.KarmaManager.register方法的典型用法代码示例。如果您正苦于以下问题:Python KarmaManager.register方法的具体用法?Python KarmaManager.register怎么用?Python KarmaManager.register使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在karma.manager.KarmaManager的用法示例。


在下文中一共展示了KarmaManager.register方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: AnswerMarkedHelpfulAction

# 需要导入模块: from karma.manager import KarmaManager [as 别名]
# 或者: from karma.manager.KarmaManager import register [as 别名]
    action_type = "first-answer"
    points = 5


class AnswerMarkedHelpfulAction(KarmaAction):
    """The user's answer was voted as helpful."""

    action_type = "helpful-answer"
    points = 10


class AnswerMarkedNotHelpfulAction(KarmaAction):
    """The user's answer was voted as not helpful."""

    action_type = "nothelpful-answer"
    points = -10


class SolutionAction(KarmaAction):
    """The user's answer was marked as the solution."""

    action_type = "solution"
    points = 25


KarmaManager.register(AnswerAction)
KarmaManager.register(FirstAnswerAction)
KarmaManager.register(AnswerMarkedHelpfulAction)
KarmaManager.register(AnswerMarkedNotHelpfulAction)
KarmaManager.register(SolutionAction)
开发者ID:erikrose,项目名称:kitsune,代码行数:32,代码来源:karma_actions.py

示例2: TestAction1

# 需要导入模块: from karma.manager import KarmaManager [as 别名]
# 或者: from karma.manager.KarmaManager import register [as 别名]
from karma.actions import KarmaAction
from karma.manager import KarmaManager


class TestAction1(KarmaAction):
    """A test action for testing!"""
    action_type = 'test-action-1'
    points = 3


class TestAction2(KarmaAction):
    """Another test action for testing!"""
    action_type = 'test-action-2'
    points = 7


KarmaManager.action_types = {}  # Clear them out for tests.
KarmaManager.register(TestAction1)
KarmaManager.register(TestAction2)
开发者ID:erikrose,项目名称:kitsune,代码行数:21,代码来源:__init__.py


注:本文中的karma.manager.KarmaManager.register方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。