103103# a simple value
104104event = "system started"
105105# DO NOT DO THIS
106- query = f"insert into log values(0, '{ event } ')"
106+ query = f"insert into log values(0, '{ event } ')"
107107print ("query:" , query )
108108
109109# BECAUSE ... a bad guy could provide a value like this
110110event = "bad guy here') ; drop table important; -- comment"
111111# which has effects like this
112- query = f"insert into log values(0, '{ event } ')"
112+ query = f"insert into log values(0, '{ event } ')"
113113print ("bad guy:" , query )
114114
115115### bindings_sequence: Bindings (sequence)
@@ -277,7 +277,7 @@ def row_tracer(
277277
278278def ilove7 (* args : apsw .SQLiteValue ) -> int :
279279 "A scalar function"
280- print (f"ilove7 got { args } but I love 7" )
280+ print (f"ilove7 got { args } but I love 7" )
281281 return 7
282282
283283
@@ -489,7 +489,7 @@ def __init__(self, x, y):
489489 self .y = y
490490
491491 def __repr__ (self ) -> str :
492- return f"Point({ self .x } , { self .y } )"
492+ return f"Point({ self .x } , { self .y } )"
493493
494494 def __eq__ (self , other : object ) -> bool :
495495 return (
@@ -500,7 +500,7 @@ def __eq__(self, other: object) -> bool:
500500
501501 def to_sqlite_value (self ) -> str :
502502 # called to convert Point into something SQLite supports
503- return f"{ self .x } ;{ self .y } "
503+ return f"{ self .x } ;{ self .y } "
504504
505505 # This converter will be registered
506506 @classmethod
@@ -510,7 +510,7 @@ def convert_from_sqlite(cls, value: str) -> Point:
510510
511511# Existing types
512512def complex_to_sqlite_value (c : complex ) -> str :
513- return f"{ c .real } +{ c .imag } "
513+ return f"{ c .real } +{ c .imag } "
514514
515515
516516def datetime_to_sqlite_value (dt : datetime .datetime ) -> float :
@@ -561,7 +561,7 @@ def sqlite_to_datetime(v: float) -> datetime.datetime:
561561print ("querying data" )
562562for row in connection .execute ("select * from conversion" ):
563563 for i , value in enumerate (row ):
564- print (f"column { i } = { value !r} " )
564+ print (f"column { i } = { value !r} " )
565565
566566# clear registrar
567567connection .cursor_factory = apsw .Cursor
@@ -657,7 +657,9 @@ def make_set(*args):
657657 ):
658658 pass
659659
660- print (f"After { time .monotonic () - start :.3f} seconds, we hit { number = } " )
660+ print (
661+ f"After { time .monotonic () - start :.3f} seconds, we hit { number = } "
662+ )
661663
662664# We used the default "no exception" exception. Lets have an explicit exception.
663665# with both row and time limits ...
@@ -941,7 +943,7 @@ def my_update_hook(
941943) -> None :
942944 op : str = apsw .mapping_authorizer_function [type ]
943945 print (
944- f"Updated: { op } db { db_name } , table { table_name } , rowid { rowid } "
946+ f"Updated: { op } db { db_name } , table { table_name } , rowid { rowid } "
945947 )
946948
947949
@@ -1191,7 +1193,7 @@ def xFileControl(self, op: int, ptr: int) -> bool:
11911193 return super ().xFileControl (op , ptr )
11921194 # implement our own pragma
11931195 p = apsw .VFSFcntlPragma (ptr )
1194- print (f"pragma received { p .name } = { p .value } " )
1196+ print (f"pragma received { p .name } = { p .value } " )
11951197 # what do we understand?
11961198 if p .name == "my_custom_pragma" :
11971199 p .result = "orange"
@@ -1323,11 +1325,9 @@ def xFileControl(self, op: int, ptr: int) -> bool:
13231325# for per connection statistics.
13241326
13251327current_usage , max_usage = apsw .status (apsw .SQLITE_STATUS_MEMORY_USED )
1326- print (f"SQLite memory usage { current_usage } max { max_usage } " )
1328+ print (f"SQLite memory usage { current_usage } max { max_usage } " )
13271329schema_used , _ = connection .status (apsw .SQLITE_DBSTATUS_SCHEMA_USED )
1328- print (
1329- f"{ schema_used } bytes used to store schema for this connection"
1330- )
1330+ print (f"{ schema_used } bytes used to store schema for this connection" )
13311331
13321332### trace_v2: Tracing
13331333# This shows using :meth:`Connection.trace_v2`
@@ -1424,7 +1424,9 @@ def trace_hook(trace: dict) -> None:
14241424
14251425 # pragma functions are virtual tables - see how many rows this processes even
14261426 # though only one has 'pow'
1427- connection .execute ("SELECT narg FROM pragma_function_list WHERE name='pow'" ).get
1427+ connection .execute (
1428+ "SELECT narg FROM pragma_function_list WHERE name='pow'"
1429+ ).get
14281430
14291431 # trigger that causes rollback
14301432 connection .execute ("""
@@ -1499,12 +1501,12 @@ def trace_hook(trace: dict) -> None:
14991501# See values before change
15001502print ("Before values" )
15011503print (f'{ connection .pragma ("schema_version" )= } ' )
1502- print (f' { connection .data_version ()= } ' )
1504+ print (f" { connection .data_version ()= } " )
15031505
15041506print ("\n After values" )
15051507# add to table from previous section
15061508con2 .execute ("insert into dummy values(1, 2, 3)" )
1507- print (f' { connection .data_version ()= } ' )
1509+ print (f" { connection .data_version ()= } " )
15081510
15091511# and add a table. changing an existing table definition etc also
15101512# bump the schema version
0 commit comments