mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2025-12-15 06:45:32 +01:00
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>
This commit is contained in:
parent
022317805b
commit
60637824d8
|
|
@ -369,7 +369,7 @@ if __name__ == "__main__":
|
||||||
line = line.expandtabs().rstrip()
|
line = line.expandtabs().rstrip()
|
||||||
# ignore empty lines (or line filled with spaces or tabs only)
|
# ignore empty lines (or line filled with spaces or tabs only)
|
||||||
# so that rule6 is always respected
|
# so that rule6 is always respected
|
||||||
if line is not '':
|
if line != '':
|
||||||
lines.append(line)
|
lines.append(line)
|
||||||
|
|
||||||
# -- parse the file --
|
# -- parse the file --
|
||||||
|
|
@ -386,7 +386,7 @@ if __name__ == "__main__":
|
||||||
line = follow_rule(6, line)
|
line = follow_rule(6, line)
|
||||||
|
|
||||||
# ignore empty lines
|
# ignore empty lines
|
||||||
if line.isspace() or line is '':
|
if line.isspace() or line == '':
|
||||||
# flush comments into the olines
|
# flush comments into the olines
|
||||||
for c in commentBloc:
|
for c in commentBloc:
|
||||||
olines.append(c)
|
olines.append(c)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user