Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1945)

Side by Side Diff: psyco_win32/psyco/classes.py

Issue 6777021: Adding Win32 installation of Psyco. This will be used to speed up GYP, adding (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « psyco_win32/psyco/_psyco.pyd ('k') | psyco_win32/psyco/core.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 ###########################################################################
2 #
3 # Psyco class support module.
4 # Copyright (C) 2001-2002 Armin Rigo et.al.
5
6 """Psyco class support module.
7
8 'psyco.classes.psyobj' is an alternate Psyco-optimized root for classes.
9 Any class inheriting from it or using the metaclass '__metaclass__' might
10 get optimized specifically for Psyco. It is equivalent to call
11 psyco.bind() on the class object after its creation.
12
13 Importing everything from psyco.classes in a module will import the
14 '__metaclass__' name, so all classes defined after a
15
16 from psyco.classes import *
17
18 will automatically use the Psyco-optimized metaclass.
19 """
20 ###########################################################################
21
22 __all__ = ['psyobj', 'psymetaclass', '__metaclass__']
23
24
25 from _psyco import compacttype
26 import core
27 from types import FunctionType
28
29 class psymetaclass(compacttype):
30 "Psyco-optimized meta-class. Turns all methods into Psyco proxies."
31
32 def __new__(cls, name, bases, dict):
33 bindlist = dict.get('__psyco__bind__')
34 if bindlist is None:
35 bindlist = [key for key, value in dict.items()
36 if isinstance(value, FunctionType)]
37 for attr in bindlist:
38 dict[attr] = core.proxy(dict[attr])
39 return super(psymetaclass, cls).__new__(cls, name, bases, dict)
40
41 psyobj = psymetaclass("psyobj", (), {})
42 __metaclass__ = psymetaclass
OLDNEW
« no previous file with comments | « psyco_win32/psyco/_psyco.pyd ('k') | psyco_win32/psyco/core.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698