Skip to content

Commit e874d4f

Browse files
committed
feat(Compare and Comply): Add attributes property to BodyCells model
1 parent 1e5d1ee commit e874d4f

File tree

1 file changed

+53
-55
lines changed

1 file changed

+53
-55
lines changed

watson_developer_cloud/compare_comply_v1.py

Lines changed: 53 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,12 +1163,21 @@ class BodyCells(object):
11631163
location in the current table.
11641164
:attr int column_index_end: (optional) The `end` index of this cell's `column`
11651165
location in the current table.
1166-
:attr list[RowHeaderIds] row_header_ids: (optional)
1167-
:attr list[RowHeaderTexts] row_header_texts: (optional)
1168-
:attr list[RowHeaderTextsNormalized] row_header_texts_normalized: (optional)
1169-
:attr list[ColumnHeaderIds] column_header_ids: (optional)
1170-
:attr list[ColumnHeaderTexts] column_header_texts: (optional)
1171-
:attr list[ColumnHeaderTextsNormalized] column_header_texts_normalized: (optional)
1166+
:attr list[str] row_header_ids: (optional) An array of values, each being the `id`
1167+
value of a row header that is applicable to this body cell.
1168+
:attr list[str] row_header_texts: (optional) An array of values, each being the `text`
1169+
value of a row header that is applicable to this body cell.
1170+
:attr list[str] row_header_texts_normalized: (optional) If you provide customization
1171+
input, the normalized version of the row header texts according to the customization;
1172+
otherwise, the same value as `row_header_texts`.
1173+
:attr list[str] column_header_ids: (optional) An array of values, each being the `id`
1174+
value of a column header that is applicable to the current cell.
1175+
:attr list[str] column_header_texts: (optional) An array of values, each being the
1176+
`text` value of a column header that is applicable to the current cell.
1177+
:attr list[str] column_header_texts_normalized: (optional) If you provide
1178+
customization input, the normalized version of the column header texts according to
1179+
the customization; otherwise, the same value as `column_header_texts`.
1180+
:attr list[Attribute] attributes: (optional)
11721181
"""
11731182

11741183
def __init__(self,
@@ -1184,7 +1193,8 @@ def __init__(self,
11841193
row_header_texts_normalized=None,
11851194
column_header_ids=None,
11861195
column_header_texts=None,
1187-
column_header_texts_normalized=None):
1196+
column_header_texts_normalized=None,
1197+
attributes=None):
11881198
"""
11891199
Initialize a BodyCells object.
11901200
@@ -1203,13 +1213,21 @@ def __init__(self,
12031213
`column` location in the current table.
12041214
:param int column_index_end: (optional) The `end` index of this cell's `column`
12051215
location in the current table.
1206-
:param list[RowHeaderIds] row_header_ids: (optional)
1207-
:param list[RowHeaderTexts] row_header_texts: (optional)
1208-
:param list[RowHeaderTextsNormalized] row_header_texts_normalized: (optional)
1209-
:param list[ColumnHeaderIds] column_header_ids: (optional)
1210-
:param list[ColumnHeaderTexts] column_header_texts: (optional)
1211-
:param list[ColumnHeaderTextsNormalized] column_header_texts_normalized:
1212-
(optional)
1216+
:param list[str] row_header_ids: (optional) An array of values, each being the
1217+
`id` value of a row header that is applicable to this body cell.
1218+
:param list[str] row_header_texts: (optional) An array of values, each being the
1219+
`text` value of a row header that is applicable to this body cell.
1220+
:param list[str] row_header_texts_normalized: (optional) If you provide
1221+
customization input, the normalized version of the row header texts according to
1222+
the customization; otherwise, the same value as `row_header_texts`.
1223+
:param list[str] column_header_ids: (optional) An array of values, each being the
1224+
`id` value of a column header that is applicable to the current cell.
1225+
:param list[str] column_header_texts: (optional) An array of values, each being
1226+
the `text` value of a column header that is applicable to the current cell.
1227+
:param list[str] column_header_texts_normalized: (optional) If you provide
1228+
customization input, the normalized version of the column header texts according
1229+
to the customization; otherwise, the same value as `column_header_texts`.
1230+
:param list[Attribute] attributes: (optional)
12131231
"""
12141232
self.cell_id = cell_id
12151233
self.location = location
@@ -1244,34 +1262,22 @@ def _from_dict(cls, _dict):
12441262
if 'column_index_end' in _dict:
12451263
args['column_index_end'] = _dict.get('column_index_end')
12461264
if 'row_header_ids' in _dict:
1247-
args['row_header_ids'] = [
1248-
RowHeaderIds._from_dict(x)
1249-
for x in (_dict.get('row_header_ids'))
1250-
]
1265+
args['row_header_ids'] = _dict.get('row_header_ids')
12511266
if 'row_header_texts' in _dict:
1252-
args['row_header_texts'] = [
1253-
RowHeaderTexts._from_dict(x)
1254-
for x in (_dict.get('row_header_texts'))
1255-
]
1267+
args['row_header_texts'] = _dict.get('row_header_texts')
12561268
if 'row_header_texts_normalized' in _dict:
1257-
args['row_header_texts_normalized'] = [
1258-
RowHeaderTextsNormalized._from_dict(x)
1259-
for x in (_dict.get('row_header_texts_normalized'))
1260-
]
1269+
args['row_header_texts_normalized'] = _dict.get(
1270+
'row_header_texts_normalized')
12611271
if 'column_header_ids' in _dict:
1262-
args['column_header_ids'] = [
1263-
ColumnHeaderIds._from_dict(x)
1264-
for x in (_dict.get('column_header_ids'))
1265-
]
1272+
args['column_header_ids'] = _dict.get('column_header_ids')
12661273
if 'column_header_texts' in _dict:
1267-
args['column_header_texts'] = [
1268-
ColumnHeaderTexts._from_dict(x)
1269-
for x in (_dict.get('column_header_texts'))
1270-
]
1274+
args['column_header_texts'] = _dict.get('column_header_texts')
12711275
if 'column_header_texts_normalized' in _dict:
1272-
args['column_header_texts_normalized'] = [
1273-
ColumnHeaderTextsNormalized._from_dict(x)
1274-
for x in (_dict.get('column_header_texts_normalized'))
1276+
args['column_header_texts_normalized'] = _dict.get(
1277+
'column_header_texts_normalized')
1278+
if 'attributes' in _dict:
1279+
args['attributes'] = [
1280+
Attribute._from_dict(x) for x in (_dict.get('attributes'))
12751281
]
12761282
return cls(**args)
12771283

@@ -1297,35 +1303,27 @@ def _to_dict(self):
12971303
'column_index_end') and self.column_index_end is not None:
12981304
_dict['column_index_end'] = self.column_index_end
12991305
if hasattr(self, 'row_header_ids') and self.row_header_ids is not None:
1300-
_dict['row_header_ids'] = [
1301-
x._to_dict() for x in self.row_header_ids
1302-
]
1306+
_dict['row_header_ids'] = self.row_header_ids
13031307
if hasattr(self,
13041308
'row_header_texts') and self.row_header_texts is not None:
1305-
_dict['row_header_texts'] = [
1306-
x._to_dict() for x in self.row_header_texts
1307-
]
1309+
_dict['row_header_texts'] = self.row_header_texts
13081310
if hasattr(self, 'row_header_texts_normalized'
13091311
) and self.row_header_texts_normalized is not None:
1310-
_dict['row_header_texts_normalized'] = [
1311-
x._to_dict() for x in self.row_header_texts_normalized
1312-
]
1312+
_dict[
1313+
'row_header_texts_normalized'] = self.row_header_texts_normalized
13131314
if hasattr(self,
13141315
'column_header_ids') and self.column_header_ids is not None:
1315-
_dict['column_header_ids'] = [
1316-
x._to_dict() for x in self.column_header_ids
1317-
]
1316+
_dict['column_header_ids'] = self.column_header_ids
13181317
if hasattr(
13191318
self,
13201319
'column_header_texts') and self.column_header_texts is not None:
1321-
_dict['column_header_texts'] = [
1322-
x._to_dict() for x in self.column_header_texts
1323-
]
1320+
_dict['column_header_texts'] = self.column_header_texts
13241321
if hasattr(self, 'column_header_texts_normalized'
13251322
) and self.column_header_texts_normalized is not None:
1326-
_dict['column_header_texts_normalized'] = [
1327-
x._to_dict() for x in self.column_header_texts_normalized
1328-
]
1323+
_dict[
1324+
'column_header_texts_normalized'] = self.column_header_texts_normalized
1325+
if hasattr(self, 'attributes') and self.attributes is not None:
1326+
_dict['attributes'] = [x._to_dict() for x in self.attributes]
13291327
return _dict
13301328

13311329
def __str__(self):

0 commit comments

Comments
 (0)