@@ -104,6 +104,18 @@ def __str__(self):
104
104
"""
105
105
return str (self .__dict__ )
106
106
107
+ def __repr__ (self ):
108
+ """Define string representation of ``Edge``.
109
+
110
+ Format:
111
+ {
112
+ 'source_arn': 'string', 'destination_arn': 'string',
113
+ 'association_type': 'string'
114
+ }
115
+
116
+ """
117
+ return "\n \t " + str (self .__dict__ )
118
+
107
119
108
120
class Vertex :
109
121
"""A vertex for a lineage graph."""
@@ -155,6 +167,19 @@ def __str__(self):
155
167
"""
156
168
return str (self .__dict__ )
157
169
170
+ def __repr__ (self ):
171
+ """Define string representation of ``Vertex``.
172
+
173
+ Format:
174
+ {
175
+ 'arn': 'string', 'lineage_entity': 'string',
176
+ 'lineage_source': 'string',
177
+ '_session': <sagemaker.session.Session object>
178
+ }
179
+
180
+ """
181
+ return "\n \t " + str (self .__dict__ )
182
+
158
183
def to_lineage_object (self ):
159
184
"""Convert the ``Vertex`` object to its corresponding lineage object.
160
185
@@ -312,29 +337,19 @@ def __str__(self):
312
337
Format:
313
338
{
314
339
'edges':[
315
- "{
316
- 'source_arn': 'string', 'destination_arn': 'string',
317
- 'association_type': 'string'
318
- }",
319
- ...
320
- ],
340
+ {'source_arn': 'string', 'destination_arn': 'string', 'association_type': 'string'},
341
+ ...],
342
+
321
343
'vertices':[
322
- "{
323
- 'arn': 'string', 'lineage_entity': 'string',
324
- 'lineage_source': 'string',
325
- '_session': <sagemaker.session.Session object>
326
- }",
327
- ...
328
- ],
329
- 'startarn':[
330
- 'string',
331
- ...
332
- ]
344
+ {'arn': 'string', 'lineage_entity': 'string', 'lineage_source': 'string', '_session': <sagemaker.session.Session object>},
345
+ ...],
346
+
347
+ 'startarn':['string', ...]
333
348
}
334
349
335
350
"""
336
351
result_dict = vars (self )
337
- return str ({ k : [ str ( val ) for val in v ] for k , v in result_dict . items ()})
352
+ return '{ \n ' + ' \n \n ' . join ( ' \' {} \' : {},' . format ( key , val ) for key , val in self . __dict__ . items ()) + ' \n }'
338
353
339
354
def _covert_edges_to_tuples (self ):
340
355
"""Convert edges to tuple format for visualizer."""
0 commit comments