[Python-checkins] python/dist/src/Lib ConfigParser.py,1.54,1.55

fdrake@users.sourceforge.net fdrake@users.sourceforge.net
2002年12月30日 15:51:48 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv16764
Modified Files:
	ConfigParser.py 
Log Message:
- added InterpolationSyntaxError to __all__
- added docstring to exceptions
Index: ConfigParser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/ConfigParser.py,v
retrieving revision 1.54
retrieving revision 1.55
diff -C2 -d -r1.54 -r1.55
*** ConfigParser.py	30 Dec 2002 23:38:47 -0000	1.54
--- ConfigParser.py	30 Dec 2002 23:51:45 -0000	1.55
***************
*** 90,96 ****
 import re
 
! __all__ = ["NoSectionError","DuplicateSectionError","NoOptionError",
! "InterpolationError","InterpolationDepthError","ParsingError",
! "MissingSectionHeaderError","ConfigParser",
 "DEFAULTSECT", "MAX_INTERPOLATION_DEPTH"]
 
--- 90,97 ----
 import re
 
! __all__ = ["NoSectionError", "DuplicateSectionError", "NoOptionError",
! "InterpolationError", "InterpolationDepthError",
! "InterpolationSyntaxError", "ParsingError",
! "MissingSectionHeaderError", "ConfigParser",
 "DEFAULTSECT", "MAX_INTERPOLATION_DEPTH"]
 
***************
*** 103,114 ****
--- 104,121 ----
 # exception classes
 class Error(Exception):
+ """Base class for ConfigParser exceptions."""
+ 
 def __init__(self, msg=''):
 self._msg = msg
 Exception.__init__(self, msg)
+ 
 def __repr__(self):
 return self._msg
+ 
 __str__ = __repr__
 
 class NoSectionError(Error):
+ """Raised when no section matches a requested option."""
+ 
 def __init__(self, section):
 Error.__init__(self, 'No section: %s' % section)
***************
*** 116,119 ****
--- 123,128 ----
 
 class DuplicateSectionError(Error):
+ """Raised when a section is multiply-created."""
+ 
 def __init__(self, section):
 Error.__init__(self, "Section %s already exists" % section)
***************
*** 121,124 ****
--- 130,135 ----
 
 class NoOptionError(Error):
+ """A requested option was not found."""
+ 
 def __init__(self, option, section):
 Error.__init__(self, "No option `%s' in section: %s" %
***************
*** 128,131 ****
--- 139,144 ----
 
 class InterpolationError(Error):
+ """A string substitution required a setting which was not available."""
+ 
 def __init__(self, reference, option, section, rawval):
 Error.__init__(self,
***************
*** 140,146 ****
 self.section = section
 
! class InterpolationSyntaxError(Error): pass
 
 class InterpolationDepthError(Error):
 def __init__(self, option, section, rawval):
 Error.__init__(self,
--- 153,163 ----
 self.section = section
 
! class InterpolationSyntaxError(Error):
! """Raised when the source text into which substitutions are made
! does not conform to the required syntax."""
 
 class InterpolationDepthError(Error):
+ """Raised when substitutions are nested too deeply."""
+ 
 def __init__(self, option, section, rawval):
 Error.__init__(self,
***************
*** 154,157 ****
--- 171,176 ----
 
 class ParsingError(Error):
+ """Raised when a configuration file does not follow legal syntax."""
+ 
 def __init__(self, filename):
 Error.__init__(self, 'File contains parsing errors: %s' % filename)
***************
*** 164,167 ****
--- 183,188 ----
 
 class MissingSectionHeaderError(ParsingError):
+ """Raised when a key-value pair is found before any section header."""
+ 
 def __init__(self, filename, lineno, line):
 Error.__init__(

AltStyle によって変換されたページ (->オリジナル) /