Browse Source

Fix pep8 E731 error

Change-Id: I753edf74988065145e98b68fa72d6caa9159c559
zhurong 3 months ago
parent
commit
43182e1ebf

+ 3
- 2
murano/dsl/dsl.py View File

@@ -351,8 +351,9 @@ def to_mutable(obj, yaql_engine=None):
351 351
         else:
352 352
             return utils.convert_output_data(value, limit_func, engine, rec)
353 353
 
354
-    limiter = lambda it: utils.limit_iterable(
355
-        it, CONF.murano.dsl_iterators_limit)
354
+    def limiter(it):
355
+        return utils.limit_iterable(it, CONF.murano.dsl_iterators_limit)
356
+
356 357
     return converter(obj, limiter, yaql_engine, converter)
357 358
 
358 359
 

+ 2
- 1
murano/dsl/meta.py View File

@@ -116,7 +116,8 @@ def merge_providers(initial_class, producer, context):
116 116
 
117 117
 
118 118
 def aggregate_meta(provider, context, group_by_name=True):
119
-    key_func = lambda m: m.type.name if group_by_name else m.type
119
+    def key_func(m):
120
+        return m.type.name if group_by_name else m.type
120 121
     meta = provider.get_meta(context)
121 122
     result = {}
122 123
     for item in meta:

+ 4
- 3
murano/dsl/yaql_integration.py View File

@@ -154,9 +154,10 @@ def _infer_parameter_type(name, class_name):
154 154
 
155 155
 def get_function_definition(func, murano_method, original_name):
156 156
     cls = murano_method.declaring_type.extension_class
157
-    param_type_func = \
158
-        lambda name: None if not cls else _infer_parameter_type(
159
-            name, cls.__name__)
157
+
158
+    def param_type_func(name):
159
+        return None if not cls else _infer_parameter_type(name, cls.__name__)
160
+
160 161
     body = func
161 162
     if (cls is None or helpers.inspect_is_method(cls, original_name) or
162 163
             helpers.inspect_is_classmethod(cls, original_name)):

+ 2
- 1
murano/tests/unit/common/messaging/test_mqclient.py View File

@@ -216,7 +216,8 @@ class MQClientTest(base.MuranoTestCase):
216 216
     def test_send_signed(self, mock_kombu):
217 217
         mock_message = mock.MagicMock(body='test_message', id=3)
218 218
 
219
-        signer = lambda msg: "SIGNATURE"
219
+        signer = mock.MagicMock()
220
+        signer.return_value = "SIGNATURE"
220 221
         self.ssl_client.connect()
221 222
         self.ssl_client.send(mock_message, 'test_key', 'test_exchange', signer)
222 223
 

+ 4
- 2
murano/tests/unit/dsl/test_helpers.py View File

@@ -302,7 +302,8 @@ class TestDSLHelpers(base.MuranoTestCase):
302 302
             [mock.sentinel.second], [mock.sentinel.third]
303 303
         ]
304 304
         first_obj = mock.sentinel.first
305
-        handler = lambda i: True
305
+        handler = mock.MagicMock()
306
+        handler.return_value = True
306 307
 
307 308
         expected = [
308 309
             [mock.sentinel.first],
@@ -321,7 +322,8 @@ class TestDSLHelpers(base.MuranoTestCase):
321 322
             [mock.sentinel.second], [mock.sentinel.second]
322 323
         ]
323 324
         first_obj = mock.sentinel.first
324
-        handler = lambda i: True
325
+        handler = mock.MagicMock()
326
+        handler.return_value = True
325 327
 
326 328
         expected = [
327 329
             [mock.sentinel.first],

+ 2
- 1
murano/tests/unit/dsl/test_session_local_storage.py View File

@@ -97,7 +97,8 @@ class TestExecutionSessionMemoize(test_case.DslTestCase):
97 97
     @mock.patch.object(helpers, 'get_memoize_func',
98 98
                        return_value=mock.sentinel.mem_func)
99 99
     def test_execution_session_memoize(self, mock_gef):
100
-        f = lambda: 'im a function'
100
+        f = mock.MagicMock()
101
+        f.return_value = 'im a function'
101 102
         new_f = session_local_storage.execution_session_memoize(f)
102 103
         self.assertEqual(f, mock_gef.call_args[0][0])
103 104
         self.assertIsInstance(mock_gef.call_args[0][1],

Loading…
Cancel
Save