99import os
1010import sys
1111from os import chmod
12- from os .path import expanduser ,exists ,join
12+ from os .path import expanduser , exists , join
1313
1414
1515home_env_path = expanduser ('~/.irods' )
16- env_file_path = join (home_env_path ,'irods_environment.json' )
17- auth_file_path = join (home_env_path ,'.irodsA' )
16+ env_file_path = join (home_env_path , 'irods_environment.json' )
17+ auth_file_path = join (home_env_path , '.irodsA' )
1818
1919
2020def do_iinit (host , port , user , zone , password ):
@@ -23,25 +23,26 @@ def do_iinit(host, port, user, zone, password):
2323 else :
2424 raise RuntimeError ('~/.irods already exists' )
2525
26- with open (env_file_path ,'w' ) as env_file :
27- json .dump ( { "irods_host" : host ,
28- "irods_port" : int (port ),
29- "irods_user_name" : user ,
30- "irods_zone_name" : zone }, env_file , indent = 4 )
31- with open (auth_file_path ,'w' ) as auth_file :
26+ with open (env_file_path , 'w' ) as env_file :
27+ json .dump (
28+ {"irods_host" : host , "irods_port" : int (port ), "irods_user_name" : user , "irods_zone_name" : zone },
29+ env_file ,
30+ indent = 4 ,
31+ )
32+ with open (auth_file_path , 'w' ) as auth_file :
3233 auth_file .write (encode (password ))
33- chmod (auth_file_path ,0o600 )
34+ chmod (auth_file_path , 0o600 )
3435
3536
3637def get_kv_pairs_from_cmdline (* args ):
3738 arglist = list (args )
3839 while arglist :
3940 k = arglist .pop (0 )
4041 v = arglist .pop (0 )
41- yield k ,v
42+ yield k , v
4243
4344
4445if __name__ == '__main__' :
4546 args = sys .argv [1 :]
46- dct = {k :v for k ,v in get_kv_pairs_from_cmdline (* args )}
47+ dct = {k : v for k , v in get_kv_pairs_from_cmdline (* args )}
4748 do_iinit (** dct )
0 commit comments