[ARCH] Arch_Roof fix for adjust_list_len function

LGTM code analysis did not like that the adjust_list_len function would mutate default list values. De function now always clones the list.
See: https://forum.freecadweb.org/viewtopic.php?f=23&t=55943
This commit is contained in:
Roy-043
2021-02-23 19:58:39 +01:00
committed by GitHub
parent 5ab70fd1b6
commit 99af124f80

View File

@@ -49,7 +49,7 @@ else:
# \brief The Roof object and tools
#
# This module provides tools to build Roof objects.
# Roofs are build from a closed contour and a series of
# Roofs are built from a closed contour and a series of
# slopes.
__title__ = "FreeCAD Roof"
@@ -58,13 +58,12 @@ __url__ = "https://www.freecadweb.org"
def adjust_list_len (lst, newLn, val):
'''Returns a clone of lst with length newLn, val is appended if required'''
ln = len(lst)
if ln > newLn:
return lst[0:newLn]
else:
for i in range(newLn - ln):
lst.append(val)
return lst
return lst[:] + ([val] * (newLn - ln))
def find_inters (edge1, edge2, infinite1=True, infinite2=True):