diff options
author | Jeremy Kerr <jk@codeconstruct.com.au> | 2021-12-17 10:59:11 +0800 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2021-12-21 18:49:37 -0800 |
commit | 60637824d8b4d4a319a4384e29eb0a1344ddc634 (patch) | |
tree | 49da6e3ae3a4aff07475d84e3bde0e8f5b70732e | |
parent | 022317805b09942790e664cef68e9a1d17838caf (diff) | |
download | meta-openembedded-60637824d8b4d4a319a4384e29eb0a1344ddc634.tar.gz |
contrib: fix python warnings for oe-stylize
I get a couple of python SyntaxWarnings when running oe-stylize:
[jk@pecola meta-openembedded]$ python3 contrib/oe-stylize.py
contrib/oe-stylize.py:372: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if line is not '':
contrib/oe-stylize.py:389: SyntaxWarning: "is" with a literal. Did you mean "=="?
if line.isspace() or line is '':
The 'is' operator is for object reference comparison, which is not what
we want here. Change to '==' / '!=' instead.
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rwxr-xr-x | contrib/oe-stylize.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/oe-stylize.py b/contrib/oe-stylize.py index 67c06b1bb..30b460e12 100755 --- a/contrib/oe-stylize.py +++ b/contrib/oe-stylize.py | |||
@@ -369,7 +369,7 @@ if __name__ == "__main__": | |||
369 | line = line.expandtabs().rstrip() | 369 | line = line.expandtabs().rstrip() |
370 | # ignore empty lines (or line filled with spaces or tabs only) | 370 | # ignore empty lines (or line filled with spaces or tabs only) |
371 | # so that rule6 is always respected | 371 | # so that rule6 is always respected |
372 | if line is not '': | 372 | if line != '': |
373 | lines.append(line) | 373 | lines.append(line) |
374 | 374 | ||
375 | # -- parse the file -- | 375 | # -- parse the file -- |
@@ -386,7 +386,7 @@ if __name__ == "__main__": | |||
386 | line = follow_rule(6, line) | 386 | line = follow_rule(6, line) |
387 | 387 | ||
388 | # ignore empty lines | 388 | # ignore empty lines |
389 | if line.isspace() or line is '': | 389 | if line.isspace() or line == '': |
390 | # flush comments into the olines | 390 | # flush comments into the olines |
391 | for c in commentBloc: | 391 | for c in commentBloc: |
392 | olines.append(c) | 392 | olines.append(c) |