@@ -62,14 +62,11 @@ def _verify_event(self):
6262 self .packet .rewind (20 )
6363
6464 def dump (self ):
65- print ("=== %s ===" % (self .__class__ .__name__ ))
66- print (
67- "Date: %s"
68- % (datetime .datetime .utcfromtimestamp (self .timestamp ).isoformat ())
69- )
70- print ("Log position: %d" % self .packet .log_pos )
71- print ("Event size: %d" % (self .event_size ))
72- print ("Read bytes: %d" % (self .packet .read_bytes ))
65+ print (f"=== { self .__class__ .__name__ } ===" )
66+ print (f"Date: { datetime .datetime .utcfromtimestamp (self .timestamp ).isoformat ()} " )
67+ print (f"Log position: { self .packet .log_pos } " )
68+ print (f"Event size: { self .event_size } " )
69+ print (f"Read bytes: { self .packet .read_bytes } " )
7370 self ._dump ()
7471 print ()
7572
@@ -123,14 +120,14 @@ def gtid(self):
123120 return gtid
124121
125122 def _dump (self ):
126- print ("Commit: %s" % self .commit_flag )
127- print ("GTID_NEXT: %s" % self .gtid )
123+ print (f "Commit: { self .commit_flag } " )
124+ print (f "GTID_NEXT: { self .gtid } " )
128125 if hasattr (self , "last_committed" ):
129- print ("last_committed: %d" % self .last_committed )
130- print ("sequence_number: %d" % self .sequence_number )
126+ print (f "last_committed: { self .last_committed } " )
127+ print (f "sequence_number: { self .sequence_number } " )
131128
132129 def __repr__ (self ):
133- return '<GtidEvent "%s">' % self .gtid
130+ return f '<GtidEvent "{ self .gtid } ">'
134131
135132
136133class PreviousGtidsEvent (BinLogEvent ):
@@ -172,10 +169,10 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs)
172169 self ._previous_gtids = "," .join (self ._gtids )
173170
174171 def _dump (self ):
175- print ("previous_gtids: %s" % self ._previous_gtids )
172+ print (f "previous_gtids: { self ._previous_gtids } " )
176173
177174 def __repr__ (self ):
178- return '<PreviousGtidsEvent "%s">' % self ._previous_gtids
175+ return f '<PreviousGtidsEvent "{ self ._previous_gtids } ">'
179176
180177
181178class MariadbGtidEvent (BinLogEvent ):
@@ -198,12 +195,12 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs)
198195 self .gtid_seq_no = self .packet .read_uint64 ()
199196 self .domain_id = self .packet .read_uint32 ()
200197 self .flags = self .packet .read_uint8 ()
201- self .gtid = "%d-%d-%d" % ( self .domain_id , self .server_id , self .gtid_seq_no )
198+ self .gtid = f" { self .domain_id } - { self .server_id } - { self .gtid_seq_no } "
202199
203200 def _dump (self ):
204201 super ()._dump ()
205- print ("Flags:" , self .flags )
206- print ("GTID:" , self .gtid )
202+ print (f "Flags: { self .flags } " )
203+ print (f "GTID: { self .gtid } " )
207204
208205
209206class MariadbBinLogCheckPointEvent (BinLogEvent ):
@@ -225,7 +222,7 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs)
225222 self .filename = self .packet .read (filename_length ).decode ()
226223
227224 def _dump (self ):
228- print ("Filename:" , self .filename )
225+ print (f "Filename: { self .filename } " )
229226
230227
231228class MariadbAnnotateRowsEvent (BinLogEvent ):
@@ -243,7 +240,7 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs)
243240
244241 def _dump (self ):
245242 super ()._dump ()
246- print ("SQL statement :" , self .sql_statement )
243+ print (f "SQL statement : { self .sql_statement } " )
247244
248245
249246class MariadbGtidListEvent (BinLogEvent ):
@@ -280,11 +277,7 @@ def __init__(
280277 self .domain_id = self .packet .read_uint32 ()
281278 self .server_id = self .packet .read_uint32 ()
282279 self .gtid_seq_no = self .packet .read_uint64 ()
283- self .gtid = "%d-%d-%d" % (
284- self .domain_id ,
285- self .server_id ,
286- self .gtid_seq_no ,
287- )
280+ self .gtid = f"{ self .domain_id } -{ self .server_id } -{ self .gtid_seq_no } "
288281
289282 self .gtid_length = self .packet .read_uint32 ()
290283 self .gtid_list = [
@@ -312,9 +305,9 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs)
312305 self .next_binlog = self .packet .read (event_size - 8 ).decode ()
313306
314307 def dump (self ):
315- print ("=== %s ===" % ( self .__class__ .__name__ ) )
316- print ("Position: %d" % self .position )
317- print ("Next binlog file: %s" % self .next_binlog )
308+ print (f "=== { self .__class__ .__name__ } ===" )
309+ print (f "Position: { self .position } " )
310+ print (f "Next binlog file: { self .next_binlog } " )
318311 print ()
319312
320313
@@ -347,9 +340,9 @@ def xid(self):
347340 return self .xid_gtrid .decode () + self .xid_bqual .decode ()
348341
349342 def _dump (self ):
350- print ("One phase: %s" % self .one_phase )
351- print ("XID formatID: %d" % self .xid_format_id )
352- print ("XID: %s" % self .xid )
343+ print (f "One phase: { self .one_phase } " )
344+ print (f "XID formatID: { self .xid_format_id } " )
345+ print (f "XID: { self .xid } " )
353346
354347
355348class FormatDescriptionEvent (BinLogEvent ):
@@ -371,8 +364,8 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs)
371364 self .mysql_version = tuple (map (int , numbers .split ("." )))
372365
373366 def _dump (self ):
374- print ("Binlog version: %s" % self .binlog_version )
375- print ("MySQL version: %s" % self .mysql_version_str )
367+ print (f "Binlog version: { self .binlog_version } " )
368+ print (f "MySQL version: { self .mysql_version_str } " )
376369
377370
378371class StopEvent (BinLogEvent ):
@@ -394,7 +387,7 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs)
394387
395388 def _dump (self ):
396389 super ()._dump ()
397- print ("Transaction ID: %d" % ( self .xid ) )
390+ print (f "Transaction ID: { self .xid } " )
398391
399392
400393class HeartbeatLogEvent (BinLogEvent ):
@@ -427,7 +420,7 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs)
427420
428421 def _dump (self ):
429422 super ()._dump ()
430- print ("Current binlog: %s" % ( self .ident ) )
423+ print (f "Current binlog: { self .indent } " )
431424
432425
433426class QueryEvent (BinLogEvent ):
@@ -473,9 +466,9 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs)
473466
474467 def _dump (self ):
475468 super ()._dump ()
476- print ("Schema: %s " % (self .schema ))
477- print ("Execution time: %d" % ( self .execution_time ) )
478- print ("Query: %s" % ( self .query ) )
469+ print (f "Schema: { self . schema } " % (self .schema ))
470+ print (f "Execution time: { self .execution_time } " )
471+ print (f "Query: { self .query } " )
479472
480473 def _read_status_vars_value_for_key (self , key ):
481474 """parse status variable VALUE for given KEY
@@ -582,8 +575,8 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs)
582575
583576 def _dump (self ):
584577 super ()._dump ()
585- print ("File id: %d" % ( self .file_id ) )
586- print ("Block data: %s" % ( self .block_data ) )
578+ print (f "File id: { self .file_id } " )
579+ print (f "Block data: { self .block_data } " )
587580
588581
589582class ExecuteLoadQueryEvent (BinLogEvent ):
@@ -622,15 +615,15 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs)
622615
623616 def _dump (self ):
624617 super (ExecuteLoadQueryEvent , self )._dump ()
625- print ("Slave proxy id: %d" % ( self .slave_proxy_id ) )
626- print ("Execution time: %d" % ( self .execution_time ) )
627- print ("Schema length: %d" % ( self .schema_length ) )
628- print ("Error code: %d" % ( self .error_code ) )
629- print ("Status vars length: %d" % ( self .status_vars_length ) )
630- print ("File id: %d" % ( self .file_id ) )
631- print ("Start pos: %d" % ( self .start_pos ) )
632- print ("End pos: %d" % ( self .end_pos ) )
633- print ("Dup handling flags: %d" % ( self .dup_handling_flags ) )
618+ print (f "Slave proxy id: { self .slave_proxy_id } " )
619+ print (f "Execution time: { self .execution_time } " )
620+ print (f "Schema length: { self .schema_length } " )
621+ print (f "Error code: { self .error_code } " )
622+ print (f "Status vars length: { self .status_vars_length } " )
623+ print (f "File id: { self .file_id } " )
624+ print (f "Start pos: { self .start_pos } " )
625+ print (f "End pos: { self .end_pos } " )
626+ print (f "Dup handling flags: { self .dup_handling_flags } " )
634627
635628
636629class IntvarEvent (BinLogEvent ):
@@ -652,8 +645,8 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs)
652645
653646 def _dump (self ):
654647 super ()._dump ()
655- print ("type: %d" % ( self .type ) )
656- print ("Value: %d" % ( self .value ) )
648+ print (f "type: { self .type } " )
649+ print (f "Value: { self .value } " )
657650
658651
659652class RandEvent (BinLogEvent ):
@@ -686,8 +679,8 @@ def seed2(self):
686679
687680 def _dump (self ):
688681 super ()._dump ()
689- print ("seed1: %d" % ( self .seed1 ) )
690- print ("seed2: %d" % ( self .seed2 ) )
682+ print (f "seed1: { self .seed1 } " )
683+ print (f "seed2: { self .seed2 } " )
691684
692685
693686class UserVarEvent (BinLogEvent ):
@@ -793,16 +786,15 @@ def _read_default(self) -> bytes:
793786
794787 def _dump (self ) -> None :
795788 super (UserVarEvent , self )._dump ()
796- print ("User variable name: %s" % self .name )
797- print (" Is NULL: %s" % ( " Yes" if self .is_null else "No" ) )
789+ print (f "User variable name: { self .name } " )
790+ print (f' Is NULL: { " Yes" if self .is_null else "No" } ' )
798791 if not self .is_null :
799792 print (
800- "Type: %s"
801- % self .type_to_codes_and_method .get (self .type , ["UNKNOWN_TYPE" ])[0 ]
793+ f'Type: { self .type_to_codes_and_method .get (self .type , ["UNKNOWN_TYPE" ])[0 ]} '
802794 )
803- print ("Charset: %s" % self .charset )
804- print ("Value: %s" % self .value )
805- print ("Flags: %s" % self .flags )
795+ print (f "Charset: { self .charset } " )
796+ print (f "Value: { self .value } " )
797+ print (f "Flags: { self .flags } " )
806798
807799
808800class MariadbStartEncryptionEvent (BinLogEvent ):
@@ -829,8 +821,8 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs)
829821 self .nonce = self .packet .read (12 )
830822
831823 def _dump (self ):
832- print ("Schema: %d" % self .schema )
833- print ("Key version: %d" % self .key_version )
824+ print (f "Schema: { self .schema } " )
825+ print (f "Key version: { self .key_version } " )
834826 print (f"Nonce: { self .nonce } " )
835827
836828
@@ -853,9 +845,9 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs)
853845 self .query = self .packet .read (self .query_length ).decode ("utf-8" )
854846
855847 def dump (self ):
856- print ("=== %s ===" % ( self .__class__ .__name__ ) )
857- print ("Query length: %d" % self .query_length )
858- print ("Query: %s" % self .query )
848+ print (f "=== { self .__class__ .__name__ } ===" )
849+ print (f "Query length: { self .query_length } " )
850+ print (f "Query: { self .query } " )
859851
860852
861853class NotImplementedEvent (BinLogEvent ):
0 commit comments