Here is a summary of the features offered by the bz2 module:
* :class:`BZ2File` class implements a complete file interface, including
- :meth:`readline`, :meth:`readlines`, :meth:`writelines`, :meth:`seek`, etc;
+ :meth:`~BZ2File.readline`, :meth:`~BZ2File.readlines`,
+ :meth:`~BZ2File.writelines`, :meth:`~BZ2File.seek`, etc;
-* :class:`BZ2File` class implements emulated :meth:`seek` support;
+* :class:`BZ2File` class implements emulated :meth:`~BZ2File.seek` support;
* :class:`BZ2File` class implements universal newline support;
try:
lumberjack()
- except:
- exceptionType, exceptionValue, exceptionTraceback = sys.exc_info()
+ except IndexError:
+ exc_type, exc_value, exc_traceback = sys.exc_info()
print "*** print_tb:"
- traceback.print_tb(exceptionTraceback, limit=1, file=sys.stdout)
+ traceback.print_tb(exc_traceback, limit=1, file=sys.stdout)
print "*** print_exception:"
- traceback.print_exception(exceptionType, exceptionValue, exceptionTraceback,
+ traceback.print_exception(exc_type, exc_value, exc_traceback,
limit=2, file=sys.stdout)
print "*** print_exc:"
traceback.print_exc()
print formatted_lines[0]
print formatted_lines[-1]
print "*** format_exception:"
- print repr(traceback.format_exception(exceptionType, exceptionValue,
- exceptionTraceback))
+ print repr(traceback.format_exception(exc_type, exc_value,
+ exc_traceback))
print "*** extract_tb:"
- print repr(traceback.extract_tb(exceptionTraceback))
+ print repr(traceback.extract_tb(exc_traceback))
print "*** format_tb:"
- print repr(traceback.format_tb(exceptionTraceback))
- print "*** tb_lineno:", traceback.tb_lineno(exceptionTraceback)
+ print repr(traceback.format_tb(exc_traceback))
+ print "*** tb_lineno:", exc_traceback.tb_lineno
The output for the example would look similar to this::
except ValueError, msg:
if msg[0] != 0:
s = str(msg)
- if s.find(TESTFN) != -1 or s.find(bad_mode) == -1:
+ if TESTFN in s or bad_mode not in s:
self.fail("bad error message for invalid mode: %s" % s)
# if msg[0] == 0, we're probably on Windows where there may be
# no obvious way to discover why open() failed.
except ValueError as msg:
if msg.args[0] != 0:
s = str(msg)
- if s.find(TESTFN) != -1 or s.find(bad_mode) == -1:
+ if TESTFN in s or bad_mode not in s:
self.fail("bad error message for invalid mode: %s" % s)
# if msg.args[0] == 0, we're probably on Windows where there may be
# no obvious way to discover why open() failed.
string1 = repr(el)
string2 = str(el)
self.confirm(string1 == string2)
- self.confirm(string1.find("slash:abc") != -1)
+ self.confirm("slash:abc" in string1)
dom.unlink()
def testAttributeRepr(self):
if (use_attr == TRUE) {
attr_old = getattrs(self->win);
- wattrset(self->win,attr);
+ (void)wattrset(self->win,attr);
}
if (use_xy == TRUE)
rtn = mvwaddstr(self->win,y,x,str);
else
rtn = waddstr(self->win,str);
if (use_attr == TRUE)
- wattrset(self->win,attr_old);
+ (void)wattrset(self->win,attr_old);
return PyCursesCheckERR(rtn, "addstr");
}
if (use_attr == TRUE) {
attr_old = getattrs(self->win);
- wattrset(self->win,attr);
+ (void)wattrset(self->win,attr);
}
if (use_xy == TRUE)
rtn = mvwaddnstr(self->win,y,x,str,n);
else
rtn = waddnstr(self->win,str,n);
if (use_attr == TRUE)
- wattrset(self->win,attr_old);
+ (void)wattrset(self->win,attr_old);
return PyCursesCheckERR(rtn, "addnstr");
}
if (use_attr == TRUE) {
attr_old = getattrs(self->win);
- wattrset(self->win,attr);
+ (void)wattrset(self->win,attr);
}
if (use_xy == TRUE)
rtn = mvwinsstr(self->win,y,x,str);
else
rtn = winsstr(self->win,str);
if (use_attr == TRUE)
- wattrset(self->win,attr_old);
+ (void)wattrset(self->win,attr_old);
return PyCursesCheckERR(rtn, "insstr");
}
if (use_attr == TRUE) {
attr_old = getattrs(self->win);
- wattrset(self->win,attr);
+ (void)wattrset(self->win,attr);
}
if (use_xy == TRUE)
rtn = mvwinsnstr(self->win,y,x,str,n);
else
rtn = winsnstr(self->win,str,n);
if (use_attr == TRUE)
- wattrset(self->win,attr_old);
+ (void)wattrset(self->win,attr_old);
return PyCursesCheckERR(rtn, "insnstr");
}
On Unix and Mac systems if you intend to install multiple versions of Python
using the same installation prefix (--prefix argument to the configure
script) you must take care that your primary python executable is not
-overwritten by the installation of a different versio. All files and
+overwritten by the installation of a different version. All files and
directories installed using "make altinstall" contain the major and minor
version and can thus live side-by-side. "make install" also creates
${prefix}/bin/python which refers to ${prefix}/bin/pythonX.Y. If you intend