@@ -62,17 +62,16 @@ class AmdSmiBaseModel(BaseModel):
6262 extra = "forbid" , # Forbid extra fields not defined in the model
6363 )
6464
65- # During building if a field contains a ValueUnit in its tuple, convert input into a ValueUnit
6665 def __init__ (self , ** data ):
67- # Convert all fields that are supposed to be ValueUnit to ValueUnit if they are int | str | float
66+ # Convert int | str | float -> ValueUnit
6867 for field_name , field_type in self .model_fields .items ():
6968 annotation = field_type .annotation
7069 target_type , container = find_annotation_in_container (annotation , ValueUnit )
7170 if target_type is None :
7271 continue
7372
7473 if field_name in data and isinstance (data [field_name ], (int , str , float )):
75- # If the field is a primitive type, convert it to ValueUnit dict and let validtor handle it
74+ # If the field is a primitive type, convert it to ValueUnit dict for validator
7675 data [field_name ] = {
7776 "value" : data [field_name ],
7877 "unit" : "" ,
@@ -104,7 +103,6 @@ def na(x) -> bool:
104103 if na (v ):
105104 return None
106105
107- # Dict form: normalize value and possibly extract unit
108106 if isinstance (v , dict ):
109107 val = v .get ("value" )
110108 unit = v .get ("unit" , "" )
@@ -218,7 +216,7 @@ def _stringify(cls, v):
218216
219217
220218class PartitionAccelerator (BaseModel ):
221- """Contains the tition data for the GPUs """
219+ """Accelerator partition data"""
222220
223221 gpu_id : int
224222 memory : str | None = None
@@ -392,6 +390,8 @@ class StaticClockData(BaseModel):
392390
393391
394392class AmdSmiStatic (BaseModel ):
393+ """Contains all static data"""
394+
395395 gpu : int
396396 asic : StaticAsic
397397 bus : StaticBus
0 commit comments