1717except :
1818 pass
1919
20- from string import join
2120import sys
2221import os
2322from errno import *
@@ -56,7 +55,7 @@ def __getenv__(var, pattern = '.', trans = lambda x: x):
5655 rpat = re .compile (rpat )
5756 if not rpat .search (val ):
5857 raise RuntimeError ("env var %s doesn't match required pattern %s" % \
59- (var , ` pattern` ))
58+ (var , repr ( pattern ) ))
6059 return trans (val )
6160
6261def get_fuse_python_api ():
@@ -134,12 +133,12 @@ def assemble(self):
134133 args = [sys .argv and sys .argv [0 ] or "python" ]
135134 if self .mountpoint :
136135 args .append (self .mountpoint )
137- for m , v in self .modifiers .iteritems ():
136+ for m , v in self .modifiers .items ():
138137 if v :
139138 args .append (self .fuse_modifiers [m ])
140139
141140 opta = []
142- for o , v in self .optdict .iteritems ():
141+ for o , v in self .optdict .items ():
143142 opta .append (o + '=' + v )
144143 opta .extend (self .optlist )
145144
@@ -283,15 +282,15 @@ def __init__(self, *args, **kw):
283282
284283 if dsd == 'whine' :
285284 def dsdcb (option , opt_str , value , parser ):
286- raise RuntimeError , """
285+ raise RuntimeError ( """
287286
288287! If you want the "-s" option to work, pass
289288!
290289! dash_s_do='setsingle'
291290!
292291! to the Fuse constructor. See docstring of the FuseOptParse class for an
293292! explanation why is it not set by default.
294- """
293+ """ )
295294
296295 elif dsd == 'setsingle' :
297296 def dsdcb (option , opt_str , value , parser ):
@@ -300,7 +299,7 @@ def dsdcb(option, opt_str, value, parser):
300299 elif dsd == 'undef' :
301300 dsdcb = None
302301 else :
303- raise ArgumentError , "key `dash_s_do': uninterpreted value " + str (dsd )
302+ raise ArgumentError ( "key `dash_s_do': uninterpreted value " + str (dsd ) )
304303
305304 if dsdcb :
306305 self .add_option ('-s' , action = 'callback' , callback = dsdcb ,
@@ -313,11 +312,10 @@ def exit(self, status=0, msg=None):
313312
314313 def error (self , msg ):
315314 SubbedOptParse .error (self , msg )
316- raise OptParseError , msg
315+ raise OptParseError ( msg )
317316
318317 def print_help (self , file = sys .stderr ):
319318 SubbedOptParse .print_help (self , file )
320- print >> file
321319 self .fuse_args .setmod ('showhelp' )
322320
323321 def print_version (self , file = sys .stderr ):
@@ -359,8 +357,8 @@ def __init__(self, func):
359357
360358 def __call__ (self , * args , ** kw ):
361359 try :
362- return apply ( self .func , args , kw )
363- except (IOError , OSError ), detail :
360+ return self .func ( * args , ** kw )
361+ except (IOError , OSError ) as detail :
364362 # Sometimes this is an int, sometimes an instance...
365363 if hasattr (detail , "errno" ): detail = detail .errno
366364 return - detail
@@ -578,7 +576,7 @@ def resolve(args, maxva):
578576 mag = ma .groups ()
579577 fp = re .compile (mag [1 ])
580578 neg = bool (mag [0 ])
581- for f in fmap .keys () + [ 'has_' + a for a in Fuse ._attrs ]:
579+ for f in list ( fmap .keys () ) + [ 'has_' + a for a in Fuse ._attrs ]:
582580 if neg != bool (re .search (fp , f )):
583581 yield f
584582 continue
@@ -663,11 +661,11 @@ def __init__(self, *args, **kw):
663661 """
664662
665663 if not fuse_python_api :
666- raise RuntimeError , __name__ + """.fuse_python_api not defined.
664+ raise RuntimeError ( __name__ + """.fuse_python_api not defined.
667665
668666! Please define """ + __name__ + """.fuse_python_api internally (eg.
669667!
670- ! (1) """ + __name__ + """.fuse_python_api = """ + ` FUSE_PYTHON_API_VERSION` + """
668+ ! (1) """ + __name__ + """.fuse_python_api = """ + repr ( FUSE_PYTHON_API_VERSION ) + """
671669!
672670! ) or in the enviroment (eg.
673671!
@@ -678,22 +676,21 @@ def __init__(self, *args, **kw):
678676! If you are actually developing a filesystem, probably (1) is the way to go.
679677! If you are using a filesystem written before 2007 Q2, probably (2) is what
680678! you want."
681- """
679+ """ )
682680
683681 def malformed ():
684- raise RuntimeError , \
685- "malformatted fuse_python_api value " + `fuse_python_api`
682+ raise RuntimeError ("malformatted fuse_python_api value " + repr (fuse_python_api ))
686683 if not isinstance (fuse_python_api , tuple ):
687684 malformed ()
688685 for i in fuse_python_api :
689686 if not isinstance (i , int ) or i < 0 :
690687 malformed ()
691688
692689 if fuse_python_api > FUSE_PYTHON_API_VERSION :
693- raise RuntimeError , """
694- ! You require FUSE-Python API version """ + ` fuse_python_api` + """.
695- ! However, the latest available is """ + ` FUSE_PYTHON_API_VERSION` + """.
696- """
690+ raise RuntimeError ( """
691+ ! You require FUSE-Python API version """ + repr ( fuse_python_api ) + """.
692+ ! However, the latest available is """ + repr ( FUSE_PYTHON_API_VERSION ) + """.
693+ """ )
697694
698695 self .fuse_args = \
699696 'fuse_args' in kw and kw .pop ('fuse_args' ) or FuseArgs ()
@@ -719,7 +716,7 @@ def parse(self, *args, **kw):
719716
720717 ev = 'errex' in kw and kw .pop ('errex' )
721718 if ev and not isinstance (ev , int ):
722- raise TypeError , "error exit value should be an integer"
719+ raise TypeError ( "error exit value should be an integer" )
723720
724721 try :
725722 self .cmdline = self .parser .parse_args (* args , ** kw )
@@ -893,7 +890,7 @@ def __getattr__(self, meth):
893890 if m :
894891 return m
895892
896- raise AttributeError , "Fuse instance has no attribute '%s'" % meth
893+ raise AttributeError ( "Fuse instance has no attribute '%s'" % meth )
897894
898895
899896
0 commit comments