Don't use is operatory to compare Python strings

`is` checks identity. `==` checks value. I can't think of a reason why
we would want the former in these scenarios.

More info:

* http://stackoverflow.com/a/1504742
* https://docs.python.org/2/reference/expressions.html#is
This commit is contained in:
Corey Farwell 2015-08-22 10:22:47 -04:00
parent 3a48e04caf
commit 5bf262770f
2 changed files with 3 additions and 3 deletions

View file

@ -1583,7 +1583,7 @@ class CGIndenter(CGThing):
def define(self): def define(self):
defn = self.child.define() defn = self.child.define()
if defn is not "": if defn != "":
return re.sub(lineStartDetector, self.indent, defn) return re.sub(lineStartDetector, self.indent, defn)
else: else:
return defn return defn
@ -3641,7 +3641,7 @@ class ClassMethod(ClassItem):
'override': ' MOZ_OVERRIDE' if self.override else '', 'override': ' MOZ_OVERRIDE' if self.override else '',
'args': args, 'args': args,
'body': body, 'body': body,
'visibility': self.visibility + ' ' if self.visibility is not 'priv' else '' 'visibility': self.visibility + ' ' if self.visibility != 'priv' else ''
}) })
def define(self, cgClass): def define(self, cgClass):

View file

@ -9,7 +9,7 @@ propList = eval(sys.stdin.read())
props = "" props = ""
for [prop, pref] in propList: for [prop, pref] in propList:
extendedAttrs = ["Throws", "TreatNullAs=EmptyString"] extendedAttrs = ["Throws", "TreatNullAs=EmptyString"]
if pref is not "": if pref != "":
extendedAttrs.append("Pref=%s" % pref) extendedAttrs.append("Pref=%s" % pref)
if not prop.startswith("Moz"): if not prop.startswith("Moz"):
prop = prop[0].lower() + prop[1:] prop = prop[0].lower() + prop[1:]