Use instance method for _load_config (#4112)

This commit is contained in:
codefiles 2026-01-10 19:29:01 -05:00 committed by GitHub
parent cb4b7e3db0
commit efd57870d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 9 deletions

View File

@ -32,24 +32,21 @@ class LocaleConfiguration:
output += '{}: {}'.format(tr('Locale encoding'), self.sys_enc)
return output
@classmethod
def _load_config(cls, config: 'LocaleConfiguration', args: dict[str, str]) -> 'LocaleConfiguration':
def _load_config(self, args: dict[str, str]) -> None:
if 'sys_lang' in args:
config.sys_lang = args['sys_lang']
self.sys_lang = args['sys_lang']
if 'sys_enc' in args:
config.sys_enc = args['sys_enc']
self.sys_enc = args['sys_enc']
if 'kb_layout' in args:
config.kb_layout = args['kb_layout']
return config
self.kb_layout = args['kb_layout']
@classmethod
def parse_arg(cls, args: dict[str, Any]) -> 'LocaleConfiguration':
default = cls.default()
if 'locale_config' in args:
default = cls._load_config(default, args['locale_config'])
default._load_config(args['locale_config'])
else:
default = cls._load_config(default, args)
default._load_config(args)
return default