diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e0a066..2bf1557 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ - Add ability to download attachments for comments - Increase default http timeout to 120s - Add `--resume-on-error` flag when creating annotations +- Remove `--use-moon-forms` flag # v0.28.0 - Add general fields to `create datasets` diff --git a/cli/src/commands/create/annotations.rs b/cli/src/commands/create/annotations.rs index 285dbb2..dce296a 100644 --- a/cli/src/commands/create/annotations.rs +++ b/cli/src/commands/create/annotations.rs @@ -39,11 +39,6 @@ pub struct CreateAnnotationsArgs { /// Don't display a progress bar (only applicable when --file is used). no_progress: bool, - #[structopt(long)] - /// Whether to use the moon_forms field when creating annotations - /// for a comment. - use_moon_forms: bool, - #[structopt(long = "batch-size", default_value = "128")] /// Number of comments to batch in a single request. batch_size: usize, @@ -96,7 +91,6 @@ pub fn create(client: &Client, args: &CreateAnnotationsArgs, pool: &mut Pool) -> file, &statistics, &dataset_name, - args.use_moon_forms, args.batch_size, pool, args.resume_on_error, @@ -119,7 +113,6 @@ pub fn create(client: &Client, args: &CreateAnnotationsArgs, pool: &mut Pool) -> BufReader::new(io::stdin()), &statistics, &dataset_name, - args.use_moon_forms, args.batch_size, pool, args.resume_on_error, @@ -147,7 +140,6 @@ pub fn upload_batch_of_annotations( source: &Source, statistics: &(impl AnnotationStatistic + std::marker::Sync), dataset_name: &DatasetFullName, - use_moon_forms: bool, pool: &mut Pool, resume_on_error: bool, ) -> Result<()> { @@ -161,7 +153,7 @@ pub fn upload_batch_of_annotations( let comment_uid = CommentUid(format!("{}.{}", source.id.0, new_comment.comment.id.0)); - let result = (if !use_moon_forms { + let result = (if new_comment.moon_forms.is_none() { client.update_labelling( dataset_name, &comment_uid, @@ -178,7 +170,7 @@ pub fn upload_batch_of_annotations( dataset_name, &comment_uid, None, - None, + new_comment.entities.as_ref(), new_comment.moon_forms.as_deref(), ) }) @@ -219,7 +211,6 @@ fn upload_annotations_from_reader( annotations: impl BufRead, statistics: &Statistics, dataset_name: &DatasetFullName, - use_moon_forms: bool, batch_size: usize, pool: &mut Pool, resume_on_error: bool, @@ -238,7 +229,6 @@ fn upload_annotations_from_reader( source, statistics, dataset_name, - use_moon_forms, pool, resume_on_error, )?; @@ -253,7 +243,6 @@ fn upload_annotations_from_reader( source, statistics, dataset_name, - use_moon_forms, pool, resume_on_error, )?; diff --git a/cli/src/commands/create/comments.rs b/cli/src/commands/create/comments.rs index e18a7c3..2a09c96 100644 --- a/cli/src/commands/create/comments.rs +++ b/cli/src/commands/create/comments.rs @@ -62,11 +62,6 @@ pub struct CreateCommentsArgs { /// which is already associated to different data on the platform. overwrite: bool, - #[structopt(long)] - /// Whether to use the moon_forms field when creating annotations - /// for a comment. - use_moon_forms: bool, - #[structopt(short = "n", long = "no-charge")] /// Whether to attempt to bypass billing (internal only) no_charge: bool, @@ -153,7 +148,6 @@ pub fn create(client: &Client, args: &CreateCommentsArgs, pool: &mut Pool) -> Re dataset_name.as_ref(), args.overwrite, args.allow_duplicates, - args.use_moon_forms, args.no_charge, pool, args.resume_on_error, @@ -182,7 +176,6 @@ pub fn create(client: &Client, args: &CreateCommentsArgs, pool: &mut Pool) -> Re dataset_name.as_ref(), args.overwrite, args.allow_duplicates, - args.use_moon_forms, args.no_charge, pool, args.resume_on_error, @@ -333,7 +326,6 @@ fn upload_comments_from_reader( dataset_name: Option<&DatasetFullName>, overwrite: bool, allow_duplicates: bool, - use_moon_forms: bool, no_charge: bool, pool: &mut Pool, resume_on_error: bool, @@ -359,25 +351,14 @@ fn upload_comments_from_reader( let new_comment = read_comment_result?; if dataset_name.is_some() && new_comment.has_annotations() { - if !use_moon_forms { - annotations.push(NewAnnotation { - comment: CommentIdComment { - id: new_comment.comment.id.clone(), - }, - labelling: new_comment.labelling.map(Into::into), - entities: new_comment.entities, - moon_forms: None, - }); - } else { - annotations.push(NewAnnotation { - comment: CommentIdComment { - id: new_comment.comment.id.clone(), - }, - labelling: None, - entities: None, - moon_forms: new_comment.moon_forms.map(Into::into), - }); - }; + annotations.push(NewAnnotation { + comment: CommentIdComment { + id: new_comment.comment.id.clone(), + }, + labelling: new_comment.labelling, + entities: new_comment.entities, + moon_forms: new_comment.moon_forms.map(Into::into), + }); } if let Some(audio_path) = new_comment.audio_path { @@ -420,7 +401,6 @@ fn upload_comments_from_reader( source, statistics, dataset_name, - use_moon_forms, pool, resume_on_error, )?; @@ -448,7 +428,6 @@ fn upload_comments_from_reader( source, statistics, dataset_name, - use_moon_forms, pool, resume_on_error, )?; diff --git a/cli/tests/test_comments.rs b/cli/tests/test_comments.rs index a2c2a40..7d75b45 100644 --- a/cli/tests/test_comments.rs +++ b/cli/tests/test_comments.rs @@ -28,11 +28,6 @@ fn test_comments_lifecycle_moon_forms() { const SAMPLE_MOON_LABELLING: &str = include_str!("./samples/moon_forms.jsonl"); // check without moon forms check_comments_lifecycle(SAMPLE_MOON_LABELLING, vec!["--allow-duplicates", "--yes"]); - // and with moon forms - check_comments_lifecycle( - SAMPLE_MOON_LABELLING, - vec!["--allow-duplicates", "--yes", "--use-moon-forms"], - ); } #[test] @@ -177,6 +172,7 @@ fn test_delete_comments_in_range() { dataset1.identifier(), source.identifier(), ]); + assert_eq!(uploaded_annotated.lines().count(), num_annotated); // Delete comments in range. By default this should exclude annotated comments