@@ -56,7 +56,7 @@ def __getenv__(var, pattern = '.', trans = lambda x: x):
5656 rpat = re .compile (rpat )
5757 if not rpat .search (val ):
5858 raise RuntimeError ("env var %s doesn't match required pattern %s" % \
59- (var , ` pattern` ))
59+ (var , repr ( pattern ) ))
6060 return trans (val )
6161
6262def get_fuse_python_api ():
@@ -134,12 +134,12 @@ def assemble(self):
134134 args = [sys .argv and sys .argv [0 ] or "python" ]
135135 if self .mountpoint :
136136 args .append (self .mountpoint )
137- for m , v in self .modifiers .iteritems ():
137+ for m , v in self .modifiers .items ():
138138 if v :
139139 args .append (self .fuse_modifiers [m ])
140140
141141 opta = []
142- for o , v in self .optdict .iteritems ():
142+ for o , v in self .optdict .items ():
143143 opta .append (o + '=' + v )
144144 opta .extend (self .optlist )
145145
@@ -283,15 +283,15 @@ def __init__(self, *args, **kw):
283283
284284 if dsd == 'whine' :
285285 def dsdcb (option , opt_str , value , parser ):
286- raise RuntimeError , """
286+ raise RuntimeError ( """
287287
288288! If you want the "-s" option to work, pass
289289!
290290! dash_s_do='setsingle'
291291!
292292! to the Fuse constructor. See docstring of the FuseOptParse class for an
293293! explanation why is it not set by default.
294- """
294+ """ )
295295
296296 elif dsd == 'setsingle' :
297297 def dsdcb (option , opt_str , value , parser ):
@@ -300,7 +300,7 @@ def dsdcb(option, opt_str, value, parser):
300300 elif dsd == 'undef' :
301301 dsdcb = None
302302 else :
303- raise ArgumentError , "key `dash_s_do': uninterpreted value " + str (dsd )
303+ raise ArgumentError ( "key `dash_s_do': uninterpreted value " + str (dsd ) )
304304
305305 if dsdcb :
306306 self .add_option ('-s' , action = 'callback' , callback = dsdcb ,
@@ -313,11 +313,11 @@ def exit(self, status=0, msg=None):
313313
314314 def error (self , msg ):
315315 SubbedOptParse .error (self , msg )
316- raise OptParseError , msg
316+ raise OptParseError ( msg )
317317
318318 def print_help (self , file = sys .stderr ):
319319 SubbedOptParse .print_help (self , file )
320- print >> file
320+ print ( file = file )
321321 self .fuse_args .setmod ('showhelp' )
322322
323323 def print_version (self , file = sys .stderr ):
@@ -359,8 +359,8 @@ def __init__(self, func):
359359
360360 def __call__ (self , * args , ** kw ):
361361 try :
362- return apply ( self .func , args , kw )
363- except (IOError , OSError ), detail :
362+ return self .func ( * args , ** kw )
363+ except (IOError , OSError ) as detail :
364364 # Sometimes this is an int, sometimes an instance...
365365 if hasattr (detail , "errno" ): detail = detail .errno
366366 return - detail
@@ -578,7 +578,7 @@ def resolve(args, maxva):
578578 mag = ma .groups ()
579579 fp = re .compile (mag [1 ])
580580 neg = bool (mag [0 ])
581- for f in fmap .keys () + [ 'has_' + a for a in Fuse ._attrs ]:
581+ for f in list ( fmap .keys () ) + [ 'has_' + a for a in Fuse ._attrs ]:
582582 if neg != bool (re .search (fp , f )):
583583 yield f
584584 continue
@@ -663,11 +663,11 @@ def __init__(self, *args, **kw):
663663 """
664664
665665 if not fuse_python_api :
666- raise RuntimeError , __name__ + """.fuse_python_api not defined.
666+ raise RuntimeError ( __name__ + """.fuse_python_api not defined.
667667
668668! Please define """ + __name__ + """.fuse_python_api internally (eg.
669669!
670- ! (1) """ + __name__ + """.fuse_python_api = """ + ` FUSE_PYTHON_API_VERSION` + """
670+ ! (1) """ + __name__ + """.fuse_python_api = """ + repr ( FUSE_PYTHON_API_VERSION ) + """
671671!
672672! ) or in the enviroment (eg.
673673!
@@ -678,22 +678,21 @@ def __init__(self, *args, **kw):
678678! If you are actually developing a filesystem, probably (1) is the way to go.
679679! If you are using a filesystem written before 2007 Q2, probably (2) is what
680680! you want."
681- """
681+ """ )
682682
683683 def malformed ():
684- raise RuntimeError , \
685- "malformatted fuse_python_api value " + `fuse_python_api`
684+ raise RuntimeError ("malformatted fuse_python_api value " + repr (fuse_python_api ))
686685 if not isinstance (fuse_python_api , tuple ):
687686 malformed ()
688687 for i in fuse_python_api :
689688 if not isinstance (i , int ) or i < 0 :
690689 malformed ()
691690
692691 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- """
692+ raise RuntimeError ( """
693+ ! You require FUSE-Python API version """ + repr ( fuse_python_api ) + """.
694+ ! However, the latest available is """ + repr ( FUSE_PYTHON_API_VERSION ) + """.
695+ """ )
697696
698697 self .fuse_args = \
699698 'fuse_args' in kw and kw .pop ('fuse_args' ) or FuseArgs ()
@@ -719,7 +718,7 @@ def parse(self, *args, **kw):
719718
720719 ev = 'errex' in kw and kw .pop ('errex' )
721720 if ev and not isinstance (ev , int ):
722- raise TypeError , "error exit value should be an integer"
721+ raise TypeError ( "error exit value should be an integer" )
723722
724723 try :
725724 self .cmdline = self .parser .parse_args (* args , ** kw )
@@ -893,7 +892,7 @@ def __getattr__(self, meth):
893892 if m :
894893 return m
895894
896- raise AttributeError , "Fuse instance has no attribute '%s'" % meth
895+ raise AttributeError ( "Fuse instance has no attribute '%s'" % meth )
897896
898897
899898
0 commit comments