Skip to content

Use "is None" and add space after comma #695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 21, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions stdlib/public/common/MirrorCommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@
# If you edit this, make sure to also accordingly tweak the actual template files.

def getDisposition(disp=None):
if disp == None:
if disp is None:
return '.Aggregate'
if len(disp) == 0 or disp[0] != '.':
disp = '.' + disp
return disp

def _getGenericArgStrings(genericArgs=None,genericConstraints=None):
if genericArgs == None:
def _getGenericArgStrings(genericArgs=None, genericConstraints=None):
if genericArgs is None:
return ('','')
genericArgString = ''
first = True
for arg in genericArgs:
if not first:
genericArgString = genericArgString + ','
genericArgString = genericArgString + ','
first = False
genericArgString = genericArgString + arg
if genericConstraints == None:
if genericConstraints is None:
genericConstraintString = genericArgString
else:
genericConstraintString = ''
Expand All @@ -45,11 +45,11 @@ def _getGenericArgStrings(genericArgs=None,genericConstraints=None):
genericConstraintString = genericConstraintString + ' : ' + cons
genericArgString = '<' + genericArgString + '>'
genericConstraintString = '<' + genericConstraintString + '>'
return (genericArgString,genericConstraintString)
return (genericArgString, genericConstraintString)

def getGenericArgString(genericArgs=None,genericConstraints=None):
return _getGenericArgStrings(genericArgs,genericConstraints)[0]
def getGenericArgString(genericArgs=None, genericConstraints=None):
return _getGenericArgStrings(genericArgs, genericConstraints)[0]

def getGenericConstraintString(genericArgs=None,genericConstraints=None):
return _getGenericArgStrings(genericArgs,genericConstraints)[1]
def getGenericConstraintString(genericArgs=None, genericConstraints=None):
return _getGenericArgStrings(genericArgs, genericConstraints)[1]

6 changes: 3 additions & 3 deletions utils/cmpcodesize/cmpcodesize/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@


def addFunction(sizes, function, startAddr, endAddr, groupByPrefix):
if not function or startAddr == None or endAddr == None:
if not function or startAddr is None or endAddr is None:
return

size = endAddr - startAddr
Expand Down Expand Up @@ -113,7 +113,7 @@ def readSizes(sizes, fileName, functionDetails, groupByPrefix):
asmlineMatch = asmlinePattern.match(line)
if asmlineMatch:
addr = int(asmlineMatch.group(1), 16)
if startAddr == None:
if startAddr is None:
startAddr = addr
endAddr = addr
elif line == "Section":
Expand Down Expand Up @@ -142,7 +142,7 @@ def readSizes(sizes, fileName, functionDetails, groupByPrefix):
def compareSizes(oldSizes, newSizes, nameKey, title):
oldSize = oldSizes[nameKey]
newSize = newSizes[nameKey]
if oldSize != None and newSize != None:
if oldSize is not None and newSize is not None:
if oldSize != 0:
perc = "%.1f%%" % ((1.0 - float(newSize) / float(oldSize)) * 100.0)
else:
Expand Down