Skip to content

Commit 881f96d

Browse files
committed
Fix lint errors
Signed-off-by: Bob Haddleton <bob.haddleton@nokia.com>
1 parent 487c5a2 commit 881f96d

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

function/fn.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import importlib.util
44
import inspect
5-
import sys
65
import traceback
76
import types
87

@@ -53,7 +52,10 @@ async def RunFunction(
5352
else:
5453
script.compose(req, rsp)
5554
except Exception as e:
56-
msg = f"Exception: {type(e)}, traceback: {traceback.format_tb(e.__traceback__.tb_next)}"
55+
msg = (
56+
f"Exception: {type(e)}, "
57+
f"traceback: {traceback.format_tb(e.__traceback__.tb_next)}"
58+
)
5759
log.debug(msg)
5860
response.fatal(rsp, msg)
5961

@@ -65,7 +67,10 @@ async def RunFunction(
6567
else:
6668
script.operate(req, rsp)
6769
except Exception as e:
68-
msg = f"Exception: {e}, traceback: {traceback.format_tb(e.__traceback__.tb_next)}"
70+
msg = (
71+
f"Exception: {e}, "
72+
f"traceback: {traceback.format_tb(e.__traceback__.tb_next)}"
73+
)
6974
log.debug(msg)
7075
response.fatal(rsp, msg)
7176

tests/test_fn.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ class TestCase:
207207
),
208208
),
209209
TestCase(
210-
reason="Function should fail gracefully when compose script raises an exception.",
210+
reason="Function should fail gracefully when compose script raises"
211+
" an exception.",
211212
req=fnv1.RunFunctionRequest(
212213
input=resource.dict_to_struct(
213214
{"script": composition_script_with_exception}
@@ -217,7 +218,9 @@ class TestCase:
217218
meta=fnv1.ResponseMeta(ttl=durationpb.Duration(seconds=60)),
218219
results=[
219220
{
220-
"message": "Exception: <class 'AttributeError'>, traceback: [' File \"<string>\", line 14, in compose\\n']",
221+
"message": "Exception: <class 'AttributeError'>, traceback:"
222+
" [' File \"<string>\", line 14, in compose\\n'"
223+
"]",
221224
"severity": "SEVERITY_FATAL",
222225
}
223226
],
@@ -240,7 +243,8 @@ class TestCase:
240243
),
241244
),
242245
TestCase(
243-
reason="Function should fail gracefully when async compose script raises an exception.",
246+
reason="Function should fail gracefully when async compose script"
247+
" raises an exception.",
244248
req=fnv1.RunFunctionRequest(
245249
input=resource.dict_to_struct(
246250
{"script": async_composition_script_with_exception}
@@ -250,7 +254,9 @@ class TestCase:
250254
meta=fnv1.ResponseMeta(ttl=durationpb.Duration(seconds=60)),
251255
results=[
252256
{
253-
"message": "Exception: <class 'AttributeError'>, traceback: [' File \"<string>\", line 14, in compose\\n']",
257+
"message": "Exception: <class 'AttributeError'>, traceback:"
258+
" [' File \"<string>\", line 14, in compose\\n'"
259+
"]",
254260
"severity": "SEVERITY_FATAL",
255261
}
256262
],

0 commit comments

Comments
 (0)