commit inicial

This commit is contained in:
Mauro Torrez
2019-06-02 18:35:36 -03:00
commit 16c2f29f06
8 changed files with 1169 additions and 0 deletions

15
filter_plugins/belist.py Normal file
View File

@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
from collections import Sequence
def assert_list(arg):
''' Convert string argument to list-of-strings '''
if isinstance(arg, basestring):
return [ arg ]
if not isinstance(arg, Sequence):
return [ arg ]
return arg
class FilterModule(object):
def filters(self):
return {
'belist': assert_list
}

15
filter_plugins/binary.py Normal file
View File

@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
from collections import Sequence
def binary(arg,yes_value='yes',no_value='no'):
''' Convert boolean argument to 'yes' or 'no' string value '''
if isinstance(arg, bool):
if arg:
return yes_value
return no_value
return arg
class FilterModule(object):
def filters(self):
return {
'binary': binary
}