Author: bugman Date: Sun Sep 3 07:14:41 2006 New Revision: 2549 URL: http://svn.gna.org/viewcvs/relax?rev=2549&view=rev Log: Reverted the last changes to remove the RelaxWarning system code which Chris MacRaild has recoded within the 'warning' branch. The command used to revert the changes was: svn merge -r2532:2531 svn+ssh://bugman@xxxxxxxxxxx/svn/relax/branches/nan_catch_test Modified: branches/nan_catch_test/errors.py branches/nan_catch_test/generic_fns/pdb.py branches/nan_catch_test/prompt/interpreter.py branches/nan_catch_test/relax Modified: branches/nan_catch_test/errors.py URL: http://svn.gna.org/viewcvs/relax/branches/nan_catch_test/errors.py?rev=2549&r1=2548&r2=2549&view=diff ============================================================================== --- branches/nan_catch_test/errors.py (original) +++ branches/nan_catch_test/errors.py Sun Sep 3 07:14:41 2006 @@ -23,11 +23,7 @@ import __builtin__ from re import match from types import ClassType -import warnings - - -# Error objects. -################ + class RelaxErrors: def __init__(self): @@ -480,68 +476,3 @@ class RelaxNaNError(BaseError): def __init__(self, name): self.text = "The invalid " + name + " floating point value of NaN (Not a Number) has occurred." - - - -# Warning objects. -################## - -class RelaxWarnings: - def __init__(self): - """Class for placing all the warnings below into __builtin__""" - - # Loop over all objects in 'self'. - for name in dir(self): - # Get the object. - object = getattr(self, name) - - # Skip over all non-warning class objects. - if type(object) != ClassType or not match('Relax', name): - continue - - # Place the warnings into __builtin__ - __builtin__.__setattr__(name, object) - - # Tuple of all the warnings. - if hasattr(__builtin__, 'AllRelaxWarnings'): - __builtin__.AllRelaxWarnings = __builtin__.AllRelaxWarnings, object - else: - __builtin__.AllRelaxWarnings = object, - - # Change the formatting of the warning message. - warnings.formatwarning = self.format - - - def format(self, message, category, filename, lineno): - """Change the warning message formatting.""" - - # The RelaxWarning string. - string = "RelaxWarning: %s\n" % message - - return string - - - # Base class for all warnings. - ############################ - - class BaseWarning(Warning): - def __str__(self): - return (self.text + "\n") - - - # Standard warnings. - #################### - - class RelaxWarning(BaseWarning): - def __init__(self, text): - self.text = text - - - # Zero length vector. - ##################### - - class RelaxZeroVectorWarning(BaseWarning): - def __init__(self, res): - self.text = "The XH bond vector for residue " + `res` + " is of zero length." - - Modified: branches/nan_catch_test/generic_fns/pdb.py URL: http://svn.gna.org/viewcvs/relax/branches/nan_catch_test/generic_fns/pdb.py?rev=2549&r1=2548&r2=2549&view=diff ============================================================================== --- branches/nan_catch_test/generic_fns/pdb.py (original) +++ branches/nan_catch_test/generic_fns/pdb.py Sun Sep 3 07:14:41 2006 @@ -268,10 +268,8 @@ # Test for zero length. if norm_factor == 0.0: - # Warning. - warn(RelaxZeroVector(self.relax.data.res[self.run][j].num)) - - # Set the vector to None. + if self.print_flag: + print "The XH bond vector for residue " + `self.relax.data.res[self.run][j].num` + " is of zero length." self.relax.data.res[self.run][j].xh_vect.append(None) # Calculate the normalised vector. Modified: branches/nan_catch_test/prompt/interpreter.py URL: http://svn.gna.org/viewcvs/relax/branches/nan_catch_test/prompt/interpreter.py?rev=2549&r1=2548&r2=2549&view=diff ============================================================================== --- branches/nan_catch_test/prompt/interpreter.py (original) +++ branches/nan_catch_test/prompt/interpreter.py Sun Sep 3 07:14:41 2006 @@ -301,10 +301,7 @@ else: more = self.push(line) except KeyboardInterrupt: - if Debug: - self.showtraceback() - else: - self.write("\nKeyboardInterrupt\n") + self.write("\nKeyboardInterrupt\n") self.resetbuffer() more = 0 @@ -348,11 +345,6 @@ self.showtraceback() else: sys.stderr.write(instance.__str__()) - except AllRelaxWarnings, instance: - if Debug: - self.showtraceback() - else: - sys.stderr.write(instance.__str__()) except: raise Modified: branches/nan_catch_test/relax URL: http://svn.gna.org/viewcvs/relax/branches/nan_catch_test/relax?rev=2549&r1=2548&r2=2549&view=diff ============================================================================== --- branches/nan_catch_test/relax (original) +++ branches/nan_catch_test/relax Sun Sep 3 07:14:41 2006 @@ -41,7 +41,6 @@ from re import match from string import split, strip import sys -from warnings import warn # Numeric. try: @@ -67,7 +66,7 @@ # relax modules. from colour import Colour from data import Data -from errors import RelaxErrors, RelaxWarnings +from errors import RelaxErrors from io import IO from generic_fns.main import Generic from prompt.gpl import gpl @@ -93,10 +92,8 @@ # Get and store the PID of this process. self.pid = getpid() - # Set up the program internal errors and warnings. + # Set up the program internal errors. RelaxErrors() - RelaxWarnings() - __builtin__.warn = warn # Debugging flag (default is off). __builtin__.Debug = 0