Spaces:
Sleeping
Sleeping
z up fix test
Browse files
app.py
CHANGED
|
@@ -78,25 +78,34 @@ async def get_rpk_info(filename: str):
|
|
| 78 |
default_val = attr.get_default_value()
|
| 79 |
annotations = []
|
| 80 |
|
| 81 |
-
|
|
|
|
| 82 |
py_annotations = attr.get_annotations()
|
| 83 |
-
|
| 84 |
-
# Annotations are typically list of objects or similar
|
| 85 |
for anno in py_annotations:
|
| 86 |
-
|
|
|
|
| 87 |
if hasattr(anno, 'get_key'):
|
| 88 |
key = anno.get_key()
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
annotations.append({"key": key, "arguments": args})
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
|
|
|
|
|
|
| 100 |
elif isinstance(attr, str):
|
| 101 |
# Fallback if list of strings
|
| 102 |
formatted_attrs.append({
|
|
|
|
| 78 |
default_val = attr.get_default_value()
|
| 79 |
annotations = []
|
| 80 |
|
| 81 |
+
if hasattr(attr, 'get_annotations'):
|
| 82 |
+
try:
|
| 83 |
py_annotations = attr.get_annotations()
|
| 84 |
+
logger.info(f"Attr {name} annotations: {py_annotations}")
|
|
|
|
| 85 |
for anno in py_annotations:
|
| 86 |
+
key = None
|
| 87 |
+
args = []
|
| 88 |
if hasattr(anno, 'get_key'):
|
| 89 |
key = anno.get_key()
|
| 90 |
+
elif hasattr(anno, 'key'):
|
| 91 |
+
key = anno.key
|
| 92 |
+
|
| 93 |
+
if hasattr(anno, 'get_arguments'):
|
| 94 |
+
args = anno.get_arguments()
|
| 95 |
+
elif hasattr(anno, 'arguments'):
|
| 96 |
+
args = anno.arguments
|
| 97 |
+
|
| 98 |
+
if key:
|
| 99 |
annotations.append({"key": key, "arguments": args})
|
| 100 |
+
except Exception as e:
|
| 101 |
+
logger.error(f"Error fetching annotations for {name}: {e}")
|
| 102 |
+
|
| 103 |
+
formatted_attrs.append({
|
| 104 |
+
"name": name,
|
| 105 |
+
"type": attr_type,
|
| 106 |
+
"defaultValue": default_val,
|
| 107 |
+
"annotations": annotations
|
| 108 |
+
})
|
| 109 |
elif isinstance(attr, str):
|
| 110 |
# Fallback if list of strings
|
| 111 |
formatted_attrs.append({
|