Skip to content

Commit

Permalink
Merge pull request #86 from Wakoma/fix-shelf-key
Browse files Browse the repository at this point in the history
Fix  to replace invalid characters
  • Loading branch information
julianstirling authored Aug 7, 2024
2 parents d6fd69b + bdaa260 commit f0e4093
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion nimble_build_system/orchestration/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ def shelf_key(self):
"""
Return an key to identify the shelf.
"""
return f"shelf_h{self.height_in_u}_t{self.shelf_type.lower().replace(' ', '_')}"
def clean_name(name):
name = name.lower()
name = name.replace(' ', '_')
unsafe_char = re.findall(r'[a-zA-Z0-9-_]', name)
for char in set(unsafe_char):
name.replace(char, '')
return f"shelf_h{self.height_in_u}_--{clean_name(self.shelf_type)}"

@property
def shelf_builder_id(self):
Expand Down

0 comments on commit f0e4093

Please sign in to comment.