Skip to content

Commit c244641

Browse files
committed
Add support for numeric keys in BaseConfig's get method
1 parent 6959133 commit c244641

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

config/config/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ def get(self, key: str, /, default: Any = None, set_if_not_found: bool = False)
4848
for token in key_tokens:
4949
if token in config:
5050
config = config[token]
51+
elif token.isdigit() and 0 <= int(token) < len(config):
52+
config = config[int(token)]
5153
else:
5254
if default is None:
5355
raise KeyError(f"Key '{key}' not found in configuration.")

0 commit comments

Comments
 (0)