mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Enable RUF019
This commit is contained in:
parent
97a83acb17
commit
9a9599450c
@ -245,7 +245,7 @@ select = [
|
||||
"RUF016", # Slice in indexed access to type `{value_type}` uses type `{index_type}` instead of an integer
|
||||
# "RUF017", # Avoid quadratic list summation
|
||||
"RUF018", # Avoid assignment expressions in `assert` statements
|
||||
# "RUF019", # Unnecessary key check before dictionary access
|
||||
"RUF019", # Unnecessary key check before dictionary access
|
||||
"RUF020", # `{never_like} | T` is equivalent to `T`
|
||||
# "RUF100", # Unused `noqa` directive
|
||||
"RUF200", # Failed to parse pyproject.toml: {message}
|
||||
|
@ -81,7 +81,7 @@ class ReferencesResolver(SphinxPostTransform):
|
||||
domain = None
|
||||
|
||||
try:
|
||||
if 'refdomain' in node and node['refdomain']:
|
||||
if node.get('refdomain', False):
|
||||
# let the domain try to resolve the reference
|
||||
try:
|
||||
domain = self.env.domains[node['refdomain']]
|
||||
|
@ -288,7 +288,7 @@ class TexinfoTranslator(SphinxTranslator):
|
||||
targets: list[Element] = [self.document]
|
||||
targets.extend(self.document.findall(nodes.section))
|
||||
for node in targets:
|
||||
assert 'node_name' in node and node['node_name'] # NoQA: PT018
|
||||
assert node.get('node_name', False)
|
||||
entries = [s['node_name'] for s in find_subsections(node)]
|
||||
node_menus[node['node_name']] = entries
|
||||
# try to find a suitable "Top" node
|
||||
|
Loading…
Reference in New Issue
Block a user