Apply refurb/ruff rule FURB123 (#11842)

This commit is contained in:
Dimitri Papadopoulos Orfanos 2024-01-04 04:13:20 +01:00 committed by GitHub
parent 98f5ddea78
commit 3d60254f8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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)

View File

@ -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):

View File

@ -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