本文整理汇总了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)
示例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)