Struct Python3Plugin

Source
pub struct Python3Plugin;

Implementations§

Source§

impl Python3Plugin

Source

pub const fn new() -> Self

Trait Implementations§

Source§

impl Default for Python3Plugin

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl LanguagePlugin for Python3Plugin

Project directory: Contains setup.py, requirements.txt, test/init.py, or tmc/main.py OR Contains an .ipynb file. This is given lower priority than the prior rule, and if there are multiple .ipynb files, the shallowest directory is returned.

Source§

const PLUGIN_NAME: &'static str = "python3"

Source§

const DEFAULT_SANDBOX_IMAGE: &'static str = "eu.gcr.io/moocfi-public/tmc-sandbox-python:latest"

Source§

const LINE_COMMENT: &'static str = "#"

Source§

const BLOCK_COMMENT: Option<(&'static str, &'static str)>

Source§

type StudentFilePolicy = Python3StudentFilePolicy

Source§

fn scan_exercise( &self, exercise_directory: &Path, exercise_name: String, ) -> Result<ExerciseDesc, TmcError>

Produces an exercise description of an exercise directory. Read more
Source§

fn run_tests_with_timeout( &self, exercise_directory: &Path, timeout: Option<Duration>, ) -> Result<RunResult, TmcError>

Runs the tests for the exercise with the given timeout. Used by run_tests with the timeout from the project config.
Source§

fn find_project_dir_in_archive<R: Read + Seek>( archive: &mut Archive<R>, ) -> Result<PathBuf, TmcError>

Searches the zip for a valid project directory. This function is used to detect the language plugin for the archive, so simply finding “src” is not sufficient, e.g. the Python plugin should check that there is an actual “src/*.py” file inside src. Note that the returned path may not actually have an entry in the zip.
Source§

fn is_exercise_type_correct(path: &Path) -> bool

Tells if there’s a valid exercise in this path. Delegates to find_project_dir_in_archive by default. Unlike is_archive_type_correct, only checks the root directory.
Source§

fn clean(&self, exercise_path: &Path) -> Result<(), TmcError>

Runs clean command e.g make clean for make or mvn clean for maven.
Source§

fn get_default_student_file_paths() -> Vec<PathBuf>

Source§

fn get_default_exercise_file_paths() -> Vec<PathBuf>

Source§

fn points_parser(i: &str) -> IResult<&str, Vec<&str>, VerboseError<&str>>

A nom parser that recognizes a points annotation and returns the inner points value(s). Read more
Source§

fn run_tests(&self, path: &Path) -> Result<RunResult, TmcError>

Runs the tests for the exercise.
Source§

fn check_code_style( &self, _path: &Path, _locale: Language, ) -> Result<Option<StyleValidationResult>, TmcError>

Run checkstyle or similar plugin to project if applicable, no-op by default
Source§

fn extract_project<R>( archive: &mut Archive<R>, target_location: &Path, clean: bool, ) -> Result<(), TmcError>
where R: Read + Seek,

Extract a given archive file containing a compressed project to a target location. Read more
Source§

fn extract_student_files( compressed_project: impl Read + Seek, compression: Compression, target_location: &Path, ) -> Result<(), TmcError>

Extracts student files from the compressed project. It finds the project dir from the zip and extracts the student files from there. Overwrites all files. Important: does not extract .tmcproject.yml from the students’ submission as they control that file and they could use it to modify the test files.
Source§

fn safe_find_project_dir_in_archive<R>(archive: &mut Archive<R>) -> PathBuf
where R: Read + Seek,

A safer variant of find_project_dir_in_archive used by default extraction helpers. Read more
Source§

fn is_archive_type_correct<R>(archive: &mut Archive<R>) -> bool
where R: Read + Seek,

Tells if there’s a valid exercise in this archive. Unlike is_exercise_type_correct, searches the entire archive.
Source§

fn get_exercise_packaging_configuration( path: &Path, ) -> Result<ExercisePackagingConfiguration, TmcError>

Returns configuration which is used to package submission on tmc-server.
Source§

fn get_available_points(exercise_path: &Path) -> Result<Vec<String>, TmcError>

Parses exercise files using Self::LINE_COMMENT and Self::BLOCK_COMMENT to filter out comments and Self::points_parser to parse points from the actual code.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V