コード例 #1
0
ファイル: one-line.py プロジェクト: dmanubens-zz/cylc
#!/usr/bin/env python

import os, sys

fpath = os.path.dirname(os.path.abspath(__file__))
# parsec
sys.path.append( fpath + '/../../..' )

"""
Check that single-line config print works
""" 

from config import config
from validate import validator as vdr
from OrderedDict import OrderedDict

SPEC = { 'foo' : { 'bar' : { '__MANY__' : vdr( vtype="string" ) } } }
cfg = config( SPEC )
cfg.loadcfg( "test.rc" )

cfg.mdump ( [['foo','bar','baz'],['foo','bar','qux']], oneline=True, sparse=True)
コード例 #2
0
ファイル: empty.py プロジェクト: dmanubens/cylc
#!/usr/bin/env python

import os, sys

fpath = os.path.dirname(os.path.abspath(__file__))
# parsec
sys.path.append( fpath + '/../../..' )

"""
An empty config file should successfully yield an empty sparse config dict.
""" 

from config import config
from validate import validator as vdr
from OrderedDict import OrderedDict

SPEC = { 'title' : vdr( vtype="string" ) }
cfg = config( SPEC )
cfg.loadcfg( "empty.rc" )

if cfg.get(sparse=True) != OrderedDict():
    sys.exit(1)
コード例 #3
0
ファイル: test_spec.py プロジェクト: areinecke/cylc
        os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))

from fileparse import parse
from util import printcfg
from validate import validator as vdr
from validate import validate, expand
"""
Legal items and validators for the parsec test config file.
"""

TEST_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'test.rc')

cfg = None

SPEC = {
    'unquoted': vdr(vtype="string"),
    'continuation': vdr(vtype="string"),
    'level 1': {
        'single-quoted': vdr(vtype="string"),
        'level 2': {
            'double-quoted': vdr(vtype="string"),
            'level 3': {
                'single-line triple-single-quoted': vdr(vtype="string"),
                'single-line triple-double-quoted': vdr(vtype="string"),
                'empty value': vdr(vtype="string"),
            },
        },
        'level 2_2': {
            'multiline value': vdr(vtype="string"),
            '__MANY__': vdr(vtype="string"),
        },
コード例 #4
0
ファイル: cfgspec.py プロジェクト: dmanubens/cylc
#C: This program is distributed in the hope that it will be useful,
#C: but WITHOUT ANY WARRANTY; without even the implied warranty of
#C: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#C: GNU General Public License for more details.
#C:
#C: You should have received a copy of the GNU General Public License
#C: along with this program.  If not, see <http://www.gnu.org/licenses/>.

from validate import validator as vdr

"""
Legal items and validators for the parsec test config file.
"""

SPEC = {
        'title' : vdr( vtype="string" ),
        'single values' :
        {
            'integers' : { '__MANY__' : vdr( vtype="integer" ) },
            'booleans' : { '__MANY__' : vdr( vtype="boolean" ) },
            'floats'   : { '__MANY__' : vdr( vtype="float"   ) },
            'strings'  : { '__MANY__' : vdr( vtype="string"  ) },
            'strings with internal comments'  : { '__MANY__' : vdr( vtype="string"  ) },
            'multiline strings'  : { '__MANY__' : vdr( vtype="string"  ) },
            'multiline strings with internal comments'  : { '__MANY__' : vdr( vtype="string"  ) },
             },
        'list values' :
        {
            'string lists' :
            {
                '__MANY__'   : vdr( vtype="string_list"  ),
コード例 #5
0
ファイル: test_spec.py プロジェクト: areinecke/cylc
from fileparse import parse
from util import printcfg
from validate import validator as vdr
from validate import validate, expand

"""
Legal items and validators for the parsec test config file.
"""

TEST_FILE = os.path.join( os.path.dirname( os.path.abspath( __file__ )), 'test.rc' )

cfg = None

SPEC = {
        'unquoted' : vdr( vtype="string" ),
        'continuation' : vdr( vtype="string" ),
        'level 1' : 
        {
            'single-quoted' : vdr( vtype="string" ),
            'level 2' :
            {
                'double-quoted' : vdr( vtype="string" ),
                'level 3' :
                {
                    'single-line triple-single-quoted' : vdr( vtype="string" ),
                    'single-line triple-double-quoted' : vdr( vtype="string" ),
                    'empty value' : vdr( vtype="string" ),
                    },
                },
            'level 2_2' :
コード例 #6
0
#C: (at your option) any later version.
#C:
#C: This program is distributed in the hope that it will be useful,
#C: but WITHOUT ANY WARRANTY; without even the implied warranty of
#C: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#C: GNU General Public License for more details.
#C:
#C: You should have received a copy of the GNU General Public License
#C: along with this program.  If not, see <http://www.gnu.org/licenses/>.

from validate import validator as vdr

SPEC = {
    'boolean': {
        '__MANY__': {
            '__MANY__': vdr(vtype="boolean")
        },
    },
    'integer': {
        '__MANY__': {
            '__MANY__': vdr(vtype="integer")
        },
    },
    'float': {
        '__MANY__': {
            '__MANY__': vdr(vtype="float")
        },
    },
    'string': {
        '__MANY__': {
            '__MANY__': vdr(vtype="string")
コード例 #7
0
#!/usr/bin/env python

import os, sys

fpath = os.path.dirname(os.path.abspath(__file__))
# parsec
sys.path.append(fpath + '/../../..')
"""
An empty config file should successfully yield an empty sparse config dict.
"""

from config import config
from validate import validator as vdr
from OrderedDict import OrderedDict

SPEC = {'title': vdr(vtype="string")}
cfg = config(SPEC)
cfg.loadcfg("empty.rc")

if cfg.get(sparse=True) != OrderedDict():
    sys.exit(1)
コード例 #8
0
ファイル: cfgspec.py プロジェクト: dmanubens-zz/cylc
#C:
#C: This program is distributed in the hope that it will be useful,
#C: but WITHOUT ANY WARRANTY; without even the implied warranty of
#C: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#C: GNU General Public License for more details.
#C:
#C: You should have received a copy of the GNU General Public License
#C: along with this program.  If not, see <http://www.gnu.org/licenses/>.

from validate import validator as vdr
"""
Legal items and validators for the parsec test config file.
"""

SPEC = {
    'title': vdr(vtype="string"),
    'single values': {
        'integers': {
            '__MANY__': vdr(vtype="integer")
        },
        'booleans': {
            '__MANY__': vdr(vtype="boolean")
        },
        'floats': {
            '__MANY__': vdr(vtype="float")
        },
        'strings': {
            '__MANY__': vdr(vtype="string")
        },
        'strings with internal comments': {
            '__MANY__': vdr(vtype="string")
コード例 #9
0
ファイル: cfgspec.py プロジェクト: raghu330/cylc
#C: the Free Software Foundation, either version 3 of the License, or
#C: (at your option) any later version.
#C:
#C: This program is distributed in the hope that it will be useful,
#C: but WITHOUT ANY WARRANTY; without even the implied warranty of
#C: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#C: GNU General Public License for more details.
#C:
#C: You should have received a copy of the GNU General Public License
#C: along with this program.  If not, see <http://www.gnu.org/licenses/>.

from validate import validator as vdr

SPEC = {
        'boolean' : {
            '__MANY__' : { '__MANY__' : vdr( vtype="boolean" ) },
            }, 
        'integer' : { 
            '__MANY__' : { '__MANY__' : vdr( vtype="integer" ) },
            },
        'float'   : { 
            '__MANY__' : { '__MANY__' : vdr( vtype="float"   ) },
            },
        'string'  : {
            '__MANY__' : { '__MANY__' : vdr( vtype="string"  ) },
            },
        'string_list' : {
            '__MANY__' : { '__MANY__'   : vdr( vtype="string_list" ) },
            },
        'float_list' : {
            '__MANY__' : { '__MANY__' : vdr( vtype="float_list", allow_zeroes=False   ) },