Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vb/fix rcmdcheck notes #24

Merged
merged 8 commits into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Imports:
stats,
utils,
XML
RoxygenNote: 7.1.2
RoxygenNote: 7.3.1
Suggests:
testthat (>= 2.1.0),
covr,
Expand Down
2 changes: 1 addition & 1 deletion R/ApproveAssignment.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function (assignments,
)

# Check if failure
if (class(response) != "try-error") {
if (!(inherits(response, "try-error"))) {
valid <- TRUE
if (verbose) {
message(i, ": Assignment (", assignments[i], ") Approved")
Expand Down
2 changes: 1 addition & 1 deletion R/AssignQualification.R
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ AssignQualification <-
), silent = !verbose)

# Validity check
if(class(response) == "try-error") {
if (inherits(response, "try-error")) {
return(data.frame(valid = FALSE))
}
else response$valid = TRUE
Expand Down
2 changes: 1 addition & 1 deletion R/BlockWorker.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ BlockWorker <-
), silent = !verbose)

# Validity check
if(class(response) == "try-error") {
if (inherits(response, "try-error")) {
valid = FALSE
}
else {
Expand Down
8 changes: 4 additions & 4 deletions R/ChangeHITType.R
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ ChangeHITType <-
auto.approval.delay = auto.approval.delay,
qual.req = qual.req), silent = !verbose)

if (class(register) == "try-error") {
if (inherits(register, "try-error")) {
stop("Could not RegisterHITType(), check parameters")
} else {
new.hit.type <- register$HITTypeId
Expand Down Expand Up @@ -204,10 +204,10 @@ ChangeHITType <-
HITTypeId = new.hit.type
), silent = !verbose)

if (class(response) != "try-error") { # Valid
valid <- TRUE
} else {
if (inherits(response, "try-error")) {
valid <- FALSE
} else {
valid <- TRUE
}

if (is.null(old.hit.type)) {
Expand Down
4 changes: 2 additions & 2 deletions R/ContactWorker.R
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ ContactWorker <-
WorkerIds = as.list(workerbatch[[i]]),
MessageText = msgs
), silent = !verbose)
if (class(response) != "try-error") {
if (!(inherits(response, "try-error"))) {
Notifications$Valid[Notifications$WorkerId %in% workerbatch[[i]]] <- TRUE
if (verbose) {
message(i, ": Workers ", workerbatch[[i]][1], " to ", utils::tail(workerbatch[[i]],1), " Notified")
Expand Down Expand Up @@ -226,7 +226,7 @@ ContactWorker <-
response$NotifyWorkersFailureStatuses[[1]]$NotifyWorkersFailureMessage)
}
}
if (class(response) != "try-error" & valid == TRUE) {
if ((!(inherits(response, "try-error"))) & valid == TRUE) {
if (verbose) {
message(i, ": Worker (", workers[i], ") Notified")
}
Expand Down
2 changes: 1 addition & 1 deletion R/CreateHIT.R
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ CreateHIT <-
)

# Validity check
if(class(response) == "try-error") {
if (inherits(response, "try-error")) {
warning("Invalid Request")
warning(response)
} else {
Expand Down
2 changes: 1 addition & 1 deletion R/CreateQualificationType.R
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ CreateQualificationType <-

# Update Qualification with any other parameters,
# but only if we've just created it
if(class(response) == "try-error") {
if (inherits(response, "try-error")) {
stop("Unable to create qualification")
} else {

Expand Down
4 changes: 2 additions & 2 deletions R/DisableHIT.R
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ DisableHIT <-
), silent = !verbose)
operation <- "Disable/Expire"

if(class(response) == "try-error") {
if (inherits(response, "try-error")) {
warning(i, ": Invalid Request for HIT ", hit)
valid <- FALSE
} else {
Expand All @@ -184,7 +184,7 @@ DisableHIT <-
if(hitdetail$HITs$HITStatus %in% c("Reviewing", "Reviewable")){
response <- try(pyMTurkR$Client$delete_hit(HITId = hit), silent = !verbose)

if(class(response) == "try-error") {
if (inherits(response, "try-error")) {
warning(i, ": Unable to Delete HIT ", hit)
valid <- FALSE
} else {
Expand Down
2 changes: 1 addition & 1 deletion R/DisposeQualificationType.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ DisposeQualificationType <-
QualificationTypeId = qual
), silent = !verbose)

if(class(response) == "try-error") {
if (inherits(response, "try-error")) {
warning("Invalid request\n Does this qualification exist?")
return(emptydf(0, 2, c("QualificationTypeId", "Valid")))
} else {
Expand Down
4 changes: 2 additions & 2 deletions R/ExtendHIT.R
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ ExtendHIT <-
do.call('fun', args)
)

if(class(response) == "try-error") {
if (inherits(response, "try-error")) {
valid <- FALSE
warning("Invalid Request")
} else {
Expand All @@ -176,7 +176,7 @@ ExtendHIT <-
HITId = hit,
ExpireAt = as.character(as.integer(expirations[i]) + as.integer(add.seconds))
), silent = !verbose)
if(class(response) == "try-error") {
if (inherits(response, "try-error")) {
warning("Invalid Request")
valid <- FALSE
} else {
Expand Down
4 changes: 2 additions & 2 deletions R/GetAssignment.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ GetAssignment <-
for (i in 1:length(assignment)) {
response <- try(pyMTurkR$Client$get_assignment(AssignmentId = assignment[i]), silent = !verbose)
QualificationRequirements <- list()
if (class(response) != "try-error") {
if (!(inherits(response, "try-error"))) {
tmp <- ToDataFrameAssignment(response$Assignment)
a <- tmp$assignments
ans <- tmp$answers
Expand Down Expand Up @@ -185,7 +185,7 @@ GetAssignment <-
}

# Validity check response
if(class(response) == "try-error" & persist.on.error) {
if ((inherits(response, "try-error")) & persist.on.error) {

# If the response was an error, then we should try again
# but stop after 5 attempts
Expand Down
2 changes: 1 addition & 1 deletion R/GetBlockedWorkers.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ GetBlockedWorkers <-
}

# Validity check response
if(class(response) == "try-error") {
if (inherits(response, "try-error")) {
stop("Request failed")
}

Expand Down
2 changes: 1 addition & 1 deletion R/GetBonuses.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ GetBonuses <-
}

# Validity check response
if(class(response) == "try-error") {
if (inherits(response, "try-error")) {
stop("Request failed")
}

Expand Down
2 changes: 1 addition & 1 deletion R/GetHIT.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ GetHIT <-
GetClient() # Boto3 client
response <- try(pyMTurkR$Client$get_hit(HITId = hit), silent = !verbose)

if (class(response) != "try-error") {
if (!(inherits(response, "try-error"))) {
hitdetails <- list(response$HIT) # Hack for 1 result
return.list <- list(HITs = ToDataFrameHITs(hitdetails),
QualificationRequirements = ToDataFrameQualificationRequirements(hitdetails))
Expand Down
2 changes: 1 addition & 1 deletion R/GetHITsForQualificationType.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ GetHITsForQualificationType <-
}

# Validity check response
if(class(response) == "try-error") {
if (inherits(response, "try-error")) {
stop("Request failed")
}

Expand Down
2 changes: 1 addition & 1 deletion R/GetQualificationRequests.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ GetQualificationRequests <-
}

# Validity check response
if(class(response) == "try-error") {
if (inherits(response, "try-error")) {
stop("Request failed")
}

Expand Down
2 changes: 1 addition & 1 deletion R/GetQualificationScore.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ GetQualificationScore <-
WorkerId = workers[i]), silent = !verbose)

# Validity check response
if(class(response) != "try-error") {
if (!(inherits(response, "try-error"))) {
Qualifications[i,] <- ToDataFrameQualifications(response$Qualification)
Qualifications[i,]$Valid <- TRUE
if (verbose) {
Expand Down
2 changes: 1 addition & 1 deletion R/GetQualificationType.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ GetQualificationType <-
response <- try(pyMTurkR$Client$get_qualification_type(QualificationTypeId = qual), silent = !verbose)

# Validity check response
if(class(response) == "try-error") {
if (inherits(response, "try-error")) {
Qualifications <- emptydf(nrow=0, ncol=13, c("QualificationTypeId", "CreationTime", "Name", "Description",
"Keywords", "QualificationTypeStatus", "AutoGranted", "AutoGrantedValue",
"IsRequestable", "RetryDelayInSeconds", "TestDurationInSeconds",
Expand Down
2 changes: 1 addition & 1 deletion R/GetQualifications.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ GetQualifications <-
)

# Validity check response
if(class(response) == "try-error") {
if (inherits(response, "try-error")) {
stop("Request failed")
}

Expand Down
2 changes: 1 addition & 1 deletion R/GetReviewResultsForHIT.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ GetReviewResultsForHIT <-
)

# Validity check response
if(class(response) == "try-error") {
if (inherits(response, "try-error")) {
stop("Request failed")
}

Expand Down
2 changes: 1 addition & 1 deletion R/GetReviewableHITs.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ GetReviewableHITs <-
)

# Validity check response
if(class(response) == "try-error") {
if (inherits(response, "try-error")) {
stop("Request failed")
}

Expand Down
8 changes: 4 additions & 4 deletions R/GrantBonus.R
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ GrantBonus <-
)

# Check if failure
if (class(response) != "try-error") {
valid <- TRUE
} else {
if (inherits(response, "try-error")) {
valid <- FALSE
} else {
valid <- TRUE
}

Bonuses[i, ] <- c(workers[i], assignments[i], amounts[i], reasons[i], valid)
Expand All @@ -167,7 +167,7 @@ GrantBonus <-
response[1])
}
}
if (class(response) != "try-error" & valid == TRUE) {
if ((!(inherits(response, "try-error"))) & valid == TRUE) {
if (verbose) {
message(i, ": Worker (", workers[i], ") Granted Bonus of ", amounts[i], " for Assignment ", assignments[i])
}
Expand Down
8 changes: 4 additions & 4 deletions R/GrantQualification.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,16 @@ GrantQualification <-


# Check if failure
if (class(response) != "try-error") {
valid <- TRUE
} else {
if (inherits(response, "try-error")) {
valid <- FALSE
} else {
valid <- TRUE
}

QualificationRequests[i, ] <- c(qual.requests[i], values[i], valid)

# Message with results
if (class(response) != "try-error" & valid == TRUE) {
if ((!(inherits(response, "try-error"))) & valid == TRUE) {
if (verbose) {
message(i, ": Qualification (", qual.requests[i],") Granted")
}
Expand Down
2 changes: 1 addition & 1 deletion R/RegisterHITType.R
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ RegisterHITType <-
do.call('fun', args), silent = !verbose
)

if (class(response) != "try-error") { # Valid
if (!(inherits(response, "try-error"))) { # Valid
HITType[1, ] <- c(response$HITTypeId, TRUE)
if (verbose) {
message("HITType Registered: ", HITType$HITTypeId)
Expand Down
2 changes: 1 addition & 1 deletion R/RejectAssignment.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ RejectAssignment <-
), silent = !verbose)

# Check if failure
if (class(response) == "try-error") {
if (inherits(response, "try-error")) {
valid <- FALSE
if (verbose) {
warning(i, ": Invalid request for assignment ",assignments[i])
Expand Down
2 changes: 1 addition & 1 deletion R/RejectQualification.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ RejectQualification <-
}

# Check if failure
if (class(response) == "try-error") {
if (inherits(response, "try-error")) {
valid <- FALSE
if (verbose) {
warning(i, ": Invalid Request for QualificationRequestId ", qual.requests[i])
Expand Down
2 changes: 1 addition & 1 deletion R/RevokeQualification.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ RevokeQualification <-
)

# Check if failure
if (class(response) != "try-error") {
if (!(inherits(response, "try-error"))) {
message(i, ": Qualification (", qual, ") for worker ", workers[i], " Revoked")
valid <- TRUE
} else {
Expand Down
2 changes: 1 addition & 1 deletion R/SearchHITs.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function (return.pages = NULL,
}

# Validity check response
if(class(response) == "try-error") {
if (inherits(response, "try-error")) {
stop("SearchHITs request failed!")
}

Expand Down
2 changes: 1 addition & 1 deletion R/SearchQualificationTypes.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ SearchQualificationTypes <-
)

# Validity check response
if(class(response) == "try-error") {
if (inherits(response, "try-error")) {
stop("Request failed!")
}

Expand Down
2 changes: 1 addition & 1 deletion R/SendTestEventNotification.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ SendTestEventNotification <-
)

# Check if failure
if (class(response) != "try-error") {
if (!(inherits(response, "try-error"))) {
valid <- TRUE
if (verbose) {
message("TestEventNotification ", test.event.type," Sent")
Expand Down
2 changes: 1 addition & 1 deletion R/SetHITAsReviewing.R
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ SetHITAsReviewing <-
status <- "Reviewable"
}

if(class(response) == "try-error") {
if (inherits(response, "try-error")) {
warning(i, ": Invalid Request for HIT ", hit)
valid = FALSE
} else {
Expand Down
2 changes: 1 addition & 1 deletion R/SetHITTypeNotification.R
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ SetHITTypeNotification <-
# Call the function with the arguments
response <- try(do.call('fun', args), silent = !verbose)

if(class(response) == "try-error") {
if (inherits(response, "try-error")) {
valid = FALSE
if (verbose) {
warning("Invalid Request")
Expand Down
2 changes: 1 addition & 1 deletion R/UnblockWorker.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ UnblockWorker <-
)

# Validity check
if(class(response) == "try-error") {
if (inherits(response, "try-error")) {
valid = FALSE
if(verbose){
message(i, ": Worker ", workers[i], " Unblocked")
Expand Down
2 changes: 1 addition & 1 deletion R/UpdateQualificationType.R
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function (qual,

# Update Qualification with any other parameters,
# but only if we've just created it
if(class(response) == "try-error") {
if (inherits(response, "try-error")) {
stop("Unable to update qualification")
} else {

Expand Down
Loading
Loading