Comparison with None shouldn't use equality

That type of comparisons should always be done with 'is' or 'is not',
never the equality operators.
This commit is contained in:
Rémy Léone 2017-09-10 15:30:22 +02:00
parent 67728e73d7
commit 8f1ad57931
2 changed files with 7 additions and 7 deletions

View file

@ -267,7 +267,7 @@ class DeckManager:
draggedDeckName = draggedDeck['name'] draggedDeckName = draggedDeck['name']
ontoDeckName = self.get(ontoDeckDid)['name'] ontoDeckName = self.get(ontoDeckDid)['name']
if ontoDeckDid == None or ontoDeckDid == '': if ontoDeckDid is None or ontoDeckDid == '':
if len(self._path(draggedDeckName)) > 1: if len(self._path(draggedDeckName)) > 1:
self.rename(draggedDeck, self._basename(draggedDeckName)) self.rename(draggedDeck, self._basename(draggedDeckName))
elif self._canDragAndDrop(draggedDeckName, ontoDeckName): elif self._canDragAndDrop(draggedDeckName, ontoDeckName):

View file

@ -220,7 +220,7 @@ class SupermemoXmlImporter(NoteImporter):
# you can deceide if you are going to tag all toppics or just that containing some pattern # you can deceide if you are going to tag all toppics or just that containing some pattern
tTaggTitle = False tTaggTitle = False
for pattern in self.META.pathsToBeTagged: for pattern in self.META.pathsToBeTagged:
if item.lTitle != None and pattern.lower() in " ".join(item.lTitle).lower(): if item.lTitle is not None and pattern.lower() in " ".join(item.lTitle).lower():
tTaggTitle = True tTaggTitle = True
break break
if tTaggTitle or self.META.tagAllTopics: if tTaggTitle or self.META.tagAllTopics:
@ -295,7 +295,7 @@ class SupermemoXmlImporter(NoteImporter):
def parse(self, node=None): def parse(self, node=None):
"Parse method - parses document elements" "Parse method - parses document elements"
if node==None and self.xmldoc!=None: if node is None and self.xmldoc is not None:
node = self.xmldoc node = self.xmldoc
_method = "parse_%s" % node.__class__.__name__ _method = "parse_%s" % node.__class__.__name__
@ -361,7 +361,7 @@ class SupermemoXmlImporter(NoteImporter):
# Process cntElm if is valid Item (and not an Topic etc..) # Process cntElm if is valid Item (and not an Topic etc..)
# if smel.Lapses != None and smel.Interval != None and smel.Question != None and smel.Answer != None: # if smel.Lapses != None and smel.Interval != None and smel.Question != None and smel.Answer != None:
if smel.Title == None and smel.Question != None and smel.Answer != None: if smel.Title is None and smel.Question is not None and smel.Answer is not None:
if smel.Answer.strip() !='' and smel.Question.strip() !='': if smel.Answer.strip() !='' and smel.Question.strip() !='':
# migrate only memorized otherway skip/continue # migrate only memorized otherway skip/continue
@ -385,7 +385,7 @@ class SupermemoXmlImporter(NoteImporter):
# parseing of whole node is now finished # parseing of whole node is now finished
# test if it's really topic # test if it's really topic
if smel.Title != None: if smel.Title is not None:
# remove topic from title list # remove topic from title list
t = self.cntMeta['title'].pop() t = self.cntMeta['title'].pop()
self.logger('End of topic \t- %s' % (t), level=2) self.logger('End of topic \t- %s' % (t), level=2)
@ -394,14 +394,14 @@ class SupermemoXmlImporter(NoteImporter):
"Process SM element Content" "Process SM element Content"
for child in node.childNodes: for child in node.childNodes:
if hasattr(child,'tagName') and child.firstChild != None: if hasattr(child,'tagName') and child.firstChild is not None:
self.cntElm[-1][child.tagName]=child.firstChild.data self.cntElm[-1][child.tagName]=child.firstChild.data
def do_LearningData(self, node): def do_LearningData(self, node):
"Process SM element LearningData" "Process SM element LearningData"
for child in node.childNodes: for child in node.childNodes:
if hasattr(child,'tagName') and child.firstChild != None: if hasattr(child,'tagName') and child.firstChild is not None:
self.cntElm[-1][child.tagName]=child.firstChild.data self.cntElm[-1][child.tagName]=child.firstChild.data
# It's being processed in do_Content now # It's being processed in do_Content now