File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,11 +88,16 @@ def typer_warn(message: str):
8888
8989def yaml_dump (data , to_file : Path = None ) -> str :
9090 if to_file :
91- with open (to_file , 'w' ) as f :
91+ with open (to_file , 'w' , encoding = "utf-8" ) as f :
9292 return yaml .dump (data , stream = f , allow_unicode = True )
9393 return yaml .dump (data , allow_unicode = True )
9494
9595
96+ def yaml_load (from_file : Path ) -> dict :
97+ with open (from_file , 'r' , encoding = "utf-8" ) as f :
98+ return yaml .safe_load (f )
99+
100+
96101# ------------------------------ Configuration ------------------------------ #
97102
98103
@@ -266,8 +271,7 @@ def config(
266271def get_config (path = DEFAULT_CONFIG_PATH ) -> dict :
267272 _config = None
268273 if path .exists ():
269- with open (path , 'r' ) as f :
270- _config = yaml .safe_load (f )
274+ _config = yaml_load (path )
271275 if not _config :
272276 typer_warn (f"No configuration found in { path } . Generate one." )
273277 _config = config (path )
You can’t perform that action at this time.
0 commit comments