Skip to content

Commit

Permalink
Generated from 3822585577dd1ffd3c0c742aa30b131f84d20183 (#2993)
Browse files Browse the repository at this point in the history
[cognitive Services] Update endpoint URL template for Face.
  • Loading branch information
AutorestCI authored Jul 26, 2018
1 parent eed1e22 commit 19e7127
Show file tree
Hide file tree
Showing 81 changed files with 2,261 additions and 518 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
# regenerated.
# --------------------------------------------------------------------------

from .face_api import FaceAPI
from .face_client import FaceClient
from .version import VERSION

__all__ = ['FaceAPI']
__all__ = ['FaceClient']

__version__ = VERSION

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from msrest.service_client import ServiceClient
from msrest.service_client import SDKClient
from msrest import Configuration, Serializer, Deserializer
from .version import VERSION
from .operations.face_operations import FaceOperations
Expand All @@ -19,45 +19,41 @@
from . import models


class FaceAPIConfiguration(Configuration):
"""Configuration for FaceAPI
class FaceClientConfiguration(Configuration):
"""Configuration for FaceClient
Note that all parameters used to create this instance are saved as instance
attributes.
:param azure_region: Supported Azure regions for Cognitive Services
endpoints. Possible values include: 'westus', 'westeurope',
'southeastasia', 'eastus2', 'westcentralus', 'westus2', 'eastus',
'southcentralus', 'northeurope', 'eastasia', 'australiaeast',
'brazilsouth'
:type azure_region: str or
~azure.cognitiveservices.vision.face.models.AzureRegions
:param endpoint: Supported Cognitive Services endpoints (protocol and
hostname, for example: https://westus.api.cognitive.microsoft.com).
:type endpoint: str
:param credentials: Subscription credentials which uniquely identify
client subscription.
:type credentials: None
"""

def __init__(
self, azure_region, credentials):
self, endpoint, credentials):

if azure_region is None:
raise ValueError("Parameter 'azure_region' must not be None.")
if endpoint is None:
raise ValueError("Parameter 'endpoint' must not be None.")
if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
base_url = 'https://{AzureRegion}.api.cognitive.microsoft.com/face/v1.0'
base_url = '{Endpoint}/face/v1.0'

super(FaceAPIConfiguration, self).__init__(base_url)
super(FaceClientConfiguration, self).__init__(base_url)

self.add_user_agent('azure-cognitiveservices-vision-face/{}'.format(VERSION))

self.azure_region = azure_region
self.endpoint = endpoint
self.credentials = credentials


class FaceAPI(object):
class FaceClient(SDKClient):
"""An API for face detection, verification, and identification.
:ivar config: Configuration for client.
:vartype config: FaceAPIConfiguration
:vartype config: FaceClientConfiguration
:ivar face: Face operations
:vartype face: azure.cognitiveservices.vision.face.operations.FaceOperations
Expand All @@ -68,23 +64,19 @@ class FaceAPI(object):
:ivar face_list: FaceList operations
:vartype face_list: azure.cognitiveservices.vision.face.operations.FaceListOperations
:param azure_region: Supported Azure regions for Cognitive Services
endpoints. Possible values include: 'westus', 'westeurope',
'southeastasia', 'eastus2', 'westcentralus', 'westus2', 'eastus',
'southcentralus', 'northeurope', 'eastasia', 'australiaeast',
'brazilsouth'
:type azure_region: str or
~azure.cognitiveservices.vision.face.models.AzureRegions
:param endpoint: Supported Cognitive Services endpoints (protocol and
hostname, for example: https://westus.api.cognitive.microsoft.com).
:type endpoint: str
:param credentials: Subscription credentials which uniquely identify
client subscription.
:type credentials: None
"""

def __init__(
self, azure_region, credentials):
self, endpoint, credentials):

self.config = FaceAPIConfiguration(azure_region, credentials)
self._client = ServiceClient(self.config.credentials, self.config)
self.config = FaceClientConfiguration(endpoint, credentials)
super(FaceClient, self).__init__(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '1.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,81 @@
# regenerated.
# --------------------------------------------------------------------------

from .error import Error
from .api_error import APIError, APIErrorException
from .face_rectangle import FaceRectangle
from .coordinate import Coordinate
from .face_landmarks import FaceLandmarks
from .facial_hair import FacialHair
from .head_pose import HeadPose
from .emotion import Emotion
from .hair_color import HairColor
from .hair import Hair
from .makeup import Makeup
from .occlusion import Occlusion
from .accessory import Accessory
from .blur import Blur
from .exposure import Exposure
from .noise import Noise
from .face_attributes import FaceAttributes
from .detected_face import DetectedFace
from .find_similar_request import FindSimilarRequest
from .similar_face import SimilarFace
from .group_request import GroupRequest
from .group_result import GroupResult
from .identify_request import IdentifyRequest
from .identify_candidate import IdentifyCandidate
from .identify_result import IdentifyResult
from .verify_face_to_person_request import VerifyFaceToPersonRequest
from .verify_face_to_face_request import VerifyFaceToFaceRequest
from .verify_result import VerifyResult
from .persisted_face import PersistedFace
from .face_list import FaceList
from .person_group import PersonGroup
from .person import Person
from .update_person_face_request import UpdatePersonFaceRequest
from .training_status import TrainingStatus
from .name_and_user_data_contract import NameAndUserDataContract
from .image_url import ImageUrl
from .face_api_enums import (
try:
from .error_py3 import Error
from .api_error_py3 import APIError, APIErrorException
from .face_rectangle_py3 import FaceRectangle
from .coordinate_py3 import Coordinate
from .face_landmarks_py3 import FaceLandmarks
from .facial_hair_py3 import FacialHair
from .head_pose_py3 import HeadPose
from .emotion_py3 import Emotion
from .hair_color_py3 import HairColor
from .hair_py3 import Hair
from .makeup_py3 import Makeup
from .occlusion_py3 import Occlusion
from .accessory_py3 import Accessory
from .blur_py3 import Blur
from .exposure_py3 import Exposure
from .noise_py3 import Noise
from .face_attributes_py3 import FaceAttributes
from .detected_face_py3 import DetectedFace
from .find_similar_request_py3 import FindSimilarRequest
from .similar_face_py3 import SimilarFace
from .group_request_py3 import GroupRequest
from .group_result_py3 import GroupResult
from .identify_request_py3 import IdentifyRequest
from .identify_candidate_py3 import IdentifyCandidate
from .identify_result_py3 import IdentifyResult
from .verify_face_to_person_request_py3 import VerifyFaceToPersonRequest
from .verify_face_to_face_request_py3 import VerifyFaceToFaceRequest
from .verify_result_py3 import VerifyResult
from .persisted_face_py3 import PersistedFace
from .face_list_py3 import FaceList
from .person_group_py3 import PersonGroup
from .person_py3 import Person
from .update_person_face_request_py3 import UpdatePersonFaceRequest
from .training_status_py3 import TrainingStatus
from .name_and_user_data_contract_py3 import NameAndUserDataContract
from .image_url_py3 import ImageUrl
except (SyntaxError, ImportError):
from .error import Error
from .api_error import APIError, APIErrorException
from .face_rectangle import FaceRectangle
from .coordinate import Coordinate
from .face_landmarks import FaceLandmarks
from .facial_hair import FacialHair
from .head_pose import HeadPose
from .emotion import Emotion
from .hair_color import HairColor
from .hair import Hair
from .makeup import Makeup
from .occlusion import Occlusion
from .accessory import Accessory
from .blur import Blur
from .exposure import Exposure
from .noise import Noise
from .face_attributes import FaceAttributes
from .detected_face import DetectedFace
from .find_similar_request import FindSimilarRequest
from .similar_face import SimilarFace
from .group_request import GroupRequest
from .group_result import GroupResult
from .identify_request import IdentifyRequest
from .identify_candidate import IdentifyCandidate
from .identify_result import IdentifyResult
from .verify_face_to_person_request import VerifyFaceToPersonRequest
from .verify_face_to_face_request import VerifyFaceToFaceRequest
from .verify_result import VerifyResult
from .persisted_face import PersistedFace
from .face_list import FaceList
from .person_group import PersonGroup
from .person import Person
from .update_person_face_request import UpdatePersonFaceRequest
from .training_status import TrainingStatus
from .name_and_user_data_contract import NameAndUserDataContract
from .image_url import ImageUrl
from .face_client_enums import (
Gender,
GlassesType,
HairColorType,
Expand All @@ -56,7 +94,6 @@
FindSimilarMatchMode,
TrainingStatusType,
FaceAttributeType,
AzureRegions,
)

__all__ = [
Expand Down Expand Up @@ -106,5 +143,4 @@
'FindSimilarMatchMode',
'TrainingStatusType',
'FaceAttributeType',
'AzureRegions',
]
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Accessory(Model):
'confidence': {'key': 'confidence', 'type': 'float'},
}

def __init__(self, type=None, confidence=None):
super(Accessory, self).__init__()
self.type = type
self.confidence = confidence
def __init__(self, **kwargs):
super(Accessory, self).__init__(**kwargs)
self.type = kwargs.get('type', None)
self.confidence = kwargs.get('confidence', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class Accessory(Model):
"""Accessory item and corresponding confidence level.
:param type: Type of an accessory. Possible values include: 'headWear',
'glasses', 'mask'
:type type: str or
~azure.cognitiveservices.vision.face.models.AccessoryType
:param confidence: Confidence level of an accessory
:type confidence: float
"""

_attribute_map = {
'type': {'key': 'type', 'type': 'AccessoryType'},
'confidence': {'key': 'confidence', 'type': 'float'},
}

def __init__(self, *, type=None, confidence: float=None, **kwargs) -> None:
super(Accessory, self).__init__(**kwargs)
self.type = type
self.confidence = confidence
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class APIError(Model):
'error': {'key': 'error', 'type': 'Error'},
}

def __init__(self, error=None):
super(APIError, self).__init__()
self.error = error
def __init__(self, **kwargs):
super(APIError, self).__init__(**kwargs)
self.error = kwargs.get('error', None)


class APIErrorException(HttpOperationError):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model
from msrest.exceptions import HttpOperationError


class APIError(Model):
"""Error information returned by the API.
:param error:
:type error: ~azure.cognitiveservices.vision.face.models.Error
"""

_attribute_map = {
'error': {'key': 'error', 'type': 'Error'},
}

def __init__(self, *, error=None, **kwargs) -> None:
super(APIError, self).__init__(**kwargs)
self.error = error


class APIErrorException(HttpOperationError):
"""Server responsed with exception of type: 'APIError'.
:param deserialize: A deserializer
:param response: Server response to be deserialized.
"""

def __init__(self, deserialize, response, *args):

super(APIErrorException, self).__init__(deserialize, response, 'APIError', *args)
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Blur(Model):
'value': {'key': 'value', 'type': 'float'},
}

def __init__(self, blur_level=None, value=None):
super(Blur, self).__init__()
self.blur_level = blur_level
self.value = value
def __init__(self, **kwargs):
super(Blur, self).__init__(**kwargs)
self.blur_level = kwargs.get('blur_level', None)
self.value = kwargs.get('value', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class Blur(Model):
"""Properties describing any presence of blur within the image.
:param blur_level: An enum value indicating level of blurriness. Possible
values include: 'Low', 'Medium', 'High'
:type blur_level: str or
~azure.cognitiveservices.vision.face.models.BlurLevel
:param value: A number indicating level of blurriness ranging from 0 to 1.
:type value: float
"""

_attribute_map = {
'blur_level': {'key': 'blurLevel', 'type': 'BlurLevel'},
'value': {'key': 'value', 'type': 'float'},
}

def __init__(self, *, blur_level=None, value: float=None, **kwargs) -> None:
super(Blur, self).__init__(**kwargs)
self.blur_level = blur_level
self.value = value
Loading

0 comments on commit 19e7127

Please sign in to comment.