Skip to content

Commit 40b0d23

Browse files
committed
More type annotation futzing
apsw.no_change is impossible to reference in a way that keeps sphinx and mypy happy
1 parent 12745eb commit 40b0d23

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

doc/conf.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ def split(self, input):
2525
"sphinx.ext.autosummary",
2626
]
2727

28+
# this shows shorter names like Buffer instead of collections.abc.Buffer
29+
python_use_unqualified_type_names = True
30+
# less verbose Literal [ "one", "two"] -> "one" : "two"
31+
python_display_short_literal_types = True
32+
2833
autodoc_preserve_defaults = True
2934

3035
extlinks = {

src/session.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ APSWTableChange_indirect(PyObject *self_, void *Py_UNUSED(unused))
10181018
}
10191019

10201020
/** .. attribute:: new
1021-
:type: tuple[SQLiteValue | typing.Literal[apsw.no_change], ...] | None
1021+
:type: tuple[SQLiteValue | Literal[no_change], ...] | None
10221022
10231023
:class:`None` if not applicable (like a DELETE). Otherwise a
10241024
tuple of the new values for the row, with :attr:`apsw.no_change`
@@ -1067,7 +1067,7 @@ APSWTableChange_new(PyObject *self_, void *Py_UNUSED(unused))
10671067
}
10681068

10691069
/** .. attribute:: old
1070-
:type: tuple[SQLiteValue | typing.Literal[apsw.no_change], ...] | None
1070+
:type: tuple[SQLiteValue | Literal[no_change], ...] | None
10711071
10721072
:class:`None` if not applicable (like an INSERT). Otherwise a tuple
10731073
of the old values for the row before this change, with

tools/code2rst.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ def do_methods():
229229

230230
# insert index stuff
231231
op.extend(indexop)
232+
# we need full buffer name
233+
dec = re.sub(r"\bBuffer\b", "collections.abc.Buffer", dec)
232234
# insert classname into dec
233235
if curclass:
234236
dec = re.sub(r"^(\.\.\s+(method|attribute)::\s+)()", r"\1" + curclass + ".", dec)

0 commit comments

Comments
 (0)