26
26
27
27
fmlogger = logging .getLogger ("nipype.utils" )
28
28
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" )]
34
30
35
31
36
32
def _resolve_with_filenotfound (path , ** kwargs ):
@@ -876,7 +872,7 @@ def get_dependencies(name, environ):
876
872
877
873
878
874
def canonicalize_env (env ):
879
- """Windows requires that environment be dicts with bytes as keys and values
875
+ """Windows requires that environment be dicts with str as keys and values
880
876
This function converts any unicode entries for Windows only, returning the
881
877
dictionary untouched in other environments.
882
878
@@ -888,18 +884,18 @@ def canonicalize_env(env):
888
884
Returns
889
885
-------
890
886
env : dict
891
- Windows: environment dictionary with bytes keys and values
887
+ Windows: environment dictionary with str keys and values
892
888
Other: untouched input ``env``
893
889
"""
894
890
if os .name != "nt" :
895
891
return env
896
892
897
893
out_env = {}
898
894
for key , val in env .items ():
899
- if not isinstance (key , bytes ):
900
- key = key .encode ("utf-8" )
901
- if not isinstance (val , bytes ):
902
- val = val .encode ("utf-8" )
895
+ if not isinstance (key , str ):
896
+ key = key .decode ("utf-8" )
897
+ if not isinstance (val , str ):
898
+ val = val .decode ("utf-8" )
903
899
out_env [key ] = val
904
900
return out_env
905
901
0 commit comments