mailr19008 - in /trunk: ./ auto_analyses/ gui/ gui/analyses/ lib/text/ prompt/


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

Header


Content

Posted by edward on March 22, 2013 - 21:45:
Author: bugman
Date: Fri Mar 22 21:44:59 2013
New Revision: 19008

URL: http://svn.gna.org/viewcvs/relax?rev=19008&view=rev
Log:
Renamed the relax_string module to lib.text.string.

This is part of the relax library redesign.


Added:
    trunk/lib/text/string.py
      - copied unchanged from r19003, trunk/relax_string.py
Removed:
    trunk/relax_string.py
Modified:
    trunk/auto_analyses/dauvergne_protocol.py
    trunk/gui/analyses/auto_model_free.py
    trunk/gui/uf_objects.py
    trunk/lib/text/__init__.py
    trunk/prompt/uf_objects.py

Modified: trunk/auto_analyses/dauvergne_protocol.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/auto_analyses/dauvergne_protocol.py?rev=19008&r1=19007&r2=19008&view=diff
==============================================================================
--- trunk/auto_analyses/dauvergne_protocol.py (original)
+++ trunk/auto_analyses/dauvergne_protocol.py Fri Mar 22 21:44:59 2013
@@ -35,7 +35,7 @@
 from prompt.interpreter import Interpreter
 from lib.errors import RelaxError, RelaxNoSequenceError, RelaxNoValueError
 from relax_io import DummyFileObject
-from relax_string import LIST, PARAGRAPH, SECTION, SUBSECTION, TITLE, 
to_docstring
+from lib.text.string import LIST, PARAGRAPH, SECTION, SUBSECTION, TITLE, 
to_docstring
 from status import Status; status = Status()
 
 

Modified: trunk/gui/analyses/auto_model_free.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/gui/analyses/auto_model_free.py?rev=19008&r1=19007&r2=19008&view=diff
==============================================================================
--- trunk/gui/analyses/auto_model_free.py (original)
+++ trunk/gui/analyses/auto_model_free.py Fri Mar 22 21:44:59 2013
@@ -40,7 +40,7 @@
 from graphics import fetch_icon
 from physical_constants import NH_BOND_LENGTH
 from lib.errors import RelaxError
-from relax_string import LIST, PARAGRAPH, SECTION, SUBSECTION, TITLE
+from lib.text.string import LIST, PARAGRAPH, SECTION, SUBSECTION, TITLE
 from specific_fns.setup import get_specific_fn
 from status import Status; status = Status()
 

Modified: trunk/gui/uf_objects.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/gui/uf_objects.py?rev=19008&r1=19007&r2=19008&view=diff
==============================================================================
--- trunk/gui/uf_objects.py (original)
+++ trunk/gui/uf_objects.py Fri Mar 22 21:44:59 2013
@@ -32,7 +32,7 @@
 import arg_check
 from graphics import fetch_icon
 from lib.errors import AllRelaxErrors, RelaxError
-from relax_string import strip_lead
+from lib.text.string import strip_lead
 from status import Status; status = Status()
 from user_functions.data import Uf_info; uf_info = Uf_info()
 from user_functions.data import Uf_tables; uf_tables = Uf_tables()

Modified: trunk/lib/text/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/text/__init__.py?rev=19008&r1=19007&r2=19008&view=diff
==============================================================================
--- trunk/lib/text/__init__.py (original)
+++ trunk/lib/text/__init__.py Fri Mar 22 21:44:59 2013
@@ -24,5 +24,6 @@
 
 __all__ = [
     'sectioning',
+    'string',
     'table'
 ]

Modified: trunk/prompt/uf_objects.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/prompt/uf_objects.py?rev=19008&r1=19007&r2=19008&view=diff
==============================================================================
--- trunk/prompt/uf_objects.py (original)
+++ trunk/prompt/uf_objects.py Fri Mar 22 21:44:59 2013
@@ -27,7 +27,7 @@
 from prompt.uf_docstring import bold_text, build_subtitle, create_table, 
format_text
 from prompt.help import relax_class_help
 from lib.errors import RelaxError
-from relax_string import strip_lead
+from lib.text.string import strip_lead
 from status import Status; status = Status()
 from user_functions.data import Uf_info; uf_info = Uf_info()
 from user_functions.objects import Desc_container

Removed: trunk/relax_string.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/relax_string.py?rev=19007&view=auto
==============================================================================
--- trunk/relax_string.py (original)
+++ trunk/relax_string.py (removed)
@@ -1,119 +1,0 @@
-###############################################################################
-#                                                                            
 #
-# Copyright (C) 2010-2012 Edward d'Auvergne                                  
 #
-#                                                                            
 #
-# This file is part of the program relax (http://www.nmr-relax.com).         
 #
-#                                                                            
 #
-# This program is free software: you can redistribute it and/or modify       
 #
-# it under the terms of the GNU General Public License as published by       
 #
-# the Free Software Foundation, either version 3 of the License, or          
 #
-# (at your option) any later version.                                        
 #
-#                                                                            
 #
-# This program is distributed in the hope that it will be useful,            
 #
-# but WITHOUT ANY WARRANTY; without even the implied warranty of             
 #
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              
 #
-# GNU General Public License for more details.                               
 #
-#                                                                            
 #
-# You should have received a copy of the GNU General Public License          
 #
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.      
 #
-#                                                                            
 #
-###############################################################################
-
-# Module docstring.
-"""Module for building documentation."""
-
-# Some constants.
-TITLE = 3
-SECTION = 2
-SUBSECTION = 1
-PARAGRAPH = 0
-LIST = 10
-
-
-def strip_lead(text):
-    """Strip the leading whitespace from the given text.
-
-    @param text:    The text to strip the leading whitespace from.
-    @type text:     str
-    @return:        The text with leading whitespace removed.
-    @rtype:         str
-    """
-
-    # Split by newline.
-    lines = text.split('\n')
-
-    # Find the minimum whitespace.
-    min_white = 1000
-    for line in lines:
-        # Empty lines.
-        if line.strip() == '':
-            continue
-
-        # Count the whitespace for the current line.
-        num_white = 0
-        for i in range(len(line)):
-            if line[i] != ' ':
-                break
-            num_white = num_white + 1
-
-        # The min value.
-        min_white = min(min_white, num_white)
-
-    # Strip the whitespace.
-    new_text = ''
-    for line in lines:
-        new_text = new_text + line[min_white:] + '\n'
-
-    # Return the new text.
-    return new_text
-
-
-def to_docstring(data):
-    """Convert the text to that of a docstring, dependent on the text level.
-
-    @param data:    The lists of constants and text to convert into a 
properly formatted docstring.
-    @type data:     list of lists of int and str
-    """
-
-    # Init.
-    doc = ''
-    for i in range(len(data)):
-        # The level and text.
-        level, text = data[i]
-
-        # Title level.
-        if level == TITLE:
-            doc += text + '\n\n'
-
-        # Section level.
-        if level == SECTION:
-            doc += '\n\n' + text + '\n' + '='*len(text) + '\n\n'
-
-        # Subsection level.
-        if level == SUBSECTION:
-            doc += '\n\n' + text + '\n' + '-'*len(text) + '\n\n'
-
-        # Paragraph level.
-        elif level == PARAGRAPH:
-            # Starting newline.
-            if i and data[i-1][0] == PARAGRAPH:
-                doc += '\n'
-
-            # The text.
-            doc += text + '\n'
-
-        # List level.
-        elif level == LIST:
-            # Start of list.
-            if i and data[i-1][0] != LIST:
-                doc += '\n'
-
-            # The text.
-            doc += "    - %s\n" % text
-
-            # End of list.
-            if i < len(data) and data[i+1][0] == PARAGRAPH:
-                doc += '\n'
-
-    # Return the docstring.
-    return doc




Related Messages


Powered by MHonArc, Updated Fri Mar 22 22:00:02 2013