Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blender-dev-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
blender-dev-tools
Commits
de5fc13c
Commit
de5fc13c
authored
Dec 8, 2022
by
Campbell Barton
Browse files
Options
Downloads
Patches
Plain Diff
Cleanup: replace pool.map with starmap
Avoid the need to unpack a single argument.
parent
b0193966
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
utils_maintenance/code_clean.py
+12
-5
12 additions, 5 deletions
utils_maintenance/code_clean.py
with
12 additions
and
5 deletions
utils_maintenance/code_clean.py
+
12
−
5
View file @
de5fc13c
...
...
@@ -1187,8 +1187,15 @@ def apply_edit(data: str, text_to_replace: str, start: int, end: int, *, verbose
return
data
def
wash_source_with_edits
(
arg_group
:
Tuple
[
str
,
str
,
Sequence
[
str
],
Optional
[
str
],
str
,
bool
,
Any
])
->
None
:
(
source
,
output
,
build_args
,
build_cwd
,
edit_to_apply
,
skip_test
,
shared_edit_data
)
=
arg_group
def
wash_source_with_edits
(
source
:
str
,
output
:
str
,
build_args
:
Sequence
[
str
],
build_cwd
:
Optional
[
str
],
edit_to_apply
:
str
,
skip_test
:
bool
,
shared_edit_data
:
Any
,
)
->
None
:
# build_args = build_args + " -Werror=duplicate-decl-specifier"
with
open
(
source
,
'
r
'
,
encoding
=
'
utf-8
'
)
as
fh
:
data
=
fh
.
read
()
...
...
@@ -1397,12 +1404,12 @@ def run_edits_on_directory(
import
multiprocessing
job_total
=
multiprocessing
.
cpu_count
()
pool
=
multiprocessing
.
Pool
(
processes
=
job_total
*
2
)
pool
.
map
(
wash_source_with_edits
,
args_expanded
)
pool
.
star
map
(
wash_source_with_edits
,
args_expanded
)
del
args_expanded
else
:
# now we have commands
for
c
,
build_args
,
build_cwd
in
args_with_cwd
:
wash_source_with_edits
(
(
wash_source_with_edits
(
c
,
output_from_build_args
(
build_args
,
build_cwd
),
build_args
,
...
...
@@ -1410,7 +1417,7 @@ def run_edits_on_directory(
edit_to_apply
,
skip_test
,
shared_edit_data
,
)
)
)
except
Exception
as
ex
:
raise
ex
finally
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment