Fix comparisons to None
Diff checked manually. autopep8 -a -ir -j2 --select=E711 . This required the "agressive" option because it can change code behavior.
This commit is contained in:
parent
7094931c92
commit
e0542c2e4a
14 changed files with 27 additions and 27 deletions
|
|
@ -109,7 +109,7 @@ class MainWindow(QtMainWindow):
|
|||
f=codecs.open(history_path,'r','utf-8')
|
||||
conf_hist = f.read()
|
||||
f.close()
|
||||
if conf_hist != None and conf_hist.strip() != '':
|
||||
if conf_hist is not None and conf_hist.strip() != '':
|
||||
result = conf_hist.strip().split('\n')
|
||||
return result
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ class MainWindow(QtMainWindow):
|
|||
and save it in the action history
|
||||
'''
|
||||
self.ui.currentActionLabel.setText(description)
|
||||
if self.action_history['last_action'] != None:
|
||||
if self.action_history['last_action'] is not None:
|
||||
self.action_history['action_list'].append(self.action_history['last_action'])
|
||||
self.ui.backButton.setToolTip(self.action_history['last_action']['description'])
|
||||
self.ui.backButton.show()
|
||||
|
|
@ -246,7 +246,7 @@ class MainWindow(QtMainWindow):
|
|||
|
||||
def displayMovie(self, movie, backend):
|
||||
self.ui.stackedWidget.setCurrentWidget(self.ui.info_page)
|
||||
if self.current_info_widget != None:
|
||||
if self.current_info_widget is not None:
|
||||
self.ui.info_content.layout().removeWidget(self.current_info_widget)
|
||||
self.current_info_widget.hide()
|
||||
self.current_info_widget.deleteLater()
|
||||
|
|
@ -289,7 +289,7 @@ class MainWindow(QtMainWindow):
|
|||
|
||||
def displayPerson(self, person, backend):
|
||||
self.ui.stackedWidget.setCurrentWidget(self.ui.info_page)
|
||||
if self.current_info_widget != None:
|
||||
if self.current_info_widget is not None:
|
||||
self.ui.info_content.layout().removeWidget(self.current_info_widget)
|
||||
self.current_info_widget.hide()
|
||||
self.current_info_widget.deleteLater()
|
||||
|
|
@ -332,7 +332,7 @@ class MainWindow(QtMainWindow):
|
|||
|
||||
def displayTorrent(self, torrent, backend):
|
||||
self.ui.stackedWidget.setCurrentWidget(self.ui.info_page)
|
||||
if self.current_info_widget != None:
|
||||
if self.current_info_widget is not None:
|
||||
self.ui.info_content.layout().removeWidget(self.current_info_widget)
|
||||
self.current_info_widget.hide()
|
||||
self.current_info_widget.deleteLater()
|
||||
|
|
@ -375,7 +375,7 @@ class MainWindow(QtMainWindow):
|
|||
|
||||
def displaySubtitle(self, subtitle, backend):
|
||||
self.ui.stackedWidget.setCurrentWidget(self.ui.info_page)
|
||||
if self.current_info_widget != None:
|
||||
if self.current_info_widget is not None:
|
||||
self.ui.info_content.layout().removeWidget(self.current_info_widget)
|
||||
self.current_info_widget.hide()
|
||||
self.current_info_widget.deleteLater()
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ class GenericNewsPage(BasePage):
|
|||
self.element_title_selector,
|
||||
1).text_content().strip()
|
||||
except AttributeError:
|
||||
if self.main_div == None:
|
||||
if self.main_div is None:
|
||||
#TODO: Mettre un warning
|
||||
return self.__article.title
|
||||
else:
|
||||
|
|
@ -132,7 +132,7 @@ class GenericNewsPage(BasePage):
|
|||
except BrokenPageError:
|
||||
raise NoBodyElement("no body on %s" % (self.browser))
|
||||
except AttributeError:
|
||||
if self.main_div == None:
|
||||
if self.main_div is None:
|
||||
raise NoneMainDiv("main_div is none on %s" % (self.browser))
|
||||
else:
|
||||
raise
|
||||
|
|
@ -143,7 +143,7 @@ class GenericNewsPage(BasePage):
|
|||
except BrokenPageError:
|
||||
raise NoAuthorElement()
|
||||
except AttributeError:
|
||||
if self.main_div == None:
|
||||
if self.main_div is None:
|
||||
raise NoneMainDiv("main_div is none on %s" % (self.browser))
|
||||
else:
|
||||
raise
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue