mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
sqlite3: Avoid optional type for 'description' (#7842)
Use the `| Any` trick instead, since it seems that in a lot of code the value can be predicted to be non-`None` (if a query has been executed previously, I think). The docs don't mention the possibility of this being `None`, so it seems likely that a lot of code doesn't check for it: https://docs.python.org/3/library/sqlite3.html#sqlite3.Cursor.description
This commit is contained in:
@@ -374,8 +374,9 @@ class Cursor(Iterator[Any]):
|
||||
arraysize: int
|
||||
@property
|
||||
def connection(self) -> Connection: ...
|
||||
# May be None, but using | Any instead to avoid slightly annoying false positives.
|
||||
@property
|
||||
def description(self) -> tuple[tuple[str, None, None, None, None, None, None], ...] | None: ...
|
||||
def description(self) -> tuple[tuple[str, None, None, None, None, None, None], ...] | Any: ...
|
||||
@property
|
||||
def lastrowid(self) -> int | None: ...
|
||||
row_factory: Callable[[Cursor, Row[Any]], object] | None
|
||||
|
||||
Reference in New Issue
Block a user