[Python-checkins] CVS: python/dist/src/Lib/xml/sax expatreader.py,1.4,1.5

Fred L. Drake python-dev@python.org
Fri, 22 Sep 2000 22:32:28 -0700


Update of /cvsroot/python/python/dist/src/Lib/xml/sax
In directory slayer.i.sourceforge.net:/tmp/cvs-serv17458

Modified Files:
	expatreader.py 
Log Message:

Conform more closely with the Python style guide.


Index: expatreader.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/expatreader.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** expatreader.py	2000/09/23 04:49:30	1.4
--- expatreader.py	2000/09/23 05:32:26	1.5
***************
*** 23,27 ****
  # --- ExpatParser
  
! class ExpatParser( xmlreader.IncrementalParser, xmlreader.Locator ):
      "SAX driver for the Pyexpat C module."
  
--- 23,27 ----
  # --- ExpatParser
  
! class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator):
      "SAX driver for the Pyexpat C module."
  
***************
*** 35,44 ****
      # XMLReader methods
  
!     def parse(self, stream_or_string ):
          "Parse an XML document from a URL."
!         if type( stream_or_string ) == type( "" ):
!             stream=open( stream_or_string )
          else:
!             stream=stream_or_string
   
          self.reset()
--- 35,44 ----
      # XMLReader methods
  
!     def parse(self, stream_or_string):
          "Parse an XML document from a URL."
!         if type(stream_or_string) is type(""):
!             stream = open(stream_or_string)
          else:
!             stream = stream_or_string
   
          self.reset()
***************
*** 79,83 ****
      def feed(self, data):
          if not self._parsing:
!             self._parsing=1
              self.reset()
              self._cont_handler.startDocument()
--- 79,83 ----
      def feed(self, data):
          if not self._parsing:
!             self._parsing = 1
              self.reset()
              self._cont_handler.startDocument()
***************
*** 88,92 ****
          if self._parsing:
              self._cont_handler.endDocument()
!             self._parsing=0
          self._parser.Parse("", 1)
          
--- 88,92 ----
          if self._parsing:
              self._cont_handler.endDocument()
!             self._parsing = 0
          self._parser.Parse("", 1)
          
***************
*** 136,145 ****
  
      def end_element(self, name):
!         self._cont_handler.endElement( name, name )
  
      def start_element_ns(self, name, attrs):
          pair = name.split()
          if len(pair) == 1:
!             tup = (None, name )
          else:
              tup = pair
--- 136,145 ----
  
      def end_element(self, name):
!         self._cont_handler.endElement(name, name)
  
      def start_element_ns(self, name, attrs):
          pair = name.split()
          if len(pair) == 1:
!             tup = (None, name)
          else:
              tup = pair
***************
*** 153,157 ****
              name = (None, name, None)
          else:
!             name = pair+[None] # prefix is not implemented yet!
              
          self._cont_handler.endElement(name, None)
--- 153,157 ----
              name = (None, name, None)
          else:
!             name = pair + [None] # prefix is not implemented yet!
              
          self._cont_handler.endElement(name, None)
***************
*** 188,192 ****
          
  def create_parser(*args, **kwargs):
!     return apply( ExpatParser, args, kwargs )
          
  # ---
--- 188,192 ----
          
  def create_parser(*args, **kwargs):
!     return apply(ExpatParser, args, kwargs)
          
  # ---