LGTM: various fixes for using string operator instead of numeric

This commit is contained in:
luz.paz
2019-10-22 10:42:18 -04:00
committed by Yorik van Havre
parent e4c8890d52
commit 1bc33025d6
23 changed files with 49 additions and 54 deletions

View File

@@ -158,7 +158,7 @@ class MathParser:
break
value = self.vars.get(var, None)
if value == None:
if value is None:
raise ValueError(
"Unrecognized variable: '" +
var +
@@ -233,7 +233,7 @@ class Spreadsheet:
if self.isKey(key):
key = key.lower()
if DEBUG: print("Setting key ",key," to value ",value)
if (value == "") or (value == None):
if (value == "") or (value is None):
# remove cell
if key in self._cells.keys():
del self._cells[key]
@@ -809,7 +809,7 @@ class SpreadsheetView(QtGui.QWidget):
content = getattr(self.spreadsheet.Proxy,cell)
if self.spreadsheet.Proxy.isFunction(cell):
self.doNotChange = True
if content == None:
if content is None:
content = ""
if DEBUG: print("Updating ",cell," to ",content)
if self.table.item(r,c):
@@ -838,7 +838,7 @@ class SpreadsheetView(QtGui.QWidget):
self.doNotChange = False
elif self.spreadsheet:
key = "abcdefghijklmnopqrstuvwxyz"[c]+str(r+1)
if value == None:
if value is None:
value = self.table.item(r,c).text()
if value == "":
if DEBUG: print("Wiping "+key)
@@ -874,7 +874,7 @@ class SpreadsheetView(QtGui.QWidget):
from DraftTools import translate
self.label.setText(str(translate("Spreadsheet","Cell"))+" "+c.upper()+str(r)+" :")
content = self.spreadsheet.Proxy.getFunction(c+str(r))
if content == None:
if content is None:
content = ""
self.lineEdit.setText(str(content))

View File

@@ -226,13 +226,13 @@ class FormulaTranslator(object):
if theExpr[0] in sepToken:
branch = sepToken[theExpr[0]]
if branch == None:
if branch is None:
keyToken = True
else:
#print('There is a branch. look up: ', theExpr[1])
if (lenExpr > 1) and (theExpr[1] in treeDict[branch]):
branch = treeDict[branch][theExpr[0]]
if branch == None:
if branch is None:
keyToken = True
else:
if (lenExpr > 2) and (theExpr[2] in treeDict[branch]):