Skip to content

Commit 9302be3

Browse files
committed
additoinal
1 parent 0c19c1c commit 9302be3

File tree

2 files changed

+45
-18
lines changed

2 files changed

+45
-18
lines changed

doc/build/builder/autodoc_mods.py

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,26 @@ def autodoc_skip_member(app, what, name, obj, skip, options):
1010
return skip
1111

1212

13-
def _adjust_rendered_mod_name(modname, objname):
14-
modname = modname.replace("sqlalchemy.sql.sqltypes", "sqlalchemy.types")
15-
modname = modname.replace("sqlalchemy.sql.type_api", "sqlalchemy.types")
16-
modname = modname.replace("sqlalchemy.sql.schema", "sqlalchemy.schema")
17-
modname = modname.replace("sqlalchemy.sql.elements", "sqlalchemy.sql.expression")
18-
modname = modname.replace("sqlalchemy.sql.selectable", "sqlalchemy.sql.expression")
19-
modname = modname.replace("sqlalchemy.sql.dml", "sqlalchemy.sql.expression")
20-
modname = modname.replace("sqlalchemy.sql.ddl", "sqlalchemy.schema")
21-
modname = modname.replace("sqlalchemy.sql.base", "sqlalchemy.sql.expression")
13+
_convert_modname = {
14+
"sqlalchemy.sql.sqltypes": "sqlalchemy.types",
15+
"sqlalchemy.sql.type_api": "sqlalchemy.types",
16+
"sqlalchemy.sql.schema": "sqlalchemy.schema",
17+
"sqlalchemy.sql.elements": "sqlalchemy.sql.expression",
18+
"sqlalchemy.sql.selectable": "sqlalchemy.sql.expression",
19+
"sqlalchemy.sql.dml": "sqlalchemy.sql.expression",
20+
"sqlalchemy.sql.ddl": "sqlalchemy.schema",
21+
"sqlalchemy.sql.base": "sqlalchemy.sql.expression"
22+
}
23+
24+
_convert_modname_w_class = {
25+
("sqlalchemy.engine.interfaces", "Connectable"): "sqlalchemy.engine"
26+
}
2227

23-
return modname
28+
def _adjust_rendered_mod_name(modname, objname):
29+
if modname in _convert_modname:
30+
return _convert_modname[modname]
31+
elif (modname, objname) in _convert_modname_w_class:
32+
return _convert_modname_w_class[(modname, objname)]
2433

2534
# im sure this is in the app somewhere, but I don't really
2635
# know where, so we're doing it here.
@@ -30,6 +39,9 @@ def autodoc_process_docstring(app, what, name, obj, options, lines):
3039
if what == "class":
3140
_track_autodoced[name] = obj
3241

42+
# need to translate module names for bases, others
43+
# as we document lots of symbols in namespace modules
44+
# outside of their source
3345
bases = []
3446
for base in obj.__bases__:
3547
if base is not object:
@@ -38,11 +50,10 @@ def autodoc_process_docstring(app, what, name, obj, options, lines):
3850
base.__name__))
3951

4052
if bases:
41-
lines.insert(0,
42-
"Bases: %s" % (
43-
", ".join(bases)
44-
))
45-
lines.insert(1, "")
53+
lines[:0] = [
54+
"Bases: %s" % (", ".join(bases)),
55+
""
56+
]
4657

4758

4859
elif what in ("attribute", "method") and \
@@ -74,7 +85,6 @@ def autodoc_process_docstring(app, what, name, obj, options, lines):
7485
""
7586
]
7687

77-
from docutils import nodes
7888
def missing_reference(app, env, node, contnode):
7989
if node.attributes['reftarget'] in _inherited_names:
8090
return node.children[0]

lib/sqlalchemy/sql/selectable.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,7 +1153,7 @@ def _from_objects(self):
11531153

11541154

11551155
class SelectBase(Executable, FromClause):
1156-
"""Base class for :class:`.Select` and ``CompoundSelects``."""
1156+
"""Base class for :class:`.Select` and :class:`.CompoundSelect`."""
11571157

11581158
_order_by_clause = ClauseList()
11591159
_group_by_clause = ClauseList()
@@ -1446,7 +1446,24 @@ def _from_objects(self):
14461446

14471447
class CompoundSelect(SelectBase):
14481448
"""Forms the basis of ``UNION``, ``UNION ALL``, and other
1449-
SELECT-based set operations."""
1449+
SELECT-based set operations.
1450+
1451+
1452+
.. seealso::
1453+
1454+
:func:`.union`
1455+
1456+
:func:`.union_all`
1457+
1458+
:func:`.intersect`
1459+
1460+
:func:`.intersect_all`
1461+
1462+
:func:`.except`
1463+
1464+
:func:`.except_all`
1465+
1466+
"""
14501467

14511468
__visit_name__ = 'compound_select'
14521469

0 commit comments

Comments
 (0)