materialsproject / fireworks

The Fireworks Workflow Management Repo.
https://materialsproject.github.io/fireworks
Other
361 stars 185 forks source link

syntax warning reported with Python=3.8 #397

Open zhubonan opened 4 years ago

zhubonan commented 4 years ago

When running with python 3.8, the following line will make the interpreter print out syntax warning.

/home/bonan/appdir/fireworks/fireworks/features/fw_report.py:146: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if style is 'bar':
/home/bonan/appdir/fireworks/fireworks/features/fw_report.py:149: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif style is 'fill':

Which is related to the following lines:

https://github.com/materialsproject/fireworks/blob/e33821518acf4dc7276aa161a523a0770a776191/fireworks/features/fw_report.py#L146-L154

Using identity comparison is can give false negative is some edge cases:

a = 'abc'
b = ''.join(a)
a is b  # will give False
a == b  # will give True