-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfig_loader.py
More file actions
33 lines (28 loc) · 849 Bytes
/
config_loader.py
File metadata and controls
33 lines (28 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/micropython
# -*- coding: utf-8 -*-
#
# Copyright 2020-2025 by Murray Altheim. All rights reserved. This file is part
# of the Robot Operating System project, released under the MIT License. Please
# see the LICENSE file included as part of this package.
#
# author: Murray Altheim
# created: 2025-05-22
# modified: 2025-06-21
#
# This is a MicroPython-compatible simplified version of the ConfigLoader class
# used with the KROS robot operating system to load a YAML configuration file.
#
# Usage:
#
# config = ConfigLoader.configure() # defaults to 'config.yaml'
# or
# config = ConfigLoader.configure('my_file.yaml')
#
import yaml
class ConfigLoader:
DEFAULT_FILE = 'config.yaml'
@staticmethod
def configure(filename=None):
path = filename or ConfigLoader.DEFAULT_FILE
return yaml.load(path)
#EOF