Skip to content

Commit 449a21a

Browse files
committed
Merge branch 'master' into refresh-sandbox
2 parents ba9898b + 12f021b commit 449a21a

File tree

39 files changed

+3556
-2032
lines changed

39 files changed

+3556
-2032
lines changed

plugins/python3/src/plugin.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,25 +74,25 @@ impl Python3Plugin {
7474
}
7575
}
7676

77-
fn get_local_python_ver() -> Result<(usize, usize, usize), PythonError> {
77+
fn get_local_python_ver() -> Result<(u32, u32, u32), PythonError> {
7878
let output = Self::get_local_python_command()
7979
.with(|e| e.args(&["-c", "import sys; print(sys.version_info.major); print(sys.version_info.minor); print(sys.version_info.micro);"]))
8080
.output_checked()?;
8181
let stdout = String::from_utf8_lossy(&output.stdout);
8282
let mut lines = stdout.lines();
83-
let major: usize = lines
83+
let major: u32 = lines
8484
.next()
8585
.ok_or_else(|| PythonError::VersionPrintError(stdout.clone().into_owned()))?
8686
.trim()
8787
.parse()
8888
.map_err(|e| PythonError::VersionParseError(stdout.clone().into_owned(), e))?;
89-
let minor: usize = lines
89+
let minor: u32 = lines
9090
.next()
9191
.ok_or_else(|| PythonError::VersionPrintError(stdout.clone().into_owned()))?
9292
.trim()
9393
.parse()
9494
.map_err(|e| PythonError::VersionParseError(stdout.clone().into_owned(), e))?;
95-
let patch: usize = lines
95+
let patch: u32 = lines
9696
.next()
9797
.ok_or_else(|| PythonError::VersionPrintError(stdout.clone().into_owned()))?
9898
.trim()

tmc-client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ chrono = { version = "0.4", features = ["serde"] }
1313
dirs = "3"
1414
http = "0.2"
1515
log = "0.4"
16-
oauth2 = { version = "4.0.0-beta.1", features = ["reqwest"] }
16+
oauth2 = { version = "4", features = ["reqwest"] }
1717
once_cell = "1"
1818
percent-encoding = "2"
1919
regex = "1"

tmc-client/src/error.rs

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,6 @@ type TokenError = oauth2::RequestTokenError<
1313
/// The main error type for tmc-client.
1414
#[derive(Debug, Error)]
1515
pub enum ClientError {
16-
// Arc
17-
#[error("Tried to mutate client while it was borrowed")]
18-
ArcBorrowed,
19-
20-
// file IO
21-
#[error("Failed to create temporary file")]
22-
TempFile(#[source] std::io::Error),
23-
24-
// network
2516
#[error("HTTP error {status} for {url}: {error}. Obsolete client: {obsolete_client}")]
2617
HttpError {
2718
url: Url,
@@ -33,37 +24,23 @@ pub enum ClientError {
3324
ConnectionError(Method, Url, #[source] reqwest::Error),
3425
#[error("OAuth2 password exchange error")]
3526
Token(#[source] Box<TokenError>),
36-
#[error("OAuth2 unexpected token response: {0}")]
37-
TokenParse(String, #[source] serde_json::error::Error),
3827
#[error("Failed to parse as URL: {0}")]
3928
UrlParse(String, #[source] url::ParseError),
4029
#[error("Failed to write response")]
4130
HttpWriteResponse(#[source] reqwest::Error),
4231
#[error("Failed to deserialize response from {0} as JSON")]
4332
HttpJsonResponse(Url, #[source] reqwest::Error),
4433

45-
#[error("Failed to download some exercises")]
46-
IncompleteDownloadResult {
47-
downloaded: Vec<usize>,
48-
failed: Vec<(usize, Box<ClientError>)>,
49-
},
50-
5134
#[error("Already authenticated")]
5235
AlreadyAuthenticated,
5336
#[error("Authentication required")]
54-
NotLoggedIn,
55-
#[error("Failed to find cache directory")]
56-
CacheDir,
57-
#[error("No values found in exercise details map returned by server")]
58-
MissingDetailsValue,
59-
#[error("List of exercises given was empty")]
60-
NoExercisesGiven,
37+
NotAuthenticated,
6138

6239
#[error(transparent)]
6340
SystemTime(#[from] std::time::SystemTimeError),
6441
#[error(transparent)]
6542
WalkDir(#[from] walkdir::Error),
66-
#[error("File IO error")]
43+
#[error(transparent)]
6744
FileError(#[from] FileError),
6845
#[error(transparent)]
6946
Plugin(#[from] tmc_langs_plugins::PluginError),

tmc-client/src/lib.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,20 @@
55
//! ```rust,no_run
66
//! use tmc_client::TmcClient;
77
//!
8-
//! let mut client = TmcClient::new_in_config("https://tmc.mooc.fi".to_string(), "some_client".to_string(), "some_version".to_string()).unwrap();
8+
//! let mut client = TmcClient::new("https://tmc.mooc.fi".parse().unwrap(), "some_client".to_string(), "some_version".to_string());
99
//! client.authenticate("client_name", "email".to_string(), "password".to_string());
1010
//! let organizations = client.get_organizations();
1111
//! ```
1212
//!
1313
1414
mod error;
15-
mod request;
16-
mod response;
15+
pub mod request;
16+
pub mod response;
1717
mod tmc_client;
1818

1919
pub use self::error::ClientError;
20-
pub use self::request::FeedbackAnswer;
21-
pub use self::response::{
22-
Course, CourseData, CourseDataExercise, CourseDataExercisePoint, CourseDetails, CourseExercise,
23-
Exercise, ExerciseDetails, ExercisesDetails, NewSubmission, Organization, Review, Submission,
24-
SubmissionFeedbackResponse, SubmissionFinished, SubmissionProcessingStatus, SubmissionStatus,
25-
UpdateResult, User,
26-
};
27-
pub use self::tmc_client::{ClientUpdateData, TmcClient, Token};
20+
pub use self::tmc_client::{api_v8, ClientUpdateData, TmcClient, Token, UpdateResult};
21+
22+
// these types are part of tmc-client's API and thus re-exported
2823
pub use oauth2;
29-
pub use tmc_langs_plugins::{Language, RunResult, StyleValidationResult, StyleValidationStrategy};
24+
pub use tmc_langs_plugins::Language;

tmc-client/src/request.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
33
/// Used to respond to feedback questions. See TmcClient::send_feedback.
44
pub struct FeedbackAnswer {
5-
pub question_id: usize,
5+
pub question_id: u32,
66
pub answer: String,
77
}

0 commit comments

Comments
 (0)