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 ):
@@ -878,7 +874,7 @@ def get_dependencies(name, environ):
878
874
879
875
880
876
def 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
882
878
This function converts any unicode entries for Windows only, returning the
883
879
dictionary untouched in other environments.
884
880
@@ -890,18 +886,18 @@ def canonicalize_env(env):
890
886
Returns
891
887
-------
892
888
env : dict
893
- Windows: environment dictionary with bytes keys and values
889
+ Windows: environment dictionary with str keys and values
894
890
Other: untouched input ``env``
895
891
"""
896
892
if os .name != "nt" :
897
893
return env
898
894
899
895
out_env = {}
900
896
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" )
905
901
out_env [key ] = val
906
902
return out_env
907
903
0 commit comments