Skip to content

Commit d79fdb7

Browse files
committed
override bug fix
1 parent 9b3d09a commit d79fdb7

1 file changed

Lines changed: 21 additions & 18 deletions

File tree

classes/protocol_settings.py

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,8 @@ def load_registry_overrides(self, override_path, keys : list[str]):
346346
for row in reader:
347347
for key in keys:
348348
if key in row:
349-
key_value = row[key].strip().lower().replace(' ', '_')
349+
row[key] = row[key].strip().lower().replace(' ', '_')
350+
key_value = row[key]
350351
if key_value:
351352
overrides[key][key_value] = row
352353
return overrides
@@ -391,23 +392,7 @@ def process_row(row):
391392
numeric_part = 1
392393
character_part = ''
393394

394-
#if or is in the unit; ignore unit
395-
if "or" in row['unit'].lower() or ":" in row['unit'].lower():
396-
numeric_part = 1
397-
character_part = row['unit']
398-
else:
399-
# Use regular expressions to extract numeric and character parts
400-
matches = re.findall(r'(\-?[0-9.]+)|(.*?)$', row['unit'])
401-
402-
# Iterate over the matches and assign them to appropriate variables
403-
for match in matches:
404-
if match[0]: # If it matches a numeric part
405-
numeric_part = float(match[0])
406-
elif match[1]: # If it matches a character part
407-
character_part = match[1].strip()
408-
#print(str(row['documented name']) + " Unit: " + str(character_part) )
409-
410-
#clean up doc name, for extra parsing
395+
#clean up doc name, for extra parsing
411396
row['documented name'] = row['documented name'].strip().lower().replace(' ', '_')
412397

413398
if overrides != None:
@@ -427,6 +412,23 @@ def process_row(row):
427412
if override_value: # Only replace if override value is non-empty
428413
row[field] = override_value
429414

415+
#if or is in the unit; ignore unit
416+
if "or" in row['unit'].lower() or ":" in row['unit'].lower():
417+
numeric_part = 1
418+
character_part = row['unit']
419+
else:
420+
# Use regular expressions to extract numeric and character parts
421+
matches = re.findall(r'(\-?[0-9.]+)|(.*?)$', row['unit'])
422+
423+
# Iterate over the matches and assign them to appropriate variables
424+
for match in matches:
425+
if match[0]: # If it matches a numeric part
426+
numeric_part = float(match[0])
427+
elif match[1]: # If it matches a character part
428+
character_part = match[1].strip()
429+
#print(str(row['documented name']) + " Unit: " + str(character_part) )
430+
431+
430432
variable_name = row['variable name'] if row['variable name'] else row['documented name']
431433
variable_name = variable_name.strip().lower().replace(' ', '_').replace('__', '_') #clean name
432434

@@ -590,6 +592,7 @@ def process_row(row):
590592
write_mode=writeMode
591593
)
592594
registry_map.append(item)
595+
593596
register = register + 1
594597

595598

0 commit comments

Comments
 (0)