2626
2727fmlogger = logging .getLogger ("nipype.utils" )
2828
29- related_filetype_sets = [
30- (".hdr" , ".img" , ".mat" ),
31- (".nii" , ".mat" ),
32- (".BRIK" , ".HEAD" ),
33- ]
29+ related_filetype_sets = [(".hdr" , ".img" , ".mat" ), (".nii" , ".mat" ), (".BRIK" , ".HEAD" )]
3430
3531
3632def _resolve_with_filenotfound (path , ** kwargs ):
@@ -878,7 +874,7 @@ def get_dependencies(name, environ):
878874
879875
880876def canonicalize_env (env ):
881- """Windows requires that environment be dicts with bytes as keys and values
877+ """Windows requires that environment be dicts with str as keys and values
882878 This function converts any unicode entries for Windows only, returning the
883879 dictionary untouched in other environments.
884880
@@ -890,18 +886,18 @@ def canonicalize_env(env):
890886 Returns
891887 -------
892888 env : dict
893- Windows: environment dictionary with bytes keys and values
889+ Windows: environment dictionary with str keys and values
894890 Other: untouched input ``env``
895891 """
896892 if os .name != "nt" :
897893 return env
898894
899895 out_env = {}
900896 for key , val in env .items ():
901- if not isinstance (key , bytes ):
902- key = key .encode ("utf-8" )
903- if not isinstance (val , bytes ):
904- val = val .encode ("utf-8" )
897+ if not isinstance (key , str ):
898+ key = key .decode ("utf-8" )
899+ if not isinstance (val , str ):
900+ val = val .decode ("utf-8" )
905901 out_env [key ] = val
906902 return out_env
907903
0 commit comments