Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.buildout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xavier Thompson
slapos.buildout
Commits
a1b8a4cf
Commit
a1b8a4cf
authored
Nov 09, 2023
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[opti] Remove redundant deepcopies
parent
d9d46918
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
12 deletions
+6
-12
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+6
-12
No files found.
src/zc/buildout/buildout.py
View file @
a1b8a4cf
...
@@ -1986,7 +1986,6 @@ def _update_section(in1, s2):
...
@@ -1986,7 +1986,6 @@ def _update_section(in1, s2):
# in section 2 overriding those in section 1. If there are += or -=
# in section 2 overriding those in section 1. If there are += or -=
# operators in section 2, process these to add or subtract items (delimited
# operators in section 2, process these to add or subtract items (delimited
# by newlines) from the preexisting values.
# by newlines) from the preexisting values.
s2
=
copy
.
deepcopy
(
s2
)
# avoid mutating the second argument, which is unexpected
# Sort on key, then on the addition or subtraction operator (+ comes first)
# Sort on key, then on the addition or subtraction operator (+ comes first)
for
k
,
v
in
sorted
(
s2
.
items
(),
key
=
lambda
x
:
(
x
[
0
].
rstrip
(
' +'
),
x
[
0
][
-
1
])):
for
k
,
v
in
sorted
(
s2
.
items
(),
key
=
lambda
x
:
(
x
[
0
].
rstrip
(
' +'
),
x
[
0
][
-
1
])):
if
k
.
endswith
(
'+'
):
if
k
.
endswith
(
'+'
):
...
@@ -1996,8 +1995,6 @@ def _update_section(in1, s2):
...
@@ -1996,8 +1995,6 @@ def _update_section(in1, s2):
section_key
=
s2
.
get
(
key
,
s1
.
get
(
key
,
implicit_value
))
section_key
=
s2
.
get
(
key
,
s1
.
get
(
key
,
implicit_value
))
section_key
=
copy
.
deepcopy
(
section_key
)
section_key
=
copy
.
deepcopy
(
section_key
)
section_key
.
addToValue
(
v
.
value
,
v
.
source
)
section_key
.
addToValue
(
v
.
value
,
v
.
source
)
s2
[
key
]
=
section_key
del
s2
[
k
]
elif
k
.
endswith
(
'-'
):
elif
k
.
endswith
(
'-'
):
key
=
k
.
rstrip
(
' -'
)
key
=
k
.
rstrip
(
' -'
)
implicit_value
=
SectionKey
(
""
,
"IMPLICIT_VALUE"
)
implicit_value
=
SectionKey
(
""
,
"IMPLICIT_VALUE"
)
...
@@ -2005,19 +2002,16 @@ def _update_section(in1, s2):
...
@@ -2005,19 +2002,16 @@ def _update_section(in1, s2):
section_key
=
s2
.
get
(
key
,
s1
.
get
(
key
,
implicit_value
))
section_key
=
s2
.
get
(
key
,
s1
.
get
(
key
,
implicit_value
))
section_key
=
copy
.
deepcopy
(
section_key
)
section_key
=
copy
.
deepcopy
(
section_key
)
section_key
.
removeFromValue
(
v
.
value
,
v
.
source
)
section_key
.
removeFromValue
(
v
.
value
,
v
.
source
)
s2
[
key
]
=
section_key
else
:
del
s2
[
k
]
key
=
k
section_key
=
v
_update_verbose
(
s1
,
s2
)
return
s1
def
_update_verbose
(
s1
,
s2
):
for
key
,
v2
in
s2
.
items
():
if
key
in
s1
:
if
key
in
s1
:
v1
=
s1
[
key
]
v1
=
s1
[
key
]
v1
.
overrideValue
(
v2
)
v1
.
overrideValue
(
section_key
)
else
:
else
:
s1
[
key
]
=
copy
.
deepcopy
(
v2
)
s1
[
key
]
=
section_key
return
s1
def
_update
(
in1
,
d2
):
def
_update
(
in1
,
d2
):
d1
=
copy
.
deepcopy
(
in1
)
d1
=
copy
.
deepcopy
(
in1
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment