1
0
Fork 0

rename the config load function

This commit is contained in:
Kevin Matz 2022-05-12 23:19:40 -04:00
parent c392edccf7
commit f90bd45e5e
4 changed files with 8 additions and 9 deletions

View File

@ -5,7 +5,7 @@ from .bacon import (
beautify_lisp_string,
OscCommentMacroListener,
SyntaxErrorListener,
load_config,
load_servers,
comment,
WALKER,
LISTENER,
@ -16,7 +16,7 @@ __all__ = [
"beautify_lisp_string",
"OscCommentMacroListener",
"SyntaxErrorListener",
"load_config",
"load_servers",
"comment",
"WALKER",
"LISTENER",

View File

@ -4,7 +4,7 @@ from .hog4 import HogNet
from .OscListener import beautify_lisp_string, OscCommentMacroListener
from .script import (
SyntaxErrorListener,
load_config,
load_servers,
comment,
WALKER,
LISTENER
@ -21,7 +21,7 @@ __all__ += [
__all__ = [
"SyntaxErrorListener",
"load_config",
"load_servers",
"comment",
"WALKER",
"LISTENER",

View File

@ -14,7 +14,7 @@ from .OscListener import OscCommentMacroListener
__all__ = [
"SyntaxErrorListener",
"load_config",
"load_servers",
"comment",
"WALKER",
"LISTENER",
@ -29,7 +29,7 @@ class SyntaxErrorListener(ErrorListener):
raise SyntaxError(f"line {line}:{column} {msg}")
def load_config(file: str = 'server.cfg') -> Dict[int, object]:
def load_servers(file: str = 'server.cfg') -> Dict[int, object]:
"""Load an ini style configuration file."""
# empty server dictionary
servers: Dict[int, object] = {}

5
bs.py
View File

@ -5,13 +5,12 @@
import logging
import sys
from .bacon import comment, LISTENER, HogNet
from .bacon import load_config as loadBsConfig
from .bacon import comment, LISTENER, HogNet, load_servers
logging.basicConfig(level=logging.INFO)
log = logging.getLogger(__name__)
LISTENER.osc = HogNet(loadBsConfig('server.cfg'))
LISTENER.osc = HogNet(load_servers('server.cfg'))
# handle user input if run directly
if __name__ == '__main__':