##// END OF EJS Templates
Use 'is' to compare with None...
Boris Egorov -
Show More
@@ -450,7 +450,7 b' class FileLinks(FileLink):'
450 display_fnames = []
450 display_fnames = []
451 for fname in fnames:
451 for fname in fnames:
452 if (isfile(join(dirname,fname)) and
452 if (isfile(join(dirname,fname)) and
453 (included_suffixes == None or
453 (included_suffixes is None or
454 splitext(fname)[1] in included_suffixes)):
454 splitext(fname)[1] in included_suffixes)):
455 display_fnames.append(fname)
455 display_fnames.append(fname)
456
456
@@ -116,7 +116,7 b' class MagicHelper(QtGui.QDockWidget):'
116 instance is expected to invoke populate_magic_helper() when magic
116 instance is expected to invoke populate_magic_helper() when magic
117 info is available.
117 info is available.
118 """
118 """
119 if not visible or self.data != None:
119 if not visible or self.data is not None:
120 return
120 return
121 self.data = {}
121 self.data = {}
122 self.search_class.clear()
122 self.search_class.clear()
@@ -178,14 +178,14 b' class MagicHelper(QtGui.QDockWidget):'
178 """Emit pasteRequested signal with currently selected item text
178 """Emit pasteRequested signal with currently selected item text
179 """
179 """
180 text = self._get_current_search_item(item)
180 text = self._get_current_search_item(item)
181 if text != None:
181 if text is not None:
182 self.pasteRequested.emit(text)
182 self.pasteRequested.emit(text)
183
183
184 def run_requested(self, item = None):
184 def run_requested(self, item = None):
185 """Emit runRequested signal with currently selected item text
185 """Emit runRequested signal with currently selected item text
186 """
186 """
187 text = self._get_current_search_item(item)
187 text = self._get_current_search_item(item)
188 if text != None:
188 if text is not None:
189 self.runRequested.emit(text)
189 self.runRequested.emit(text)
190
190
191 def filter_magic_helper(self, regex, cls):
191 def filter_magic_helper(self, regex, cls):
@@ -193,9 +193,9 b' class MagicHelper(QtGui.QDockWidget):'
193 regex and class match cls.
193 regex and class match cls.
194 If cls equals 'any' - any class matches.
194 If cls equals 'any' - any class matches.
195 """
195 """
196 if regex == "" or regex == None:
196 if regex == "" or regex is None:
197 regex = '.'
197 regex = '.'
198 if cls == None:
198 if cls is None:
199 cls = 'any'
199 cls = 'any'
200
200
201 self.search_list.clear()
201 self.search_list.clear()
@@ -144,7 +144,7 b' class MainWindow(QtGui.QMainWindow):'
144 # of this is when 'exit' is sent in a slave tab. 'exit' will be
144 # of this is when 'exit' is sent in a slave tab. 'exit' will be
145 # re-sent by this function on the master widget, which ask all slave
145 # re-sent by this function on the master widget, which ask all slave
146 # widgets to exit
146 # widgets to exit
147 if closing_widget==None:
147 if closing_widget is None:
148 return
148 return
149
149
150 #get a list of all slave widgets on the same kernel.
150 #get a list of all slave widgets on the same kernel.
@@ -719,12 +719,12 b' class MainWindow(QtGui.QMainWindow):'
719 QtCore.QTimer.singleShot(200, self.active_frontend._control.setFocus)
719 QtCore.QTimer.singleShot(200, self.active_frontend._control.setFocus)
720
720
721 def magic_helper_paste_requested(self, text = None):
721 def magic_helper_paste_requested(self, text = None):
722 if text != None:
722 if text is not None:
723 self.active_frontend.input_buffer = text
723 self.active_frontend.input_buffer = text
724 self._set_active_frontend_focus()
724 self._set_active_frontend_focus()
725
725
726 def magic_helper_run_requested(self, text = None):
726 def magic_helper_run_requested(self, text = None):
727 if text != None:
727 if text is not None:
728 self.active_frontend.execute(text)
728 self.active_frontend.execute(text)
729 self._set_active_frontend_focus()
729 self._set_active_frontend_focus()
730
730
@@ -296,7 +296,7 b' class Win32ShellCommandController(object):'
296 c_hstdin = None
296 c_hstdin = None
297 CloseHandle(c_hstdout)
297 CloseHandle(c_hstdout)
298 c_hstdout = None
298 c_hstdout = None
299 if c_hstderr != None:
299 if c_hstderr is not None:
300 CloseHandle(c_hstderr)
300 CloseHandle(c_hstderr)
301 c_hstderr = None
301 c_hstderr = None
302
302
@@ -403,10 +403,10 b' class Win32ShellCommandController(object):'
403 These functions are called from different threads (but not
403 These functions are called from different threads (but not
404 concurrently, because of the GIL).
404 concurrently, because of the GIL).
405 """
405 """
406 if stdout_func == None and stdin_func == None and stderr_func == None:
406 if stdout_func is None and stdin_func is None and stderr_func is None:
407 return self._run_stdio()
407 return self._run_stdio()
408
408
409 if stderr_func != None and self.mergeout:
409 if stderr_func is not None and self.mergeout:
410 raise RuntimeError("Shell command was initiated with "
410 raise RuntimeError("Shell command was initiated with "
411 "merged stdin/stdout, but a separate stderr_func "
411 "merged stdin/stdout, but a separate stderr_func "
412 "was provided to the run() method")
412 "was provided to the run() method")
@@ -421,7 +421,7 b' class Win32ShellCommandController(object):'
421 threads.append(threading.Thread(target=self._stdout_thread,
421 threads.append(threading.Thread(target=self._stdout_thread,
422 args=(self.hstdout, stdout_func)))
422 args=(self.hstdout, stdout_func)))
423 if not self.mergeout:
423 if not self.mergeout:
424 if stderr_func == None:
424 if stderr_func is None:
425 stderr_func = stdout_func
425 stderr_func = stdout_func
426 threads.append(threading.Thread(target=self._stdout_thread,
426 threads.append(threading.Thread(target=self._stdout_thread,
427 args=(self.hstderr, stderr_func)))
427 args=(self.hstderr, stderr_func)))
@@ -541,7 +541,7 b' class Win32ShellCommandController(object):'
541 if self.hstderr:
541 if self.hstderr:
542 CloseHandle(self.hstderr)
542 CloseHandle(self.hstderr)
543 self.hstderr = None
543 self.hstderr = None
544 if self.piProcInfo != None:
544 if self.piProcInfo is not None:
545 CloseHandle(self.piProcInfo.hProcess)
545 CloseHandle(self.piProcInfo.hProcess)
546 CloseHandle(self.piProcInfo.hThread)
546 CloseHandle(self.piProcInfo.hThread)
547 self.piProcInfo = None
547 self.piProcInfo = None
General Comments 0
You need to be logged in to leave comments. Login now