Skip to content

Commit 37ddbc4

Browse files
committed
ci(variant): clean up useless code
apply black Signed-off-by: Frederic Pillon <[email protected]>
1 parent ae68ec1 commit 37ddbc4

File tree

1 file changed

+10
-40
lines changed

1 file changed

+10
-40
lines changed

CI/update/stm32variant.py

+10-40
Original file line numberDiff line numberDiff line change
@@ -149,17 +149,6 @@ def update_file(filePath, compile_pattern, subs):
149149
file.write(fileContents)
150150

151151

152-
# get xml family
153-
def get_mcu_family(mcu_file):
154-
xml_mcu = parse(str(mcu_file))
155-
mcu_node = xml_mcu.getElementsByTagName("Mcu")[0]
156-
mcu_family = mcu_node.attributes["Family"].value
157-
if mcu_family.endswith("+"):
158-
mcu_family = mcu_family[:-1]
159-
xml_mcu.unlink()
160-
return mcu_family
161-
162-
163152
# mcu file parsing
164153
def parse_mcu_file():
165154
global gpiofile
@@ -908,9 +897,11 @@ def can_pinmap(lst):
908897
)
909898
return dict(
910899
name=name,
911-
hal=["CAN", "CAN_LEGACY"]
912-
if name != "FDCAN" and any(mcu in mcu_family for mcu in legacy_hal["CAN"])
913-
else name,
900+
hal=(
901+
["CAN", "CAN_LEGACY"]
902+
if name != "FDCAN" and any(mcu in mcu_family for mcu in legacy_hal["CAN"])
903+
else name
904+
),
914905
aname=aname,
915906
data="",
916907
wpin=max(wpin) + 1,
@@ -939,9 +930,11 @@ def eth_pinmap():
939930
)
940931
return dict(
941932
name="ETHERNET",
942-
hal=["ETH", "ETH_LEGACY"]
943-
if any(mcu in mcu_family for mcu in legacy_hal["ETH"])
944-
else "ETH",
933+
hal=(
934+
["ETH", "ETH_LEGACY"]
935+
if any(mcu in mcu_family for mcu in legacy_hal["ETH"])
936+
else "ETH"
937+
),
945938
aname="Ethernet",
946939
data="",
947940
wpin=max(wpin) + 1,
@@ -2501,7 +2494,6 @@ def manage_repo():
25012494
templates_dir = script_path / "templates"
25022495
mcu_family_dir = ""
25032496
filtered_family = ""
2504-
# filtered_mcu_file = ""
25052497
periph_c_filename = "PeripheralPins.c"
25062498
pinvar_h_filename = "PinNamesVar.h"
25072499
config_filename = script_path / "variant_config.json"
@@ -2553,18 +2545,6 @@ def manage_repo():
25532545
help="list available xml files description in database",
25542546
action="store_true",
25552547
)
2556-
# group.add_argument(
2557-
# "-m",
2558-
# "--mcu",
2559-
# metavar="xml",
2560-
# help=textwrap.dedent(
2561-
# """\
2562-
# Generate all files for specified mcu xml file description in database.
2563-
# This xml file can contain non alpha characters in its name,
2564-
# you should call it with double quotes.
2565-
# """
2566-
# ),
2567-
# )
25682548

25692549
group.add_argument(
25702550
"-f",
@@ -2627,16 +2607,6 @@ def manage_repo():
26272607
db_release = release_match.group(1)
26282608
print(f"CubeMX DB release {db_release}\n")
26292609

2630-
# if args.mcu:
2631-
# # Check input file exists
2632-
# if not ((dirMCU / args.mcu).is_file()):
2633-
# print("\n" + args.mcu + " file not found")
2634-
# print("\nCheck in " + dirMCU + " the correct name of this file")
2635-
# print("\nYou may use double quotes for file containing special characters")
2636-
# quit()
2637-
# # Get the family of the desired mcu file
2638-
# filtered_mcu_file = dirMCU / args.mcu
2639-
# filtered_family = get_mcu_family(filtered_mcu_file)
26402610
if args.family:
26412611
filtered_family = args.family.upper()
26422612
# Get all xml files

0 commit comments

Comments
 (0)