mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-14 02:26:53 -07:00
Move common libs to libs/common
This commit is contained in:
parent
8dbb1a2451
commit
1f4bd41bcc
1612 changed files with 962 additions and 10 deletions
79
libs/common/rebulk/test/default_rules_module.py
Normal file
79
libs/common/rebulk/test/default_rules_module.py
Normal file
|
@ -0,0 +1,79 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# pylint: disable=no-self-use, 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')
|
Loading…
Add table
Add a link
Reference in a new issue