Skip to content

Commit

Permalink
Fix style check
Browse files Browse the repository at this point in the history
  • Loading branch information
leareai committed May 16, 2024
1 parent 03793c4 commit cc6ef56
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,23 @@

import com.azure.ai.vision.face.FaceAsyncClient;
import com.azure.ai.vision.face.FaceClientBuilder;
import com.azure.ai.vision.face.samples.utils.ConfigurationHelper;
import com.azure.ai.vision.face.samples.utils.Resources;
import com.azure.ai.vision.face.samples.utils.Utils;
import com.azure.ai.vision.face.models.DetectOptions;
import com.azure.ai.vision.face.models.FaceDetectionModel;
import com.azure.ai.vision.face.models.FaceDetectionResult;
import com.azure.ai.vision.face.models.FaceRecognitionModel;
import com.azure.ai.vision.face.samples.utils.ConfigurationHelper;
import com.azure.ai.vision.face.samples.utils.Resources;
import com.azure.ai.vision.face.samples.utils.Utils;
import com.azure.core.credential.AzureKeyCredential;
import com.azure.core.util.BinaryData;
import reactor.core.publisher.Flux;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import static com.azure.ai.vision.face.samples.utils.Utils.log;
import static com.azure.ai.vision.face.models.FaceAttributeType.Detection01;
import static com.azure.ai.vision.face.models.FaceAttributeType.Detection03;
import static com.azure.ai.vision.face.models.FaceAttributeType.Recognition04;
import static com.azure.ai.vision.face.samples.utils.Utils.log;

public class DetectFacesAsync {
public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ public static void main(String[] args) {
// We can also list all the liveness sessions of this face account.
List<LivenessSessionItem> sessions = faceSessionClient.getLivenessSessions();
logObject("List all the liveness sessions: ", sessions, true);
}
finally {
} finally {
// Delete this session
faceSessionClient.deleteLivenessSession(livenessSessionCreationResult.getSessionId());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static void main(String[] args) {

} finally {
// Delete this session
logObject("Delete liveness sessions: "+sessionId);
logObject("Delete liveness sessions: " + sessionId);
faceSessionClient.deleteLivenessWithVerifySession(sessionId);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static void main(String[] args) {
logObject("List all the liveness sessions: ", sessions, true);

} finally {
logObject("Delete liveness sessions: "+sessionId);
logObject("Delete liveness sessions: " + sessionId);
// Delete this session
faceSessionClient.deleteLivenessWithVerifySession(livenessSessionCreationResult.getSessionId())
.block();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

package com.azure.ai.vision.face.samples;

//import com.azure.ai.vision.face.*;

import com.azure.ai.vision.face.FaceAdministrationClient;
import com.azure.ai.vision.face.FaceAdministrationClientBuilder;
import com.azure.ai.vision.face.FaceClient;
Expand Down Expand Up @@ -35,7 +37,10 @@
import java.util.Objects;
import java.util.stream.Collectors;

import static com.azure.ai.vision.face.samples.utils.Utils.*;
import static com.azure.ai.vision.face.samples.utils.Utils.log;
import static com.azure.ai.vision.face.samples.utils.Utils.logObject;
import static com.azure.ai.vision.face.samples.utils.Utils.safelyRun;


public class IdentifyAgainstDynamicPersonDirectory {
private static final RuntimeException[] EXCEPTION_CONTAINER = new RuntimeException[1];
Expand Down Expand Up @@ -200,8 +205,8 @@ private static void listDynamicPersonGroupReferences(
logObject("List DynamicPersonGroup with " + personData.getName() + " ", dynamicPersonGroupNames);
}

private static void deleteDynamicPersonGroups
(FaceAdministrationClient administrationClient, List<String> dynamicPersonGroupsIds) {
private static void deleteDynamicPersonGroups(
FaceAdministrationClient administrationClient, List<String> dynamicPersonGroupsIds) {

log("Deleting DynamicPeronGroups: " + dynamicPersonGroupsIds.size());
List<SyncPoller<FaceOperationResult, Void>> pollers = dynamicPersonGroupsIds.stream()
Expand Down Expand Up @@ -321,7 +326,7 @@ private static String createUserData(String... tags) {
private static Pair<PersonData, SyncPoller<FaceOperationResult, PersonDirectoryPerson>> createPerson(
FaceAdministrationClient administrationClient, PersonData personData) {
log("Create Person: " + personData.getName());
return Utils.safelyRunWithExceptionCheck(EXCEPTION_CONTAINER, "createPerson", ()->
return Utils.safelyRunWithExceptionCheck(EXCEPTION_CONTAINER, "createPerson", () ->
Pair.of(personData,
administrationClient.beginCreatePerson(personData.getName(), personData.getUserData())));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private static void createPersonsAndAddFaces(FaceAdministrationClient administra

private static Pair<PersonData, SyncPoller<FaceOperationResult, PersonDirectoryPerson>> createPerson(
FaceAdministrationClient administrationClient, PersonData personData) {
return Utils.safelyRunWithExceptionCheck(EXCEPTION_CONTAINER, "createPerson", ()->
return Utils.safelyRunWithExceptionCheck(EXCEPTION_CONTAINER, "createPerson", () ->
Pair.of(personData,
administrationClient.beginCreatePerson(personData.getName(), personData.getUserData())));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
import java.util.Objects;
import java.util.stream.Collectors;

import static com.azure.ai.vision.face.samples.utils.Utils.*;
import static com.azure.ai.vision.face.samples.utils.Utils.log;
import static com.azure.ai.vision.face.samples.utils.Utils.safelyRun;

public class VerifyFromDynamicPersonDirectory {
private static final RuntimeException[] EXCEPTION_CONTAINER = new RuntimeException[1];
Expand Down Expand Up @@ -106,7 +107,7 @@ private static void createPersons(FaceAdministrationClient administrationClient,
private static Pair<PersonData, SyncPoller<FaceOperationResult, PersonDirectoryPerson>> createPerson(
FaceAdministrationClient administrationClient, PersonData personData) {
log("Create Person: " + personData.getName());
return Utils.safelyRunWithExceptionCheck(EXCEPTION_CONTAINER, "createPerson", ()->
return Utils.safelyRunWithExceptionCheck(EXCEPTION_CONTAINER, "createPerson", () ->
Pair.of(personData,
administrationClient.beginCreatePerson(personData.getName(), personData.getUserData())));
}
Expand Down Expand Up @@ -160,7 +161,7 @@ private static SyncPoller<FaceOperationResult, PersonDirectoryFace> addFacesToPe
private static void deletePersons(FaceAdministrationClient administrationClient, List<PersonData> personDataList) {
log("Deleting Persons: " + personDataList.size());
List<SyncPoller<FaceOperationResult, Void>> pollers = personDataList.stream()
.map(personData -> Utils.safelyRun(
.map(personData -> safelyRun(
() -> administrationClient
.beginDeletePerson(personData.getPersonId())))
.filter(Objects::nonNull)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@

import com.azure.ai.vision.face.models.FaceOperationResult;
import com.azure.ai.vision.face.models.PersonDirectoryFace;
import com.azure.ai.vision.face.models.PersonDirectoryPerson;
import com.azure.core.util.polling.SyncPoller;

import java.time.Duration;

public class PersonData {
private final String name;
private final String userData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter;
import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;

import java.nio.file.Path;
Expand Down

0 comments on commit cc6ef56

Please sign in to comment.