This file is indexed.

/usr/share/doc/python-pebl/html/_sources/config.txt is in python-pebl-doc 1.0.2-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
:mod:`config` -- Pebl's configuration system
=============================================

.. module:: pebl.config
    :synopsis: Pebl's configuration system

The config module defines a set of parameter types and functions to validate
user input. A module or class can define a parameter by creating an instance of
one of the Parameter classes -- it is automatically registered with the config
module. Many modules provide a fromconfig() factory function that create and
return a parametrized object.


Specifying Parameters
---------------------

A Parameter definition requires the following:

    * a name of the form section.option
      (examples: data.filename, result.format)
    * a short description
    * a validator function  

      The function has one argument: the string value of the parameter. It
      should return true if the value is valid and false otherwise.  The config
      module includes several factory functions that create
      validator functions. See section on validator factories.
    * a default value specified as a string  
       
Example parameter definitions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

From the pebl.data module::

    _pfilename = config.StringParameter(
        'data.filename',
        'File to read data from.',
        config.fileexists(),
    )

In the above example, the config.fileexists() function returns a validator
function that checks whether the file exists.

From the pebl.result module::

    _psize = config.IntParameter(
        'result.numnetworks',
        \"\"\"Number of top-scoring networks to save. Specify 0 to indicate that
        all scored networks should be saved.\"\"\",
        default=1000
    )

In the above example, The IntParameter subclass of Parameter automatically
checks whether the parameter value is an integer and raises an error if it is
not. It thus does not require an additional validator.

Parameter Types
---------------

.. autoclass:: StringParameter
.. autoclass:: IntParameter
.. autoclass:: FloatParameter


Validator Factories
-------------------

The following functions create validator functions.

.. autofunction:: between
.. autofunction:: oneof
.. autofunction:: atleast
.. autofunction:: atmost
.. autofunction:: fileexists


Using Parameters
----------------

Parameters can be set with the config.set function or in a configuration file.
The config file should be in a format compatible with Python's ConfigParser
module.

Specifying parameter values using a config file::
    
    [data]
    filename = example_data.txt

    [result]
    format=html

Specifying parameter values using config.set::

    from pebl import config
    config.set('data.filename', 'example_data.txt')
    config.set('result.format', 'html')

.. autofunction:: set


The following functions are used for reading, getting, writing and listing
parameters.

.. autofunction:: read
.. autofunction:: get
.. autofunction:: write
.. autofunction:: parameters
.. autofunction:: configobj