def datetime_class(parent): cls = Class(name='DateTime', wrapped_class='datetime.datetime', parent=parent) Constructor( signature=[('unsigned int', 'year'), ('unsigned int', 'month'), ('unsigned int', 'day'), ('unsigned int', 'hour', '0'), ('unsigned int', 'minute', '0'), ('unsigned int', 'second', '0'), ('unsigned int', 'microsecond', '0'), #[, tzinfo ], parent=cls) class_method('DateTime today()', parent=cls) class_method('DateTime now()', parent=cls) class_method('DateTime now(TZInfo tz)', parent=cls) class_method('DateTime utcnow()', parent=cls) class_method('DateTime fromtimestamp(float timestamp)', parent=cls)
def date_class(parent): cls = Class(name='Date', wrapped_class='datetime.date', parent=parent) Constructor( signature=[('unsigned int', 'year'), ('unsigned int', 'month'), ('unsigned int', 'day')], parent=cls) class_method('Date today()', parent=cls) class_method('Date fromtimestamp(double timestamp)', parent=cls) class_method('Date fromordinal(unsigned int ordinal)', parent=cls) ClassProperty( name='min', type='Date', read_only=True, parent=cls) ClassProperty( name='max', type='Date', read_only=True, parent=cls) ClassProperty( name='resolution', type='TimeDelta', read_only=True, parent=cls) Property( name='year', type='unsigned int', read_only=True, parent=cls) Property( name='month', type='unsigned int', read_only=True, parent=cls) Property( name='day', type='unsigned int', read_only=True, parent=cls) Method( name='_replace', python_name='replace', return_type='Date', signature=[('unsigned int', 'year'), ('unsigned int', 'month'), ('unsigned int', 'day')], const=True, parent=cls) InlineFunction( code=replace_method, parent=cls) for m in [ 'tm timetuple() const', 'unsigned int toordinal() const', 'int weekday() const', 'int isoweekday() const', 'boost::tuple<int, int, int> isocalendar() const', 'std::string isoformat() const', 'std::string ctime() const', 'std::wstring strftime(std::wstring fmt) const']: method(m, parent=cls) InlineFunction( code=equality_operator, parent=cls)