1#!/usr/bin/env python 2""" 3io.pyx: Cython functionality for mlpack::IO. 4 5This file imports the GetParam() function from mlpack::IO, plus a utility 6SetParam() function because Cython can't seem to support lvalue references. 7 8mlpack is free software; you may redistribute it and/or modify it under the 9terms of the 3-clause BSD license. You should have received a copy of the 103-clause BSD license along with mlpack. If not, see 11http://www.opensource.org/licenses/BSD-3-Clause for more information. 12""" 13cimport cython 14 15from libcpp.string cimport string 16from libcpp cimport bool 17 18cdef extern from "<mlpack/core/util/io.hpp>" namespace "mlpack" nogil: 19 cdef cppclass IO: 20 @staticmethod 21 (T&) GetParam[T](string) nogil except + 22 23 @staticmethod 24 bool HasParam(string) nogil except + 25 26 @staticmethod 27 void SetPassed(string) nogil except + 28 29 @staticmethod 30 void Destroy() nogil except + 31 32 @staticmethod 33 void StoreSettings(string) nogil except + 34 35 @staticmethod 36 void RestoreSettings(string) nogil except + 37 38 @staticmethod 39 void ClearSettings() nogil except + 40 41cdef extern from "<mlpack/bindings/python/mlpack/io_util.hpp>" \ 42 namespace "mlpack::util" nogil: 43 void SetParam[T](string, T&) nogil except + 44 void SetParamPtr[T](string, T*, bool) nogil except + 45 void SetParamWithInfo[T](string, T&, const bool*) nogil except + 46 (T*) GetParamPtr[T](string) nogil except + 47 (T&) GetParamWithInfo[T](string) nogil except + 48 void EnableVerbose() nogil except + 49 void DisableVerbose() nogil except + 50 void DisableBacktrace() nogil except + 51 void ResetTimers() nogil except + 52 void EnableTimers() nogil except + 53