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