mailRe: r26814 - /branches/nmrglue/lib/io.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Edward d'Auvergne on December 01, 2014 - 19:36:
Hi,

That is probably because the docstrings are old.  The arguments
probably used to be parameters and were then converted to keyword
arguments.  I'll fix this in the trunk.  Just start the svnmerge.py
tracking on your branch (on an svn copy) and then pull in the changes
when they are there.

Regards,

Edward


On 1 December 2014 at 19:24, Troels Emtekær Linnet
<tlinnet@xxxxxxxxxxxxx> wrote:
Hi Edward.

Could you then clarify this difference:

From: http://epydoc.sourceforge.net/fields.html
@param p: ... A description of the parameter p for a function or method. It
may appear in the class docstring to describe a costructor parameter: mostly
useful for C extensions.
@keyword p: ... A description of the keyword parameter p. It may appear in
the class docstring to describe a costructor keyword parameter.

And all other functions in io use param.

http://epydoc.sourceforge.net/epydoc.html
@param fields should be used to document any explicit parameter (including
the keyword parameter).
@keyword fields should only be used for non-explicit keyword parameters:

Best
Troels



2014-11-29 9:24 GMT+01:00 Edward d'Auvergne <edward@xxxxxxxxxxxxx>:

Hi Troels,

The epydoc markup is not quite right here.  These are keyword
arguments, so you need to replace:

    @param glob_pattern:    Pattern may contain simple shell-style
wildcards.

With:

    @keyword glob_pattern:    Pattern may contain simple shell-style
wildcards.

Cheers,

Edward


On 29 November 2014 at 00:04,  <tlinnet@xxxxxxxxxxxxx> wrote:
Author: tlinnet
Date: Sat Nov 29 00:04:32 2014
New Revision: 26814

URL: http://svn.gna.org/viewcvs/relax?rev=26814&view=rev
Log:
Added functionality to lib/io to extract a list of file basenames and a
list of fileroot matching a pathname pattern.

This can be useful when loading many spectra and assigning spectrum IDs.

Task #7873 (https://gna.org/task/index.php?7873): Write wrapper function
to nmrglue, to read .ft2 files and process them.
Homepage: http://www.nmrglue.com/
Link to nmrglue discussion:
https://groups.google.com/forum/#!forum/nmrglue-discuss
The code is develop at Github: https://github.com/jjhelmus/nmrglue/
Google code: https://code.google.com/p/nmrglue/
Documentation: http://nmrglue.readthedocs.org/en/latest/index.html

Modified:
    branches/nmrglue/lib/io.py

Modified: branches/nmrglue/lib/io.py
URL:
http://svn.gna.org/viewcvs/relax/branches/nmrglue/lib/io.py?rev=26814&r1=26813&r2=26814&view=diff

==============================================================================
--- branches/nmrglue/lib/io.py  (original)
+++ branches/nmrglue/lib/io.py  Sat Nov 29 00:04:32 2014
@@ -35,6 +35,7 @@
     bz2 = None
     message = sys.exc_info()[1]
     bz2_module_message = message.args[0]
+from glob import glob
 from os import devnull
 from os import F_OK, X_OK, access, altsep, getenv, makedirs, pathsep,
remove, sep
 from os.path import expanduser, basename, splitext, isfile
@@ -173,6 +174,42 @@

     # Return the file root with the directories stripped.
     return basename(file_path)
+
+
+def get_file_list(glob_pattern=None, dir=None):
+    """Return a list of file basenames and a list of fileroot matching
a pathname pattern.
+
+    @param glob_pattern:    Pattern may contain simple shell-style
wildcards.
+    @type glob_pattern:     str
+    @param dir:             The path where the files is located.  If
None, then the current directory is assumed.
+    @type dir:              str
+    @return:                list of file basenames, list of fileroots.
+    @rtype:                 list of str, list of str
+    """
+
+    # Get the file path.
+    file_path = get_file_path(file_name=glob_pattern, dir=dir)
+
+    # Get the file list.
+    file_list = glob(file_path)
+
+    # Make a list if of basenames.
+    basename_list = []
+
+    # Loop over the file list.
+    for file_i in file_list:
+        basename_list.append(basename(file_i))
+
+    # Sort the file list Alphanumeric.
+    basename_list = sort_filenames(filenames=basename_list)
+
+    # Now make a list of file_root, which is the file name striped of
extension detail.
+    # This can be useful when assigning spectrum IDs.
+    file_root_list = []
+    for file_i in basename_list:
+        file_root_list.append(file_root(file_i))
+
+    return basename_list, file_root_list


 def get_file_path(file_name=None, dir=None):


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

This is the relax-commits mailing list
relax-commits@xxxxxxx

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
relax-devel@xxxxxxx

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





Related Messages


Powered by MHonArc, Updated Mon Dec 01 23:00:09 2014