File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from . import csv
2+ from . import json
23
3- __all__ = ['csv' ]
4+ __all__ = ['csv' , 'json' ]
Original file line number Diff line number Diff line change 1+ import json , os
2+
3+ def write (srcData , targetPath ):
4+ os .makedirs (os .path .dirname (targetPath ), exist_ok = True )
5+ with open (targetPath , 'w' , encoding = 'utf-8' ) as file :
6+ json .dump (srcData , file , indent = 2 )
Original file line number Diff line number Diff line change @@ -66,10 +66,8 @@ def config_file(cli):
6666 cli .config_data = resp .json ()
6767 except (requests .RequestException , ValueError ):
6868 cli .config_data = {}
69-
70- with open (cli .config_path , 'w' , encoding = 'utf-8' ) as config_file :
71- json .dump (cli .config_data , config_file , indent = 2 )
72-
69+
70+ data .json .write (cli .config_data , cli .config_path )
7371 print (f'Default config created at { cli .config_path } ' )
7472
7573def locales_dir (locales_dir ):
You can’t perform that action at this time.
0 commit comments