72 """ |
72 """ |
73 Public method to get the attributes of a variable as a dictionary. |
73 Public method to get the attributes of a variable as a dictionary. |
74 |
74 |
75 @param var variable to be converted |
75 @param var variable to be converted |
76 @type any |
76 @type any |
77 @return dictionary containing the variable attributes |
77 @yield tuple containing the batch start index and a dictionary |
78 @rtype dict |
78 containing the variable attributes |
|
79 @ytype tuple of (int, dict) |
79 """ |
80 """ |
80 names = dir(var) |
81 names = dir(var) |
81 if not names and hasattr(var, "__members__"): |
82 if not names and hasattr(var, "__members__"): |
82 names = var.__members__ |
83 names = var.__members__ |
83 |
84 |
149 """ |
150 """ |
150 Public method to get the attributes of a variable as a dictionary. |
151 Public method to get the attributes of a variable as a dictionary. |
151 |
152 |
152 @param var variable to be converted |
153 @param var variable to be converted |
153 @type any |
154 @type any |
154 @return dictionary containing the variable attributes |
155 @yield tuple containing the batch start index and a dictionary |
155 @rtype dict |
156 containing the variable attributes |
|
157 @ytype tuple of (int, dict) |
156 """ |
158 """ |
157 d = {} |
159 d = {} |
158 start = count = 0 |
160 start = count = 0 |
159 allItems = list(var.items()) |
161 allItems = list(var.items()) |
160 try: |
162 try: |
214 """ |
216 """ |
215 Public method to get the attributes of a variable as a dictionary. |
217 Public method to get the attributes of a variable as a dictionary. |
216 |
218 |
217 @param var variable to be converted |
219 @param var variable to be converted |
218 @type any |
220 @type any |
219 @return dictionary containing the variable attributes |
221 @yield tuple containing the batch start index and a dictionary |
220 @rtype dict |
222 containing the variable attributes |
|
223 @ytype tuple of (int, dict) |
221 """ |
224 """ |
222 d = {} |
225 d = {} |
223 start = count = 0 |
226 start = count = 0 |
224 for idx, value in enumerate(var): |
227 for idx, value in enumerate(var): |
225 d[idx] = value |
228 d[idx] = value |
402 """ |
406 """ |
403 Public method to get the attributes of a variable as a dictionary. |
407 Public method to get the attributes of a variable as a dictionary. |
404 |
408 |
405 @param var variable to be converted |
409 @param var variable to be converted |
406 @type any |
410 @type any |
407 @return dictionary containing the variable attributes |
411 @yield tuple containing the batch start index and a dictionary |
408 @rtype dict |
412 containing the variable attributes |
|
413 @ytype tuple of (int, dict) |
409 """ |
414 """ |
410 d = {} |
415 d = {} |
411 start = count = 0 |
416 start = count = 0 |
412 try: |
417 try: |
413 len(var) # Check if it's an unsized object, e.g. np.ndarray(()) |
418 len(var) # Check if it's an unsized object, e.g. np.ndarray(()) |
494 """ |
499 """ |
495 Public method to get the attributes of a variable as a dictionary. |
500 Public method to get the attributes of a variable as a dictionary. |
496 |
501 |
497 @param var variable to be converted |
502 @param var variable to be converted |
498 @type any |
503 @type any |
499 @return dictionary containing the variable attributes |
504 @yield tuple containing the batch start index and a dictionary |
500 @rtype dict |
505 containing the variable attributes |
|
506 @ytype tuple of (int, dict) |
501 """ |
507 """ |
502 d = {} |
508 d = {} |
503 start = count = 0 |
509 start = count = 0 |
504 allKeys = list(var.keys()) |
510 allKeys = list(var.keys()) |
505 try: |
511 try: |
577 """ |
583 """ |
578 Public method to get the attributes of a variable as a dictionary. |
584 Public method to get the attributes of a variable as a dictionary. |
579 |
585 |
580 @param var variable to be converted |
586 @param var variable to be converted |
581 @type any |
587 @type any |
582 @return dictionary containing the variable attributes |
588 @yield tuple containing the batch start index and a dictionary |
583 @rtype dict |
589 containing the variable attributes |
|
590 @ytype tuple of (int, dict) |
584 """ |
591 """ |
585 d = {} |
592 d = {} |
586 start = count = 0 |
593 start = count = 0 |
587 allItems = var.tolist() |
594 allItems = var.tolist() |
588 |
595 |