50 @return list containing the variable attributes |
50 @return list containing the variable attributes |
51 @rtype list |
51 @rtype list |
52 """ |
52 """ |
53 d = [] |
53 d = [] |
54 for name in dir(var): |
54 for name in dir(var): |
55 try: |
55 with contextlib.suppress(AttributeError): |
56 attribute = getattr(var, name) |
56 attribute = getattr(var, name) |
57 except Exception: |
57 d.append((name, attribute)) |
58 continue |
|
59 d.append((name, attribute)) |
|
60 |
58 |
61 return d |
59 return d |
62 |
60 |
63 |
61 |
64 ############################################################ |
62 ############################################################ |
81 containing the variable attributes |
79 containing the variable attributes |
82 @ytype tuple of (int, list) |
80 @ytype tuple of (int, list) |
83 """ |
81 """ |
84 d = [] |
82 d = [] |
85 for name in dir(var): |
83 for name in dir(var): |
86 try: |
84 with contextlib.suppress(AttributeError): |
87 attribute = getattr(var, name) |
85 attribute = getattr(var, name) |
88 except Exception: |
86 d.append((name, attribute)) |
89 continue |
|
90 d.append((name, attribute)) |
|
91 |
87 |
92 yield -1, d |
88 yield -1, d |
93 while True: |
89 while True: |
94 yield -2, [] |
90 yield -2, [] |
95 |
91 |