Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 24... Línea 24...
24
 
24
 
Línea 25... Línea 25...
25
namespace mlbackend_python;
25
namespace mlbackend_python;
Línea -... Línea 26...
-
 
26
 
-
 
27
defined('MOODLE_INTERNAL') || die();
-
 
28
 
-
 
29
global $CFG;
-
 
30
require_once($CFG->dirroot . '/analytics/tests/classes/mlbackend_helper_trait.php');
26
 
31
 
27
defined('MOODLE_INTERNAL') || die();
32
use core_analytics\tests\mlbackend_helper_trait;
28
 
33
 
29
/**
34
/**
30
 * Python predictions processor.
35
 * Python predictions processor.
31
 *
36
 *
32
 * @package   mlbackend_python
37
 * @package   mlbackend_python
33
 * @copyright 2016 David Monllao {@link http://www.davidmonllao.com}
38
 * @copyright 2016 David Monllao {@link http://www.davidmonllao.com}
Línea -... Línea 39...
-
 
39
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-
 
40
 */
34
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
41
class processor implements  \core_analytics\classifier, \core_analytics\regressor, \core_analytics\packable {
35
 */
42
 
36
class processor implements  \core_analytics\classifier, \core_analytics\regressor, \core_analytics\packable {
43
    use mlbackend_helper_trait;
37
 
44
 
Línea 88... Línea 95...
88
     *
95
     *
89
     */
96
     */
90
    public function __construct() {
97
    public function __construct() {
91
        global $CFG;
98
        global $CFG;
Línea -... Línea 99...
-
 
99
 
-
 
100
        if ((defined('BEHAT_SITE_RUNNING') || (defined('PHPUNIT_TEST') && PHPUNIT_TEST)) &&
-
 
101
                self::is_mlbackend_python_configured()) {
-
 
102
            $this->useserver = true;
-
 
103
            $this->host = TEST_MLBACKEND_PYTHON_HOST;
-
 
104
            $this->port = TEST_MLBACKEND_PYTHON_PORT;
-
 
105
            $this->secure = false;
-
 
106
            $this->username = TEST_MLBACKEND_PYTHON_USERNAME;
-
 
107
            $this->password = TEST_MLBACKEND_PYTHON_PASSWORD;
92
 
108
        } else {
Línea 93... Línea 109...
93
        $config = get_config('mlbackend_python');
109
            $config = get_config('mlbackend_python');
Línea 94... Línea 110...
94
 
110
 
95
        $this->useserver = !empty($config->useserver);
111
            $this->useserver = !empty($config->useserver);
96
 
112
 
97
        if (!$this->useserver) {
113
            if (!$this->useserver) {
-
 
114
                // Set the python location if there is a value.
-
 
115
                if (!empty($CFG->pathtopython)) {
-
 
116
                    $this->pathtopython = $CFG->pathtopython;
-
 
117
                }
-
 
118
            } else {
-
 
119
                $this->host = $config->host ?? '';
-
 
120
                $this->port = $config->port ?? '';
98
            // Set the python location if there is a value.
121
                $this->secure = $config->secure ?? false;
99
            if (!empty($CFG->pathtopython)) {
-
 
100
                $this->pathtopython = $CFG->pathtopython;
-
 
101
            }
-
 
102
        } else {
-
 
103
            $this->host = $config->host ?? '';
-
 
104
            $this->port = $config->port ?? '';
-
 
105
            $this->secure = $config->secure ?? false;
122
                $this->username = $config->username ?? '';
106
            $this->username = $config->username ?? '';
123
                $this->password = $config->password ?? '';
Línea 107... Línea 124...
107
            $this->password = $config->password ?? '';
124
            }
108
        }
125
        }