diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-03-31 01:51:45 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-03-31 01:51:45 (GMT) |
commit | 2a691a814914a9d2b2188cac25426543a14a8500 (patch) | |
tree | f185d13c060efb0cb0877df705aba3ed62e96434 /Lib | |
parent | 7315bad3c4be4c0053e8f98d8410009238b98af8 (diff) | |
download | cpython-2a691a814914a9d2b2188cac25426543a14a8500.zip cpython-2a691a814914a9d2b2188cac25426543a14a8500.tar.gz cpython-2a691a814914a9d2b2188cac25426543a14a8500.tar.bz2 |
Merged revisions 62021,62029,62035-62038,62043-62044,62052-62053 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62021 | benjamin.peterson | 2008-03-28 18:11:01 -0500 (Fri, 28 Mar 2008) | 2 lines
NIL => NULL
........
r62029 | amaury.forgeotdarc | 2008-03-28 20:42:31 -0500 (Fri, 28 Mar 2008) | 3 lines
Correctly call the base class tearDown();
otherwise running test_logging twice produce the errors we see on all buildbots
........
r62035 | raymond.hettinger | 2008-03-29 05:42:07 -0500 (Sat, 29 Mar 2008) | 1 line
Be explicit about what efficient means.
........
r62036 | georg.brandl | 2008-03-29 06:46:18 -0500 (Sat, 29 Mar 2008) | 2 lines
Fix capitalization.
........
r62037 | amaury.forgeotdarc | 2008-03-29 07:42:54 -0500 (Sat, 29 Mar 2008) | 5 lines
lib2to3 should install a logging handler only when run as a main program,
not when used as a library.
This may please the buildbots, which fail when test_lib2to3 is run before test_logging.
........
r62043 | benjamin.peterson | 2008-03-29 10:24:25 -0500 (Sat, 29 Mar 2008) | 3 lines
#2503 make singletons compared with "is" not == or !=
Thanks to Wummel for the patch
........
r62044 | gerhard.haering | 2008-03-29 14:11:52 -0500 (Sat, 29 Mar 2008) | 2 lines
Documented the lastrowid attribute.
........
r62052 | benjamin.peterson | 2008-03-30 14:35:10 -0500 (Sun, 30 Mar 2008) | 2 lines
Updated README regarding doc formats
........
r62053 | georg.brandl | 2008-03-30 14:41:39 -0500 (Sun, 30 Mar 2008) | 2 lines
The other download formats will be available for 2.6 too.
........
Diffstat (limited to 'Lib')
44 files changed, 134 insertions, 127 deletions
diff --git a/Lib/bsddb/dbshelve.py b/Lib/bsddb/dbshelve.py index 3727270..7344945 100644 --- a/Lib/bsddb/dbshelve.py +++ b/Lib/bsddb/dbshelve.py @@ -135,7 +135,7 @@ class DBShelf(MutableMapping): def keys(self, txn=None): - if txn != None: + if txn is not None: return self.db.keys(txn) else: return self.db.keys() @@ -161,7 +161,7 @@ class DBShelf(MutableMapping): def items(self, txn=None): - if txn != None: + if txn is not None: items = self.db.items(txn) else: items = self.db.items() @@ -172,7 +172,7 @@ class DBShelf(MutableMapping): return newitems def values(self, txn=None): - if txn != None: + if txn is not None: values = self.db.values(txn) else: values = self.db.values() diff --git a/Lib/bsddb/test/test_basics.py b/Lib/bsddb/test/test_basics.py index 4e070bd..6b99cc1 100644 --- a/Lib/bsddb/test/test_basics.py +++ b/Lib/bsddb/test/test_basics.py @@ -366,7 +366,7 @@ class BasicTestCase(unittest.TestCase): else: if set_raises_error: self.fail("expected exception") - if n != None: + if n is not None: self.fail("expected None: %r" % (n,)) rec = c.get_both(b'0404', self.makeData(b'0404')) @@ -380,7 +380,7 @@ class BasicTestCase(unittest.TestCase): else: if get_raises_error: self.fail("expected exception") - if n != None: + if n is not None: self.fail("expected None: %r" % (n,)) if self.d.get_type() == db.DB_BTREE: diff --git a/Lib/bsddb/test/test_dbtables.py b/Lib/bsddb/test/test_dbtables.py index 8964de8..f1328f0 100644 --- a/Lib/bsddb/test/test_dbtables.py +++ b/Lib/bsddb/test/test_dbtables.py @@ -328,7 +328,7 @@ class TableDBTestCase(unittest.TestCase): self.tdb.Insert(tabname, {'Type': b'Unknown', 'Access': b'0'}) def set_type(type): - if type == None: + if type is None: return b'MP3' return type diff --git a/Lib/idlelib/AutoComplete.py b/Lib/idlelib/AutoComplete.py index b2b1657..ac0827c 100644 --- a/Lib/idlelib/AutoComplete.py +++ b/Lib/idlelib/AutoComplete.py @@ -35,10 +35,9 @@ class AutoComplete: "popupwait", type="int", default=0) def __init__(self, editwin=None): - if editwin == None: # subprocess and test - self.editwin = None - return self.editwin = editwin + if editwin is None: # subprocess and test + return self.text = editwin.text self.autocompletewindow = None diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index 434df67..7c66088 100644 --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -922,7 +922,7 @@ class PyShell(OutputWindow): "The program is still running!\n Do you want to kill it?", default="ok", parent=self.text) - if response == False: + if response is False: return "cancel" if self.reading: self.top.quit() diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py index 33b5ed0..23ebe54 100644 --- a/Lib/lib-tk/Tkinter.py +++ b/Lib/lib-tk/Tkinter.py @@ -187,7 +187,7 @@ class Variable: else: self._name = 'PY_VAR' + repr(_varnum) _varnum += 1 - if value != None: + if value is not None: self.set(value) elif not self._tk.call("info", "exists", self._name): self.set(self._default) diff --git a/Lib/lib-tk/turtle.py b/Lib/lib-tk/turtle.py index 7cf298d..960a9f6 100644 --- a/Lib/lib-tk/turtle.py +++ b/Lib/lib-tk/turtle.py @@ -749,25 +749,25 @@ def setup(**geometry): global _width, _height, _startx, _starty width = geometry.get('width',_width) - if width is None or width >= 0: + if width >= 0 or width is None: _width = width else: raise ValueError("width can not be less than 0") height = geometry.get('height',_height) - if height is None or height >= 0: + if height >= 0 or height is None: _height = height else: raise ValueError("height can not be less than 0") startx = geometry.get('startx', _startx) - if startx is None or startx >= 0: + if startx >= 0 or startx is None: _startx = _startx else: raise ValueError("startx can not be less than 0") starty = geometry.get('starty', _starty) - if starty is None or starty >= 0: + if starty >= 0 or starty is None: _starty = starty else: raise ValueError("startx can not be less than 0") diff --git a/Lib/lib2to3/refactor.py b/Lib/lib2to3/refactor.py index 49c9a03..ae7d3cdf 100755 --- a/Lib/lib2to3/refactor.py +++ b/Lib/lib2to3/refactor.py @@ -28,15 +28,6 @@ from . import patcomp from . import fixes from . import pygram -if sys.version_info < (2, 4): - hdlr = logging.StreamHandler() - fmt = logging.Formatter('%(name)s: %(message)s') - hdlr.setFormatter(fmt) - logging.root.addHandler(hdlr) -else: - logging.basicConfig(format='%(name)s: %(message)s', level=logging.INFO) - - def main(args=None): """Main program. @@ -73,6 +64,15 @@ def main(args=None): print("Use --help to show usage.", file=sys.stderr) return 2 + # Set up logging handler + if sys.version_info < (2, 4): + hdlr = logging.StreamHandler() + fmt = logging.Formatter('%(name)s: %(message)s') + hdlr.setFormatter(fmt) + logging.root.addHandler(hdlr) + else: + logging.basicConfig(format='%(name)s: %(message)s', level=logging.INFO) + # Initialize the refactoring tool rt = RefactoringTool(options) diff --git a/Lib/plat-mac/EasyDialogs.py b/Lib/plat-mac/EasyDialogs.py index 68beafa..f697417 100644 --- a/Lib/plat-mac/EasyDialogs.py +++ b/Lib/plat-mac/EasyDialogs.py @@ -78,7 +78,7 @@ def Message(msg, id=260, ok=None): return h = d.GetDialogItemAsControl(2) SetDialogItemText(h, lf2cr(msg)) - if ok != None: + if ok is not None: h = d.GetDialogItemAsControl(1) h.SetControlTitle(ok) d.SetDialogDefaultItem(1) @@ -115,10 +115,10 @@ def AskString(prompt, default = "", id=261, ok=None, cancel=None): SetDialogItemText(h, lf2cr(default)) d.SelectDialogItemText(4, 0, 999) # d.SetDialogItem(4, 0, 255) - if ok != None: + if ok is not None: h = d.GetDialogItemAsControl(1) h.SetControlTitle(ok) - if cancel != None: + if cancel is not None: h = d.GetDialogItemAsControl(2) h.SetControlTitle(cancel) d.SetDialogDefaultItem(1) @@ -159,10 +159,10 @@ def AskPassword(prompt, default='', id=264, ok=None, cancel=None): SetControlData(pwd, kControlEditTextPart, kControlEditTextPasswordTag, default) d.SelectDialogItemText(4, 0, 999) Ctl.SetKeyboardFocus(d.GetDialogWindow(), pwd, kControlEditTextPart) - if ok != None: + if ok is not None: h = d.GetDialogItemAsControl(1) h.SetControlTitle(ok) - if cancel != None: + if cancel is not None: h = d.GetDialogItemAsControl(2) h.SetControlTitle(cancel) d.SetDialogDefaultItem(Dialogs.ok) @@ -203,19 +203,19 @@ def AskYesNoCancel(question, default = 0, yes=None, no=None, cancel=None, id=262 # The question string is item 5 h = d.GetDialogItemAsControl(5) SetDialogItemText(h, lf2cr(question)) - if yes != None: + if yes is not None: if yes == '': d.HideDialogItem(2) else: h = d.GetDialogItemAsControl(2) h.SetControlTitle(yes) - if no != None: + if no is not None: if no == '': d.HideDialogItem(3) else: h = d.GetDialogItemAsControl(3) h.SetControlTitle(no) - if cancel != None: + if cancel is not None: if cancel == '': d.HideDialogItem(4) else: @@ -316,7 +316,7 @@ class ProgressBar: def set(self, value, max=None): """set(value) - Set progress bar position""" - if max != None: + if max is not None: self.maxval = max bar = self.d.GetDialogItemAsControl(3) if max <= 0: # indeterminate bar diff --git a/Lib/plat-mac/FrameWork.py b/Lib/plat-mac/FrameWork.py index 8f8be55..fabd97e 100644 --- a/Lib/plat-mac/FrameWork.py +++ b/Lib/plat-mac/FrameWork.py @@ -92,7 +92,7 @@ _watch = None def setwatchcursor(): global _watch - if _watch == None: + if _watch is None: _watch = GetCursor(4).data SetCursor(_watch) @@ -129,7 +129,7 @@ class Application: self._quititem = MenuItem(m, "Quit", "Q", self._quit) def gethelpmenu(self): - if self._helpmenu == None: + if self._helpmenu is None: self._helpmenu = HelpMenu(self.menubar) return self._helpmenu @@ -266,7 +266,7 @@ class Application: else: name = "do_%d" % partcode - if wid == None: + if wid is None: # No window, or a non-python window try: handler = getattr(self, name) @@ -475,7 +475,7 @@ class MenuBar: self.menus = None def addmenu(self, title, after = 0, id=None): - if id == None: + if id is None: id = self.getnextid() if DEBUG: print('Newmenu', title, id) # XXXX m = NewMenu(id, title) @@ -907,8 +907,8 @@ class ScrolledWindow(ControlsWindow): self.barx_enabled = self.bary_enabled = 1 x0, y0, x1, y1 = self.wid.GetWindowPort().GetPortBounds() vx, vy = self.getscrollbarvalues() - if vx == None: self.barx_enabled, vx = 0, 0 - if vy == None: self.bary_enabled, vy = 0, 0 + if vx is None: self.barx_enabled, vx = 0, 0 + if vy is None: self.bary_enabled, vy = 0, 0 if wantx: rect = x0-1, y1-(SCROLLBARWIDTH-1), x1-(SCROLLBARWIDTH-2), y1+1 self.barx = NewControl(self.wid, rect, "", 1, vx, 0, 32767, 16, 0) @@ -1007,7 +1007,7 @@ class ScrolledWindow(ControlsWindow): SetPort(self.wid) vx, vy = self.getscrollbarvalues() if self.barx: - if vx == None: + if vx is None: self.barx.HiliteControl(255) self.barx_enabled = 0 else: @@ -1017,7 +1017,7 @@ class ScrolledWindow(ControlsWindow): self.barx.HiliteControl(0) self.barx.SetControlValue(vx) if self.bary: - if vy == None: + if vy is None: self.bary.HiliteControl(255) self.bary_enabled = 0 else: diff --git a/Lib/plat-mac/MiniAEFrame.py b/Lib/plat-mac/MiniAEFrame.py index e2f7cec..16f44d9 100644 --- a/Lib/plat-mac/MiniAEFrame.py +++ b/Lib/plat-mac/MiniAEFrame.py @@ -159,7 +159,7 @@ class AEServer: #Same try/except comment as above rv = _function(**_parameters) - if rv == None: + if rv is None: aetools.packevent(_reply, {}) else: aetools.packevent(_reply, {'----':rv}) diff --git a/Lib/plat-mac/PixMapWrapper.py b/Lib/plat-mac/PixMapWrapper.py index a4bacaa..98abb4a 100644 --- a/Lib/plat-mac/PixMapWrapper.py +++ b/Lib/plat-mac/PixMapWrapper.py @@ -147,9 +147,9 @@ class PixMapWrapper: """Draw this pixmap into the given (default current) grafport.""" src = self.bounds dest = [x1,y1,x2,y2] - if x2 == None: + if x2 is None: dest[2] = x1 + src[2]-src[0] - if y2 == None: + if y2 is None: dest[3] = y1 + src[3]-src[1] if not port: port = Qd.GetPort() Qd.CopyBits(self.PixMap(), port.GetPortBitMapForCopyBits(), src, tuple(dest), diff --git a/Lib/plat-mac/aepack.py b/Lib/plat-mac/aepack.py index b030140..c082b1d 100644 --- a/Lib/plat-mac/aepack.py +++ b/Lib/plat-mac/aepack.py @@ -82,7 +82,7 @@ def pack(x, forcetype = None): else: return pack(x).AECoerceDesc(forcetype) - if x == None: + if x is None: return AE.AECreateDesc(b'null', '') if isinstance(x, AEDescType): diff --git a/Lib/plat-mac/buildtools.py b/Lib/plat-mac/buildtools.py index 1545014..87a099e 100644 --- a/Lib/plat-mac/buildtools.py +++ b/Lib/plat-mac/buildtools.py @@ -203,13 +203,13 @@ def process_common(template, progress, code, rsrcname, destname, is_update, dummy, tmplowner = copyres(input, output, skiptypes, 1, progress) Res.CloseResFile(input) -## if ownertype == None: +## if ownertype is None: ## raise BuildError, "No owner resource found in either resource file or template" # Make sure we're manipulating the output resource file now Res.UseResFile(output) - if ownertype == None: + if ownertype is None: # No owner resource in the template. We have skipped the # Python owner resource, so we have to add our own. The relevant # bundle stuff is already included in the interpret/applet template. diff --git a/Lib/plat-mac/findertools.py b/Lib/plat-mac/findertools.py index bebd2a0..9bb35e6 100644 --- a/Lib/plat-mac/findertools.py +++ b/Lib/plat-mac/findertools.py @@ -124,7 +124,7 @@ def comment(object, comment=None): """comment: get or set the Finder-comment of the item, displayed in the 'Get Info' window.""" object = Carbon.File.FSRef(object) object_alias = object.FSNewAliasMonimal() - if comment == None: + if comment is None: return _getcomment(object_alias) else: return _setcomment(object_alias, comment) @@ -329,7 +329,7 @@ def label(object, index=None): """label: set or get the label of the item. Specify file by name or fsspec.""" object = Carbon.File.FSRef(object) object_alias = object.FSNewAliasMinimal() - if index == None: + if index is None: return _getlabel(object_alias) if index < 0 or index > 7: index = 0 @@ -375,7 +375,7 @@ def windowview(folder, view=None): """ fsr = Carbon.File.FSRef(folder) folder_alias = fsr.FSNewAliasMinimal() - if view == None: + if view is None: return _getwindowview(folder_alias) return _setwindowview(folder_alias, view) @@ -535,7 +535,7 @@ def icon(object, icondata=None): Development opportunity: get and set the data as PICT.""" fsr = Carbon.File.FSRef(object) object_alias = fsr.FSNewAliasMinimal() - if icondata == None: + if icondata is None: return _geticon(object_alias) return _seticon(object_alias, icondata) diff --git a/Lib/plat-mac/gensuitemodule.py b/Lib/plat-mac/gensuitemodule.py index 9d4df6d..c3b42e4 100644 --- a/Lib/plat-mac/gensuitemodule.py +++ b/Lib/plat-mac/gensuitemodule.py @@ -770,7 +770,7 @@ class SuiteCompiler: fp.write(" if _object:\n") fp.write(" _arguments['----'] = _object\n") else: - fp.write(" if _no_object != None: raise TypeError, 'No direct arg expected'\n") + fp.write(" if _no_object is not None: raise TypeError, 'No direct arg expected'\n") fp.write("\n") # # Do enum-name substitution diff --git a/Lib/plat-mac/ic.py b/Lib/plat-mac/ic.py index 5a377ebc..f4f8370 100644 --- a/Lib/plat-mac/ic.py +++ b/Lib/plat-mac/ic.py @@ -198,12 +198,12 @@ class IC: self.ic.ICLaunchURL(hint, url, 0, len(url)) def parseurl(self, data, start=None, end=None, hint=""): - if start == None: + if start is None: selStart = 0 selEnd = len(data) else: selStart = selEnd = start - if end != None: + if end is not None: selEnd = end selStart, selEnd = self.ic.ICParseURL(hint, data, selStart, selEnd, self.h) return self.h.data, selStart, selEnd @@ -227,27 +227,27 @@ _dft_ic = None def launchurl(url, hint=""): global _dft_ic - if _dft_ic == None: _dft_ic = IC() + if _dft_ic is None: _dft_ic = IC() return _dft_ic.launchurl(url, hint) def parseurl(data, start=None, end=None, hint=""): global _dft_ic - if _dft_ic == None: _dft_ic = IC() + if _dft_ic is None: _dft_ic = IC() return _dft_ic.parseurl(data, start, end, hint) def mapfile(filename): global _dft_ic - if _dft_ic == None: _dft_ic = IC() + if _dft_ic is None: _dft_ic = IC() return _dft_ic.mapfile(filename) def maptypecreator(type, creator, filename=""): global _dft_ic - if _dft_ic == None: _dft_ic = IC() + if _dft_ic is None: _dft_ic = IC() return _dft_ic.maptypecreator(type, creator, filename) def settypecreator(file): global _dft_ic - if _dft_ic == None: _dft_ic = IC() + if _dft_ic is None: _dft_ic = IC() return _dft_ic.settypecreator(file) def _test(): diff --git a/Lib/plat-mac/lib-scriptpackages/CodeWarrior/CodeWarrior_suite.py b/Lib/plat-mac/lib-scriptpackages/CodeWarrior/CodeWarrior_suite.py index 1106937..ab1fd6a 100644 --- a/Lib/plat-mac/lib-scriptpackages/CodeWarrior/CodeWarrior_suite.py +++ b/Lib/plat-mac/lib-scriptpackages/CodeWarrior/CodeWarrior_suite.py @@ -51,7 +51,7 @@ class CodeWarrior_suite_Events: _subcode = 'MAKE' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -135,7 +135,8 @@ class CodeWarrior_suite_Events: _subcode = 'EXPT' aetools.keysubst(_arguments, self._argmap_export) - if _no_object != None: raise TypeError('No direct arg expected') + if _arguments: raise TypeError('No optional args expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -154,7 +155,7 @@ class CodeWarrior_suite_Events: _subcode = 'RMOB' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -193,7 +194,7 @@ class CodeWarrior_suite_Events: _subcode = 'RUN ' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -232,7 +233,7 @@ class CodeWarrior_suite_Events: _subcode = 'UP2D' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, diff --git a/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py b/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py index 4a9cc5e..48f42fd 100644 --- a/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py +++ b/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py @@ -72,7 +72,7 @@ class Metrowerks_Shell_Suite_Events: _subcode = 'ClsP' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -190,7 +190,7 @@ class Metrowerks_Shell_Suite_Events: _subcode = 'GDoc' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -217,7 +217,8 @@ class Metrowerks_Shell_Suite_Events: _subcode = 'Gref' aetools.keysubst(_arguments, self._argmap_Get_Preferences) - if _no_object != None: raise TypeError('No direct arg expected') + if _arguments: raise TypeError('No optional args expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -263,7 +264,7 @@ class Metrowerks_Shell_Suite_Events: _subcode = 'GetP' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -283,7 +284,7 @@ class Metrowerks_Shell_Suite_Events: _subcode = 'GSeg' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -324,7 +325,7 @@ class Metrowerks_Shell_Suite_Events: _subcode = 'NsCl' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -410,7 +411,8 @@ class Metrowerks_Shell_Suite_Events: _subcode = 'Make' aetools.keysubst(_arguments, self._argmap_Make_Project) - if _no_object != None: raise TypeError('No direct arg expected') + if _arguments: raise TypeError('No optional args expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -503,7 +505,7 @@ class Metrowerks_Shell_Suite_Events: _subcode = 'RemB' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -543,7 +545,7 @@ class Metrowerks_Shell_Suite_Events: _subcode = 'ReFP' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -570,7 +572,8 @@ class Metrowerks_Shell_Suite_Events: _subcode = 'RunP' aetools.keysubst(_arguments, self._argmap_Run_Project) - if _no_object != None: raise TypeError('No direct arg expected') + if _arguments: raise TypeError('No optional args expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -682,7 +685,8 @@ class Metrowerks_Shell_Suite_Events: _subcode = 'Pref' aetools.keysubst(_arguments, self._argmap_Set_Preferences) - if _no_object != None: raise TypeError('No direct arg expected') + if _arguments: raise TypeError('No optional args expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -778,7 +782,8 @@ class Metrowerks_Shell_Suite_Events: _subcode = 'UpdP' aetools.keysubst(_arguments, self._argmap_Update_Project) - if _no_object != None: raise TypeError('No direct arg expected') + if _arguments: raise TypeError('No optional args expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, diff --git a/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Standard_Suite.py b/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Standard_Suite.py index 54deabb..a0df41e 100644 --- a/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Standard_Suite.py +++ b/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Standard_Suite.py @@ -115,7 +115,7 @@ class Standard_Suite_Events(Standard_Suite_Events): _subcode = 'crel' aetools.keysubst(_arguments, self._argmap_make) - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, diff --git a/Lib/plat-mac/lib-scriptpackages/Explorer/Required_Suite.py b/Lib/plat-mac/lib-scriptpackages/Explorer/Required_Suite.py index 7c902fb..cc6ef6f 100644 --- a/Lib/plat-mac/lib-scriptpackages/Explorer/Required_Suite.py +++ b/Lib/plat-mac/lib-scriptpackages/Explorer/Required_Suite.py @@ -61,7 +61,7 @@ class Required_Suite_Events(Required_Suite_Events): _subcode = 'quit' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -80,7 +80,7 @@ class Required_Suite_Events(Required_Suite_Events): _subcode = 'oapp' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, diff --git a/Lib/plat-mac/lib-scriptpackages/Explorer/Web_Browser_Suite.py b/Lib/plat-mac/lib-scriptpackages/Explorer/Web_Browser_Suite.py index 78c58c8..a7e4a8c 100644 --- a/Lib/plat-mac/lib-scriptpackages/Explorer/Web_Browser_Suite.py +++ b/Lib/plat-mac/lib-scriptpackages/Explorer/Web_Browser_Suite.py @@ -42,7 +42,7 @@ class Web_Browser_Suite_Events: _subcode = 'CLSA' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -69,7 +69,8 @@ class Web_Browser_Suite_Events: _subcode = 'CLOS' aetools.keysubst(_arguments, self._argmap_CloseWindow) - if _no_object != None: raise TypeError('No direct arg expected') + if _arguments: raise TypeError('No optional args expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -110,7 +111,7 @@ class Web_Browser_Suite_Events: _subcode = 'LSTW' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, diff --git a/Lib/plat-mac/lib-scriptpackages/Finder/Finder_Basics.py b/Lib/plat-mac/lib-scriptpackages/Finder/Finder_Basics.py index 4afe48a..3433d7a 100644 --- a/Lib/plat-mac/lib-scriptpackages/Finder/Finder_Basics.py +++ b/Lib/plat-mac/lib-scriptpackages/Finder/Finder_Basics.py @@ -20,7 +20,7 @@ class Finder_Basics_Events: _subcode = 'copy' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, diff --git a/Lib/plat-mac/lib-scriptpackages/Finder/Legacy_suite.py b/Lib/plat-mac/lib-scriptpackages/Finder/Legacy_suite.py index c2eb48a..fc9da2e 100644 --- a/Lib/plat-mac/lib-scriptpackages/Finder/Legacy_suite.py +++ b/Lib/plat-mac/lib-scriptpackages/Finder/Legacy_suite.py @@ -20,7 +20,7 @@ class Legacy_suite_Events: _subcode = 'rest' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -39,7 +39,7 @@ class Legacy_suite_Events: _subcode = 'shut' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -58,7 +58,7 @@ class Legacy_suite_Events: _subcode = 'slep' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, diff --git a/Lib/plat-mac/lib-scriptpackages/Finder/Standard_Suite.py b/Lib/plat-mac/lib-scriptpackages/Finder/Standard_Suite.py index ff28486..ff75edc 100644 --- a/Lib/plat-mac/lib-scriptpackages/Finder/Standard_Suite.py +++ b/Lib/plat-mac/lib-scriptpackages/Finder/Standard_Suite.py @@ -179,7 +179,7 @@ class Standard_Suite_Events(Standard_Suite_Events): _subcode = 'crel' aetools.keysubst(_arguments, self._argmap_make) - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -285,7 +285,7 @@ class Standard_Suite_Events(Standard_Suite_Events): _subcode = 'quit' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, diff --git a/Lib/plat-mac/lib-scriptpackages/Netscape/Mozilla_suite.py b/Lib/plat-mac/lib-scriptpackages/Netscape/Mozilla_suite.py index 21a28d8..89cb37f 100644 --- a/Lib/plat-mac/lib-scriptpackages/Netscape/Mozilla_suite.py +++ b/Lib/plat-mac/lib-scriptpackages/Netscape/Mozilla_suite.py @@ -21,7 +21,7 @@ class Mozilla_suite_Events: _subcode = 'Impt' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -41,7 +41,7 @@ class Mozilla_suite_Events: _subcode = 'upro' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -61,7 +61,7 @@ class Mozilla_suite_Events: _subcode = 'wurl' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -126,7 +126,7 @@ class Mozilla_suite_Events: _subcode = 'addr' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -165,7 +165,7 @@ class Mozilla_suite_Events: _subcode = 'prfl' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, diff --git a/Lib/plat-mac/lib-scriptpackages/Netscape/PowerPlant.py b/Lib/plat-mac/lib-scriptpackages/Netscape/PowerPlant.py index a0c84b2..a5dd228 100644 --- a/Lib/plat-mac/lib-scriptpackages/Netscape/PowerPlant.py +++ b/Lib/plat-mac/lib-scriptpackages/Netscape/PowerPlant.py @@ -25,7 +25,7 @@ class PowerPlant_Events: _subcode = 'sttg' aetools.keysubst(_arguments, self._argmap_SwitchTellTarget) - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, diff --git a/Lib/plat-mac/lib-scriptpackages/Netscape/Required_suite.py b/Lib/plat-mac/lib-scriptpackages/Netscape/Required_suite.py index 8767ac3..a7d3e96 100644 --- a/Lib/plat-mac/lib-scriptpackages/Netscape/Required_suite.py +++ b/Lib/plat-mac/lib-scriptpackages/Netscape/Required_suite.py @@ -61,7 +61,7 @@ class Required_suite_Events(Required_Suite_Events): _subcode = 'quit' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -80,7 +80,7 @@ class Required_suite_Events(Required_Suite_Events): _subcode = 'oapp' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, diff --git a/Lib/plat-mac/lib-scriptpackages/Netscape/WorldWideWeb_suite.py b/Lib/plat-mac/lib-scriptpackages/Netscape/WorldWideWeb_suite.py index 2bfa2a5..24a89e7 100644 --- a/Lib/plat-mac/lib-scriptpackages/Netscape/WorldWideWeb_suite.py +++ b/Lib/plat-mac/lib-scriptpackages/Netscape/WorldWideWeb_suite.py @@ -154,7 +154,7 @@ class WorldWideWeb_suite_Events: _subcode = 'LSTW' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, diff --git a/Lib/plat-mac/lib-scriptpackages/StdSuites/AppleScript_Suite.py b/Lib/plat-mac/lib-scriptpackages/StdSuites/AppleScript_Suite.py index 5e710b9..e5acd48 100644 --- a/Lib/plat-mac/lib-scriptpackages/StdSuites/AppleScript_Suite.py +++ b/Lib/plat-mac/lib-scriptpackages/StdSuites/AppleScript_Suite.py @@ -268,7 +268,7 @@ class AppleScript_Suite_Events: _subcode = 'actv' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -371,7 +371,7 @@ class AppleScript_Suite_Events: _subcode = 'tend' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -443,7 +443,7 @@ class AppleScript_Suite_Events: _subcode = 'idle' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -462,7 +462,7 @@ class AppleScript_Suite_Events: _subcode = 'noop' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -585,7 +585,7 @@ class AppleScript_Suite_Events: _subcode = 'log1' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -625,7 +625,8 @@ class AppleScript_Suite_Events: _subcode = 'log0' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') + _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -644,7 +645,7 @@ class AppleScript_Suite_Events: _subcode = 'tell' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, diff --git a/Lib/plat-mac/lib-scriptpackages/StdSuites/Standard_Suite.py b/Lib/plat-mac/lib-scriptpackages/StdSuites/Standard_Suite.py index 187ea50..e305668 100644 --- a/Lib/plat-mac/lib-scriptpackages/StdSuites/Standard_Suite.py +++ b/Lib/plat-mac/lib-scriptpackages/StdSuites/Standard_Suite.py @@ -255,7 +255,7 @@ class Standard_Suite_Events(builtin_Suite_Events): _subcode = 'crel' aetools.keysubst(_arguments, self._argmap_make) - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -345,7 +345,7 @@ class Standard_Suite_Events(builtin_Suite_Events): _subcode = 'quit' aetools.keysubst(_arguments, self._argmap_quit) - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') aetools.enumsubst(_arguments, 'savo', _Enum_savo) @@ -365,7 +365,7 @@ class Standard_Suite_Events(builtin_Suite_Events): _subcode = 'rapp' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -384,7 +384,7 @@ class Standard_Suite_Events(builtin_Suite_Events): _subcode = 'oapp' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, diff --git a/Lib/plat-mac/lib-scriptpackages/SystemEvents/Standard_Suite.py b/Lib/plat-mac/lib-scriptpackages/SystemEvents/Standard_Suite.py index 5778288..a0cd3da 100644 --- a/Lib/plat-mac/lib-scriptpackages/SystemEvents/Standard_Suite.py +++ b/Lib/plat-mac/lib-scriptpackages/SystemEvents/Standard_Suite.py @@ -175,7 +175,7 @@ class Standard_Suite_Events: _subcode = 'crel' aetools.keysubst(_arguments, self._argmap_make) - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, diff --git a/Lib/plat-mac/lib-scriptpackages/Terminal/Standard_Suite.py b/Lib/plat-mac/lib-scriptpackages/Terminal/Standard_Suite.py index 61a27a8..0020e52 100644 --- a/Lib/plat-mac/lib-scriptpackages/Terminal/Standard_Suite.py +++ b/Lib/plat-mac/lib-scriptpackages/Terminal/Standard_Suite.py @@ -175,7 +175,7 @@ class Standard_Suite_Events: _subcode = 'crel' aetools.keysubst(_arguments, self._argmap_make) - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, diff --git a/Lib/plat-mac/lib-scriptpackages/_builtinSuites/builtin_Suite.py b/Lib/plat-mac/lib-scriptpackages/_builtinSuites/builtin_Suite.py index 7d5abbd..a5ee8c6 100644 --- a/Lib/plat-mac/lib-scriptpackages/_builtinSuites/builtin_Suite.py +++ b/Lib/plat-mac/lib-scriptpackages/_builtinSuites/builtin_Suite.py @@ -37,8 +37,7 @@ class builtin_Suite_Events: _subcode = 'oapp' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') - + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) @@ -56,7 +55,7 @@ class builtin_Suite_Events: _subcode = 'rapp' if _arguments: raise TypeError('No optional args expected') - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') _reply, _arguments, _attributes = self.send(_code, _subcode, @@ -100,7 +99,7 @@ class builtin_Suite_Events: _subcode = 'quit' aetools.keysubst(_arguments, self._argmap_quit) - if _no_object != None: raise TypeError('No direct arg expected') + if _no_object is not None: raise TypeError('No direct arg expected') aetools.enumsubst(_arguments, 'savo', _Enum_savo) diff --git a/Lib/plat-mac/macostools.py b/Lib/plat-mac/macostools.py index 80c3727..3d5b6f8 100644 --- a/Lib/plat-mac/macostools.py +++ b/Lib/plat-mac/macostools.py @@ -106,7 +106,7 @@ def copy(src, dst, createpath=0, copydates=1, forcetype=None): sf = srcfss.FSpGetFInfo() df = dstfss.FSpGetFInfo() df.Creator, df.Type = sf.Creator, sf.Type - if forcetype != None: + if forcetype is not None: df.Type = forcetype df.Flags = (sf.Flags & COPY_FLAGS) dstfss.FSpSetFInfo(df) diff --git a/Lib/plat-mac/videoreader.py b/Lib/plat-mac/videoreader.py index 42954b7..50f9299 100644 --- a/Lib/plat-mac/videoreader.py +++ b/Lib/plat-mac/videoreader.py @@ -188,7 +188,7 @@ class _Reader: def GetVideoFrameRate(self): tv = self.videocurtime - if tv == None: + if tv is None: tv = 0 flags = QuickTime.nextTimeStep|QuickTime.nextTimeEdgeOK tv, dur = self.videomedia.GetMediaNextInterestingTime(flags, tv, 1.0) @@ -199,7 +199,7 @@ class _Reader: if not time is None: self.audiocurtime = time flags = QuickTime.nextTimeStep|QuickTime.nextTimeEdgeOK - if self.audiocurtime == None: + if self.audiocurtime is None: self.audiocurtime = 0 tv = self.audiomedia.GetMediaNextInterestingTimeOnly(flags, self.audiocurtime, 1.0) if tv < 0 or (self.audiocurtime and tv < self.audiocurtime): @@ -215,7 +215,7 @@ class _Reader: if not time is None: self.videocurtime = time flags = QuickTime.nextTimeStep - if self.videocurtime == None: + if self.videocurtime is None: flags = flags | QuickTime.nextTimeEdgeOK self.videocurtime = 0 tv = self.videomedia.GetMediaNextInterestingTimeOnly(flags, self.videocurtime, 1.0) diff --git a/Lib/plat-os2emx/grp.py b/Lib/plat-os2emx/grp.py index 8ac9b15..ee63ef8 100644 --- a/Lib/plat-os2emx/grp.py +++ b/Lib/plat-os2emx/grp.py @@ -143,7 +143,7 @@ def __read_group_file(): while 1: entry = group.readline().strip() if len(entry) > 3: - if sep == None: + if sep is None: sep = __get_field_sep(entry) fields = entry.split(sep) fields[2] = int(fields[2]) diff --git a/Lib/plat-os2emx/pwd.py b/Lib/plat-os2emx/pwd.py index e1739bd..2cb077f 100644 --- a/Lib/plat-os2emx/pwd.py +++ b/Lib/plat-os2emx/pwd.py @@ -167,7 +167,7 @@ def __read_passwd_file(): while True: entry = passwd.readline().strip() if len(entry) > 6: - if sep == None: + if sep is None: sep = __get_field_sep(entry) fields = entry.split(sep) for i in (2, 3): diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index 68e5c88..cd69ce1 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -124,7 +124,7 @@ if __name__=='__main__' and sys.argv[1:] == ['-g']: def test_order(ast_node, parent_pos): - if not isinstance(ast_node, _ast.AST) or ast_node._fields == None: + if not isinstance(ast_node, _ast.AST) or ast_node._fields is None: return if isinstance(ast_node, (_ast.expr, _ast.stmt, _ast.excepthandler)): node_pos = (ast_node.lineno, ast_node.col_offset) @@ -135,7 +135,7 @@ def test_order(ast_node, parent_pos): if isinstance(value, list): for child in value: test_order(child, parent_pos) - elif value != None: + elif value is not None: test_order(value, parent_pos) def run_tests(): diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index ee9e392..6f5af15 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -450,6 +450,7 @@ class MemoryHandlerTest(BaseTest): def tearDown(self): self.mem_hdlr.close() + BaseTest.tearDown(self) def test_flush(self): # The memory handler flushes to its target handler based on specific diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py index ca87229..bc77621 100644 --- a/Lib/test/test_mailbox.py +++ b/Lib/test/test_mailbox.py @@ -626,9 +626,9 @@ class TestMaildir(TestMailbox): "tmp")), "File in wrong location: '%s'" % head) match = pattern.match(tail) - self.assert_(match != None, "Invalid file name: '%s'" % tail) + self.assert_(match is not None, "Invalid file name: '%s'" % tail) groups = match.groups() - if previous_groups != None: + if previous_groups is not None: self.assert_(int(groups[0] >= previous_groups[0]), "Non-monotonic seconds: '%s' before '%s'" % (previous_groups[0], groups[0])) diff --git a/Lib/test/test_pyclbr.py b/Lib/test/test_pyclbr.py index c96ae6d..25c7d85 100644 --- a/Lib/test/test_pyclbr.py +++ b/Lib/test/test_pyclbr.py @@ -55,7 +55,7 @@ class PyclbrTest(TestCase): ignore = set(ignore) | set(['object']) - if module == None: + if module is None: # Import it. # ('<silly>' is to work around an API silliness in __import__) module = __import__(moduleName, globals(), {}, ['<silly>']) diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 4e9bfb3..0bd4392 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -670,7 +670,7 @@ else: expectedToWork, certsreqs=None): - if certsreqs == None: + if certsreqs is None: certsreqs = ssl.CERT_NONE if certsreqs == ssl.CERT_NONE: diff --git a/Lib/xml/sax/expatreader.py b/Lib/xml/sax/expatreader.py index c4fb930..26b05c3 100644 --- a/Lib/xml/sax/expatreader.py +++ b/Lib/xml/sax/expatreader.py @@ -107,7 +107,7 @@ class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator): xmlreader.IncrementalParser.parse(self, source) def prepareParser(self, source): - if source.getSystemId() != None: + if source.getSystemId() is not None: self._parser.SetBase(source.getSystemId()) # Redefined setContentHandler to allow changing handlers during parsing |