Invalid Syntax for PEP-8 - python-3.x

I'm receiving a notification that advised the below script is not PEP-8:
example_var = print('whoa')
Output:
[E] invalid syntax.
It's showing that the error is a result of the first parentheses in the print statement, but nothing looks off to me.
example_var = print('whoa')
example_var

Related

terraform 11 and "concat" function: parse error

TF v.0.11 (I know it is old but I need this one)
I try to configure output this way:
value = "${concat(aws_lambda_function.lambda.*.arn, [""])}"
The error message is
Error reading config for output FUNCTION_ARN: parse error at 1:46 :
expected expression but found "["
What am I doing wrong, how to fix that?
Reason: [""] don't work for v11.
Solution:
value = "${element(concat(aws_lambda_function.lambda.*.arn, list("")), 0)}"

Show expected and actual values for assertion failures

When writing assertions for my tests, the assertion failures don't provide enough information without needing to open an IDE and start debugging.
For example, I have some code that uses the 'assert' library:
import * as assert from 'assert'
// some code
assert(someObject.getValue() === 0)
I just get
AssertionError [ERR_ASSERTION]: false == true
+ expected - actual
-false
+true
This error message isn't really meaningful. As a workaround, I added it in the message in the assertion:
assert(someObject.getValue() === 0,
'\nActual: ' + someObject.getValue() +
'\nExpected: ' + 0)
Is there a better, cleaner way to just show the expected & actual values without overriding the message on every assertion? I also tried to create an assert wrapper, but I wasn't able to extract the actual and expected values from the expression.
EDIT: assert.strictEqual resolves this issue for equalities only. But as soon as any other operator is included, then we have the same issue (e.g. assert(someObject.getValue() > 0)
Any advice would be appreciated.
Thanks!
You can use assert.strictEqual(actual, expected[, message]) to get actual/expected error messages without the need of the third message argument:
assert.strictEqual(someObject.getValue(), 0)
You'd get an error message such as:
// AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
//
// 1 !== 0
Hopefully that helps!

"Generator already running" message on any error

I have a very simple generator function, like this
exports.whatever = function *(next) {
this.body = 'wow';
z
};
Now, there obviously is a syntax error here ('z' on the third line),
but with koa's generators, the error I get in the console is basically useless for debugging; I do not get the line of the error, the file, or even the type of error. All I get is:
Error: Generator is already running
at GeneratorFunctionPrototype.next (native)
at onFulfilled (/Users/johndoe/Documents/nodejs/testing/node_modules/koa/node_modules/co/index.js:59:19)
at /Users/johndoe/Documents/nodejs/testing/node_modules/koa/node_modules/co/index.js:48:5
at Object.co (/Users/johndoe/Documents/nodejs/testing/node_modules/koa/node_modules/co/index.js:47:10)
at Object.toPromise (/Users/johndoe/Documents/nodejs/testing/node_modules/koa/node_modules/co/index.js:112:63)
at next (/Users/johndoe/Documents/nodejs/testing/node_modules/koa/node_modules/co/index.js:93:29)
at onRejected (/Users/johndoe/Documents/nodejs/testing/node_modules/koa/node_modules/co/index.js:79:7)
Is there any way to see the real detail of the error? Thanks in advance.

Error using Prelude.read in Hamlet Yesod

I get an error when I use the following Haskell code inside Hamlet Yesod:
#{show $ (read "True" :: Bool)}
It seems it doesn't accept ':' characters, but I actually need it.
The error is the following:
Handler/Game.hs:85:11:
Exception when trying to run compile-time code:
"#{show $ read "True" :: Bool}" (line 1, column 25):
unexpected ":"
expecting "}"
Is it possible to bypass this error and be able to use Prelude.read?

how to check if a colmmande return is true or false selenium-ide

I'm trying to get a command return with selenium ide by doing it :
storeTextPresent|myText|title
gotoIf|storedVars.tite|true
echo|${"true"}
but it doesnt work...i have : [error] Unexpected Exception: fileName -> chrome://flowcontrol/content/extensions/goto-sel-ide.js?1347871647495, lineNumber -> 120.
Does anybody know how to get the return?
Thank you
I didn't check for boolean support on gotoIf, but if gotoIf wants to go to a label, I don't see a label defined in the above script.
Also, the "storedVars.tite" reference looks to be misspelled.

Resources