[pypy-svn] r27117 - in pypy/dist/pypy: rpython/lltypesystem tool
antocuni at codespeak.net
antocuni at codespeak.net
Fri May 12 11:53:19 CEST 2006
Author: antocuni
Date: Fri May 12 11:53:11 2006
New Revision: 27117
Added:
pypy/dist/pypy/tool/staticmethods.py (contents, props changed)
Modified:
pypy/dist/pypy/rpython/lltypesystem/rstr.py
Log:
Moved StaticMethods from rstr.py to the tool directory.
Modified: pypy/dist/pypy/rpython/lltypesystem/rstr.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/rstr.py (original)
+++ pypy/dist/pypy/rpython/lltypesystem/rstr.py Fri May 12 11:53:11 2006
@@ -1,4 +1,5 @@
from weakref import WeakValueDictionary
+from pypy.tool.staticmethods import StaticMethods
from pypy.annotation.pairtype import pairtype
from pypy.rpython.robject import PyObjRepr, pyobj_repr
from pypy.rpython.rarithmetic import _hash_string
@@ -108,17 +109,6 @@
#
# TODO: move it to a better place
-import types
-class StaticMethods(type):
- """
- Metaclass that turn all methods into staticmethods.
- """
- def __new__(cls, cls_name, bases, cls_dict):
- for key, value in cls_dict.iteritems():
- if isinstance(value, types.FunctionType):
- cls_dict[key] = staticmethod(value)
- return type.__new__(cls, cls_name, bases, cls_dict)
-
class LLHelpers:
__metaclass__ = StaticMethods
Added: pypy/dist/pypy/tool/staticmethods.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/tool/staticmethods.py Fri May 12 11:53:11 2006
@@ -0,0 +1,10 @@
+import types
+class StaticMethods(type):
+ """
+ Metaclass that turns plain methods into staticmethods.
+ """
+ def __new__(cls, cls_name, bases, cls_dict):
+ for key, value in cls_dict.iteritems():
+ if isinstance(value, types.FunctionType):
+ cls_dict[key] = staticmethod(value)
+ return type.__new__(cls, cls_name, bases, cls_dict)
More information about the Pypy-commit
mailing list