@@ -296,7 +296,7 @@ def exportXml(fits, progress, callback):
296
296
fittings = doc .createElement ("fittings" )
297
297
# fit count
298
298
fit_count = len (fits )
299
- fittings .setAttribute ("count" , "%s" % fit_count )
299
+ fittings .setAttribute ("count" , str ( fit_count ) )
300
300
doc .appendChild (fittings )
301
301
302
302
def addMutantAttributes (node , mutant ):
@@ -310,21 +310,18 @@ def addMutantAttributes(node, mutant):
310
310
return None
311
311
processedFits = i + 1
312
312
progress .current = processedFits
313
- progress .message = "converting to xml (%s/%s) %s" % (processedFits , fit_count , fit .ship .name )
313
+ progress .message = f"converting to xml ({ processedFits } /{ fit_count } ) { fit .ship .name } "
314
+
314
315
try :
315
316
fitting = doc .createElement ("fitting" )
316
317
fitting .setAttribute ("name" , fit .name )
317
318
fittings .appendChild (fitting )
318
319
description = doc .createElement ("description" )
319
320
# -- 170327 Ignored description --
320
321
try :
321
- notes = fit .notes # unicode
322
-
323
- if notes :
324
- notes = re .sub (r"(\r|\n|\r\n)" , "<br>" , notes )
325
- if len (notes ) > EVE_FIT_NOTE_MAX :
326
- notes = notes [:EVE_FIT_NOTE_MAX - 3 ] + '...'
327
-
322
+ notes = re .sub (r"(\r|\n|\r\n)" , "<br>" , fit .notes or "" )
323
+ if len (notes ) > EVE_FIT_NOTE_MAX :
324
+ notes = notes [:EVE_FIT_NOTE_MAX - 3 ] + '...'
328
325
description .setAttribute ("value" , notes )
329
326
except (KeyboardInterrupt , SystemExit ):
330
327
raise
@@ -358,7 +355,7 @@ def addMutantAttributes(node, mutant):
358
355
hardware .setAttribute ("type" , module .item .name )
359
356
slotName = FittingSlot (slot ).name .lower ()
360
357
slotName = slotName if slotName != "high" else "hi"
361
- hardware .setAttribute ("slot" , "%s slot %d" % ( slotName , slotId ) )
358
+ hardware .setAttribute ("slot" , f" { slotName } slot { slotId } " )
362
359
if module .isMutated :
363
360
addMutantAttributes (hardware , module )
364
361
@@ -392,16 +389,16 @@ def addMutantAttributes(node, mutant):
392
389
charges [cargo .item .name ] = 0
393
390
charges [cargo .item .name ] += cargo .amount
394
391
395
- for name , qty in list ( charges .items () ):
392
+ for name , qty in charges .items ():
396
393
hardware = doc .createElement ("hardware" )
397
- hardware .setAttribute ("qty" , "%d" % qty )
394
+ hardware .setAttribute ("qty" , str ( qty ) )
398
395
hardware .setAttribute ("slot" , "cargo" )
399
396
hardware .setAttribute ("type" , name )
400
397
fitting .appendChild (hardware )
401
398
except (KeyboardInterrupt , SystemExit ):
402
399
raise
403
400
except Exception as e :
404
- pyfalog .error ("Failed on fitID: %d , message: %s" % e . message )
401
+ pyfalog .error (f "Failed on fitID: { fit . ship . ID } , message: { e } " )
405
402
continue
406
403
text = doc .toprettyxml ()
407
404
0 commit comments