File: default_rules_module.py

package info (click to toggle)
python-rebulk 3.3.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 752 kB
  • sloc: python: 7,497; makefile: 3
file content (79 lines) | stat: -rw-r--r-- 2,295 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=pointless-statement, missing-docstring, invalid-name, len-as-condition
from ..match import Match
from ..rules import Rule, RemoveMatch, AppendMatch, RenameMatch, AppendTags, RemoveTags


class RuleRemove0(Rule):
    consequence = RemoveMatch
    def when(self, matches, context):
        return matches[0]


class RuleAppend0(Rule):
    consequence = AppendMatch()
    def when(self, matches, context):
        return Match(5, 10)

class RuleRename0(Rule):
    consequence = [RenameMatch('renamed')]
    def when(self, matches, context):
        return [Match(5, 10, name="original")]

class RuleRemove1(Rule):
    consequence = [RemoveMatch()]
    def when(self, matches, context):
        return [matches[0]]

class RuleAppend1(Rule):
    consequence = [AppendMatch]
    def when(self, matches, context):
        return [Match(5, 10)]

class RuleRename1(Rule):
    consequence = RenameMatch('renamed')
    def when(self, matches, context):
        return [Match(5, 10, name="original")]

class RuleAppend2(Rule):
    consequence = [AppendMatch('renamed')]
    properties = {'renamed': [None]}
    def when(self, matches, context):
        return [Match(5, 10)]

class RuleRename2(Rule):
    consequence = RenameMatch('renamed')
    def when(self, matches, context):
        return Match(5, 10, name="original")

class RuleAppend3(Rule):
    consequence = AppendMatch('renamed')
    properties = {'renamed': [None]}
    def when(self, matches, context):
        return [Match(5, 10)]

class RuleRename3(Rule):
    consequence = [RenameMatch('renamed')]
    def when(self, matches, context):
        return Match(5, 10, name="original")

class RuleAppendTags0(Rule):
    consequence = AppendTags(['new-tag'])
    def when(self, matches, context):
        return matches.named('tags', 0)

class RuleRemoveTags0(Rule):
    consequence = RemoveTags(['new-tag'])
    def when(self, matches, context):
        return matches.named('tags', 0)

class RuleAppendTags1(Rule):
    consequence = AppendTags(['new-tag'])
    def when(self, matches, context):
        return matches.named('tags')

class RuleRemoveTags1(Rule):
    consequence = RemoveTags(['new-tag'])
    def when(self, matches, context):
        return matches.named('tags')