Hi Troels,

Could you remove the "return data" statement from the
pipe_control.pipes.display() function?  The callers of this function
will not be expecting that something other than None is returned.  It
is also not documented.  But the purpose of the display() functions in
the pipe_control package is to simply print information to screen,
nothing else.  This might cause problems in the future and it is not
clean.  The correct function for obtaining the list of data pipe names
is pipe_control.pipes.pipe_names().  If you need the list sorted or
reversed, then you can add the same code to the pipe_names() function.

Cheers,

Edward


On 8 September 2014 19:38, Edward d'Auvergne <[email protected]> wrote:
> Hi,
>
> The 'sort' argument is a good idea here, as it is best to preserve the
> default order which is how the user created their pipes.  The
> returning of the data is duplicated functionality, and it also doesn't
> make sense that display() will return this.  Just make a second call
> to the pipe_control.pipes.pipe_names() function which returns a list
> of all the data pipes.  You can add the sort flag to that user
> function as well.
>
> Regards,
>
> Edward
>
>
>
> On 8 September 2014 18:49,  <[email protected]> wrote:
>> Author: tlinnet
>> Date: Mon Sep  8 18:49:41 2014
>> New Revision: 25686
>>
>> URL: http://svn.gna.org/viewcvs/relax?rev=25686&view=rev
>> Log:
>> To the back-end of display pipes, added functionality to sort the pipe names 
>> before printing.
>>
>> Also added the return of the list of pipes, with its associated information 
>> about pipe type, and pipe_bundle.
>>
>> This is to help with getting a better overview for multiple pipes in data 
>> store.
>>
>> task #7826(https://gna.org/task/index.php?7826): Write an python class for 
>> the repeated analysis of dispersion data.
>>
>> Modified:
>>     trunk/pipe_control/pipes.py
>>
>> Modified: trunk/pipe_control/pipes.py
>> URL: 
>> http://svn.gna.org/viewcvs/relax/trunk/pipe_control/pipes.py?rev=25686&r1=25685&r2=25686&view=diff
>> ==============================================================================
>> --- trunk/pipe_control/pipes.py (original)
>> +++ trunk/pipe_control/pipes.py Mon Sep  8 18:49:41 2014
>> @@ -30,7 +30,7 @@
>>  from dep_check import C_module_exp_fn, scipy_module
>>  from lib.compat import builtins
>>  from lib.errors import RelaxError, RelaxNoPipeError, RelaxPipeError
>> -from lib.io import write_data
>> +from lib.io import sort_filenames, write_data
>>  from status import Status; status = Status()
>>
>>
>> @@ -283,15 +283,22 @@
>>      status.observers.pipe_alteration.notify()
>>
>>
>> -def display():
>> +def display(sort=False, rev=False):
>>      """Print the details of all the data pipes."""
>>
>>      # Acquire the pipe lock, and make sure it is finally released.
>>      status.pipe_lock.acquire(sys._getframe().f_code.co_name)
>>      try:
>>          # Loop over the data pipes.
>> +        pipe_names = []
>> +        for pipe_name_i in ds:
>> +            pipe_names.append(pipe_name_i)
>> +
>> +        if sort:
>> +            pipe_names = sort_filenames(filenames=pipe_names, rev=rev)
>> +
>>          data = []
>> -        for pipe_name in ds:
>> +        for pipe_name in pipe_names:
>>              # The current data pipe.
>>              current = ''
>>              if pipe_name == cdp_name():
>> @@ -306,6 +313,9 @@
>>
>>      # Print out.
>>      write_data(out=sys.stdout, headings=["Data pipe name", "Data pipe 
>> type", "Bundle", "Current"], data=data)
>> +
>> +    # Return data
>> +    return data
>>
>>
>>  def get_bundle(pipe=None):
>>
>>
>> _______________________________________________
>> relax (http://www.nmr-relax.com)
>>
>> This is the relax-commits mailing list
>> [email protected]
>>
>> To unsubscribe from this list, get a password
>> reminder, or change your subscription options,
>> visit the list information page at
>> https://mail.gna.org/listinfo/relax-commits

_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-devel mailing list
[email protected]

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-devel

Reply via email to