mailRe: Formating issues in the 1.3 line


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

Header


Content

Posted by Sébastien Morin on July 16, 2007 - 18:01:
Hi,

Here is the patch for function spacing again with the corrections you asked 
for
(leaving only one empty line if there are class docstrings or variables
at the top of the function...

The commit log could be something like :

This patch (patch__function_spacing__1.3_r3341) fixes function spacing 
formating
issues in the 1.3 line (r3341). The convention is to leave two empty lines
before a function definition. The issues were found with the code_validator
script and filtered so that when a function definition followed a class
docstring or class variable, only one empty line is left instead of two.

Ok, bye !


Séb :)



Selon Edward d'Auvergne <edward.dauvergne@xxxxxxxxx>, 15.07.2007:

Hi,

For this patch, most of the changes are good as it makes all functions
have 2 empty lines between them.  However for the spacing above the
first function within a class, I would recommend only one space if
there is a class docstring or class variables at the top.  Two empty
lines here is not necessary.

Cheers,

Edward


On 7/12/07, Sébastien Morin <sebastien.morin.1@xxxxxxxxx> wrote:
Hi,

Here is a patch that fixes function spacing (2 preceding empty lines)
issues of
the 1.3 line (r3340), except when a commented line precedes the function
(like
at line 31 of 'maths_fns/ri.py').

Cheers !


Séb  :)




Selon Sébastien Morin <sebastien.morin.1@xxxxxxxxx>, 11.07.2007:

Oups...

The file wasn't loaded onto the server when I pressed 'send'.

Sorry for that. It seems I should finish my coffee before sending
mails...

Ciao !


Séb  :P




Selon Sébastien Morin <sebastien.morin.1@xxxxxxxxx>, 11.07.2007:

Hi,

Here is a patch for revision 3339 of line 1.3 concerning all
indentation
issues
(without the tab issues inside the OpenDX strings.

This small patch modifies solely 2 files
('test_suite/system_tests/model_free.py' and 'float.py')

Ciao !



Séb



Selon Edward d'Auvergne <edward.dauvergne@xxxxxxxxx>, 10.07.2007:

Hi,

I've committed this 1.3 line patch to the repository (r3339).  I
specificially excluded the 'dx/isosurface_3D.py' file because these
changes could have caused the OpenDX programs to fail (the text
output
with trailing whitespace was generated by OpenDX itself, and
therefore
removing it might be dangerous).  If you could Seb, it would be best
if the indentation fixes were placed into a patch for r3339 as
'patch__indentation_tab' modifies solely the 'dx/isosurface_3D.py'
file.  The indentation inside the strings embedded in this file
should
remain as they are because OpenDX may expect this indentation.

Cheers,

Edward



On 7/10/07, Sébastien Morin <sebastien.morin.1@xxxxxxxxx> wrote:
Hi Ed !

In fact, I thought about this but wasn't sure...

Here is the patch without the modification to the code where it
should
end
in '\
', thus without any modification to those files :

maths_fns/mf.py
maths_fns/jw_mf.py
maths_fns/jw_mf_comps.py
maths_fns/chi2.py
minimise/levenberg_marquardt.py
minimise/line_search/test_functions.py


Ciao !


Séb



Selon Edward d'Auvergne <edward.dauvergne@xxxxxxxxx>, 10.07.2007:

Sorry, I didn't realise to warn you that the trailing single
space in
the equation lines which terminate in '\' are important.  This
character, if not followed by a space, will cause the newline to
be
removed from the docstring in the python help system.  For
example if
you type

relax> from maths_fns import jw_mf
relax> help(jw_mf.calc_S2f_S2s_ts_d2jw_dS2fdS2s)

with the patch applied, you can see the issue - the middle line
gets
appended to the top line.  A similar issue occurs in the OpenDX
input
files that are created by relax.  All these special single
trailing
whitespaces are important.  I'm really sorry for not having
realised
earlier, it's been a long time since I worked on that code.

Regards,

Edward



On 7/10/07, Sébastien Morin <sebastien.morin.1@xxxxxxxxx> wrote:
Hi,

Here is a patch for trailing whitespaces in the code for the
1.3
line
(revision
3338).

This should fix all formating issues of this kind for the
entire
code...

Ciao


Séb  :)






Selon Edward d'Auvergne <edward.dauvergne@xxxxxxxxx>,
09.07.2007:

Thanks.  Please try to keep different types of changes
separate
though.  All the changes so far are whitespace related so I
can
commit
the patch as fixing whitespace formatting in the 1.3 line.
If
there
are other changes, these should go as separate commits into
the
relax
repository.  That way I can decide if the whitespace commit
will
be
back ported to the 1.2 line (which isn't really necessary) 
or
if
other
changes in individual commits should be back ported (some
probably
will while others may not).

Cheers,

Edward


On 7/9/07, Sebastien Morin <sebastien.morin.1@xxxxxxxxx>
wrote:
Hi Ed !

I will send a single large patch tomorrow when I have
corrected
more
code...

Bye


Séb



Edward d'Auvergne wrote:
Hi,

These minor formatting changes do need to made to the
repository.
Would you still have all the changes in your checked out
copy
Séb?
If
you could send a single patch of all the changes, it 
will
be
much
easier for me to apply.  That would be much appreciated.

Thanks,

Edward


On 7/9/07, Sébastien Morin <sebastien.morin.1@xxxxxxxxx>
wrote:
Hi all,

Here are a few patches solving fomating issues in the
1.3
line
(revision 3324).

patch_sample_scripts_palmer              ->
sample_scripts/palmer.py

patch_test_suite_runner                  ->
sample_scripts/relax_curve_diff.py

patch_sample_scripts_relax_curve_diff    ->
sample_scripts/remap.py

patch_test_suite_system_tests_jw_mapping ->
test_suite/formatting.py

patch_sample_scripts_remap               ->
test_suite/runner.py

patch_test_suite_system_tests_main       ->
test_suite/system_tests/jw_mapping.py

patch_test_suite_formatting              ->
test_suite/system_tests/main.py

patch_test_suite_system_tests_model_free ->
test_suite/system_tests/model_free.py


These are low importance changes but nevertheless the
work
needs
to
be done.

Cheers.


Séb :)
_______________________________________________
relax (http://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





--
         ______________________________________
     _______________________________________________
    |                                               |
   || Sebastien Morin                               ||
  ||| Etudiant au PhD en biochimie                  |||
 |||| Laboratoire de resonance magnetique nucleaire ||||
||||| Dr Stephane Gagne                             |||||
 |||| CREFSIP (Universite Laval, Quebec, CANADA)    ||||
  ||| 1-418-656-2131 #4530                          |||
   ||                                               ||
    |_______________________________________________|
         ______________________________________









------------------------
Sébastien Morin
Étudiant M.Sc. Biochimie
Laboratoire S. Gagné
3252 Pav. Marchand (Université Laval)
Tél : (418) 656-2131 #4530
Fax : (418) 656-7176
e-mail : sebastien.morin.1@xxxxxxxxx






------------------------
Sébastien Morin
Étudiant M.Sc. Biochimie
Laboratoire S. Gagné
3252 Pav. Marchand (Université Laval)
Tél : (418) 656-2131 #4530
Fax : (418) 656-7176
e-mail : sebastien.morin.1@xxxxxxxxx






------------------------
Sébastien Morin
Étudiant M.Sc. Biochimie
Laboratoire S. Gagné
3252 Pav. Marchand (Université Laval)
Tél : (418) 656-2131 #4530
Fax : (418) 656-7176
e-mail : sebastien.morin.1@xxxxxxxxx


_______________________________________________
relax (http://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





------------------------
Sébastien Morin
Étudiant M.Sc. Biochimie
Laboratoire S. Gagné
3252 Pav. Marchand (Université Laval)
Tél : (418) 656-2131 #4530
Fax : (418) 656-7176
e-mail : sebastien.morin.1@xxxxxxxxx



------------------------
Sébastien Morin
Étudiant M.Sc. Biochimie
Laboratoire S. Gagné
3252 Pav. Marchand (Université Laval)
Tél : (418) 656-2131 #4530
Fax : (418) 656-7176
e-mail : sebastien.morin.1@xxxxxxxxx






------------------------
Sébastien Morin
Étudiant M.Sc. Biochimie
Laboratoire S. Gagné
3252 Pav. Marchand (Université Laval)
Tél : (418) 656-2131 #4530
Fax : (418) 656-7176
e-mail : sebastien.morin.1@xxxxxxxxx
Index: prompt/help.py
===================================================================
--- prompt/help.py      (revision 3341)
+++ prompt/help.py      (working copy)
@@ -48,6 +48,7 @@
     def __repr__(self):
         return self.text
 
+
     def __call__(self, *args, **kwds):
         if len(args) != 1 or type(args[0]) == str:
             print self.text
@@ -67,5 +68,6 @@
     def __repr__(self):
         return self.text
 
+
     def __call__(self, *args, **kwds):
         return pydoc.help(*args, **kwds)
Index: prompt/gpl.py
===================================================================
--- prompt/gpl.py       (revision 3341)
+++ prompt/gpl.py       (working copy)
@@ -26,6 +26,7 @@
         help(gpl)
         return "The GNU General Public License."
 
+
 def gpl():
     """
                     GNU GENERAL PUBLIC LICENSE
Index: maths_fns/chi2.py
===================================================================
--- maths_fns/chi2.py   (revision 3341)
+++ maths_fns/chi2.py   (working copy)
@@ -27,6 +27,7 @@
 # Chi-squared value.
 ####################
 
+
 def chi2(data, back_calc_vals, errors):
     """Function to calculate the chi-squared value.
 
@@ -53,6 +54,7 @@
 # Chi-squared gradient.
 #######################
 
+
 def dchi2(data, back_calc_vals, back_calc_grad, errors):
     """Function to create the chi-squared gradient.
 
@@ -79,6 +81,7 @@
 # Chi-squared Hessian.
 ######################
 
+
 def d2chi2(data, back_calc_vals, back_calc_grad_j, back_calc_grad_k, 
back_calc_hess, errors):
     """Function to create the chi-squared Hessian.
 
Index: generic_fns/residue.py
===================================================================
--- generic_fns/residue.py      (revision 3341)
+++ generic_fns/residue.py      (working copy)
@@ -26,7 +26,6 @@
 from selection import molecule_loop, parse_token, tokenise
 
 
-
 def copy(res_num_from=None, res_name_from=None, res_num_to=None, 
res_name_to=None):
     """Copy the contents of the residue structure from one residue to a new 
residue.
 
Index: generic_fns/molecule.py
===================================================================
--- generic_fns/molecule.py     (revision 3341)
+++ generic_fns/molecule.py     (working copy)
@@ -28,7 +28,6 @@
 # The relax data storage object.
 
 
-
 def copy(res_num_from=None, res_name_from=None, res_num_to=None, 
res_name_to=None):
     """Copy the contents of the residue structure from one residue to a new 
residue.
 
Index: generic_fns/spin.py
===================================================================
--- generic_fns/spin.py (revision 3341)
+++ generic_fns/spin.py (working copy)
@@ -28,7 +28,6 @@
 # The relax data storage object.
 
 
-
 def copy(res_num_from=None, res_name_from=None, res_num_to=None, 
res_name_to=None):
     """Copy the contents of the residue structure from one residue to a new 
residue.
 
Index: generic_fns/diffusion_tensor.py
===================================================================
--- generic_fns/diffusion_tensor.py     (revision 3341)
+++ generic_fns/diffusion_tensor.py     (working copy)
@@ -514,8 +514,6 @@
         relax_data_store = Data
 
 
-
-
     def copy(self, run1=None, run2=None):
         """Function for copying diffusion tensor data from run1 to run2."""
 
Index: generic_fns/selection.py
===================================================================
--- generic_fns/selection.py    (revision 3341)
+++ generic_fns/selection.py    (working copy)
@@ -101,6 +101,7 @@
             self.residues = parse_token(res_token)
             self.spins = parse_token(spin_token)
 
+
     def __contains__(self, obj):
         if self._union:
             return (obj in self._union[0]) or (obj in self._union[1])
@@ -124,6 +125,7 @@
 
         return False
 
+
     def intersection(self, select_obj0, select_obj1):
         """Make a Selection object the intersection of two Selection objects
 
@@ -136,6 +138,7 @@
             raise RelaxError, "Cannot define multiple Boolean relationships 
between Selection objects"
         self._intersect = (select_obj0, select_obj1)
 
+
     def union(self, select_obj0, select_obj1):
         """Make a Selection object the union of two Selection objects
 
Index: scons/distrib.py
===================================================================
--- scons/distrib.py    (revision 3341)
+++ scons/distrib.py    (working copy)
@@ -31,7 +31,6 @@
 from version import version
 
 
-
 def gpg_sign(target, source, env):
     """Builder action for creating a GPG signature of the binary 
distribution file."""
 
Index: scons/manuals.py
===================================================================
--- scons/manuals.py    (revision 3341)
+++ scons/manuals.py    (working copy)
@@ -31,7 +31,6 @@
 from version import version
 
 
-
 def clean_manual_files(target, source, env):
     """Builder action for removing the temporary manual files."""
 
Index: sample_scripts/remap.py
===================================================================
--- sample_scripts/remap.py     (revision 3341)
+++ sample_scripts/remap.py     (working copy)
@@ -2,6 +2,7 @@
 
 from Numeric import Float64, array
 
+
 def remap(values):
     """Remapping function."""
 
Index: sample_scripts/relax_curve_diff.py
===================================================================
--- sample_scripts/relax_curve_diff.py  (revision 3341)
+++ sample_scripts/relax_curve_diff.py  (working copy)
@@ -33,7 +33,6 @@
 # The relax data storage object.
 
 
-
 def back_calc(name):
     """Back calculate the peak intensities.
 
Index: test_suite/unit_tests/generic_fns/test_pipes.py
===================================================================
--- test_suite/unit_tests/generic_fns/test_pipes.py     (revision 3341)
+++ test_suite/unit_tests/generic_fns/test_pipes.py     (working copy)
@@ -30,7 +30,6 @@
 from relax_errors import RelaxError, RelaxNoRunError, RelaxRunError
 
 
-
 class Test_pipes(TestCase):
     """Unit tests for the functions of the 'generic_fns.pipes' module."""
 
Index: test_suite/unit_tests/generic_fns/test_residue.py
===================================================================
--- test_suite/unit_tests/generic_fns/test_residue.py   (revision 3341)
+++ test_suite/unit_tests/generic_fns/test_residue.py   (working copy)
@@ -30,7 +30,6 @@
 from relax_errors import RelaxError, RelaxNoRunError, RelaxRunError, 
RelaxSpinSelectDisallowError
 
 
-
 class Test_residue(TestCase):
     """Unit tests for the functions of the 'generic_fns.residue' module."""
 
Index: test_suite/unit_tests/generic_fns/test_selection.py
===================================================================
--- test_suite/unit_tests/generic_fns/test_selection.py (revision 3341)
+++ test_suite/unit_tests/generic_fns/test_selection.py (working copy)
@@ -305,6 +305,7 @@
         # Test loop length.
         self.assertEqual(i, 5)
 
+
     def test_reverse(self):
         """Test spin system selection reversal.
 
Index: test_suite/unit_tests/test_float.py
===================================================================
--- test_suite/unit_tests/test_float.py (revision 3341)
+++ test_suite/unit_tests/test_float.py (working copy)
@@ -31,6 +31,7 @@
 NEG_FLOAT_EPSILON = -FLOAT_EPSILON
 NEG_FLOAT_NORMAL =  -FLOAT_NORMAL
 
+
 def makeDictById(elements):
     result ={}
     for element in elements:
@@ -38,6 +39,7 @@
 
     return result
 
+
 def winnowDictToListById(dict,elements):
     resultDict = copy(dict)
 
@@ -52,7 +54,6 @@
                           NEG_FLOAT_NORMAL, FLOAT_EPSILON, 
                           NEG_FLOAT_EPSILON, nan, ZERO, NEG_ZERO])
 
-
     def test_getFloatClass(self):
 
         tests = ( CLASS_POS_INF, pos_inf,
@@ -70,6 +71,7 @@
         for (fpClass, value) in zip(i,i):
             self.assertEqual(fpClass, getFloatClass(value))
 
+
     def test_isZero(self):
         positives = (ZERO,NEG_ZERO)
         negatives= winnowDictToListById(self.tests,positives)
Index: test_suite/unit_tests/unit_test_runner.py
===================================================================
--- test_suite/unit_tests/unit_test_runner.py   (revision 3341)
+++ test_suite/unit_tests/unit_test_runner.py   (working copy)
@@ -253,6 +253,8 @@
     def __init__(self,e,module):
         self.e=e
         self.module=module
+
+
     def __str__(self):
         result = self.e.__str__()
         result = result + '\n\n***WARNING: no tests from module %s will be 
run!!!' % self.module
@@ -263,10 +265,12 @@
         super(ImportErrorTestCase,self).__init__('testImportError')
         self.syntax_error=syntax_error
 
+
     def testImportError(self):
         raise self.syntax_error
         #self.fail(self.syntax_error.__str__())
 
+
 def load_test_case(package_path,  module_name, class_name):
     ''' load a testCase from the file system using a package path, file name
         and class name
@@ -376,8 +380,6 @@
         self.paths_scanned = False
 
 
-
-
     def scan_paths(self):
         '''Scan directories and paths for unit test classes and load them 
into TestSuites
 
@@ -579,12 +581,6 @@
         self.verbose = verbose
 
 
-
-
-
-
-
-
     def get_first_instance_path(self, path, target_path, 
offset_path=os.curdir):
         '''Get the minimal path searching up the file system to 
target_directory.
 
@@ -644,7 +640,6 @@
         return result
 
 
-
     def paths_from_test_module(self, test_module):
         '''Determine the possible paths of the test_module.
 
@@ -718,9 +713,6 @@
         return result
 
 
-
-
-
     def run(self, runner=None):
         '''Run a unit test or set of unit tests.
 
Index: test_suite/system_tests/main.py
===================================================================
--- test_suite/system_tests/main.py     (revision 3341)
+++ test_suite/system_tests/main.py     (working copy)
@@ -238,7 +238,6 @@
         return global_pass
 
 
-
     def exec_tests(self, test_array):
         """Function for running the tests."""
 
Index: float.py
===================================================================
--- float.py    (revision 3341)
+++ float.py    (working copy)
@@ -136,9 +136,11 @@
 CLASS_POS_ZERO =  256
 CLASS_NEG_ZERO = 512
 
+
 def isZero(float):
     return isMantissaAllZeros(float) and isExpAllZeros(float)
 
+
 def getFloatClass(float):
     ''' get the ieee-class (nan,inf etc) of apython float
 
@@ -256,6 +258,7 @@
 
     return packed
 
+
 def floatAsByteArray(obj):
     ''' unpack a python float as a list of 8 bytes
 
@@ -279,7 +282,6 @@
     return list(bytes)
 
 
-
 def getSignBit(obj):
     ''' get the sign bit from a python float
 
@@ -298,6 +300,7 @@
     # grab last byte and check if sign bit is set
     return unpacked[7]  & SIGNBIT
 
+
 def isPositive(obj):
     ''' test if a a pyhton float is positive
 
@@ -314,6 +317,7 @@
     else:
         return True
 
+
 def isNegative(obj):
     ''' test if a a pyhton float 64 bit ieee-74 double is negative
 
@@ -326,7 +330,6 @@
     return not isPositive(obj)
 
 
-
 def areUnordered(obj1,obj2):
     ''' test to see if two python float  are unordered
 
@@ -372,6 +375,7 @@
 
     return result
 
+
 def copySign(fromNumber,toDouble):
     ''' copy the sign bit from one python float  to another
 
@@ -438,10 +442,6 @@
     return result
 
 
-
-
-
-
 def getMantissaBytes(obj):
     ''' get the 7 bytes that makeup the mantissa of float
 
@@ -467,6 +467,7 @@
     # remove the exponent bytes that can be removed
     return bytes[:7]
 
+
 def getExponentBytes(obj):
     ''' get the 2 bytes that makeup the exponent of a float
 
@@ -496,8 +497,6 @@
     return bytes[6:]
 
 
-
-
 def isExpAllZeros(obj):
     ''' check if the bits of the exponent of a float is zero
 
@@ -518,6 +517,7 @@
 
     return result
 
+
 def isMantissaAllZeros(obj):
     ''' check if the bits of the mantissa of a float is zero
 
@@ -540,6 +540,7 @@
 
     return result
 
+
 def isExpAllOnes(obj):
     ''' check if the bits of the exponent of a floatis all 1 bits
 
@@ -561,6 +562,7 @@
 
     return result
 
+
 def isNaN(obj):
     ''' check to see if a python float is an ieee-754 double not a number 
(nan)
 
@@ -594,6 +596,7 @@
         #    result = True
     return result
 
+
 def isInf(obj):
     ''' check to see if a python float is an infinity
 
@@ -626,6 +629,7 @@
 
     return result
 
+
 def isPosInf(obj):
     ''' check to see if a python float is positive infinity
 
Index: data/diff_tensor.py
===================================================================
--- data/diff_tensor.py (revision 3341)
+++ data/diff_tensor.py (working copy)
@@ -30,7 +30,6 @@
 from relax_errors import RelaxError
 
 
-
 def dependency_generator(diff_type):
     """Generator for the automatic updating the diffusion tensor data 
structures.
 
Index: minimise/line_search/more_thuente.py
===================================================================
--- minimise/line_search/more_thuente.py        (revision 3341)
+++ minimise/line_search/more_thuente.py        (working copy)
@@ -264,7 +264,6 @@
         Ik = copy.deepcopy(Ik_new)
 
 
-
 def print_data(text, k, a, Ik, Ik_lim):
     """Temp func for debugging."""
 
Index: minimise/line_search/backtrack.py
===================================================================
--- minimise/line_search/backtrack.py   (revision 3341)
+++ minimise/line_search/backtrack.py   (working copy)
@@ -23,6 +23,7 @@
 
 from Numeric import dot
 
+
 def backtrack(func, args, x, f, g, p, a_init=1.0, rho=0.5, c=1e-4, 
max_iter=500):
     """Backtracking line search.
 
Index: minimise/line_search/nocedal_wright_interpol.py
===================================================================
--- minimise/line_search/nocedal_wright_interpol.py     (revision 3341)
+++ minimise/line_search/nocedal_wright_interpol.py     (working copy)
@@ -26,6 +26,7 @@
 from interpolate import cubic_ext, quadratic_fafbga
 quadratic = quadratic_fafbga
 
+
 def nocedal_wright_interpol(func, args, x, f, g, p, a_init=1.0, mu=0.001, 
print_flag=0):
     """A line search algorithm based on interpolation.
 
Index: minimise/line_search/nocedal_wright_wolfe.py
===================================================================
--- minimise/line_search/nocedal_wright_wolfe.py        (revision 3341)
+++ minimise/line_search/nocedal_wright_wolfe.py        (working copy)
@@ -26,6 +26,7 @@
 from interpolate import cubic_ext, quadratic_fafbga
 quadratic = quadratic_fafbga
 
+
 def nocedal_wright_wolfe(func, func_prime, args, x, f, g, p, a_init=1.0, 
max_a=1e5, mu=0.001, eta=0.9, tol=1e-10, print_flag=0):
     """A line search algorithm implemented using the strong Wolfe conditions.
 
Index: minimise/line_search/interpolate.py
===================================================================
--- minimise/line_search/interpolate.py (revision 3341)
+++ minimise/line_search/interpolate.py (working copy)
@@ -23,6 +23,7 @@
 
 from Numeric import sqrt
 
+
 def cubic_int(a, b, fa, fb, ga, gb):
     """Cubic interpolation using f(a), f(b), g(a), and g(b).
 
Index: minimise/line_search/test_functions.py
===================================================================
--- minimise/line_search/test_functions.py      (revision 3341)
+++ minimise/line_search/test_functions.py      (working copy)
@@ -28,6 +28,7 @@
 
 from more_thuente import more_thuente
 
+
 def run():
     print "\n\n\n\n\n\n\n\n\n\n\n\n\t\t<<< Test Functions >>>\n\n\n"
     print "\nSelect the function to test:"

Related Messages


Powered by MHonArc, Updated Tue Jul 17 19:20:36 2007