Fix Python 3.8 SyntaxWarning: "is not" with a literal

Fix these three warning messages from Python 3.8:

/usr/share/manuskript/manuskript/main.py:104: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if platform.system() is not 'Windows':

/usr/share/manuskript/manuskript/importer/opmlImporter.py:124: SyntaxWarning: "is" with a literal. Did you mean "=="?
  return len(s) is 0

/usr/share/manuskript/manuskript/exporter/pandoc/abstractPlainText.py:78: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.formats is "":

These SyntaxWarning messages were brought to light with Manuskript
issue #758.

See also:

  Issue34850 - Emit a syntax warning for "is" with a literal
  https://bugs.python.org/issue34850
This commit is contained in:
Curtis Gedak 2020-04-28 10:18:31 -06:00
parent 917f1a2f73
commit cd950cbe2a
3 changed files with 3 additions and 3 deletions

View file

@ -75,7 +75,7 @@ class pandocSetting:
"""Return whether the specific setting is active with the given format."""
# Empty formats means all
if self.formats is "":
if self.formats == "":
return True
# "html" in "html markdown latex"

View file

@ -121,4 +121,4 @@ class opmlImporter(abstractImporter):
s = cls.restoreNewLines(inString)
s = ''.join(s.split())
return len(s) is 0
return len(s) == 0

View file

@ -101,7 +101,7 @@ def prepare(tests=False):
def respectSystemDarkThemeSetting():
"""Adjusts the Qt theme to match the OS 'dark theme' setting configured by the user."""
if platform.system() is not 'Windows':
if platform.system() != 'Windows':
return
# Basic Windows 10 Dark Theme support.