mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Apply refurb/ruff rule FURB123 (#11842)
This commit is contained in:
parent
98f5ddea78
commit
3d60254f8a
@ -201,7 +201,7 @@ class TocTreeCollector(EnvironmentCollector):
|
||||
numstack[-1] += 1
|
||||
reference = cast(nodes.reference, subnode[0])
|
||||
if depth > 0:
|
||||
number = list(numstack)
|
||||
number = numstack.copy()
|
||||
secnums[reference['anchorname']] = tuple(numstack)
|
||||
else:
|
||||
number = None
|
||||
|
@ -97,7 +97,7 @@ def import_object(modname: str, objpath: list[str], objtype: str = '',
|
||||
try:
|
||||
module = None
|
||||
exc_on_importing = None
|
||||
objpath = list(objpath)
|
||||
objpath = objpath.copy()
|
||||
while module is None:
|
||||
try:
|
||||
original_module_names = frozenset(sys.modules)
|
||||
|
@ -1286,7 +1286,7 @@ class NumpyDocstring(GoogleDocstring):
|
||||
if not name:
|
||||
return
|
||||
name, role = parse_item_name(name)
|
||||
items.append((name, list(rest), role))
|
||||
items.append((name, rest.copy(), role))
|
||||
del rest[:]
|
||||
|
||||
def translate(func, description, role):
|
||||
|
@ -60,7 +60,7 @@ def _todim(val: int | str) -> str:
|
||||
|
||||
|
||||
def _slice_index(values: list, slices: int) -> Iterator[list]:
|
||||
seq = list(values)
|
||||
seq = values.copy()
|
||||
length = 0
|
||||
for value in values:
|
||||
length += 1 + len(value[1][1]) # count includes subitems
|
||||
|
Loading…
Reference in New Issue
Block a user