From ee3ad51796d572851e8f7d93397f201a64b6b161 Mon Sep 17 00:00:00 2001 From: Catalina Peralta Date: Mon, 18 Oct 2021 17:53:19 -0700 Subject: [PATCH 1/2] rename DocumentElement to DocumentContentElement --- .../azure/ai/formrecognizer/__init__.py | 4 ++-- .../azure/ai/formrecognizer/_models.py | 22 +++++++++---------- .../tests/test_repr.py | 4 ++-- .../tests/test_to_dict_v3.py | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/__init__.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/__init__.py index c20ead661b69..5fafc1650083 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/__init__.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/__init__.py @@ -40,7 +40,7 @@ AnalyzeResult, AnalyzedDocument, BoundingRegion, - DocumentElement, + DocumentContentElement, DocumentEntity, DocumentField, DocumentKeyValuePair, @@ -100,7 +100,7 @@ "AnalyzeResult", "AnalyzedDocument", "BoundingRegion", - "DocumentElement", + "DocumentContentElement", "DocumentEntity", "DocumentField", "DocumentKeyValueElement", diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_models.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_models.py index e5260d3414d4..e593fe15c15a 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_models.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_models.py @@ -2125,8 +2125,8 @@ def from_dict(cls, data): ) -class DocumentElement(object): - """A DocumentElement. +class DocumentContentElement(object): + """A DocumentContentElement. :ivar content: Text content of the word. :vartype content: str @@ -2143,13 +2143,13 @@ def __init__(self, **kwargs): self.kind = kwargs.get("kind", None) def __repr__(self): - return "DocumentElement(content={}, bounding_box={}, kind={})".format( + return "DocumentContentElement(content={}, bounding_box={}, kind={})".format( self.content, self.bounding_box, self.kind ) def to_dict(self): # type: () -> dict - """Returns a dict representation of DocumentElement. + """Returns a dict representation of DocumentContentElement. :return: dict :rtype: dict @@ -2164,12 +2164,12 @@ def to_dict(self): @classmethod def from_dict(cls, data): - # type: (dict) -> DocumentElement - """Converts a dict in the shape of a DocumentElement to the model itself. + # type: (dict) -> DocumentContentElement + """Converts a dict in the shape of a DocumentContentElement to the model itself. - :param dict data: A dictionary in the shape of DocumentElement. - :return: DocumentElement - :rtype: DocumentElement + :param dict data: A dictionary in the shape of DocumentContentElement. + :return: DocumentContentElement + :rtype: DocumentContentElement """ return cls( content=data.get("content", None), @@ -2844,7 +2844,7 @@ def from_dict(cls, data): ) -class DocumentSelectionMark(DocumentElement): +class DocumentSelectionMark(DocumentContentElement): """A selection mark object representing check boxes, radio buttons, and other elements indicating a selection. :ivar state: State of the selection mark. Possible values include: "selected", @@ -3408,7 +3408,7 @@ def _from_generated(cls, op, api_version): # pylint: disable=arguments-differ ) -class DocumentWord(DocumentElement): +class DocumentWord(DocumentContentElement): """A word object consisting of a contiguous sequence of characters. For non-space delimited languages, such as Chinese, Japanese, and Korean, each character is represented as its own word. diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_repr.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_repr.py index a2e8de9d9bbd..84fd5a825534 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_repr.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_repr.py @@ -147,8 +147,8 @@ def bounding_region(bounding_box): @pytest.fixture def document_element(bounding_box): - model = _models.DocumentElement(content="content", kind="word", bounding_box=bounding_box[0]) - model_repr = "DocumentElement(content=content, bounding_box={}, kind=word)".format(bounding_box[1]) + model = _models.DocumentContentElement(content="content", kind="word", bounding_box=bounding_box[0]) + model_repr = "DocumentContentElement(content=content, bounding_box={}, kind=word)".format(bounding_box[1]) assert repr(model) == model_repr return model, model_repr diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_to_dict_v3.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_to_dict_v3.py index a326955697f3..6ecfc856fc78 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_to_dict_v3.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_to_dict_v3.py @@ -54,7 +54,7 @@ def test_document_span_to_dict(self): assert d == final def test_document_element_to_dict(self): - model = _models.DocumentElement( + model = _models.DocumentContentElement( content="sample", bounding_box=[ _models.Point(1427.0, 1669.0), From 5d2656afb18a9b936c43c92a905b8d4fab36d557 Mon Sep 17 00:00:00 2001 From: Catalina Peralta Date: Mon, 18 Oct 2021 17:56:10 -0700 Subject: [PATCH 2/2] add to changelog --- sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md b/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md index fbf0393a812a..529617aea0e7 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md +++ b/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md @@ -5,6 +5,7 @@ ### Features Added ### Breaking Changes +- Renamed `DocumentElement` to `DocumentContentElement`. ### Bugs Fixed