You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Returns the primary key and aliases for the given cfg_key.
1182
+
"""
1183
+
ifisinstance(cfg_key, str):
1184
+
returncfg_key, []
1185
+
1186
+
iflen(cfg_key) ==0:
1187
+
raiseValueError("cfg_key must be a non-empty list")
1188
+
primary_key=None
1189
+
aliases=list[runopt.alias]()
1190
+
fornameincfg_key:
1191
+
ifisinstance(name, runopt.alias):
1192
+
aliases.append(name)
1193
+
else:
1194
+
ifprimary_keyisnotNone:
1195
+
raiseValueError(
1196
+
f"cfg_key must contain a single primary key. Given more than one primary keys: {primary_key}, {name}. If one of them is an alias please use runopt.alias type instead of str. "
1197
+
)
1198
+
primary_key=name
1199
+
ifprimary_keyisNoneorprimary_key=="":
1200
+
raiseValueError(
1201
+
"Missing cfg_key. Please provide one other than the aliases."
1202
+
)
1203
+
returnprimary_key, aliases
1204
+
1146
1205
defadd(
1147
1206
self,
1148
-
cfg_key: str,
1207
+
cfg_key: str|list[str],
1149
1208
type_: Type[CfgVal],
1150
1209
help: str,
1151
1210
default: CfgVal=None,
@@ -1156,6 +1215,7 @@ def add(
1156
1215
value (if any). If the ``default`` is not specified then this option
0 commit comments