comparison libervia/backend/bridge/bridge_constructor/base_constructor.py @ 4280:4cf98f506269

bridge(constructor): fix template parsing, which was broken following `black` reformating.
author Goffi <goffi@goffi.org>
date Fri, 12 Jul 2024 17:58:06 +0200
parents 0d7bb4df2343
children
comparison
equal deleted inserted replaced
4279:6276242736c3 4280:4cf98f506269
323 try: 323 try:
324 with open(template_path) as template: 324 with open(template_path) as template:
325 for line in template: 325 for line in template:
326 326
327 for part, extend_list in parts.items(): 327 for part, extend_list in parts.items():
328 if line.startswith("##{}_PART##".format(part)): 328 if line.lstrip().startswith("##{}_PART##".format(part)):
329 bridge.extend(extend_list) 329 bridge.extend(extend_list)
330 break 330 break
331 else: 331 else:
332 # the line is not a magic part replacement 332 # the line is not a magic part replacement
333 if line.startswith("const_"): 333 if line.lstrip().startswith("const_"):
334 const_name = line[len("const_") : line.find(" = ")].strip() 334 const_name = line[len("const_") : line.find(" = ")].strip()
335 if const_name in const_override: 335 if const_name in const_override:
336 print(("const {} overriden".format(const_name))) 336 print(("const {} overriden".format(const_name)))
337 bridge.append( 337 bridge.append(
338 "const_{} = {}".format( 338 "const_{} = {}".format(