[Bf-blender-cvs] [86559c8fe1a] pygpu_extensions: Cleanup: use the assignment operator with list-comprehension
Campbell Barton
noreply at git.blender.org
Fri Feb 12 16:17:20 CET 2021
Commit: 86559c8fe1af194066bbbbec324ef876b9d6b76c
Author: Campbell Barton
Date: Fri Feb 12 15:26:32 2021 +1100
Branches: pygpu_extensions
https://developer.blender.org/rB86559c8fe1af194066bbbbec324ef876b9d6b76c
Cleanup: use the assignment operator with list-comprehension
===================================================================
M build_files/cmake/project_info.py
M release/scripts/startup/bl_operators/uvcalc_lightmap.py
M release/scripts/startup/bl_operators/wm.py
===================================================================
diff --git a/build_files/cmake/project_info.py b/build_files/cmake/project_info.py
index 5980d48f85d..dd81602630e 100755
--- a/build_files/cmake/project_info.py
+++ b/build_files/cmake/project_info.py
@@ -220,14 +220,12 @@ def cmake_advanced_info():
def cmake_cache_var(var):
- cache_file = open(join(CMAKE_DIR, "CMakeCache.txt"), encoding='utf-8')
- lines = [
- l_strip for l in cache_file
- for l_strip in (l.strip(),)
- if l_strip
- if not l_strip.startswith(("//", "#"))
- ]
- cache_file.close()
+ with open(os.path.join(CMAKE_DIR, "CMakeCache.txt"), encoding='utf-8') as cache_file:
+ lines = [
+ l_strip for l in cache_file
+ if (l_strip := l.strip())
+ if not l_strip.startswith(("//", "#"))
+ ]
for l in lines:
if l.split(":")[0] == var:
diff --git a/release/scripts/startup/bl_operators/uvcalc_lightmap.py b/release/scripts/startup/bl_operators/uvcalc_lightmap.py
index d13e98b96e9..34c36443431 100644
--- a/release/scripts/startup/bl_operators/uvcalc_lightmap.py
+++ b/release/scripts/startup/bl_operators/uvcalc_lightmap.py
@@ -568,8 +568,7 @@ def unwrap(operator, context, **kwargs):
meshes = list({
me for obj in context.selected_objects
if obj.type == 'MESH'
- for me in (obj.data,)
- if me.polygons and me.library is None
+ if (me := obj.data).polygons and me.library is None
})
if not meshes:
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index 2ee20e08589..c5457713d36 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -2191,8 +2191,7 @@ class WM_OT_batch_rename(Operator):
id
for ob in context.selected_objects
if ob.type == data_type
- for id in (ob.data,)
- if id is not None and id.library is None
+ if (id := ob.data) is not None and id.library is None
))
if only_selected else
[id for id in getattr(bpy.data, attr) if id.library is None],
More information about the Bf-blender-cvs
mailing list