[Zope3-checkins] CVS: Zope3/src/zope/xmlpickle - __init__.py:1.1.2.2 ppml.py:1.1.2.3 xmlpickle.py:1.1.2.3 xyap.py:1.1.2.2

Tim Peters tim.one@comcast.net
Tue, 24 Dec 2002 21:27:53 -0500


Update of /cvs-repository/Zope3/src/zope/xmlpickle
In directory cvs.zope.org:/tmp/cvs-serv23844/src/zope/xmlpickle

Modified Files:
      Tag: NameGeddon-branch
	__init__.py ppml.py xmlpickle.py xyap.py 
Log Message:
Finishing the whitespace normalization checkin.  Previous attempt caused
the CVS server to die with a "Too many open files" error in post-commit.


=== Zope3/src/zope/xmlpickle/__init__.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/xmlpickle/__init__.py:1.1.2.1	Mon Dec 23 14:33:37 2002
+++ Zope3/src/zope/xmlpickle/__init__.py	Tue Dec 24 21:27:22 2002
@@ -2,14 +2,14 @@
 #
 # Copyright (c) 2002 Zope Corporation and Contributors.
 # All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
-# 
+#
 ##############################################################################
 """Utility for creating Python pickles in XML format.
 


=== Zope3/src/zope/xmlpickle/ppml.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/xmlpickle/ppml.py:1.1.2.2	Mon Dec 23 15:51:43 2002
+++ Zope3/src/zope/xmlpickle/ppml.py	Tue Dec 24 21:27:22 2002
@@ -40,12 +40,12 @@
     # We don't want to get returns "normalized away, so we quote them
     # This means we can't use cdata.
     rpos = string.find('\r')
-    
+
     lpos = string.find('<')
     apos = string.find('&')
 
     if rpos >= 0 or lpos >= 0 or apos >= 0:
-        
+
         # Need to do something about special characters
         if rpos < 0 and string.find(']]>') < 0:
             # can use cdata
@@ -60,9 +60,9 @@
                 string = '&#x0d;'.join(string.split('\r'))
 
     return '', string
-        
 
-#  Function unconvert takes a encoding and a string and 
+
+#  Function unconvert takes a encoding and a string and
 #  returns the original string
 
 def unconvert_string(encoding, string):
@@ -81,7 +81,7 @@
         raise ValueError('bad encoding', encoding)
 
     return string
-    
+
 
 class Base(object):
 
@@ -105,7 +105,7 @@
 
 class Global(Base):
 
-    def __init__(self, module, name): 
+    def __init__(self, module, name):
         self.module=module
         self.name=name
 
@@ -114,7 +114,7 @@
             id = ' id="%s"' % self.id
         else:
             id = ''
-            
+
         name = self.__class__.__name__.lower()
         write(
             '%s<%s%s name="%s" module="%s"/>\n' % (
@@ -128,7 +128,7 @@
 
     def __init__(self, v):
         self._v=v
-    
+
     def value(self):
         return self._v
 
@@ -137,7 +137,7 @@
             id = ' id="%s"' % self.id
         else:
             id = ''
-            
+
         name = self.__class__.__name__.lower()
         write(
             '%s<%s%s>%s</%s>' % (
@@ -149,7 +149,7 @@
 class Int(Scalar):
     pass
 
-class Long(Scalar): 
+class Long(Scalar):
 
     def value(self):
         result = str(self._v)
@@ -169,7 +169,7 @@
         encoding, v = self.convert(v)
         self.encoding = encoding
         Scalar.__init__(self, v)
-    
+
     def convert(self, string):
         """Convert a string to a form that can be included in XML text"""
         if _binary_char(string):
@@ -189,9 +189,9 @@
             encoding = ' encoding="%s"' % encoding
         else:
             encoding = ''
-            
+
         name = self.__class__.__name__.lower()
-        
+
         write('%s<%s%s%s>' % (' '*indent, name, id, encoding))
         write(self.value())
         write('</%s>' % name)
@@ -209,7 +209,7 @@
     u'\x00-\x08'
     u'\x0b-\x0c'
     u'\x0e-\x1f'
-    
+
     # Hack to get around utf-8 encoding bug(?) for surogates.
     + unichr(0xd800)+u'-'+unichr(0xdfff) + # u'\ud800-\udfff'
 
@@ -218,7 +218,7 @@
     ).search
 
 class Unicode(String):
-    
+
     def convert(self, string):
 
         if _invalid_xml_char(string):
@@ -228,12 +228,12 @@
 
         return _convert_sub(string.encode('utf-8'))
 
-    
+
 class Wrapper(Base):
 
     def __init__(self, v):
         self._v = v
-    
+
     def value(self):
         return self._v
 
@@ -241,7 +241,7 @@
         write('%s<%s%s>\n' % (str_indent, name, id))
         v.output(write, indent+2)
         write('%s</%s>\n' % (str_indent, name))
-        
+
     def output(self, write, indent=0):
         if self.id:
             id = ' id="%s"' % self.id
@@ -265,7 +265,7 @@
         write('%s<%s%s> ' % (str_indent, name, id))
         v.output(write, indent+2)
         write(' </%s>\n' % name)
-    
+
 class Collection(Base):
     def value(self, write, indent):
         raise AttributeError, 'value'
@@ -275,7 +275,7 @@
             id = ' id="%s"' % self.id
         else:
             id= ''
-            
+
         name = self.__class__.__name__.lower()
 
         i=' '*indent
@@ -303,7 +303,7 @@
 
     def __init__(self):
         self._d = []
-        
+
     def __len__(self):
         return len(self._d)
 
@@ -344,7 +344,7 @@
 
 class Sequence(Collection):
 
-    def __init__(self, v=None): 
+    def __init__(self, v=None):
         if not v:
             v = []
         self._subs = v
@@ -386,7 +386,7 @@
 class none(Scalar):
     def __init__(self):
         pass
-    
+
     def output(self, write, indent=0, strip=0):
         write(' '*indent+'<none/>')
         if not strip:
@@ -399,7 +399,7 @@
     def output(self, write, indent=0, strip=0):
         v = self._v
         name = self.__class__.__name__.lower()
-        write('%s<%s id="%s"/>' % (' '*indent,name,v)) 
+        write('%s<%s id="%s"/>' % (' '*indent,name,v))
         if not strip:
             write('\n')
 
@@ -431,14 +431,14 @@
             len(args) == 3 and
             args[1] == _object_global and
             args[2] == none and
-            isinstance(getattr(self, 'state', None), Dictionary)            
+            isinstance(getattr(self, 'state', None), Dictionary)
             ):
             klass = args[0]
             return Object((Klass(klass),
                            Attributes(self.state),
                            )
                           ).output(write, indent)
-        
+
         if (not args and
             isinstance(getattr(self, 'state', None), Dictionary)):
             # Common simple case we want to optimize
@@ -448,7 +448,7 @@
                                   ).output(write, indent)
 
         return Sequence.output(self, write, indent)
-        
+
 
 class ToXMLUnpickler(Unpickler):
 
@@ -491,7 +491,7 @@
     def load_binint2(self):
         self.append(Int(mloads('i' + self.read(2) + '\000\000')))
     dispatch[BININT2] = load_binint2
- 
+
     def load_long(self):
         self.append(Long(long(self.readline()[:-1], 0)))
     dispatch[LONG] = load_long
@@ -578,11 +578,11 @@
         k = self.marker()
         klass = stack[k + 1]
         del stack[k + 1]
-        args = Tuple(stack[k + 1:]) 
+        args = Tuple(stack[k + 1:])
         del stack[k:]
         value = Initialized_Object(klass,args)
         self.append(value)
-    dispatch[OBJ] = load_obj                
+    dispatch[OBJ] = load_obj
 
     def load_global(self):
         module = self.readline()[:-1]
@@ -619,7 +619,7 @@
                 ob.id = self.idprefix+get_id
 
             get_info = get_id, ob
-            self.__get_info[i] = get_info 
+            self.__get_info[i] = get_info
 
         else:
             get_id = get_info[0]
@@ -713,7 +713,7 @@
             top = getattr(self, tag)(tag, top)
 
         self._append(top)
-        
+
     def handle_data(self, data):
         if data.strip() or (self._stack[-1][0] in ('string', 'unicode')):
             self._append(data)
@@ -731,7 +731,7 @@
             v.append(STOP)
         else:
             v += STOP_tuple
-            
+
         return v
 
     def none(self, tag, data, NONE_tuple = (NONE, )):
@@ -863,7 +863,7 @@
             for x in L:
                 v.extend(x)
                 v.append(APPEND)
-            
+
         return v
 
     def put(self, v, attrs):
@@ -872,7 +872,7 @@
         If v is a list, then the PUT is added to the list and the list
         is returned.
         """
-        
+
         id = attrs.get('id', '').encode('ascii')
 
         if id:
@@ -906,7 +906,7 @@
 
         D = data[2:]
         v = []
-        
+
         if self.binary:
             v.extend(self.put(EMPTY_DICT_tuple, data[1]))
             if D:
@@ -956,7 +956,7 @@
 
         v = [MARK]
         v.extend(data[2])
-        
+
         if args_pickle != (EMPTY_TUPLE, ):
             v.extend(args_pickle[1:-1])
 
@@ -997,7 +997,7 @@
         attrs=data[1]
         module = attrs['module'].encode('ascii')
         name = attrs['name'].encode('ascii')
-        
+
         return self.put((GLOBAL, module, '\n', name, '\n'), attrs)
 
     def item(self, tag, data, key_name = 'key'):
@@ -1007,14 +1007,14 @@
             key = attrs[key_name].encode('ascii')
             key = self._string(key, attrs)
             value = data[2]
-            
+
             if type(value) is list:
                 value[0:0] = list(key)
             else:
                 value = tuple(key) + value
 
             return value
-            
+
         else:
             assert len(data) == 4
             key = data[2]
@@ -1026,4 +1026,3 @@
 
     def attribute(self, tag, data):
         return self.item(tag, data, 'name')
-


=== Zope3/src/zope/xmlpickle/xmlpickle.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/xmlpickle/xmlpickle.py:1.1.2.2	Mon Dec 23 15:44:41 2002
+++ Zope3/src/zope/xmlpickle/xmlpickle.py	Tue Dec 24 21:27:22 2002
@@ -2,14 +2,14 @@
 #
 # Copyright (c) 2002 Zope Corporation and Contributors.
 # All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
-# 
+#
 ##############################################################################
 """Pickle-based serialization of Python objects to and from XML.
 


=== Zope3/src/zope/xmlpickle/xyap.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/xmlpickle/xyap.py:1.1.2.1	Mon Dec 23 14:33:37 2002
+++ Zope3/src/zope/xmlpickle/xyap.py	Tue Dec 24 21:27:22 2002
@@ -62,7 +62,7 @@
         append(top)
 
 class NoBlanks:
-    
+
     def handle_data(self, data):
         if string.strip(data): self.append(data)
 
@@ -78,12 +78,12 @@
 def tuplef(self, tag, data): return tuple(data[2:])
 
 class XYap(xyap, xmllib.XMLParser):
-        def __init__(self):
-            xmllib.XMLParser.__init__(self)
-            top=[]
-            self._stack=_stack=[top]
-            self.push=_stack.append
-            self.append=top.append
+    def __init__(self):
+        xmllib.XMLParser.__init__(self)
+        top=[]
+        self._stack=_stack=[top]
+        self.push=_stack.append
+        self.append=top.append
 
 class xmlrpc(NoBlanks, XYap, xmllib.XMLParser):
     end_handlers={
@@ -117,7 +117,7 @@
         }
 
 def test():
-    
+
     data="""<?xml version="1.0"?>
     <methodCall>
              <methodName>examples.getStateName
@@ -154,7 +154,7 @@
                 </params>
              </methodCall>
              """
-    
+
     data=string.split(data,'\n')
     r=[]
     for C in XYap, xmlrpc:
@@ -163,9 +163,8 @@
             p.feed(l)
         p.close()
         r.append(p._stack)
-    
+
     return r
 
 
 if __name__=='__main__': print test()
-