.

# phoebe.frontend package¶

## phoebe.frontend.bundle module¶

class phoebe.frontend.bundle.Bundle(params=None)[source]

Main container class for PHOEBE 2.

The Bundle is the main object in PHOEBE 2 which is used to store and filter all available system parameters as well as handling attaching datasets, running models, and accessing synthetic data.

The Bundle is simply a glorified phoebe.parameters.parameters.ParameterSet. In fact, filtering on a Bundle gives you a ParameterSet (and filtering on a ParameterSet gives you another ParameterSet). The only difference is that most “actions” are only available at the Bundle level (as they need to access /all/ parameters).

Make sure to also see the documentation and methods for * phoebe.parameters.parameters.ParameterSet * phoebe.parameters.parameters.Parameter * phoebe.parameters.parameters.FloatParameter * phoebe.parameters.parameters.ArrayParameter

To initialize a new bundle, see:
To filter parameters and set values, see:
To deal with datasets, see:
To compute forward models, see:
To plot observations or synthetic datasets, see:

Initialize a new Bundle.

Initializing a new bundle without a constructor is possible, but not advised. It is suggested that you use one of the constructors below.

Available constructors:
Parameters: parameters (list) – list of phoebe.parameters.parameters.Parameter to create the Bundle (optional) instantiated Bundle object
classmethod open(filename)[source]

Open a new bundle.

Open a bundle from a JSON-formatted PHOEBE 2.0 (beta) file. This is a constructor so should be called as:

>>> b = Bundle.open('test.phoebe')

Parameters: filename (str) – relative or full path to the file instantiated Bundle object
classmethod from_server(bundleid, server='http://localhost:5555', as_client=True)[source]

Load a new bundle from a server.

[NOT IMPLEMENTED]

Load a bundle from a phoebe server. This is a constructor so should be called as:

>>> b = Bundle.from_server('asdf', as_client=False)

Parameters: bundleid (str) – the identifier given to the bundle by the server server (str) – the host (and port) of the server as_client (bool) – whether to attach in client mode (default: True)
classmethod from_catalog(identifier)[source]

Load a new bundle from the phoebe catalog.

[NOTIMPLEMENTED]

Load a bundle from the online catalog. This is a constructor so should be called as:

>>> b = Bundle.from_catalog(identifier)

Parameters: identifier (str) – identifier of the object in the catalog instantiated Bundle object NotImplementedError – because this isn’t implemented yet
classmethod from_legacy(filename, add_compute_legacy=False, add_compute_phoebe=True)[source]

Load a bundle from a PHOEBE 1.0 Legacy file.

This is a constructor so should be called as:

>>> b = Bundle.from_legacy('myfile.phoebe')

Parameters: filename (str) – relative or full path to the file instantiated Bundle object
classmethod default_star(starA='starA')[source]

Load a bundle with a default single star as the system.

sun

This is a constructor, so should be called as:

>>> b = Bundle.default_binary()

Returns: instatiated :classBundle object
classmethod default_binary(starA='primary', starB='secondary', orbit='binary', contact_binary=False)[source]

Load a bundle with a default binary as the system.

primary - secondary

This is a constructor, so should be called as:

>>> b = Bundle.default_binary()

Returns: instantiated Bundle object
classmethod default_triple(inner_as_primary=True, inner_as_overcontact=False, starA='starA', starB='starB', starC='starC', inner='inner', outer='outer', contact_envelope='contact_envelope')[source]

Load a bundle with a default triple system.

Set inner_as_primary based on what hierarchical configuration you want.

inner_as_primary = True:

starA - starB – starC

inner_as_primary = False:

starC – starA - starB

This is a constructor, so should be called as:

>>> b = Bundle.default_triple_primary()

Parameters: inner_as_primary (bool) – whether the inner-binary should be the primary component of the outer-orbit instantiated Bundle object
save(filename, clear_history=True, incl_uniqueid=False)[source]

Save the bundle to a JSON-formatted ASCII file.

Parameters: filename (str) – relative or full path to the file clear_history (bool) – whether to clear history log items before saving (default: True) incl_uniqueid (bool) – whether to including uniqueids in the file (only needed if its necessary to maintain the uniqueids when reloading) the filename
export_legacy(filename)[source]

as_client(as_client=True, server='http://localhost:5555', bundleid=None)[source]

[NOT IMPLEMENTED]

is_client
client_update()[source]

[NOT IMPLEMENTED]

change_component(old_component, new_component)[source]

Change the label of a component attached to the Bundle

Parameters: old_component (str) – the current name of the component (must exist) new_component (str) – the desired new name of the component (must not exist) None ValueError – if the new_component is forbidden
get_setting(twig=None, **kwargs)[source]

Filter in the ‘setting’ context

Parameters: twig (str) – the twig used for filtering **kwargs – any other tags to do the filter (except tag or context) phoebe.parameters.parameters.ParameterSet
history

Property as a shortcut to get_history()

You can toggle whether history is recorded using
get_history(i=None)[source]

Get a history item by index.

You can toggle whether history is recorded using
Parameters: i (int) – integer for indexing (can be positive or negative). If i is None or not provided, the entire list of history items will be returned phoebe.parameters.parameters.Parameter if i is an int, or phoebe.parameters.parameters.ParameterSet if i is not provided ValueError – if no history items have been recorded.
remove_history(i=None)[source]

Remove a history item from the bundle by index.

You can toggle whether history is recorded using
Parameters: i (int) – integer for indexing (can be positive or negative). If i is None or not provided, the entire list of history items will be removed ValueError – if no history items have been recorded.
history_enabled

Property as a shortcut to b.get_setting(‘log_history).get_value().

You can toggle whether history is recorded using
Returns: whether logging of history items (undo/redo) is enabled. bool
enable_history()[source]

Enable logging history items (undo/redo).

You can check wither history is enabled using history_enabled().

Shortcut to b.get_setting(‘log_history’).set_value(True)

disable_history()[source]

Disable logging history items (undo/redo)

You can check wither history is enabled using history_enabled().

Shortcut to b.get_setting(‘log_history’).set_value(False)

undo(i=-1)[source]

Undo an item in the history logs

Parameters: i (int) – integer for indexing (can be positive or negative). Defaults to -1 if not provided (the latest recorded history item) ValueError – if no history items have been recorded
redo(i=-1)[source]

Redo an item in the history logs

Parameters: i (int) – integer for indexing (can be positive or negative). Defaults to -1 if not provided (the latest recorded history item) ValueError – if no history items have been recorded
set_hierarchy(*args, **kwargs)[source]

Set the hierarchy of the system.

See tutorial on building a system.

TODO: provide documentation args can be - string representation (preferably passed through hierarchy already) - func and strings/PSs/params to pass to function

get_system(twig=None, **kwargs)[source]

Filter in the ‘system’ context

Parameters: twig (str) – twig to use for filtering **kwargs – any other tags to do the filter (except twig or context)
hierarchy

Property shortcut to get_hierarchy()

Returns: the hierarcy phoebe.parameters.parameters.Parameter or None (if no hierarchy exists)
get_hierarchy()[source]

Get the hierarchy parameter

Returns: the hierarcy phoebe.parameters.parameters.Parameter or None (if no hierarchy exists)
compute_critical_pots(component, L1=True, L2=True, L3=True)[source]
compute_critical_rpoles(component, L1=True, L2=True, L3=True)[source]

run_checks(**kwargs)[source]

Check to see whether the system is expected to be computable.

This is called by default for each set_value but will only raise a logger warning if fails. This is also called immediately when calling run_compute().

Returns: True if passed, False if failed and a message
add_feature(kind, component, **kwargs)[source]

Add a new feature (spot, etc) to a component in the system. If not provided, ‘feature’ (the name of the new feature) will be created for you and can be accessed by the ‘feature’ attribute of the returned ParameterSet

>>> b.add_feature(feature.spot, component='mystar')


or

>>> b.add_feature('spot', 'mystar', colat=90)

Available kinds include:
Parameters: kind (str or callable) – function to call that returns a ParameterSet or list of parameters. This must either be a callable function that accepts nothing but default values, or the name of a function (as a string) that can be found in the phoebe.parameters.feature module (ie. ‘spot’) component (str) – name of the component to attach the feature feature (str) – (optional) name of the newly-created feature **kwargs – default value for any of the newly-created parameters phoebe.parameters.parameters.ParameterSet of all parameters that have been added NotImplementedError – if required constraint is not implemented
get_feature(feature=None, **kwargs)[source]

Filter in the ‘proerty’ context

Parameters: feature (str) – name of the feature (optional) **kwargs – any other tags to do the filter (except component or context) phoebe.parameters.parameters.ParameterSet
remove_feature(feature=None, **kwargs)[source]

[NOT IMPLEMENTED]

Remove a ‘feature’ from the bundle

Raises: NotImplementedError – because this isn’t implemented yet
add_spot(component=None, feature=None, **kwargs)[source]

Shortcut to add_feature() but with kind=’spot’

get_spot(feature=None, **kwargs)[source]

Shortcut to get_feature() but with kind=’spot’

remove_spot(feature=None, **kwargs)[source]

[NOT IMPLEMENTED]

Shortcut to remove_feature() but with kind=’spot’

add_component(kind, **kwargs)[source]

Add a new component (star or orbit) to the system. If not provided, ‘component’ (the name of the new star or orbit) will be created for you and can be accessed by the ‘component’ attribute of the returned ParameterSet.

>>> b.add_component(component.star)


or

>>> b.add_component('orbit', period=2.5)

Available kinds include:
Parameters: kind (str or callable) – function to call that returns a ParameterSet or list of parameters. This must either be a callable function that accepts nothing but default values, or the name of a function (as a string) that can be found in the phoebe.parameters.component module (ie. ‘star’, ‘orbit’) component (str) – (optional) name of the newly-created component **kwargs – default values for any of the newly-created parameters phoebe.parameters.parameters.ParameterSet of all parameters that have been added NotImplementedError – if required constraint is not implemented
get_component(component=None, **kwargs)[source]

Filter in the ‘component’ context

Parameters: component (str) – name of the component (optional) **kwargs – any other tags to do the filter (except component or context) phoebe.parameters.parameters.ParameterSet
remove_component(component=None, **kwargs)[source]

[NOT IMPLEMENTED]

Remove a ‘component’ from the bundle

Raises: NotImplementedError – because this isn’t implemented yet
add_orbit(component=None, **kwargs)[source]

Shortcut to add_component() but with kind=’orbit’

get_orbit(component=None, **kwargs)[source]

Shortcut to get_component() but with kind=’star’

remove_orbit(component=None, **kwargs)[source]

[NOT IMPLEMENTED]

Shortcut to remove_component() but with kind=’star’

add_star(component=None, **kwargs)[source]

Shortcut to add_component() but with kind=’star’

get_star(component=None, **kwargs)[source]

Shortcut to get_component() but with kind=’star’

remove_star(component=None, **kwargs)[source]

[NOT IMPLEMENTED]

Shortcut to remove_component() but with kind=’star’

add_envelope(component=None, **kwargs)[source]

[NOT SUPPORTED]

Shortcut to add_component() but with kind=’envelope’

get_envelope(component=None, **kwargs)[source]

[NOT SUPPORTED]

Shortcut to get_component() but with kind=’envelope’

remove_envelope(component=None, **kwargs)[source]

[NOT SUPPORTED] [NOT IMPLEMENTED]

Shortcut to remove_component() but with kind=’envelope’

get_ephemeris(component=None, t0='t0_supconj', shift=True, **kwargs)[source]

Get the ephemeris of a component (star or orbit)

Parameters: component (str) – name of the component. If not given, component will default to the top-most level of the current hierarchy t0 (str) – qualifier of the parameter to be used for t0 shift (boolean) – if true, phase shift is applied (which should be done to models); if false, it is not applied (which is suitable for data). **kwargs – any value passed through kwargs will override the ephemeris retrieved by component (ie period, t0, phshift, dpdt). Note: be careful about units - input values will not be converted. dictionary containing period, t0 (t0_supconj if orbit), phshift, dpdt (as applicable) dict
to_phase(time, shift=True, component=None, t0='t0_supconj', **kwargs)[source]

Get the phase(s) of a time(s) for a given ephemeris

Parameters: time (float, list, or array) – time to convert to phases (should be in same system as t0s) shift (boolean) – if true, phase shift is applied (which should be done to models); if false, it is not applied (which is suitable for data). t0 (str) – qualifier of the parameter to be used for t0 component (str) – component for which to get the ephemeris. If not given, component will default to the top-most level of the current hierarchy **kwargs – any value passed through kwargs will override the ephemeris retrieved by component (ie period, t0, phshift, dpdt). Note: be careful about units - input values will not be converted. phase (float) or phases (array)
to_time(phase, shift=True, component=None, t0='t0_supconj', **kwargs)[source]

Get the time(s) of a phase(s) for a given ephemeris

parameter phase:
phase to convert to times (should be in same system as t0s)
type phase:float, list, or array
parameter shift:
if true, phase shift is applied (which should be done to models); if false, it is not applied (which is suitable for data).
type shift:boolean
 :parameter str component: component for which to get the ephemeris.
If not given, component will default to the top-most level of the current hierarchy
parameter t0: type t0: qualifier of the parameter to be used for t0 str any value passed through kwargs will override the ephemeris retrieved by component (ie period, t0, phshift, dpdt). Note: be careful about units - input values will not be converted. time (float) or times (array)
add_dataset(kind, component=None, **kwargs)[source]

Add a new dataset to the bundle. If not provided, ‘dataset’ (the name of the new dataset) will be created for you and can be accessed by the ‘dataset’ attribute of the returned ParameterSet.

For light curves, if you do not provide a value for ‘component’, the light curve will be generated for the entire system.

For radial velocities, you need to provide a list of components for which values should be computed.

Available kinds include:
Parameters: kind (str or callable) – function to call that returns a ParameterSet or list of parameters. This must either be a callable function that accepts nothing but default values, or the name of a function (as a string) that can be found in the phoebe.parameters.dataset module component (str or list of strings or None) – a list of components for which to compute the observables. For light curves this should be left at None to always compute the light curve for the entire system. For most other types, you need to provide at least one component. dataset (str) – (optional) name of the newly-created dataset **kwargs – default values for any of the newly-created parameters phoebe.parameters.parameters.ParameterSet of all parameters that have been added NotImplementedError – if required constraint is not implemented
get_dataset(dataset=None, **kwargs)[source]

Filter in the ‘dataset’ context

Parameters: dataset (str) – name of the dataset (optional) **kwargs – any other tags to do the filter (except dataset or context) phoebe.parameters.parameters.ParameterSet
remove_dataset(dataset=None, **kwargs)[source]

Remove a dataset from the Bundle.

This removes all matching Parameters from the dataset, model, and constraint contexts (by default if the context tag is not provided).

You must provide some sort of filter or this will raise an Error (so that all Parameters are not accidentally removed).

Parameters: dataset (str) – name of the dataset **kwargs – any other tags to do the filter (except qualifier and dataset) ValueError – if no filter is provided
enable_dataset(dataset=None, **kwargs)[source]

Enable a ‘dataset’. Datasets that are enabled will be computed during run_compute() and included in the cost function during run_fitting().

Parameters: dataset (str) – name of the dataset **kwargs – any other tags to do the filter (except dataset or context) phoebe.parameters.parameters.ParameterSet of the enabled dataset
disable_dataset(dataset=None, **kwargs)[source]

Disable a ‘dataset’. Datasets that are enabled will be computed during run_compute() and included in the cost function during run_fitting().

Parameters: dataset (str) – name of the dataset **kwargs – any other tags to do the filter (except dataset or context) phoebe.parameters.parameters.ParameterSet of the disabled dataset
add_parameter()[source]

[NOT IMPLEMENTED]

Add a new parameter to the bundle

Raises: NotImplementedError – because it isn’t
add_constraint(*args, **kwargs)[source]

args can be string representation (length 1) func and strings to pass to function

get_constraint(twig=None, **kwargs)[source]

Filter in the ‘constraint’ context

Parameters: constraint (str) – name of the constraint (optional) **kwargs – any other tags to do the filter (except constraint or context) phoebe.parameters.parameters.ParameterSet
remove_constraint(twig=None, **kwargs)[source]

Remove a ‘constraint’ from the bundle

Parameters: twig (str) – twig to filter for the constraint **kwargs – any other tags to do the filter (except twig or context)
flip_constraint(twig=None, solve_for=None, **kwargs)[source]

Flip an existing constraint to solve for a different parameter

Parameters: twig (str) – twig to filter the constraint solve_for (str or :class:phoebe.parameters.parameters.Parameter) – twig or actual parameter object of the new parameter which this constraint should constraint (solve for). **kwargs – any other tags to do the filter (except twig or context)
run_constraint(twig=None, **kwargs)[source]

Run a given ‘constraint’ now and set the value of the constrained parameter. In general, there shouldn’t be any need to manually call this - constraints should automatically be run whenever a dependent parameter’s value is change.

Parameters: twig (str) – twig to filter for the constraint **kwargs – any other tags to do the filter (except twig or context) the resulting value of the constraint float or units.Quantity
run_delayed_constraints()[source]
add_compute(kind=<function phoebe>, **kwargs)[source]

Add a set of computeoptions for a given backend to the bundle. The label (‘compute’) can then be sent to run_compute().

If not provided, ‘compute’ will be created for you and can be accessed by the ‘compute’ attribute of the returned ParameterSet.

Available kinds include:
Parameters: kind (str or callable) – function to call that returns a ParameterSet or list of parameters. This must either be a callable function that accepts nothing but default values, or the name of a function (as a string) that can be found in the phoebe.parameters.compute module compute (str) – (optional) name of the newly-created compute optins **kwargs – default values for any of the newly-created parameters phoebe.parameters.parameters.ParameterSet of all parameters that have been added NotImplementedError – if required constraint is not implemented
get_compute(compute=None, **kwargs)[source]

Filter in the ‘compute’ context

Parameters: compute (str) – name of the compute options (optional) **kwargs – any other tags to do the filter (except compute or context) phoebe.parameters.parameters.ParameterSet
remove_compute(compute, **kwargs)[source]

[NOT IMPLEMENTED] Remove a ‘constraint’ from the bundle

Parameters: twig (str) – twig to filter for the compute options **kwargs – any other tags to do the filter (except twig or context) NotImplementedError – because it isn’t
run_compute(*args, **kwargs)[source]

Run a forward model of the system on the enabled dataset using a specified set of compute options.

To attach and set custom values for compute options, including choosing which backend to use, see:

To define the dataset types and times at which the model should be computed see:

To disable or enable existing datasets see:
Parameters: compute (str) – (optional) name of the compute options to use. If not provided or None, run_compute will use an existing set of attached compute options if only 1 exists. If more than 1 exist, then compute becomes a required argument. If no compute options exist, then this will use default options and create and attach a new set of compute options with a default label. model (str) – (optional) name of the resulting model. If not provided this will default to ‘latest’. NOTE: existing models with the same name will be overwritten - including ‘latest’ datach (bool) – [EXPERIMENTAL] whether to detach from the computation run, or wait for computations to complete. If detach is True, see get_model() and phoebe.parameters.parameters.JobParameter() for details on how to check the job status and retrieve the results. Alternatively, you can provide the server location (host and port) as a string to detach and the bundle will temporarily enter client mode, submit the job to the server, and leave client mode. The resulting phoebe.parameters.parameters.JobParameter() will then contain the necessary information to pull the results from the server at anytime in the future. animate – [EXPERIMENTAL] information to send to animate() while the synthetics are being built. If not False (in which case live animation will not be done), animate should be a dictionary or list of dictionaries and a new frame will be displayed and plotted as they are computed. This really only makes sense for backends that compute per-time rather than per-dataset. Note: animation may significantly slow down the time of run_compute, especially for a large number of time-points or if meshes are being stored/plotted. Also note: animate will obviously be ignored if detach=True, this isn’t magic. NOTE: fixed_limits are not supported from run_compute, axes limits will be updated each frame, but all colorlimits will be determined per-frame and will not be constant across the animation. times (list) – [EXPERIMENTAL] override the times at which to compute the model. NOTE: this only (temporarily) replaces the time array for datasets with times provided (ie empty time arrays are still ignored). So if you attach a rv to a single component, the model will still only compute for that single component. ALSO NOTE: this option is ignored if detach=True (at least for now). **kwargs – any values in the compute options to temporarily override for this single compute run (parameter values will revert after run_compute is finished) phoebe.parameters.parameters.ParameterSet of the newly-created model containing the synthetic data.
get_model(model=None, **kwargs)[source]

Filter in the ‘model’ context

Parameters: model (str) – name of the model (optional) **kwargs – any other tags to do the filter (except model or context) phoebe.parameters.parameters.ParameterSet
remove_model(model, **kwargs)[source]

Remove a ‘model’ from the bundle

Parameters: twig (str) – twig to filter for the model **kwargs – any other tags to do the filter (except twig or context)
add_prior(twig=None, **kwargs)[source]

[NOT IMPLEMENTED]

Raises: NotImplementedError – because it isn’t
get_prior(twig=None, **kwargs)[source]

[NOT IMPLEMENTED]

Raises: NotImplementedError – because it isn’t
enable_prior(twig=None, **kwargs)[source]

[NOT IMPLEMENTED]

Raises: NotImplementedError – because it isn’t
disable_prior(twig=None, **kwargs)[source]

[NOT IMPLEMENTED]

Raises: NotImplementedError – because it isn’t
draw_from_prior(twig=None, **kwargs)[source]

[NOT IMPLEMENTED]

Raises: NotImplementedError – because it isn’t
remove_prior(twig=None, **kwargs)[source]

[NOT IMPLEMENTED]

Raises: NotImplementedError – because it isn’t
add_fitting()[source]

[NOT IMPLEMENTED]

Raises: NotImplementedError – because it isn’t
get_fitting(fitting=None, **kwargs)[source]

[NOT IMPLEMENTED]

Raises: NotImplementedError – because it isn’t
remove_fitting()[source]

[NOT IMPLEMENTED]

Raises: NotImplementedError – because it isn’t
run_fitting(**kwargs)[source]

[NOT IMPLEMENTED]

Raises: NotImplementedError – because it isn’t
get_posterior(twig=None, feedback=None, **kwargs)[source]

[NOT IMPLEMENTED]

Raises: NotImplementedError – because it isn’t
draw_from_posterior(twig=None, feedback=None, **kwargs)[source]

[NOT IMPLEMENTED]

Raises: NotImplementedError – because it isn’t
remove_posterior(twig=None, feedback=None, **kwargs)[source]

[NOT IMPLEMENTED]

Raises: NotImplementedError – because it isn’t
add_feedback()[source]

[NOT IMPLEMENTED]

Raises: NotImplementedError – because it isn’t
get_feedback(feedback=None, **kwargs)[source]

[NOT IMPLEMENTED]

Raises: NotImplementedError – because it isn’t
remove_feedback(feedback=None)[source]

[NOT IMPLEMENTED]

Raises: NotImplementedError – because it isn’t
add_plugin()[source]

[NOT IMPLEMENTED]

Raises: NotImplementedError – because it isn’t
get_plugin()[source]

[NOT IMPLEMENTED]

Raises: NotImplementedError – because it isn’t
remove_plugin()[source]

[NOT IMPLEMENTED]

Raises: NotImplementedError – because it isn’t
run_plugin()[source]

[NOT IMPLEMENTED]

Raises: NotImplementedError – because it isn’t

## phoebe.frontend.io module¶

phoebe.frontend.io.ld_to_phoebe(pn, d, rvdep=None, dataid=None, law=None)[source]
phoebe.frontend.io.ret_dict(pname, val, dataid=None, rvdep=None, comid=None)[source]
phoebe.frontend.io.load_lc_data(filename, indep, dep, indweight=None, mzero=None, dir='./')[source]

phoebe.frontend.io.load_rv_data(filename, indep, dep, indweight=None, dir='./')[source]

phoebe.frontend.io.det_dataset(eb, passband, dataid, comp, time)[source]

Since RV datasets can have values related to each component in phoebe2, but are component specific in phoebe1, it is important to determine which dataset to add parameters to. This function will do that. eb - bundle rvpt - relevant phoebe 1 parameters

phoebe.frontend.io.load_legacy(filename, add_compute_legacy=True, add_compute_phoebe=True)[source]
phoebe.frontend.io.par_value(param, index=None, **kwargs)[source]
phoebe.frontend.io.ret_ldparname(param, comp_int=None, dtype=None, dnum=None, ptype=None, index=None)[source]
phoebe.frontend.io.ret_parname(param, comp_int=None, dtype=None, dnum=None, ptype=None, index=None)[source]
phoebe.frontend.io.pass_to_legacy(eb, filename='2to1.phoebe', compute=None, **kwargs)[source]
phoebe.frontend.io.N_to_Ntriangles(N)[source]

@N: WD style gridsize

Converts WD style grid size @N to the number of triangles on the surface.

Returns: number of triangles.

## phoebe.frontend.tabcomplete module¶

class phoebe.frontend.tabcomplete.Completer(namespace=None)[source]

[FUTURE]

Create a new completer for the command line.

Completer([namespace]) -> completer instance.

Completer instances should be used as the completion mechanism of readline via the set_completer() call:

complete(text, state)[source]

Return the next possible completion for ‘text’.

This is called successively with state == 0, 1, 2, ... until it returns None. The completion should begin with ‘text’.

attr_matches(text)[source]

Compute matches when text contains a dot.

Assuming the text is of the form NAME.NAME....[NAME], and is evaluable in self.namespace, it will be evaluated and its attributes (as revealed by dir()) are used as possible completions. (For class instances, class members are also considered.)

WARNING: this can still invoke arbitrary C code, if an object with a __getattr__ hook is evaluated.

## Module contents¶

.
Last update: 10/29/2018 9:20 a.m. (CET)