Imrao commited on
Commit
7a2bf4a
·
1 Parent(s): 410126b

z up fix test

Browse files
Files changed (1) hide show
  1. app.py +23 -14
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
- if hasattr(attr, 'get_annotations'):
 
82
  py_annotations = attr.get_annotations()
83
- # Convert PyPRT annotations to serializable format
84
- # Annotations are typically list of objects or similar
85
  for anno in py_annotations:
86
- # anno might be an object with get_key(), get_value_type(), get_arguments()
 
87
  if hasattr(anno, 'get_key'):
88
  key = anno.get_key()
89
- args = []
90
- if hasattr(anno, 'get_arguments'):
91
- args = anno.get_arguments()
 
 
 
 
 
 
92
  annotations.append({"key": key, "arguments": args})
93
-
94
- formatted_attrs.append({
95
- "name": name,
96
- "type": attr_type,
97
- "defaultValue": default_val,
98
- "annotations": annotations
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({