[Checkins] SVN: keas.pbstate/trunk/s Housekeeping: added some docstrings, moved the StateTuple class (since

Shane Hathaway shane at hathawaymix.org
Mon Jan 12 19:32:38 EST 2009


Log message for revision 94712:
  Housekeeping: added some docstrings, moved the StateTuple class (since 
  it will be used for more than just the metaclass), declared keas a 
  namespace package, and added package metadata.
  

Changed:
  U   keas.pbstate/trunk/setup.py
  A   keas.pbstate/trunk/src/keas/__init__.py
  U   keas.pbstate/trunk/src/keas/pbstate/meta.py
  A   keas.pbstate/trunk/src/keas/pbstate/state.py

-=-
Modified: keas.pbstate/trunk/setup.py
===================================================================
--- keas.pbstate/trunk/setup.py	2009-01-13 00:14:52 UTC (rev 94711)
+++ keas.pbstate/trunk/setup.py	2009-01-13 00:32:38 UTC (rev 94712)
@@ -18,9 +18,13 @@
     name='keas.pbstate',
     version='0.1dev',
     author='Shane Hathaway and the Zope Community',
+    author_email='zope-dev at zope.org',
+    description='Method of storing object state in a Google Protocol Buffer',
+    license='ZPL 2.1',
 
     package_dir={'': 'src'},
     packages=['keas.pbstate'],
+    namespace_packages=['keas'],
     install_requires=[
         'protobuf',
         ],

Added: keas.pbstate/trunk/src/keas/__init__.py
===================================================================
--- keas.pbstate/trunk/src/keas/__init__.py	                        (rev 0)
+++ keas.pbstate/trunk/src/keas/__init__.py	2009-01-13 00:32:38 UTC (rev 94712)
@@ -0,0 +1,7 @@
+# this is a namespace package
+try:
+    import pkg_resources
+    pkg_resources.declare_namespace(__name__)
+except ImportError:
+    import pkgutil
+    __path__ = pkgutil.extend_path(__path__, __name__)

Modified: keas.pbstate/trunk/src/keas/pbstate/meta.py
===================================================================
--- keas.pbstate/trunk/src/keas/pbstate/meta.py	2009-01-13 00:14:52 UTC (rev 94711)
+++ keas.pbstate/trunk/src/keas/pbstate/meta.py	2009-01-13 00:32:38 UTC (rev 94712)
@@ -11,11 +11,15 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
+"""Provides the ProtobufState metaclass."""
 
 from google.protobuf.descriptor import FieldDescriptor
 
+from keas.pbstate.state import StateTuple
 
+
 def _protobuf_property(name):
+    """A property that delegates to a protobuf message"""
     def get(self):
         return getattr(self.protobuf, name)
     def set(self, value):
@@ -26,6 +30,7 @@
 
 
 def _protobuf_mixin_property(container_getter, name):
+    """A property that delegates to a protobuf sub-message"""
     def get_(self):
         return getattr(container_getter(self), name)
     def set_(self, value):
@@ -36,6 +41,7 @@
 
 
 def _add_mixin(created_class, mixin_name):
+    """Add the properties from a protobuf sub-message to a class"""
     main_desc = created_class.protobuf_type.DESCRIPTOR
 
     # traverse to the named descriptor
@@ -155,13 +161,6 @@
         return targets
 
 
-class StateTuple(tuple):
-    """Contains the persistent state of a ProtobufState object.
-
-    Contains data (a byte string) and targets (a map of refid to object).
-    """
-
-
 class StateClassMethods(object):
     """Contains methods that get copied into classes using ProtobufState"""
 

Added: keas.pbstate/trunk/src/keas/pbstate/state.py
===================================================================
--- keas.pbstate/trunk/src/keas/pbstate/state.py	                        (rev 0)
+++ keas.pbstate/trunk/src/keas/pbstate/state.py	2009-01-13 00:32:38 UTC (rev 94712)
@@ -0,0 +1,7 @@
+
+
+class StateTuple(tuple):
+    """Contains the persistent state of a ProtobufState object.
+
+    Contains data (a byte string) and targets (a map of refid to object).
+    """



More information about the Checkins mailing list