original_string: public function is_ready() {
          if (empty($this->pathtopython)) {
              $settingurl = new \moodle_url('/admin/settings.php', array('section' => 'systempaths'));
              return get_string('pythonpathnotdefined', 'mlbackend_python', $settingurl->out());
          }
  
          // Check the installed pip package version.
          $cmd = "{$this->pathtopython} -m moodlemlbackend.version";
  
          $output = null;
          $exitcode = null;
          // Execute it sending the standard error to $output.
          $result = exec($cmd . ' 2>&1', $output, $exitcode);
  
          $vercheck = self::check_pip_package_version($result);
  
          if ($vercheck === 0) {
              return true;
          }
  
          if ($exitcode != 0) {
              return get_string('pythonpackagenotinstalled', 'mlbackend_python', $cmd);
          }
  
          if ($result) {
              $a = [
                  'installed' => $result,
                  'required' => self::REQUIRED_PIP_PACKAGE_VERSION,
              ];
  
              if ($vercheck < 0) {
                  return get_string('packageinstalledshouldbe', 'mlbackend_python', $a);
  
              } else if ($vercheck > 0) {
                  return get_string('packageinstalledtoohigh', 'mlbackend_python', $a);
              }
          }
  
          return get_string('pythonpackagenotinstalled', 'mlbackend_python', $cmd);
      }
code: public function is_ready() {
          if (empty($this->pathtopython)) {
              $settingurl = new \moodle_url('/admin/settings.php', array('section' => 'systempaths'));
              return get_string('pythonpathnotdefined', 'mlbackend_python', $settingurl->out());
          }
  
          // Check the installed pip package version.
          $cmd = "{$this->pathtopython} -m moodlemlbackend.version";
  
          $output = null;
          $exitcode = null;
          // Execute it sending the standard error to $output.
          $result = exec($cmd . ' 2>&1', $output, $exitcode);
  
          $vercheck = self::check_pip_package_version($result);
  
          if ($vercheck === 0) {
              return true;
          }
  
          if ($exitcode != 0) {
              return get_string('pythonpackagenotinstalled', 'mlbackend_python', $cmd);
          }
  
          if ($result) {
              $a = [
                  'installed' => $result,
                  'required' => self::REQUIRED_PIP_PACKAGE_VERSION,
              ];
  
              if ($vercheck < 0) {
                  return get_string('packageinstalledshouldbe', 'mlbackend_python', $a);
  
              } else if ($vercheck > 0) {
                  return get_string('packageinstalledtoohigh', 'mlbackend_python', $a);
              }
          }
  
          return get_string('pythonpackagenotinstalled', 'mlbackend_python', $cmd);
      }
code_tokens: public function is_ready ( ) { if ( empty ( $ this -> pathtopython ) ) { $ settingurl = new \ moodle_url ( '/admin/settings.php' , array ( 'section' => 'systempaths' ) ) ; return get_string ( 'pythonpathnotdefined' , 'mlbackend_python' , $ settingurl -> out ( ) ) ; } // Check the installed pip package version. $ cmd = "{$this->pathtopython} -m moodlemlbackend.version" ; $ output = null ; $ exitcode = null ; // Execute it sending the standard error to $output. $ result = exec ( $ cmd . ' 2>&1' , $ output , $ exitcode ) ; $ vercheck = self :: check_pip_package_version ( $ result ) ; if ( $ vercheck === 0 ) { return true ; } if ( $ exitcode != 0 ) { return get_string ( 'pythonpackagenotinstalled' , 'mlbackend_python' , $ cmd ) ; } if ( $ result ) { $ a = [ 'installed' => $ result , 'required' => self :: REQUIRED_PIP_PACKAGE_VERSION , ] ; if ( $ vercheck < 0 ) { return get_string ( 'packageinstalledshouldbe' , 'mlbackend_python' , $ a ) ; } else if ( $ vercheck > 0 ) { return get_string ( 'packageinstalledtoohigh' , 'mlbackend_python' , $ a ) ; } } return get_string ( 'pythonpackagenotinstalled' , 'mlbackend_python' , $ cmd ) ; }
docstring: Is the plugin ready to be used?.
  
  @return bool|string Returns true on success, a string detailing the error otherwise
docstring_tokens: Is the plugin ready to be used? .