From 7a88dc9076390b2e539376f3a1b3afb0050b8821 Mon Sep 17 00:00:00 2001 From: Salvo 'LtWorf' Tomaselli Date: Sun, 2 Jul 2017 12:50:48 +0200 Subject: [PATCH] Replace == None with is --- relational/parser.py | 4 ++-- relational_gui/creator.py | 2 +- relational_gui/guihandler.py | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/relational/parser.py b/relational/parser.py index 22eb518..c09eb46 100644 --- a/relational/parser.py +++ b/relational/parser.py @@ -108,7 +108,7 @@ class Node: def __init__(self, expression: Optional[list] = None) -> None: '''Generates the tree from the tokenized expression If no expression is specified then it will create an empty node''' - if expression == None or len(expression) == 0: + if expression is None or len(expression) == 0: return # If the list contains only a list, it will consider the lower level list. @@ -351,7 +351,7 @@ def tokenize(expression: str) -> list: while len(expression) > 0: if expression.startswith('('): # Parenthesis state end = _find_matching_parenthesis(expression) - if end == None: + if end is None: raise TokenizerException( "Missing matching ')' in '%s'" % expression) # Appends the tokenization of the content of the parenthesis diff --git a/relational_gui/creator.py b/relational_gui/creator.py index b4e2f83..1da2e78 100644 --- a/relational_gui/creator.py +++ b/relational_gui/creator.py @@ -35,7 +35,7 @@ class creatorForm(QtWidgets.QDialog): self.ui = ui self.table = self.ui.table - if self.rel == None: + if self.rel is None: self.setup_empty() else: self.setup_relation(self.rel) diff --git a/relational_gui/guihandler.py b/relational_gui/guihandler.py index 80ff863..d6aff2c 100644 --- a/relational_gui/guihandler.py +++ b/relational_gui/guihandler.py @@ -239,7 +239,7 @@ class relForm(QtWidgets.QMainWindow): '''Shows the selected relation into the table''' self.ui.table.clear() - if rel == None: # No relation to show + if rel is None: # No relation to show self.ui.table.setColumnCount(1) self.ui.table.headerItem().setText(0, "Empty relation") return @@ -347,7 +347,7 @@ class relForm(QtWidgets.QMainWindow): from relational_gui import creator result = creator.edit_relation() - if result == None: + if result is None: return name = self.promptRelationName() @@ -383,7 +383,7 @@ class relForm(QtWidgets.QMainWindow): pass def showSurvey(self): - if self.Survey == None: + if self.Survey is None: self.Survey = surveyForm.surveyForm() ui = survey.Ui_Form() self.Survey.setUi(ui) @@ -392,7 +392,7 @@ class relForm(QtWidgets.QMainWindow): self.Survey.show() def showAbout(self): - if self.About == None: + if self.About is None: self.About = QtWidgets.QDialog() ui = about.Ui_Dialog() ui.setupUi(self.About)