From d7a2b312837fa3416d8f05df1cd739632f72fa6e Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Wed, 22 Jul 2020 21:09:24 +0000 Subject: [PATCH] Generated from b6d9181358f641229e89b4976e3949ca702addf7 Switching sample since Ink Recognizer is global. --- .../CHANGELOG.md | 5 + .../MANIFEST.in | 5 + .../README.md | 21 + .../azure/__init__.py | 1 + .../azure/cognitiveservices/__init__.py | 1 + .../inkrecognizer/__init__.py | 19 + .../inkrecognizer/_configuration.py | 47 ++ .../inkrecognizer/_ink_recognizer_client.py | 49 ++ .../inkrecognizer/models/__init__.py | 77 ++ .../models/_ink_recognizer_client_enums.py | 114 +++ .../inkrecognizer/models/_models.py | 676 ++++++++++++++++++ .../inkrecognizer/models/_models_py3.py | 676 ++++++++++++++++++ .../inkrecognizer/operations/__init__.py | 16 + .../operations/_ink_recognizer_operations.py | 100 +++ .../inkrecognizer/version.py | 13 + .../sdk_packaging.toml | 8 + .../setup.cfg | 2 + .../setup.py | 90 +++ 18 files changed, 1920 insertions(+) create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/CHANGELOG.md create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/MANIFEST.in create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/README.md create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/__init__.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/__init__.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/__init__.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/_configuration.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/_ink_recognizer_client.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/models/__init__.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/models/_ink_recognizer_client_enums.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/models/_models.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/models/_models_py3.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/operations/__init__.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/operations/_ink_recognizer_operations.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/version.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/sdk_packaging.toml create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/setup.cfg create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/setup.py diff --git a/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/CHANGELOG.md b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/MANIFEST.in b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/MANIFEST.in new file mode 100644 index 000000000000..223bdb9a7fe1 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/MANIFEST.in @@ -0,0 +1,5 @@ +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/cognitiveservices/__init__.py + diff --git a/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/README.md b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/README.md new file mode 100644 index 000000000000..c333fb117f5a --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/README.md @@ -0,0 +1,21 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [Github repo](https://github.com/Azure/azure-sdk-for-python/) + + +# Usage + +For code examples, see [MyService Management](https://docs.microsoft.com/python/api/overview/azure/) +on docs.microsoft.com. + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-cognitiveservices-inkrecognizer%2FREADME.png) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/__init__.py new file mode 100644 index 000000000000..f7d1301bd320 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/__init__.py @@ -0,0 +1,19 @@ +# 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 ._configuration import InkRecognizerClientConfiguration +from ._ink_recognizer_client import InkRecognizerClient +__all__ = ['InkRecognizerClient', 'InkRecognizerClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/_configuration.py b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/_configuration.py new file mode 100644 index 000000000000..a7734b4072c3 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/_configuration.py @@ -0,0 +1,47 @@ +# 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 import Configuration + +from .version import VERSION + + +class InkRecognizerClientConfiguration(Configuration): + """Configuration for InkRecognizerClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param endpoint: Supported Cognitive Services endpoints (protocol and + hostname, for example: https://api.cognitive.microsoft.com). + :type endpoint: str + :param credentials: Subscription credentials which uniquely identify + client subscription. + :type credentials: None + """ + + def __init__( + self, endpoint, credentials): + + 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://{Endpoint}/inkrecognizer/v1.0-preview' + + super(InkRecognizerClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-cognitiveservices-inkrecognizer/{}'.format(VERSION)) + + self.endpoint = endpoint + self.credentials = credentials diff --git a/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/_ink_recognizer_client.py b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/_ink_recognizer_client.py new file mode 100644 index 000000000000..0d450f570524 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/_ink_recognizer_client.py @@ -0,0 +1,49 @@ +# 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.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import InkRecognizerClientConfiguration +from .operations import InkRecognizerOperations +from . import models + + +class InkRecognizerClient(SDKClient): + """The service is used to perform ink layout and recognition of written words and shapes. Ink strokes passed to the service are recognized and organized into recognition results in the response + + :ivar config: Configuration for client. + :vartype config: InkRecognizerClientConfiguration + + :ivar ink_recognizer: InkRecognizer operations + :vartype ink_recognizer: azure.cognitiveservices.inkrecognizer.operations.InkRecognizerOperations + + :param endpoint: Supported Cognitive Services endpoints (protocol and + hostname, for example: https://api.cognitive.microsoft.com). + :type endpoint: str + :param credentials: Subscription credentials which uniquely identify + client subscription. + :type credentials: None + """ + + def __init__( + self, endpoint, credentials): + + self.config = InkRecognizerClientConfiguration(endpoint, credentials) + super(InkRecognizerClient, 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' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.ink_recognizer = InkRecognizerOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/models/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/models/__init__.py new file mode 100644 index 000000000000..4cb36c708504 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/models/__init__.py @@ -0,0 +1,77 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AlternatePatternItem + from ._models_py3 import AnalysisRequest + from ._models_py3 import AnalysisResponse + from ._models_py3 import DrawingAttributesPattern + from ._models_py3 import DrawingAttributesPatternColor + from ._models_py3 import ErrorModel, ErrorModelException + from ._models_py3 import ErrorModelDetailsItem + from ._models_py3 import InkPoint + from ._models_py3 import InkPointValueAttribute + from ._models_py3 import PointDetailsPattern + from ._models_py3 import RecognitionUnitItem + from ._models_py3 import RecognitionUnitItemBoundingRectangle + from ._models_py3 import Stroke +except (SyntaxError, ImportError): + from ._models import AlternatePatternItem + from ._models import AnalysisRequest + from ._models import AnalysisResponse + from ._models import DrawingAttributesPattern + from ._models import DrawingAttributesPatternColor + from ._models import ErrorModel, ErrorModelException + from ._models import ErrorModelDetailsItem + from ._models import InkPoint + from ._models import InkPointValueAttribute + from ._models import PointDetailsPattern + from ._models import RecognitionUnitItem + from ._models import RecognitionUnitItemBoundingRectangle + from ._models import Stroke +from ._ink_recognizer_client_enums import ( + Application, + Category, + Container, + InputDevice, + Kind, + Leaf, + RasterOp, + Shape, + Tip, + Unit, +) + +__all__ = [ + 'AlternatePatternItem', + 'AnalysisRequest', + 'AnalysisResponse', + 'DrawingAttributesPattern', + 'DrawingAttributesPatternColor', + 'ErrorModel', 'ErrorModelException', + 'ErrorModelDetailsItem', + 'InkPoint', + 'InkPointValueAttribute', + 'PointDetailsPattern', + 'RecognitionUnitItem', + 'RecognitionUnitItemBoundingRectangle', + 'Stroke', + 'RasterOp', + 'Tip', + 'Shape', + 'Category', + 'Container', + 'Leaf', + 'Kind', + 'Unit', + 'Application', + 'InputDevice', +] diff --git a/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/models/_ink_recognizer_client_enums.py b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/models/_ink_recognizer_client_enums.py new file mode 100644 index 000000000000..fa2f544fcf7f --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/models/_ink_recognizer_client_enums.py @@ -0,0 +1,114 @@ +# 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 enum import Enum + + +class RasterOp(str, Enum): + + no_operation = "noOperation" + copy_pen = "copyPen" + mask_pen = "maskPen" + + +class Tip(str, Enum): + + ellipse = "ellipse" + rectangle = "rectangle" + + +class Shape(str, Enum): + + drawing = "drawing" + square = "square" + rectangle = "rectangle" + circle = "circle" + ellipse = "ellipse" + triangle = "triangle" + isosceles_triangle = "isoscelesTriangle" + equilateral_triangle = "equilateralTriangle" + right_triangle = "rightTriangle" + quadrilateral = "quadrilateral" + diamond = "diamond" + trapezoid = "trapezoid" + parallelogram = "parallelogram" + pentagon = "pentagon" + hexagon = "hexagon" + block_arrow = "blockArrow" + heart = "heart" + star_simple = "starSimple" + star_crossed = "starCrossed" + cloud = "cloud" + line = "line" + curve = "curve" + poly_line = "polyLine" + + +class Category(str, Enum): + + root = "root" + writing_region = "writingRegion" + paragraph = "paragraph" + line = "line" + ink_bullet = "inkBullet" + ink_drawing = "inkDrawing" + ink_word = "inkWord" + unknown = "unknown" + + +class Container(str, Enum): + + root = "root" + writing_region = "writingRegion" + paragraph = "paragraph" + line = "line" + + +class Leaf(str, Enum): + + ink_drawing = "inkDrawing" + ink_bullet = "inkBullet" + ink_word = "inkWord" + unknown = "unknown" + + +class Kind(str, Enum): + + ink_drawing = "inkDrawing" + ink_writing = "inkWriting" + + +class Unit(str, Enum): + + mm = "mm" + cm = "cm" + in_enum = "in" + + +class Application(str, Enum): + + drawing = "drawing" + writing = "writing" + mixed = "mixed" + + +class InputDevice(str, Enum): + + digitizer = "digitizer" + pen = "pen" + light_pen = "lightPen" + touch_screen = "touchScreen" + touch_pad = "touchPad" + white_board = "whiteBoard" + threed_digitizer = "3dDigitizer" + stereo_plotter = "stereoPlotter" + articulated_arm = "articulatedArm" + armature = "armature" diff --git a/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/models/_models.py b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/models/_models.py new file mode 100644 index 000000000000..ae68098b4120 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/models/_models.py @@ -0,0 +1,676 @@ +# 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 AlternatePatternItem(Model): + """AlternatePatternItem. + + All required parameters must be populated in order to send to Azure. + + :param category: Required. Possible values include: 'inkDrawing', + 'inkBullet', 'inkWord', 'unknown' + :type category: str or ~azure.cognitiveservices.inkrecognizer.models.Leaf + :param points: Array of point objects that represent points that are + relevant to the type of recognition unit. For example, for leaf node of + inkDrawing category that represents a triangle, points would include the + x,y coordinates of the vertices of the recognized triangle. The points + represent the coordinates of points used to create the perfectly drawn + shape that is closest to the original input. They may not exactly match. + :type points: + list[~azure.cognitiveservices.inkrecognizer.models.PointDetailsPattern] + :param rotation_angle: The angular orientation of an object relative to + the horizontal axis + :type rotation_angle: float + :param confidence: A number between 0 and 1 which indicates the confidence + level in the result + :type confidence: float + :param recognized_string: Required. The recognized string from an inkWord + or the name of a recognized shape in an inkDrawing object + :type recognized_string: str + """ + + _validation = { + 'category': {'required': True}, + 'recognized_string': {'required': True}, + } + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'points': {'key': 'points', 'type': '[PointDetailsPattern]'}, + 'rotation_angle': {'key': 'rotationAngle', 'type': 'float'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, + 'recognized_string': {'key': 'recognizedString', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AlternatePatternItem, self).__init__(**kwargs) + self.category = kwargs.get('category', None) + self.points = kwargs.get('points', None) + self.rotation_angle = kwargs.get('rotation_angle', None) + self.confidence = kwargs.get('confidence', None) + self.recognized_string = kwargs.get('recognized_string', None) + + +class AnalysisRequest(Model): + """This shows the expected contents of a request. + + All required parameters must be populated in order to send to Azure. + + :param application_type: This describes the domain of the client + application. Possible values include: 'drawing', 'writing', 'mixed' + :type application_type: str or + ~azure.cognitiveservices.inkrecognizer.models.Application + :param input_device_kind: This identifies the kind of device used as the + writing instrument. Possible values include: 'digitizer', 'pen', + 'lightPen', 'touchScreen', 'touchPad', 'whiteBoard', '3dDigitizer', + 'stereoPlotter', 'articulatedArm', 'armature' + :type input_device_kind: str or + ~azure.cognitiveservices.inkrecognizer.models.InputDevice + :param unit: This is the physical unit of the ink strokes. It is up to the + application developer to decide how to convert the device specific units + to physical units before calling the service. The conversion factor can be + different based on the type of the device used. Possible values include: + 'mm', 'cm', 'in' + :type unit: str or ~azure.cognitiveservices.inkrecognizer.models.Unit + :param unit_multiple: This is a scaling factor to be applied to the point + coordinates when interpreting them in the physical units specified. + :type unit_multiple: float + :param language: Required. The IETF BCP 47 language code (for ex. en-US, + en-GB, hi-IN etc.) of the expected language for the handwritten content in + the ink strokes. The response will include results from this language. + :type language: str + :param ink_point_value_attributes: + :type ink_point_value_attributes: + list[~azure.cognitiveservices.inkrecognizer.models.InkPointValueAttribute] + :param strokes: Required. This is the array of strokes sent for + recognition. Best results are produced when the order of strokes added in + the array matches the order in which the user created them. Changing the + stroke order may produce unexpected results. + :type strokes: list[~azure.cognitiveservices.inkrecognizer.models.Stroke] + """ + + _validation = { + 'language': {'required': True}, + 'strokes': {'required': True}, + } + + _attribute_map = { + 'application_type': {'key': 'applicationType', 'type': 'str'}, + 'input_device_kind': {'key': 'inputDeviceKind', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'unit_multiple': {'key': 'unitMultiple', 'type': 'float'}, + 'language': {'key': 'language', 'type': 'str'}, + 'ink_point_value_attributes': {'key': 'inkPointValueAttributes', 'type': '[InkPointValueAttribute]'}, + 'strokes': {'key': 'strokes', 'type': '[Stroke]'}, + } + + def __init__(self, **kwargs): + super(AnalysisRequest, self).__init__(**kwargs) + self.application_type = kwargs.get('application_type', None) + self.input_device_kind = kwargs.get('input_device_kind', None) + self.unit = kwargs.get('unit', None) + self.unit_multiple = kwargs.get('unit_multiple', None) + self.language = kwargs.get('language', None) + self.ink_point_value_attributes = kwargs.get('ink_point_value_attributes', None) + self.strokes = kwargs.get('strokes', None) + + +class AnalysisResponse(Model): + """This shows the expected contents of a response from the service. + + All required parameters must be populated in order to send to Azure. + + :param unit: This is the physical unit of the ink strokes. It is up to the + application developer to decide how to convert the device specific units + to physical units before calling the service. The conversion factor can be + different based on the type of the device used. Possible values include: + 'mm', 'cm', 'in' + :type unit: str or ~azure.cognitiveservices.inkrecognizer.models.Unit + :param unit_multiple: This is a scaling factor to be applied to the point + coordinates when interpreting them in the physical units specified. + :type unit_multiple: float + :param language: This is the language used for recognizing handwriting + from the ink strokes in the request. + :type language: str + :param recognition_units: Required. + :type recognition_units: + list[~azure.cognitiveservices.inkrecognizer.models.RecognitionUnitItem] + """ + + _validation = { + 'recognition_units': {'required': True}, + } + + _attribute_map = { + 'unit': {'key': 'unit', 'type': 'str'}, + 'unit_multiple': {'key': 'unitMultiple', 'type': 'float'}, + 'language': {'key': 'language', 'type': 'str'}, + 'recognition_units': {'key': 'recognitionUnits', 'type': '[RecognitionUnitItem]'}, + } + + def __init__(self, **kwargs): + super(AnalysisResponse, self).__init__(**kwargs) + self.unit = kwargs.get('unit', None) + self.unit_multiple = kwargs.get('unit_multiple', None) + self.language = kwargs.get('language', None) + self.recognition_units = kwargs.get('recognition_units', None) + + +class DrawingAttributesPattern(Model): + """The properties to use when rendering ink. + + :param width: The width of the stylus used to draw the stroke + :type width: float + :param color: This shows the components of the color in rgba format + :type color: + ~azure.cognitiveservices.inkrecognizer.models.DrawingAttributesPatternColor + :param height: The height of the stylus used to draw the stroke + :type height: float + :param fit_to_curve: This indicates whether Bezier smoothing is used to + render the stroke + :type fit_to_curve: bool + :param raster_op: Possible values include: 'noOperation', 'copyPen', + 'maskPen' + :type raster_op: str or + ~azure.cognitiveservices.inkrecognizer.models.RasterOp + :param ignore_pressure: This indicates whether the thickness of a + rendered Stroke changes according the amount of pressure applied. + :type ignore_pressure: bool + :param tip: This specifies the tip to be used to draw a stroke. Possible + values include: 'ellipse', 'rectangle' + :type tip: str or ~azure.cognitiveservices.inkrecognizer.models.Tip + """ + + _attribute_map = { + 'width': {'key': 'width', 'type': 'float'}, + 'color': {'key': 'color', 'type': 'DrawingAttributesPatternColor'}, + 'height': {'key': 'height', 'type': 'float'}, + 'fit_to_curve': {'key': 'fitToCurve', 'type': 'bool'}, + 'raster_op': {'key': 'rasterOp', 'type': 'str'}, + 'ignore_pressure': {'key': 'ignorePressure', 'type': 'bool'}, + 'tip': {'key': 'tip', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DrawingAttributesPattern, self).__init__(**kwargs) + self.width = kwargs.get('width', None) + self.color = kwargs.get('color', None) + self.height = kwargs.get('height', None) + self.fit_to_curve = kwargs.get('fit_to_curve', None) + self.raster_op = kwargs.get('raster_op', None) + self.ignore_pressure = kwargs.get('ignore_pressure', None) + self.tip = kwargs.get('tip', None) + + +class DrawingAttributesPatternColor(Model): + """This shows the components of the color in rgba format. + + :param r: The red component of the color + :type r: float + :param g: The green component of the color + :type g: float + :param b: The blue component of the color + :type b: float + :param a: The alpha component of the color + :type a: float + """ + + _attribute_map = { + 'r': {'key': 'r', 'type': 'float'}, + 'g': {'key': 'g', 'type': 'float'}, + 'b': {'key': 'b', 'type': 'float'}, + 'a': {'key': 'a', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(DrawingAttributesPatternColor, self).__init__(**kwargs) + self.r = kwargs.get('r', None) + self.g = kwargs.get('g', None) + self.b = kwargs.get('b', None) + self.a = kwargs.get('a', None) + + +class ErrorModel(Model): + """ErrorModel. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. This represents the error code + :type code: str + :param message: Required. This represents the error message + :type message: str + :param target: This represents the target of the error message + :type target: str + :param details: This gives details of the reason(s) for the error + :type details: + list[~azure.cognitiveservices.inkrecognizer.models.ErrorModelDetailsItem] + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorModelDetailsItem]'}, + } + + def __init__(self, **kwargs): + super(ErrorModel, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target = kwargs.get('target', None) + self.details = kwargs.get('details', None) + + +class ErrorModelException(HttpOperationError): + """Server responsed with exception of type: 'ErrorModel'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorModelException, self).__init__(deserialize, response, 'ErrorModel', *args) + + +class ErrorModelDetailsItem(Model): + """ErrorModelDetailsItem. + + :param code: This represents the error code + :type code: str + :param message: This represents the error message + :type message: str + :param target: This represents the target of the error message + :type target: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorModelDetailsItem, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target = kwargs.get('target', None) + + +class InkPoint(Model): + """An object containing the properties of an point in the path of an ink + stroke. The main properties are the x and y values. Other include tip + pressure, x tilt etc. For the coordinate values, it is recommended to have + a precision of 8 digits after the decimal to obtain most accurate + recognition results. The origin (0,0) of the canvas is assumed to be at the + top left corner of the canvas. + + All required parameters must be populated in order to send to Azure. + + :param x: Required. The x coordinate of the pen location on the writing + surface. + :type x: float + :param y: Required. The y coordinate of the pen location on the writing + surface. + :type y: float + :param z: The z coordinate of the pen location on the writing space. This + may not be used for recognition. + :type z: float + :param tip_pressure: The force exerted against the tablet surface by the + transducer, typically a stylus. This may not be used for recognition. + :type tip_pressure: float + :param barrel_pressure: The force exerted directly by the user on a + transducer sensor, such as a pressure-sensitive button on the barrel of a + stylus. This may not be used for recognition. + :type barrel_pressure: float + :param timestamp: The time relative to the absolute time the transducer + last became active. This may not be used for recognition. + :type timestamp: float + :param x_tilt: The plane angle between the Y-Z plane and the plane + containing the transducer axis and the Y axis. This may not be used for + recognition. + :type x_tilt: float + :param y_tilt: The angle between the X-Z and transducer-X planes. A + positive Y Tilt is toward the user. This may not be used for recognition. + :type y_tilt: float + :param width: The width of the tip of the writing instrument. This is used + by touch screen devices to report the width of the finger contact on the + writing surface. This may not be used for recognition. + :type width: float + :param height: The height of the tip of the writing instrument. This is + used by touch screen devices to report the height of the finger contact on + the writing surface. This may not be used for recognition. + :type height: float + :param tip_switch: A switch located on the tip of a stylus indicating + contact of the stylus with a surface. This may not be used for + recognition. + :type tip_switch: bool + :param inverted: A value that indicates that the currently sensed position + originates from the end of a stylus opposite the tip switch. This may not + be used for recognition. + :type inverted: bool + :param barrel_switch: A non-tip button located on the barrel of a stylus. + Its function is typically mapped to a system secondary button. This may + not be used for recognition. + :type barrel_switch: bool + :param eraser: The control is used for erasing objects. It is typically + located opposite the writing end of a stylus. This may not be used for + recognition. + :type eraser: bool + :param secondary_tip: A secondary switch used in conjunction with the tip + switch to indicate pressure above a certain threshold applied with the + stylus. This may not be used for recognition. + :type secondary_tip: bool + """ + + _validation = { + 'x': {'required': True}, + 'y': {'required': True}, + } + + _attribute_map = { + 'x': {'key': 'x', 'type': 'float'}, + 'y': {'key': 'y', 'type': 'float'}, + 'z': {'key': 'z', 'type': 'float'}, + 'tip_pressure': {'key': 'tipPressure', 'type': 'float'}, + 'barrel_pressure': {'key': 'barrelPressure', 'type': 'float'}, + 'timestamp': {'key': 'timestamp', 'type': 'float'}, + 'x_tilt': {'key': 'xTilt', 'type': 'float'}, + 'y_tilt': {'key': 'yTilt', 'type': 'float'}, + 'width': {'key': 'width', 'type': 'float'}, + 'height': {'key': 'height', 'type': 'float'}, + 'tip_switch': {'key': 'tipSwitch', 'type': 'bool'}, + 'inverted': {'key': 'inverted', 'type': 'bool'}, + 'barrel_switch': {'key': 'barrelSwitch', 'type': 'bool'}, + 'eraser': {'key': 'eraser', 'type': 'bool'}, + 'secondary_tip': {'key': 'secondaryTip', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(InkPoint, self).__init__(**kwargs) + self.x = kwargs.get('x', None) + self.y = kwargs.get('y', None) + self.z = kwargs.get('z', None) + self.tip_pressure = kwargs.get('tip_pressure', None) + self.barrel_pressure = kwargs.get('barrel_pressure', None) + self.timestamp = kwargs.get('timestamp', None) + self.x_tilt = kwargs.get('x_tilt', None) + self.y_tilt = kwargs.get('y_tilt', None) + self.width = kwargs.get('width', None) + self.height = kwargs.get('height', None) + self.tip_switch = kwargs.get('tip_switch', None) + self.inverted = kwargs.get('inverted', None) + self.barrel_switch = kwargs.get('barrel_switch', None) + self.eraser = kwargs.get('eraser', None) + self.secondary_tip = kwargs.get('secondary_tip', None) + + +class InkPointValueAttribute(Model): + """A container for the attributes of a value contained in the ink point + object. + + :param name: The name of the point attribute. + :type name: str + :param logical_minimum: The minimum value for the attribute + :type logical_minimum: float + :param logical_maximum: The maximum value for the attribute + :type logical_maximum: float + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'logical_minimum': {'key': 'logicalMinimum', 'type': 'float'}, + 'logical_maximum': {'key': 'logicalMaximum', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(InkPointValueAttribute, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.logical_minimum = kwargs.get('logical_minimum', None) + self.logical_maximum = kwargs.get('logical_maximum', None) + + +class PointDetailsPattern(Model): + """This holds all the properties of one point. + + All required parameters must be populated in order to send to Azure. + + :param x: Required. This represents the x coordinate of the point + :type x: float + :param y: Required. This represents the y coordinate of the point + :type y: float + """ + + _validation = { + 'x': {'required': True}, + 'y': {'required': True}, + } + + _attribute_map = { + 'x': {'key': 'x', 'type': 'float'}, + 'y': {'key': 'y', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(PointDetailsPattern, self).__init__(**kwargs) + self.x = kwargs.get('x', None) + self.y = kwargs.get('y', None) + + +class RecognitionUnitItem(Model): + """This identifies the recognized entity. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The identifier of the recognition unit. This id is + used to indicate parent/child relationship between different recognition + units. + :type id: int + :param category: Required. Possible values include: 'root', + 'writingRegion', 'paragraph', 'line', 'inkBullet', 'inkDrawing', + 'inkWord', 'unknown' + :type category: str or + ~azure.cognitiveservices.inkrecognizer.models.Category + :param alternates: + :type alternates: + list[~azure.cognitiveservices.inkrecognizer.models.AlternatePatternItem] + :param center: The coordinates (x,y) of the center of the recognition + unit. + :type center: + ~azure.cognitiveservices.inkrecognizer.models.PointDetailsPattern + :param points: Array of point objects that represent points that are + relevant to the type of recognition unit. For example, for a leaf node of + inkDrawing category that represents a triangle, points would include the + x, y coordinates of the vertices of the recognized triangle. The points + represent the coordinates used to create the perfectly drawn shape that is + closest to the original input. They may not exactly match. + :type points: + list[~azure.cognitiveservices.inkrecognizer.models.PointDetailsPattern] + :param child_ids: An array of integers representing the identifier of each + child of the current recognition unit. + :type child_ids: list[int] + :param class_property: Required. Possible values include: 'container', + 'leaf' + :type class_property: str or + ~azure.cognitiveservices.inkrecognizer.models.enum + :param parent_id: Required. The id of the parent node in the tree + structure of the recognition results. parent = 0 indicates that there is + no dedicated parent node for this unit. + :type parent_id: int + :param bounding_rectangle: The bounding rectangle of the recognition unit + represented by the coordinates of the top left corner (topX,topY) along + with width and height of the rectangle. Note that this rectangle is not + rotated. So for rotated objects such as slanted handwriting, it will + cover the entire object. The unit will be matched to the one specified in + the original request (mm by default.) + :type bounding_rectangle: + ~azure.cognitiveservices.inkrecognizer.models.RecognitionUnitItemBoundingRectangle + :param rotated_bounding_rectangle: This is the rotated bounding rectangle + that covers the entire recognized object along the angle of rotation of + the object. Note that this is NOT the same as rotating the + boundingRectangle by the rotation angle. + :type rotated_bounding_rectangle: + list[~azure.cognitiveservices.inkrecognizer.models.PointDetailsPattern] + :param stroke_ids: Required. This is an array of integers representing the + list of stroke Identifiers from the input request body that belong to this + recognition unit. + :type stroke_ids: list[int] + :param recognized_text: The string contains the text that was recognized. + It can be an empty string if the recognizer cannot determine the text. + :type recognized_text: str + :param confidence: A number between 0 and 1 which indicates the confidence + level in the result. + :type confidence: float + :param rotation_angle: This is the angle at which the unit is rotated in + degrees with respect to the positive X axis. + :type rotation_angle: float + :param recognized_object: Possible values include: 'drawing', 'square', + 'rectangle', 'circle', 'ellipse', 'triangle', 'isoscelesTriangle', + 'equilateralTriangle', 'rightTriangle', 'quadrilateral', 'diamond', + 'trapezoid', 'parallelogram', 'pentagon', 'hexagon', 'blockArrow', + 'heart', 'starSimple', 'starCrossed', 'cloud', 'line', 'curve', 'polyLine' + :type recognized_object: str or + ~azure.cognitiveservices.inkrecognizer.models.Shape + """ + + _validation = { + 'id': {'required': True}, + 'category': {'required': True}, + 'class_property': {'required': True}, + 'parent_id': {'required': True}, + 'stroke_ids': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'category': {'key': 'category', 'type': 'str'}, + 'alternates': {'key': 'alternates', 'type': '[AlternatePatternItem]'}, + 'center': {'key': 'center', 'type': 'PointDetailsPattern'}, + 'points': {'key': 'points', 'type': '[PointDetailsPattern]'}, + 'child_ids': {'key': 'childIds', 'type': '[int]'}, + 'class_property': {'key': 'class', 'type': 'str'}, + 'parent_id': {'key': 'parentId', 'type': 'int'}, + 'bounding_rectangle': {'key': 'boundingRectangle', 'type': 'RecognitionUnitItemBoundingRectangle'}, + 'rotated_bounding_rectangle': {'key': 'rotatedBoundingRectangle', 'type': '[PointDetailsPattern]'}, + 'stroke_ids': {'key': 'strokeIds', 'type': '[int]'}, + 'recognized_text': {'key': 'recognizedText', 'type': 'str'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, + 'rotation_angle': {'key': 'rotationAngle', 'type': 'float'}, + 'recognized_object': {'key': 'recognizedObject', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(RecognitionUnitItem, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.category = kwargs.get('category', None) + self.alternates = kwargs.get('alternates', None) + self.center = kwargs.get('center', None) + self.points = kwargs.get('points', None) + self.child_ids = kwargs.get('child_ids', None) + self.class_property = kwargs.get('class_property', None) + self.parent_id = kwargs.get('parent_id', None) + self.bounding_rectangle = kwargs.get('bounding_rectangle', None) + self.rotated_bounding_rectangle = kwargs.get('rotated_bounding_rectangle', None) + self.stroke_ids = kwargs.get('stroke_ids', None) + self.recognized_text = kwargs.get('recognized_text', None) + self.confidence = kwargs.get('confidence', None) + self.rotation_angle = kwargs.get('rotation_angle', None) + self.recognized_object = kwargs.get('recognized_object', None) + + +class RecognitionUnitItemBoundingRectangle(Model): + """The bounding rectangle of the recognition unit represented by the + coordinates of the top left corner (topX,topY) along with width and height + of the rectangle. Note that this rectangle is not rotated. So for rotated + objects such as slanted handwriting, it will cover the entire object. The + unit will be matched to the one specified in the original request (mm by + default.) . + + :param top_x: This is the top left x coordinate + :type top_x: float + :param top_y: This is the top left y coordinate + :type top_y: float + :param width: This is width of the bounding rectangle + :type width: float + :param height: The is the height of the bounding rectangle + :type height: float + """ + + _attribute_map = { + 'top_x': {'key': 'topX', 'type': 'float'}, + 'top_y': {'key': 'topY', 'type': 'float'}, + 'width': {'key': 'width', 'type': 'float'}, + 'height': {'key': 'height', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(RecognitionUnitItemBoundingRectangle, self).__init__(**kwargs) + self.top_x = kwargs.get('top_x', None) + self.top_y = kwargs.get('top_y', None) + self.width = kwargs.get('width', None) + self.height = kwargs.get('height', None) + + +class Stroke(Model): + """Stroke. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. This is treated as a unique identifier for each + stroke within a request. If the id is repeated within the same request, + the service will return an error. + :type id: int + :param language: The IETF BCP 47 language code (for ex. en-US, en-GB, + hi-IN etc.) of the expected language for the handwritten content in this + stroke. The response will include results from this language. + :type language: str + :param points: Required. + :type points: list[~azure.cognitiveservices.inkrecognizer.models.InkPoint] + :param drawing_attributes: + :type drawing_attributes: + ~azure.cognitiveservices.inkrecognizer.models.DrawingAttributesPattern + :param kind: This is an optional property which influences the decision + about what the stroke kind is between inkWriting and inkDrawing. This + property should be set ONLY if the type of user content is known ahead of + time. Not setting this value implies the kind is not known ahead of time. + Kind represents the type of content the stroke is a part of. Possible + values include: 'inkDrawing', 'inkWriting' + :type kind: str or ~azure.cognitiveservices.inkrecognizer.models.Kind + """ + + _validation = { + 'id': {'required': True}, + 'points': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'language': {'key': 'language', 'type': 'str'}, + 'points': {'key': 'points', 'type': '[InkPoint]'}, + 'drawing_attributes': {'key': 'drawingAttributes', 'type': 'DrawingAttributesPattern'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Stroke, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.language = kwargs.get('language', None) + self.points = kwargs.get('points', None) + self.drawing_attributes = kwargs.get('drawing_attributes', None) + self.kind = kwargs.get('kind', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/models/_models_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/models/_models_py3.py new file mode 100644 index 000000000000..186941a108f0 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/models/_models_py3.py @@ -0,0 +1,676 @@ +# 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 AlternatePatternItem(Model): + """AlternatePatternItem. + + All required parameters must be populated in order to send to Azure. + + :param category: Required. Possible values include: 'inkDrawing', + 'inkBullet', 'inkWord', 'unknown' + :type category: str or ~azure.cognitiveservices.inkrecognizer.models.Leaf + :param points: Array of point objects that represent points that are + relevant to the type of recognition unit. For example, for leaf node of + inkDrawing category that represents a triangle, points would include the + x,y coordinates of the vertices of the recognized triangle. The points + represent the coordinates of points used to create the perfectly drawn + shape that is closest to the original input. They may not exactly match. + :type points: + list[~azure.cognitiveservices.inkrecognizer.models.PointDetailsPattern] + :param rotation_angle: The angular orientation of an object relative to + the horizontal axis + :type rotation_angle: float + :param confidence: A number between 0 and 1 which indicates the confidence + level in the result + :type confidence: float + :param recognized_string: Required. The recognized string from an inkWord + or the name of a recognized shape in an inkDrawing object + :type recognized_string: str + """ + + _validation = { + 'category': {'required': True}, + 'recognized_string': {'required': True}, + } + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'points': {'key': 'points', 'type': '[PointDetailsPattern]'}, + 'rotation_angle': {'key': 'rotationAngle', 'type': 'float'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, + 'recognized_string': {'key': 'recognizedString', 'type': 'str'}, + } + + def __init__(self, *, category, recognized_string: str, points=None, rotation_angle: float=None, confidence: float=None, **kwargs) -> None: + super(AlternatePatternItem, self).__init__(**kwargs) + self.category = category + self.points = points + self.rotation_angle = rotation_angle + self.confidence = confidence + self.recognized_string = recognized_string + + +class AnalysisRequest(Model): + """This shows the expected contents of a request. + + All required parameters must be populated in order to send to Azure. + + :param application_type: This describes the domain of the client + application. Possible values include: 'drawing', 'writing', 'mixed' + :type application_type: str or + ~azure.cognitiveservices.inkrecognizer.models.Application + :param input_device_kind: This identifies the kind of device used as the + writing instrument. Possible values include: 'digitizer', 'pen', + 'lightPen', 'touchScreen', 'touchPad', 'whiteBoard', '3dDigitizer', + 'stereoPlotter', 'articulatedArm', 'armature' + :type input_device_kind: str or + ~azure.cognitiveservices.inkrecognizer.models.InputDevice + :param unit: This is the physical unit of the ink strokes. It is up to the + application developer to decide how to convert the device specific units + to physical units before calling the service. The conversion factor can be + different based on the type of the device used. Possible values include: + 'mm', 'cm', 'in' + :type unit: str or ~azure.cognitiveservices.inkrecognizer.models.Unit + :param unit_multiple: This is a scaling factor to be applied to the point + coordinates when interpreting them in the physical units specified. + :type unit_multiple: float + :param language: Required. The IETF BCP 47 language code (for ex. en-US, + en-GB, hi-IN etc.) of the expected language for the handwritten content in + the ink strokes. The response will include results from this language. + :type language: str + :param ink_point_value_attributes: + :type ink_point_value_attributes: + list[~azure.cognitiveservices.inkrecognizer.models.InkPointValueAttribute] + :param strokes: Required. This is the array of strokes sent for + recognition. Best results are produced when the order of strokes added in + the array matches the order in which the user created them. Changing the + stroke order may produce unexpected results. + :type strokes: list[~azure.cognitiveservices.inkrecognizer.models.Stroke] + """ + + _validation = { + 'language': {'required': True}, + 'strokes': {'required': True}, + } + + _attribute_map = { + 'application_type': {'key': 'applicationType', 'type': 'str'}, + 'input_device_kind': {'key': 'inputDeviceKind', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'unit_multiple': {'key': 'unitMultiple', 'type': 'float'}, + 'language': {'key': 'language', 'type': 'str'}, + 'ink_point_value_attributes': {'key': 'inkPointValueAttributes', 'type': '[InkPointValueAttribute]'}, + 'strokes': {'key': 'strokes', 'type': '[Stroke]'}, + } + + def __init__(self, *, language: str, strokes, application_type=None, input_device_kind=None, unit=None, unit_multiple: float=None, ink_point_value_attributes=None, **kwargs) -> None: + super(AnalysisRequest, self).__init__(**kwargs) + self.application_type = application_type + self.input_device_kind = input_device_kind + self.unit = unit + self.unit_multiple = unit_multiple + self.language = language + self.ink_point_value_attributes = ink_point_value_attributes + self.strokes = strokes + + +class AnalysisResponse(Model): + """This shows the expected contents of a response from the service. + + All required parameters must be populated in order to send to Azure. + + :param unit: This is the physical unit of the ink strokes. It is up to the + application developer to decide how to convert the device specific units + to physical units before calling the service. The conversion factor can be + different based on the type of the device used. Possible values include: + 'mm', 'cm', 'in' + :type unit: str or ~azure.cognitiveservices.inkrecognizer.models.Unit + :param unit_multiple: This is a scaling factor to be applied to the point + coordinates when interpreting them in the physical units specified. + :type unit_multiple: float + :param language: This is the language used for recognizing handwriting + from the ink strokes in the request. + :type language: str + :param recognition_units: Required. + :type recognition_units: + list[~azure.cognitiveservices.inkrecognizer.models.RecognitionUnitItem] + """ + + _validation = { + 'recognition_units': {'required': True}, + } + + _attribute_map = { + 'unit': {'key': 'unit', 'type': 'str'}, + 'unit_multiple': {'key': 'unitMultiple', 'type': 'float'}, + 'language': {'key': 'language', 'type': 'str'}, + 'recognition_units': {'key': 'recognitionUnits', 'type': '[RecognitionUnitItem]'}, + } + + def __init__(self, *, recognition_units, unit=None, unit_multiple: float=None, language: str=None, **kwargs) -> None: + super(AnalysisResponse, self).__init__(**kwargs) + self.unit = unit + self.unit_multiple = unit_multiple + self.language = language + self.recognition_units = recognition_units + + +class DrawingAttributesPattern(Model): + """The properties to use when rendering ink. + + :param width: The width of the stylus used to draw the stroke + :type width: float + :param color: This shows the components of the color in rgba format + :type color: + ~azure.cognitiveservices.inkrecognizer.models.DrawingAttributesPatternColor + :param height: The height of the stylus used to draw the stroke + :type height: float + :param fit_to_curve: This indicates whether Bezier smoothing is used to + render the stroke + :type fit_to_curve: bool + :param raster_op: Possible values include: 'noOperation', 'copyPen', + 'maskPen' + :type raster_op: str or + ~azure.cognitiveservices.inkrecognizer.models.RasterOp + :param ignore_pressure: This indicates whether the thickness of a + rendered Stroke changes according the amount of pressure applied. + :type ignore_pressure: bool + :param tip: This specifies the tip to be used to draw a stroke. Possible + values include: 'ellipse', 'rectangle' + :type tip: str or ~azure.cognitiveservices.inkrecognizer.models.Tip + """ + + _attribute_map = { + 'width': {'key': 'width', 'type': 'float'}, + 'color': {'key': 'color', 'type': 'DrawingAttributesPatternColor'}, + 'height': {'key': 'height', 'type': 'float'}, + 'fit_to_curve': {'key': 'fitToCurve', 'type': 'bool'}, + 'raster_op': {'key': 'rasterOp', 'type': 'str'}, + 'ignore_pressure': {'key': 'ignorePressure', 'type': 'bool'}, + 'tip': {'key': 'tip', 'type': 'str'}, + } + + def __init__(self, *, width: float=None, color=None, height: float=None, fit_to_curve: bool=None, raster_op=None, ignore_pressure: bool=None, tip=None, **kwargs) -> None: + super(DrawingAttributesPattern, self).__init__(**kwargs) + self.width = width + self.color = color + self.height = height + self.fit_to_curve = fit_to_curve + self.raster_op = raster_op + self.ignore_pressure = ignore_pressure + self.tip = tip + + +class DrawingAttributesPatternColor(Model): + """This shows the components of the color in rgba format. + + :param r: The red component of the color + :type r: float + :param g: The green component of the color + :type g: float + :param b: The blue component of the color + :type b: float + :param a: The alpha component of the color + :type a: float + """ + + _attribute_map = { + 'r': {'key': 'r', 'type': 'float'}, + 'g': {'key': 'g', 'type': 'float'}, + 'b': {'key': 'b', 'type': 'float'}, + 'a': {'key': 'a', 'type': 'float'}, + } + + def __init__(self, *, r: float=None, g: float=None, b: float=None, a: float=None, **kwargs) -> None: + super(DrawingAttributesPatternColor, self).__init__(**kwargs) + self.r = r + self.g = g + self.b = b + self.a = a + + +class ErrorModel(Model): + """ErrorModel. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. This represents the error code + :type code: str + :param message: Required. This represents the error message + :type message: str + :param target: This represents the target of the error message + :type target: str + :param details: This gives details of the reason(s) for the error + :type details: + list[~azure.cognitiveservices.inkrecognizer.models.ErrorModelDetailsItem] + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorModelDetailsItem]'}, + } + + def __init__(self, *, code: str, message: str, target: str=None, details=None, **kwargs) -> None: + super(ErrorModel, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class ErrorModelException(HttpOperationError): + """Server responsed with exception of type: 'ErrorModel'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorModelException, self).__init__(deserialize, response, 'ErrorModel', *args) + + +class ErrorModelDetailsItem(Model): + """ErrorModelDetailsItem. + + :param code: This represents the error code + :type code: str + :param message: This represents the error message + :type message: str + :param target: This represents the target of the error message + :type target: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, target: str=None, **kwargs) -> None: + super(ErrorModelDetailsItem, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + + +class InkPoint(Model): + """An object containing the properties of an point in the path of an ink + stroke. The main properties are the x and y values. Other include tip + pressure, x tilt etc. For the coordinate values, it is recommended to have + a precision of 8 digits after the decimal to obtain most accurate + recognition results. The origin (0,0) of the canvas is assumed to be at the + top left corner of the canvas. + + All required parameters must be populated in order to send to Azure. + + :param x: Required. The x coordinate of the pen location on the writing + surface. + :type x: float + :param y: Required. The y coordinate of the pen location on the writing + surface. + :type y: float + :param z: The z coordinate of the pen location on the writing space. This + may not be used for recognition. + :type z: float + :param tip_pressure: The force exerted against the tablet surface by the + transducer, typically a stylus. This may not be used for recognition. + :type tip_pressure: float + :param barrel_pressure: The force exerted directly by the user on a + transducer sensor, such as a pressure-sensitive button on the barrel of a + stylus. This may not be used for recognition. + :type barrel_pressure: float + :param timestamp: The time relative to the absolute time the transducer + last became active. This may not be used for recognition. + :type timestamp: float + :param x_tilt: The plane angle between the Y-Z plane and the plane + containing the transducer axis and the Y axis. This may not be used for + recognition. + :type x_tilt: float + :param y_tilt: The angle between the X-Z and transducer-X planes. A + positive Y Tilt is toward the user. This may not be used for recognition. + :type y_tilt: float + :param width: The width of the tip of the writing instrument. This is used + by touch screen devices to report the width of the finger contact on the + writing surface. This may not be used for recognition. + :type width: float + :param height: The height of the tip of the writing instrument. This is + used by touch screen devices to report the height of the finger contact on + the writing surface. This may not be used for recognition. + :type height: float + :param tip_switch: A switch located on the tip of a stylus indicating + contact of the stylus with a surface. This may not be used for + recognition. + :type tip_switch: bool + :param inverted: A value that indicates that the currently sensed position + originates from the end of a stylus opposite the tip switch. This may not + be used for recognition. + :type inverted: bool + :param barrel_switch: A non-tip button located on the barrel of a stylus. + Its function is typically mapped to a system secondary button. This may + not be used for recognition. + :type barrel_switch: bool + :param eraser: The control is used for erasing objects. It is typically + located opposite the writing end of a stylus. This may not be used for + recognition. + :type eraser: bool + :param secondary_tip: A secondary switch used in conjunction with the tip + switch to indicate pressure above a certain threshold applied with the + stylus. This may not be used for recognition. + :type secondary_tip: bool + """ + + _validation = { + 'x': {'required': True}, + 'y': {'required': True}, + } + + _attribute_map = { + 'x': {'key': 'x', 'type': 'float'}, + 'y': {'key': 'y', 'type': 'float'}, + 'z': {'key': 'z', 'type': 'float'}, + 'tip_pressure': {'key': 'tipPressure', 'type': 'float'}, + 'barrel_pressure': {'key': 'barrelPressure', 'type': 'float'}, + 'timestamp': {'key': 'timestamp', 'type': 'float'}, + 'x_tilt': {'key': 'xTilt', 'type': 'float'}, + 'y_tilt': {'key': 'yTilt', 'type': 'float'}, + 'width': {'key': 'width', 'type': 'float'}, + 'height': {'key': 'height', 'type': 'float'}, + 'tip_switch': {'key': 'tipSwitch', 'type': 'bool'}, + 'inverted': {'key': 'inverted', 'type': 'bool'}, + 'barrel_switch': {'key': 'barrelSwitch', 'type': 'bool'}, + 'eraser': {'key': 'eraser', 'type': 'bool'}, + 'secondary_tip': {'key': 'secondaryTip', 'type': 'bool'}, + } + + def __init__(self, *, x: float, y: float, z: float=None, tip_pressure: float=None, barrel_pressure: float=None, timestamp: float=None, x_tilt: float=None, y_tilt: float=None, width: float=None, height: float=None, tip_switch: bool=None, inverted: bool=None, barrel_switch: bool=None, eraser: bool=None, secondary_tip: bool=None, **kwargs) -> None: + super(InkPoint, self).__init__(**kwargs) + self.x = x + self.y = y + self.z = z + self.tip_pressure = tip_pressure + self.barrel_pressure = barrel_pressure + self.timestamp = timestamp + self.x_tilt = x_tilt + self.y_tilt = y_tilt + self.width = width + self.height = height + self.tip_switch = tip_switch + self.inverted = inverted + self.barrel_switch = barrel_switch + self.eraser = eraser + self.secondary_tip = secondary_tip + + +class InkPointValueAttribute(Model): + """A container for the attributes of a value contained in the ink point + object. + + :param name: The name of the point attribute. + :type name: str + :param logical_minimum: The minimum value for the attribute + :type logical_minimum: float + :param logical_maximum: The maximum value for the attribute + :type logical_maximum: float + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'logical_minimum': {'key': 'logicalMinimum', 'type': 'float'}, + 'logical_maximum': {'key': 'logicalMaximum', 'type': 'float'}, + } + + def __init__(self, *, name: str=None, logical_minimum: float=None, logical_maximum: float=None, **kwargs) -> None: + super(InkPointValueAttribute, self).__init__(**kwargs) + self.name = name + self.logical_minimum = logical_minimum + self.logical_maximum = logical_maximum + + +class PointDetailsPattern(Model): + """This holds all the properties of one point. + + All required parameters must be populated in order to send to Azure. + + :param x: Required. This represents the x coordinate of the point + :type x: float + :param y: Required. This represents the y coordinate of the point + :type y: float + """ + + _validation = { + 'x': {'required': True}, + 'y': {'required': True}, + } + + _attribute_map = { + 'x': {'key': 'x', 'type': 'float'}, + 'y': {'key': 'y', 'type': 'float'}, + } + + def __init__(self, *, x: float, y: float, **kwargs) -> None: + super(PointDetailsPattern, self).__init__(**kwargs) + self.x = x + self.y = y + + +class RecognitionUnitItem(Model): + """This identifies the recognized entity. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The identifier of the recognition unit. This id is + used to indicate parent/child relationship between different recognition + units. + :type id: int + :param category: Required. Possible values include: 'root', + 'writingRegion', 'paragraph', 'line', 'inkBullet', 'inkDrawing', + 'inkWord', 'unknown' + :type category: str or + ~azure.cognitiveservices.inkrecognizer.models.Category + :param alternates: + :type alternates: + list[~azure.cognitiveservices.inkrecognizer.models.AlternatePatternItem] + :param center: The coordinates (x,y) of the center of the recognition + unit. + :type center: + ~azure.cognitiveservices.inkrecognizer.models.PointDetailsPattern + :param points: Array of point objects that represent points that are + relevant to the type of recognition unit. For example, for a leaf node of + inkDrawing category that represents a triangle, points would include the + x, y coordinates of the vertices of the recognized triangle. The points + represent the coordinates used to create the perfectly drawn shape that is + closest to the original input. They may not exactly match. + :type points: + list[~azure.cognitiveservices.inkrecognizer.models.PointDetailsPattern] + :param child_ids: An array of integers representing the identifier of each + child of the current recognition unit. + :type child_ids: list[int] + :param class_property: Required. Possible values include: 'container', + 'leaf' + :type class_property: str or + ~azure.cognitiveservices.inkrecognizer.models.enum + :param parent_id: Required. The id of the parent node in the tree + structure of the recognition results. parent = 0 indicates that there is + no dedicated parent node for this unit. + :type parent_id: int + :param bounding_rectangle: The bounding rectangle of the recognition unit + represented by the coordinates of the top left corner (topX,topY) along + with width and height of the rectangle. Note that this rectangle is not + rotated. So for rotated objects such as slanted handwriting, it will + cover the entire object. The unit will be matched to the one specified in + the original request (mm by default.) + :type bounding_rectangle: + ~azure.cognitiveservices.inkrecognizer.models.RecognitionUnitItemBoundingRectangle + :param rotated_bounding_rectangle: This is the rotated bounding rectangle + that covers the entire recognized object along the angle of rotation of + the object. Note that this is NOT the same as rotating the + boundingRectangle by the rotation angle. + :type rotated_bounding_rectangle: + list[~azure.cognitiveservices.inkrecognizer.models.PointDetailsPattern] + :param stroke_ids: Required. This is an array of integers representing the + list of stroke Identifiers from the input request body that belong to this + recognition unit. + :type stroke_ids: list[int] + :param recognized_text: The string contains the text that was recognized. + It can be an empty string if the recognizer cannot determine the text. + :type recognized_text: str + :param confidence: A number between 0 and 1 which indicates the confidence + level in the result. + :type confidence: float + :param rotation_angle: This is the angle at which the unit is rotated in + degrees with respect to the positive X axis. + :type rotation_angle: float + :param recognized_object: Possible values include: 'drawing', 'square', + 'rectangle', 'circle', 'ellipse', 'triangle', 'isoscelesTriangle', + 'equilateralTriangle', 'rightTriangle', 'quadrilateral', 'diamond', + 'trapezoid', 'parallelogram', 'pentagon', 'hexagon', 'blockArrow', + 'heart', 'starSimple', 'starCrossed', 'cloud', 'line', 'curve', 'polyLine' + :type recognized_object: str or + ~azure.cognitiveservices.inkrecognizer.models.Shape + """ + + _validation = { + 'id': {'required': True}, + 'category': {'required': True}, + 'class_property': {'required': True}, + 'parent_id': {'required': True}, + 'stroke_ids': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'category': {'key': 'category', 'type': 'str'}, + 'alternates': {'key': 'alternates', 'type': '[AlternatePatternItem]'}, + 'center': {'key': 'center', 'type': 'PointDetailsPattern'}, + 'points': {'key': 'points', 'type': '[PointDetailsPattern]'}, + 'child_ids': {'key': 'childIds', 'type': '[int]'}, + 'class_property': {'key': 'class', 'type': 'str'}, + 'parent_id': {'key': 'parentId', 'type': 'int'}, + 'bounding_rectangle': {'key': 'boundingRectangle', 'type': 'RecognitionUnitItemBoundingRectangle'}, + 'rotated_bounding_rectangle': {'key': 'rotatedBoundingRectangle', 'type': '[PointDetailsPattern]'}, + 'stroke_ids': {'key': 'strokeIds', 'type': '[int]'}, + 'recognized_text': {'key': 'recognizedText', 'type': 'str'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, + 'rotation_angle': {'key': 'rotationAngle', 'type': 'float'}, + 'recognized_object': {'key': 'recognizedObject', 'type': 'str'}, + } + + def __init__(self, *, id: int, category, class_property, parent_id: int, stroke_ids, alternates=None, center=None, points=None, child_ids=None, bounding_rectangle=None, rotated_bounding_rectangle=None, recognized_text: str=None, confidence: float=None, rotation_angle: float=None, recognized_object=None, **kwargs) -> None: + super(RecognitionUnitItem, self).__init__(**kwargs) + self.id = id + self.category = category + self.alternates = alternates + self.center = center + self.points = points + self.child_ids = child_ids + self.class_property = class_property + self.parent_id = parent_id + self.bounding_rectangle = bounding_rectangle + self.rotated_bounding_rectangle = rotated_bounding_rectangle + self.stroke_ids = stroke_ids + self.recognized_text = recognized_text + self.confidence = confidence + self.rotation_angle = rotation_angle + self.recognized_object = recognized_object + + +class RecognitionUnitItemBoundingRectangle(Model): + """The bounding rectangle of the recognition unit represented by the + coordinates of the top left corner (topX,topY) along with width and height + of the rectangle. Note that this rectangle is not rotated. So for rotated + objects such as slanted handwriting, it will cover the entire object. The + unit will be matched to the one specified in the original request (mm by + default.) . + + :param top_x: This is the top left x coordinate + :type top_x: float + :param top_y: This is the top left y coordinate + :type top_y: float + :param width: This is width of the bounding rectangle + :type width: float + :param height: The is the height of the bounding rectangle + :type height: float + """ + + _attribute_map = { + 'top_x': {'key': 'topX', 'type': 'float'}, + 'top_y': {'key': 'topY', 'type': 'float'}, + 'width': {'key': 'width', 'type': 'float'}, + 'height': {'key': 'height', 'type': 'float'}, + } + + def __init__(self, *, top_x: float=None, top_y: float=None, width: float=None, height: float=None, **kwargs) -> None: + super(RecognitionUnitItemBoundingRectangle, self).__init__(**kwargs) + self.top_x = top_x + self.top_y = top_y + self.width = width + self.height = height + + +class Stroke(Model): + """Stroke. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. This is treated as a unique identifier for each + stroke within a request. If the id is repeated within the same request, + the service will return an error. + :type id: int + :param language: The IETF BCP 47 language code (for ex. en-US, en-GB, + hi-IN etc.) of the expected language for the handwritten content in this + stroke. The response will include results from this language. + :type language: str + :param points: Required. + :type points: list[~azure.cognitiveservices.inkrecognizer.models.InkPoint] + :param drawing_attributes: + :type drawing_attributes: + ~azure.cognitiveservices.inkrecognizer.models.DrawingAttributesPattern + :param kind: This is an optional property which influences the decision + about what the stroke kind is between inkWriting and inkDrawing. This + property should be set ONLY if the type of user content is known ahead of + time. Not setting this value implies the kind is not known ahead of time. + Kind represents the type of content the stroke is a part of. Possible + values include: 'inkDrawing', 'inkWriting' + :type kind: str or ~azure.cognitiveservices.inkrecognizer.models.Kind + """ + + _validation = { + 'id': {'required': True}, + 'points': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'language': {'key': 'language', 'type': 'str'}, + 'points': {'key': 'points', 'type': '[InkPoint]'}, + 'drawing_attributes': {'key': 'drawingAttributes', 'type': 'DrawingAttributesPattern'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__(self, *, id: int, points, language: str=None, drawing_attributes=None, kind=None, **kwargs) -> None: + super(Stroke, self).__init__(**kwargs) + self.id = id + self.language = language + self.points = points + self.drawing_attributes = drawing_attributes + self.kind = kind diff --git a/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/operations/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/operations/__init__.py new file mode 100644 index 000000000000..872c33b28ef0 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/operations/__init__.py @@ -0,0 +1,16 @@ +# 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 ._ink_recognizer_operations import InkRecognizerOperations + +__all__ = [ + 'InkRecognizerOperations', +] diff --git a/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/operations/_ink_recognizer_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/operations/_ink_recognizer_operations.py new file mode 100644 index 000000000000..b205f29bba49 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/operations/_ink_recognizer_operations.py @@ -0,0 +1,100 @@ +# 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.pipeline import ClientRawResponse + +from .. import models + + +class InkRecognizerOperations(object): + """InkRecognizerOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + + def recognize( + self, body, x_ms_client_request_id=None, custom_headers=None, raw=False, **operation_config): + """Ink Recognition operation is used to perform ink layout and recognition + of written words and shapes. It allows passing the ink strokes to the + service to get the recognition results in the response. + + :param body: The collection of stroke objects to send for analysis + :type body: + ~azure.cognitiveservices.inkrecognizer.models.AnalysisRequest + :param x_ms_client_request_id: The request id used to uniquely + identify each request during troubleshooting. This is an optional + parameter useful for correlating logs and other artifacts. + :type x_ms_client_request_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AnalysisResponse or ClientRawResponse if raw=true + :rtype: ~azure.cognitiveservices.inkrecognizer.models.AnalysisResponse + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorModelException` + """ + # Construct URL + url = self.recognize.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + if x_ms_client_request_id is not None: + header_parameters['x-ms-client-request-id'] = self._serialize.header("x_ms_client_request_id", x_ms_client_request_id, 'str') + + # Construct body + body_content = self._serialize.body(body, 'AnalysisRequest') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorModelException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AnalysisResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + recognize.metadata = {'url': '/recognize'} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/version.py b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/version.py new file mode 100644 index 000000000000..9bd1dfac7ecb --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/azure/cognitiveservices/inkrecognizer/version.py @@ -0,0 +1,13 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "0.2.0" + diff --git a/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/sdk_packaging.toml b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/sdk_packaging.toml new file mode 100644 index 000000000000..2ba15a04a0ae --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/sdk_packaging.toml @@ -0,0 +1,8 @@ +[packaging] +package_name = "azure-cognitiveservices-inkrecognizer" +package_nspkg = "azure-cognitiveservices-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = true diff --git a/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/setup.cfg b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/setup.py b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/setup.py new file mode 100644 index 000000000000..5a66379ab1d2 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-inkrecognizer/setup.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-cognitiveservices-inkrecognizer" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.cognitiveservices', + ]), + install_requires=[ + 'msrest>=0.5.0', + 'msrestazure>=0.4.32,<2.0.0', + 'azure-common~=1.1', + ], + extras_require={ + ":python_version<'3.0'": ['azure-cognitiveservices-nspkg'], + } +)