mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-09-28 23:00:12 +03:00
Merge pull request #2884 from markparonyan/mypy-config
fix(typing): resolve mypy errors in config
This commit is contained in:
commit
0bd1204d15
@ -48,6 +48,10 @@ class ConfigConflictError(Exception):
|
||||
LIST_OPTION_SEPARATORS = {"additional_images_paths": ";"}
|
||||
|
||||
|
||||
def parser_sections(parser: configparser.ConfigParser) -> dict[str, dict[str, str]]:
|
||||
return {section: dict(parser[section]) for section in parser.sections()}
|
||||
|
||||
|
||||
class Config:
|
||||
"""
|
||||
Configuration file management using configparser.
|
||||
@ -328,7 +332,7 @@ class Config:
|
||||
changed.append(f"{section}.{option}")
|
||||
|
||||
# validate the merged settings before touching the file on disk
|
||||
ServerConfig(**merged_parser._sections)
|
||||
ServerConfig(**parser_sections(merged_parser))
|
||||
|
||||
directory_name = os.path.dirname(main_config_file)
|
||||
if directory_name:
|
||||
@ -414,7 +418,7 @@ class Config:
|
||||
self._watched_files[file] = os.stat(file).st_mtime
|
||||
|
||||
try:
|
||||
self._settings = ServerConfig(**config._sections)
|
||||
self._settings = ServerConfig(**parser_sections(config))
|
||||
except ValidationError as e:
|
||||
log.critical(f"Could not validate configuration file settings: {e}")
|
||||
raise
|
||||
|
||||
@ -371,7 +371,6 @@ module = [
|
||||
"gns3server.compute.virtualbox.virtualbox_vm", # 1
|
||||
"gns3server.compute.vmware.vmware_vm", # 1
|
||||
"gns3server.compute.vpcs.vpcs_vm", # 2
|
||||
"gns3server.config", # 1
|
||||
"gns3server.controller.appliance", # 2
|
||||
"gns3server.controller.appliance_manager", # 5
|
||||
"gns3server.controller.compute", # 2
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user