@@ -231,12 +231,12 @@ def _make_methods(self, methods: List[_ComMemberSpec]) -> None:
231231 member_gen .add (m )
232232 for name , func , raw_func , is_prop in member_gen .methods ():
233233 raw_mth = instancemethod (raw_func , None , self )
234- setattr (self , "_%s__com_%s" % ( self .__name__ , name ) , raw_mth )
234+ setattr (self , f"_ { self .__name__ } __com_ { name } " , raw_mth )
235235 mth = instancemethod (func , None , self )
236236 if not is_prop :
237237 # We install the method in the class, except when it's a property.
238238 # And we make sure we don't overwrite a property that's already present.
239- mthname = name if not hasattr (self , name ) else ( "_%s" % name )
239+ mthname = name if not hasattr (self , name ) else f"_ { name } "
240240 setattr (self , mthname , mth )
241241 # For a method, this is the real name.
242242 # For a property, this is the name WITHOUT the _set_ or _get_ prefix.
@@ -247,7 +247,7 @@ def _make_methods(self, methods: List[_ComMemberSpec]) -> None:
247247 # create public properties / attribute accessors
248248 for name , accessor in member_gen .properties ():
249249 # Again, we should not overwrite class attributes that are already present.
250- propname = name if not hasattr (self , name ) else ( "_%s" % name )
250+ propname = name if not hasattr (self , name ) else f"_ { name } "
251251 setattr (self , propname , accessor )
252252 # COM is case insensitive
253253 if self ._case_insensitive_ :
@@ -302,7 +302,7 @@ def __get_value(self):
302302
303303 def __repr__ (self ):
304304 ptr = super (_compointer_base , self ).value
305- return "<%s ptr=0x%x at %x>" % ( self .__class__ .__name__ , ptr or 0 , id (self ))
305+ return f"< { self .__class__ .__name__ } ptr=0x { ptr or 0 :x } at { id (self ):x } >"
306306
307307 # This fixes the problem when there are multiple python interface types
308308 # wrapping the same COM interface. This could happen because some interfaces
@@ -338,7 +338,7 @@ def from_param(cls, value):
338338 # a kind of QueryInterface
339339 return table [cls ._iid_ ]
340340 except KeyError :
341- raise TypeError ("Interface %s not supported" % cls . _iid_ )
341+ raise TypeError (f "Interface { cls . _iid_ } not supported" )
342342 return value .QueryInterface (cls .__com_interface__ )
343343
344344
0 commit comments