[Python-checkins] r70163 - in python/branches/py3k: Doc/library/importlib.rst Lib/importlib/_bootstrap.py Lib/importlib/test/test_util.py Lib/importlib/util.py

brett.cannon python-checkins at python.org
Wed Mar 4 17:07:01 CET 2009


Author: brett.cannon
Date: Wed Mar  4 17:07:00 2009
New Revision: 70163

Log:
Rename importlib.util.set___package__ to set_package.

Modified:
   python/branches/py3k/Doc/library/importlib.rst
   python/branches/py3k/Lib/importlib/_bootstrap.py
   python/branches/py3k/Lib/importlib/test/test_util.py
   python/branches/py3k/Lib/importlib/util.py

Modified: python/branches/py3k/Doc/library/importlib.rst
==============================================================================
--- python/branches/py3k/Doc/library/importlib.rst	(original)
+++ python/branches/py3k/Doc/library/importlib.rst	Wed Mar  4 17:07:00 2009
@@ -185,7 +185,7 @@
     loader should initialize as specified by :pep:`302`.
 
 
-.. function:: set___package__(method)
+.. function:: set_package(method)
 
     A :term:`decorator` for a :term:`loader` to set the :attr:`__package__`
     attribute on the module returned by the loader. If :attr:`__package__` is

Modified: python/branches/py3k/Lib/importlib/_bootstrap.py
==============================================================================
--- python/branches/py3k/Lib/importlib/_bootstrap.py	(original)
+++ python/branches/py3k/Lib/importlib/_bootstrap.py	Wed Mar  4 17:07:00 2009
@@ -97,7 +97,7 @@
     new.__dict__.update(old.__dict__)
 
 
-def set___package__(fxn):
+def set_package(fxn):
     """Set __package__ on the returned module."""
     def wrapper(*args, **kwargs):
         module = fxn(*args, **kwargs)
@@ -131,7 +131,7 @@
         return cls if imp.is_builtin(fullname) else None
 
     @classmethod
-    @set___package__
+    @set_package
     def load_module(cls, fullname):
         """Load a built-in module."""
         if fullname not in sys.builtin_module_names:
@@ -160,7 +160,7 @@
         return cls if imp.is_frozen(fullname) else None
 
     @classmethod
-    @set___package__
+    @set_package
     def load_module(cls, fullname):
         """Load a frozen module."""
         if cls.find_module(fullname) is None:
@@ -248,7 +248,7 @@
             raise ValueError("extension modules cannot be packages")
 
     @check_name
-    @set___package__
+    @set_package
     def load_module(self, fullname):
         """Load an extension module."""
         is_reload = fullname in sys.modules

Modified: python/branches/py3k/Lib/importlib/test/test_util.py
==============================================================================
--- python/branches/py3k/Lib/importlib/test/test_util.py	(original)
+++ python/branches/py3k/Lib/importlib/test/test_util.py	Wed Mar  4 17:07:00 2009
@@ -63,13 +63,13 @@
 class SetPackageTests(unittest.TestCase):
 
 
-    """Tests for importlib.util.set___package__."""
+    """Tests for importlib.util.set_package."""
 
     def verify(self, module, expect):
         """Verify the module has the expected value for __package__ after
-        passing through set___package__."""
+        passing through set_package."""
         fxn = lambda: module
-        wrapped = util.set___package__(fxn)
+        wrapped = util.set_package(fxn)
         wrapped()
         self.assert_(hasattr(module, '__package__'))
         self.assertEqual(expect, module.__package__)

Modified: python/branches/py3k/Lib/importlib/util.py
==============================================================================
--- python/branches/py3k/Lib/importlib/util.py	(original)
+++ python/branches/py3k/Lib/importlib/util.py	Wed Mar  4 17:07:00 2009
@@ -1,3 +1,3 @@
 """Utility code for constructing importers, etc."""
 from ._bootstrap import module_for_loader
-from ._bootstrap import set___package__
+from ._bootstrap import set_package


More information about the Python-checkins mailing list