simplified

This commit is contained in:
Martin Diehl 2022-02-10 23:55:05 +01:00
parent b81116f62a
commit 3ee98164fa
1 changed files with 5 additions and 8 deletions

View File

@ -144,10 +144,9 @@ class Config(dict):
Configuration from file. Configuration from file.
""" """
if isinstance(fname, (str, Path)): fhandle = open(fname) if isinstance(fname, (str, Path)) else \
fhandle = open(fname) fname
else:
fhandle = fname
return cls(yaml.safe_load(fhandle)) return cls(yaml.safe_load(fhandle))
def save(self, def save(self,
@ -164,10 +163,8 @@ class Config(dict):
Keyword arguments parsed to yaml.dump. Keyword arguments parsed to yaml.dump.
""" """
if isinstance(fname, (str, Path)): fhandle = open(fname,'w',newline='\n') if isinstance(fname, (str, Path)) else \
fhandle = open(fname,'w',newline='\n') fname
else:
fhandle = fname
if 'width' not in kwargs: if 'width' not in kwargs:
kwargs['width'] = 256 kwargs['width'] = 256