This file is indexed.

/usr/lib/python3/dist-packages/bumps/plugin.py is in python3-bumps 0.7.6-3.

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
109
110
111
112
"""
Bumps plugin architecture.

With sophisticated models, developers need to be able to provide tools
such as model builders and data viewers.

Some of these will be tools for the GUI, such as views.  Others will be
tools to display results.

This file defines the interface that can be defined by your own application
so that it interacts with models of your type.  Define your own model
package with a module plugin.py.

Create a main program which looks like::


    if __name__ == "__main__":
        import multiprocessing
        multiprocessing.freeze_support()

        import bumps.cli
        import mypackage.plugin
        bumps.cli.install_plugin(mypackage.plugin)
        bumps.cli.main()

You should be able to use this as a driver program for your application.

Note: the plugin architecture is likely to change radically as more models
are added to the system, particularly so that we can accommodate simultaneous
fitting of data taken using different experimental techniques.  For now, only
only one plugin at a time is supported.
"""

__all__ = [
    'new_model',
    'load_model',
    'calc_errors',
    'show_errors',
    'data_view',
    'model_view',
]

# TODO: refl1d wants to do the following after cli.getopts()
#
#    from refl1d.probe import Probe
#    Probe.view = opts.plot
#
# It also wants to modify the opts so that more plotters are available,
# such as Fresnel.


def new_model():
    """
    Return a new empty model or None.

    Called in response to >File >New from the GUI.  Creates a new empty
    model.  Also triggered if GUI is started without a model.
    """
    return None


def load_model(filename):
    """
    Return a model stored within a file.

    This routine is for specialized model descriptions not defined by script.

    If the filename does not contain a model of the appropriate type (e.g.,
    because the extension is incorrect), then return None.

    No need to load pickles or script models.  These will be attempted if
    load_model returns None.
    """
    return None


def calc_errors(problem, sample):
    """
    Gather data needed to display uncertainty in the model and the data.

    Returns an object to be passed later to :func:`show_errors`.
    """
    return None


def show_errors(errs):
    """
    Display the model with uncertainty on the current figure.

    *errs* is the data returned from calc_errs.
    """
    pass


def data_view():
    """
    Panel factory for the data tab in the GUI.

    If your model has an adequate show() function this should not be
    necessary.
    """
    from .gui.data_view import DataView
    return DataView


def model_view():
    """
    Panel factory for the model tab in the GUI.

    Return None if not present.
    """
    return None