(type, value)
| 169 | |
| 170 | |
| 171 | def get_value(type, value): |
| 172 | |
| 173 | def have_multipliers(value, mps): |
| 174 | for m in mps: |
| 175 | if value.endswith(m): |
| 176 | return True |
| 177 | |
| 178 | return False |
| 179 | |
| 180 | if value == 'nullptr' or value == 'NULL': |
| 181 | return None |
| 182 | |
| 183 | # We want to make the type right when inserting the element into the dict. |
| 184 | if type == 'FLOAT': |
| 185 | return float(value) |
| 186 | elif type == 'INT': |
| 187 | # We need to make it YAML compliant as this will be an int, so if contains |
| 188 | # any special character like hex or a multiplier, then we make a string. ATS will |
| 189 | # parse it as string anyway. |
| 190 | if value.startswith('0x') or have_multipliers(value, ['K', 'M', 'G', 'T']): |
| 191 | return str(value) |
| 192 | else: |
| 193 | return int(value) |
| 194 | elif type == 'STRING': |
| 195 | return str(value) |
| 196 | |
| 197 | return None |
| 198 | |
| 199 | |
| 200 | def add_object(config, var, value, type, track_info): |
no test coverage detected