Skip to content

Commit

Permalink
[formrecognizer] Rename DocumentElement to DocumentContentElement (#2…
Browse files Browse the repository at this point in the history
…1323)

* rename DocumentElement to DocumentContentElement

* add to changelog
  • Loading branch information
catalinaperalta committed Oct 22, 2021
1 parent 03186ba commit b5d4fea
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Features Added

### Breaking Changes
- Renamed `DocumentElement` to `DocumentContentElement`.

### Bugs Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
AnalyzeResult,
AnalyzedDocument,
BoundingRegion,
DocumentElement,
DocumentContentElement,
DocumentEntity,
DocumentField,
DocumentKeyValuePair,
Expand Down Expand Up @@ -100,7 +100,7 @@
"AnalyzeResult",
"AnalyzedDocument",
"BoundingRegion",
"DocumentElement",
"DocumentContentElement",
"DocumentEntity",
"DocumentField",
"DocumentKeyValueElement",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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),
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions sdk/formrecognizer/azure-ai-formrecognizer/tests/test_repr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit b5d4fea

Please sign in to comment.