Debian Codegraph @

pypy/module/__pypy__/interp_pypydatetime.py

raw symbols SCIP
1 from pypy.interpreter.baseobjspace import W_Root
2 from pypy.interpreter.typedef import TypeDef
3 from pypy.interpreter.gateway import interp2app
4 from rpython.tool.sourcetools import func_with_new_name
5
6 def create_class(name):
7 class W_Class(W_Root):
8 'builtin base class for datetime.%s to allow interop with cpyext' % name
9 def descr_new__(space, w_type):
10 return space.allocate_instance(W_Class, w_type)
11
12 W_Class.typedef = TypeDef(name,
13 __new__ = interp2app(func_with_new_name(
14 W_Class.descr_new__.im_func,
15 '%s_new' % (name,))),
16 )
17 W_Class.typedef.acceptable_as_base_class = True
18 return W_Class
19
20 W_DateTime_Time = create_class('pypydatetime_time')
21 W_DateTime_Date = create_class('pypydatetime_date')
22 W_DateTime_Delta = create_class('pypydatetime_delta')
23
24