Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in either
comments, docstrings or error messages. I fixed two minor things in test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't"). There is a minor style issue involved: Guido seems to have preferred English grammar (behaviour, honour) in a couple places. This patch changes that to American, which is the more prominent style in the source. I prefer English myself, so if English is preferred, I'd be happy to supply a patch myself ;)
This commit is contained in:
parent
c533e4a012
commit
7e47402264
|
@ -43,7 +43,7 @@ def viewobj (r, s, t, mat) :
|
||||||
popmatrix()
|
popmatrix()
|
||||||
|
|
||||||
#
|
#
|
||||||
# makeobj : the contructor of the object
|
# makeobj : the constructor of the object
|
||||||
#
|
#
|
||||||
def mkobj () :
|
def mkobj () :
|
||||||
v0 = (-5.0 ,0.0, 0.0)
|
v0 = (-5.0 ,0.0, 0.0)
|
||||||
|
|
|
@ -15,10 +15,10 @@ def report(time, iframe):
|
||||||
print 'Frame', iframe, ': t =', time
|
print 'Frame', iframe, ': t =', time
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
sys.stderr.write('usage: Vcopy [-t type] [-m treshold] [-a] infile outfile\n')
|
sys.stderr.write('usage: Vcopy [-t type] [-m threshold] [-a] infile outfile\n')
|
||||||
sys.stderr.write('-t Convert to other type\n')
|
sys.stderr.write('-t Convert to other type\n')
|
||||||
sys.stderr.write('-a Automatic\n')
|
sys.stderr.write('-a Automatic\n')
|
||||||
sys.stderr.write('-m Convert grey to mono with treshold\n')
|
sys.stderr.write('-m Convert grey to mono with threshold\n')
|
||||||
sys.stderr.write('-d Convert grey to mono with dithering\n')
|
sys.stderr.write('-d Convert grey to mono with dithering\n')
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ def usage():
|
||||||
print '-g bits : greyscale (2, 4 or 8 bits)'
|
print '-g bits : greyscale (2, 4 or 8 bits)'
|
||||||
print '-G : 2-bit greyscale dithered'
|
print '-G : 2-bit greyscale dithered'
|
||||||
print '-m : monochrome dithered'
|
print '-m : monochrome dithered'
|
||||||
print '-M value : monochrome tresholded with value'
|
print '-M value : monochrome thresholded with value'
|
||||||
print '-f : Capture fields (in stead of frames)'
|
print '-f : Capture fields (in stead of frames)'
|
||||||
print '-P frames : preallocate space for "frames" frames'
|
print '-P frames : preallocate space for "frames" frames'
|
||||||
print 'moviefile : here goes the movie data (default film.video)'
|
print 'moviefile : here goes the movie data (default film.video)'
|
||||||
|
|
|
@ -45,7 +45,7 @@ def usage():
|
||||||
print '-g bits : greyscale (2, 4 or 8 bits)'
|
print '-g bits : greyscale (2, 4 or 8 bits)'
|
||||||
print '-G : 2-bit greyscale dithered'
|
print '-G : 2-bit greyscale dithered'
|
||||||
print '-m : monochrome dithered'
|
print '-m : monochrome dithered'
|
||||||
print '-M value : monochrome tresholded with value'
|
print '-M value : monochrome thresholded with value'
|
||||||
print '-f : Capture fields (instead of frames)'
|
print '-f : Capture fields (instead of frames)'
|
||||||
print '-n number : Capture this many frames (default 60)'
|
print '-n number : Capture this many frames (default 60)'
|
||||||
print '-N memsize : Capture frames fitting in this many kbytes'
|
print '-N memsize : Capture frames fitting in this many kbytes'
|
||||||
|
|
|
@ -695,7 +695,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
DL_IMPORT(PyObject *) PySequence_Concat(PyObject *o1, PyObject *o2);
|
DL_IMPORT(PyObject *) PySequence_Concat(PyObject *o1, PyObject *o2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Return the concatination of o1 and o2 on success, and NULL on
|
Return the concatenation of o1 and o2 on success, and NULL on
|
||||||
failure. This is the equivalent of the Python
|
failure. This is the equivalent of the Python
|
||||||
expression: o1+o2.
|
expression: o1+o2.
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Basic fuctions to manipulate cStringIO objects from C */
|
/* Basic functions to manipulate cStringIO objects from C */
|
||||||
|
|
||||||
static struct PycStringIO_CAPI {
|
static struct PycStringIO_CAPI {
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ extern DL_IMPORT(PyTypeObject) PyCObject_Type;
|
||||||
#define PyCObject_Check(op) ((op)->ob_type == &PyCObject_Type)
|
#define PyCObject_Check(op) ((op)->ob_type == &PyCObject_Type)
|
||||||
|
|
||||||
/* Create a PyCObject from a pointer to a C object and an optional
|
/* Create a PyCObject from a pointer to a C object and an optional
|
||||||
destrutor function. If the second argument is non-null, then it
|
destructor function. If the second argument is non-null, then it
|
||||||
will be called with the first argument if and when the PyCObject is
|
will be called with the first argument if and when the PyCObject is
|
||||||
destroyed.
|
destroyed.
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ PyCObject_FromVoidPtr(void *cobj, void (*destruct)(void*));
|
||||||
|
|
||||||
|
|
||||||
/* Create a PyCObject from a pointer to a C object, a description object,
|
/* Create a PyCObject from a pointer to a C object, a description object,
|
||||||
and an optional destrutor function. If the third argument is non-null,
|
and an optional destructor function. If the third argument is non-null,
|
||||||
then it will be called with the first and second arguments if and when
|
then it will be called with the first and second arguments if and when
|
||||||
the PyCObject is destroyed.
|
the PyCObject is destroyed.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -44,7 +44,7 @@ typedef BASE_TWODIGITS_TYPE stwodigits; /* signed variant of twodigits */
|
||||||
In a normalized number, ob_digit[abs(ob_size)-1] (the most significant
|
In a normalized number, ob_digit[abs(ob_size)-1] (the most significant
|
||||||
digit) is never zero. Also, in all cases, for all valid i,
|
digit) is never zero. Also, in all cases, for all valid i,
|
||||||
0 <= ob_digit[i] <= MASK.
|
0 <= ob_digit[i] <= MASK.
|
||||||
The allocation fuction takes care of allocating extra memory
|
The allocation function takes care of allocating extra memory
|
||||||
so that ob_digit[0] ... ob_digit[abs(ob_size)-1] are actually available. */
|
so that ob_digit[0] ... ob_digit[abs(ob_size)-1] are actually available. */
|
||||||
|
|
||||||
struct _longobject {
|
struct _longobject {
|
||||||
|
|
|
@ -44,7 +44,7 @@ extern DL_IMPORT(PyObject *) Py_VaBuildValue(char *, va_list);
|
||||||
#define PYTHON_API_STRING "1009"
|
#define PYTHON_API_STRING "1009"
|
||||||
/* The API version is maintained (independently from the Python version)
|
/* The API version is maintained (independently from the Python version)
|
||||||
so we can detect mismatches between the interpreter and dynamically
|
so we can detect mismatches between the interpreter and dynamically
|
||||||
loaded modules. These are diagnosticised by an error message but
|
loaded modules. These are diagnosed by an error message but
|
||||||
the module is still loaded (because the mismatch can only be tested
|
the module is still loaded (because the mismatch can only be tested
|
||||||
after loading the module). The error message is intended to
|
after loading the module). The error message is intended to
|
||||||
explain the core dump a few seconds later.
|
explain the core dump a few seconds later.
|
||||||
|
|
|
@ -51,7 +51,7 @@ and the type pointer. The actual memory allocated for an object
|
||||||
contains other data that can only be accessed after casting the pointer
|
contains other data that can only be accessed after casting the pointer
|
||||||
to a pointer to a longer structure type. This longer type must start
|
to a pointer to a longer structure type. This longer type must start
|
||||||
with the reference count and type fields; the macro PyObject_HEAD should be
|
with the reference count and type fields; the macro PyObject_HEAD should be
|
||||||
used for this (to accomodate for future changes). The implementation
|
used for this (to accommodate for future changes). The implementation
|
||||||
of a particular object type can cast the object pointer to the proper
|
of a particular object type can cast the object pointer to the proper
|
||||||
type and back.
|
type and back.
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ The macros Py_INCREF(op) and Py_DECREF(op) are used to increment or decrement
|
||||||
reference counts. Py_DECREF calls the object's deallocator function; for
|
reference counts. Py_DECREF calls the object's deallocator function; for
|
||||||
objects that don't contain references to other objects or heap memory
|
objects that don't contain references to other objects or heap memory
|
||||||
this can be the standard function free(). Both macros can be used
|
this can be the standard function free(). Both macros can be used
|
||||||
whereever a void expression is allowed. The argument shouldn't be a
|
wherever a void expression is allowed. The argument shouldn't be a
|
||||||
NIL pointer. The macro _Py_NewReference(op) is used only to initialize
|
NIL pointer. The macro _Py_NewReference(op) is used only to initialize
|
||||||
reference counts to 1; it is defined here for convenience.
|
reference counts to 1; it is defined here for convenience.
|
||||||
|
|
||||||
|
@ -518,7 +518,7 @@ times.
|
||||||
redefinition for better locality and less overhead.
|
redefinition for better locality and less overhead.
|
||||||
|
|
||||||
Objects that want to be recursion safe need to use
|
Objects that want to be recursion safe need to use
|
||||||
the macroes
|
the macro's
|
||||||
Py_TRASHCAN_SAFE_BEGIN(name)
|
Py_TRASHCAN_SAFE_BEGIN(name)
|
||||||
and
|
and
|
||||||
Py_TRASHCAN_SAFE_END(name)
|
Py_TRASHCAN_SAFE_END(name)
|
||||||
|
|
|
@ -493,7 +493,7 @@ extern DL_IMPORT(PyObject*) PyUnicode_AsUTF16String(
|
||||||
|
|
||||||
Note that Py_UNICODE data is being interpreted as UTF-16 reduced to
|
Note that Py_UNICODE data is being interpreted as UTF-16 reduced to
|
||||||
UCS-2. This trick makes it possible to add full UTF-16 capabilities
|
UCS-2. This trick makes it possible to add full UTF-16 capabilities
|
||||||
at a later point without comprimising the APIs.
|
at a later point without compromising the APIs.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -815,7 +815,7 @@ extern DL_IMPORT(int) PyUnicode_Compare(
|
||||||
PyObject *right /* Right string */
|
PyObject *right /* Right string */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Apply a argument tuple or dictionar to a format string and return
|
/* Apply a argument tuple or dictionary to a format string and return
|
||||||
the resulting Unicode string. */
|
the resulting Unicode string. */
|
||||||
|
|
||||||
extern DL_IMPORT(PyObject *) PyUnicode_Format(
|
extern DL_IMPORT(PyObject *) PyUnicode_Format(
|
||||||
|
|
|
@ -4,7 +4,7 @@ class UserList:
|
||||||
def __init__(self, initlist=None):
|
def __init__(self, initlist=None):
|
||||||
self.data = []
|
self.data = []
|
||||||
if initlist is not None:
|
if initlist is not None:
|
||||||
# XXX should this accept an arbitary sequence?
|
# XXX should this accept an arbitrary sequence?
|
||||||
if type(initlist) == type(self.data):
|
if type(initlist) == type(self.data):
|
||||||
self.data[:] = initlist
|
self.data[:] = initlist
|
||||||
elif isinstance(initlist, UserList):
|
elif isinstance(initlist, UserList):
|
||||||
|
|
|
@ -82,7 +82,7 @@ This returns an instance of a class with the following public methods:
|
||||||
close() -- close the instance (make it unusable)
|
close() -- close the instance (make it unusable)
|
||||||
The position returned by tell(), the position given to setpos() and
|
The position returned by tell(), the position given to setpos() and
|
||||||
the position of marks are all compatible and have nothing to do with
|
the position of marks are all compatible and have nothing to do with
|
||||||
the actual postion in the file.
|
the actual position in the file.
|
||||||
The close() method is called automatically when the class instance
|
The close() method is called automatically when the class instance
|
||||||
is destroyed.
|
is destroyed.
|
||||||
|
|
||||||
|
|
|
@ -287,7 +287,7 @@ class fifo:
|
||||||
## return result
|
## return result
|
||||||
|
|
||||||
# yes, this is about twice as fast, but still seems
|
# yes, this is about twice as fast, but still seems
|
||||||
# to be neglible CPU. The previous could do about 290
|
# to be negligible CPU. The previous could do about 290
|
||||||
# searches/sec. the new one about 555/sec.
|
# searches/sec. the new one about 555/sec.
|
||||||
|
|
||||||
import regex
|
import regex
|
||||||
|
|
|
@ -75,7 +75,7 @@ if os.name == 'mac':
|
||||||
|
|
||||||
else:
|
else:
|
||||||
#
|
#
|
||||||
# Glue code for non-macintosh useage
|
# Glue code for non-macintosh usage
|
||||||
#
|
#
|
||||||
|
|
||||||
class FInfo:
|
class FInfo:
|
||||||
|
|
12
Lib/cgi.py
12
Lib/cgi.py
|
@ -83,7 +83,7 @@ of FieldStorage (or MiniFieldStorage, depending on the form encoding).
|
||||||
If the submitted form data contains more than one field with the same
|
If the submitted form data contains more than one field with the same
|
||||||
name, the object retrieved by form[key] is not a (Mini)FieldStorage
|
name, the object retrieved by form[key] is not a (Mini)FieldStorage
|
||||||
instance but a list of such instances. If you are expecting this
|
instance but a list of such instances. If you are expecting this
|
||||||
possibility (i.e., when your HTML form comtains multiple fields with
|
possibility (i.e., when your HTML form contains multiple fields with
|
||||||
the same name), use the type() function to determine whether you have
|
the same name), use the type() function to determine whether you have
|
||||||
a single instance or a list of instances. For example, here's code
|
a single instance or a list of instances. For example, here's code
|
||||||
that concatenates any number of username fields, separated by commas:
|
that concatenates any number of username fields, separated by commas:
|
||||||
|
@ -106,7 +106,7 @@ that concatenates any number of username fields, separated by commas:
|
||||||
If a field represents an uploaded file, the value attribute reads the
|
If a field represents an uploaded file, the value attribute reads the
|
||||||
entire file in memory as a string. This may not be what you want. You can
|
entire file in memory as a string. This may not be what you want. You can
|
||||||
test for an uploaded file by testing either the filename attribute or the
|
test for an uploaded file by testing either the filename attribute or the
|
||||||
file attribute. You can then read the data at leasure from the file
|
file attribute. You can then read the data at leisure from the file
|
||||||
attribute:
|
attribute:
|
||||||
|
|
||||||
fileitem = form["userfile"]
|
fileitem = form["userfile"]
|
||||||
|
@ -500,7 +500,7 @@ def parse(fp=None, environ=os.environ, keep_blank_values=0, strict_parsing=0):
|
||||||
|
|
||||||
keep_blank_values: flag indicating whether blank values in
|
keep_blank_values: flag indicating whether blank values in
|
||||||
URL encoded forms should be treated as blank strings.
|
URL encoded forms should be treated as blank strings.
|
||||||
A true value inicates that blanks should be retained as
|
A true value indicates that blanks should be retained as
|
||||||
blank strings. The default false value indicates that
|
blank strings. The default false value indicates that
|
||||||
blank values are to be ignored and treated as if they were
|
blank values are to be ignored and treated as if they were
|
||||||
not included.
|
not included.
|
||||||
|
@ -551,7 +551,7 @@ def parse_qs(qs, keep_blank_values=0, strict_parsing=0):
|
||||||
|
|
||||||
keep_blank_values: flag indicating whether blank values in
|
keep_blank_values: flag indicating whether blank values in
|
||||||
URL encoded queries should be treated as blank strings.
|
URL encoded queries should be treated as blank strings.
|
||||||
A true value inicates that blanks should be retained as
|
A true value indicates that blanks should be retained as
|
||||||
blank strings. The default false value indicates that
|
blank strings. The default false value indicates that
|
||||||
blank values are to be ignored and treated as if they were
|
blank values are to be ignored and treated as if they were
|
||||||
not included.
|
not included.
|
||||||
|
@ -578,7 +578,7 @@ def parse_qsl(qs, keep_blank_values=0, strict_parsing=0):
|
||||||
|
|
||||||
keep_blank_values: flag indicating whether blank values in
|
keep_blank_values: flag indicating whether blank values in
|
||||||
URL encoded queries should be treated as blank strings.
|
URL encoded queries should be treated as blank strings.
|
||||||
A true value inicates that blanks should be retained as
|
A true value indicates that blanks should be retained as
|
||||||
blank strings. The default false value indicates that
|
blank strings. The default false value indicates that
|
||||||
blank values are to be ignored and treated as if they were
|
blank values are to be ignored and treated as if they were
|
||||||
not included.
|
not included.
|
||||||
|
@ -806,7 +806,7 @@ class FieldStorage:
|
||||||
|
|
||||||
keep_blank_values: flag indicating whether blank values in
|
keep_blank_values: flag indicating whether blank values in
|
||||||
URL encoded forms should be treated as blank strings.
|
URL encoded forms should be treated as blank strings.
|
||||||
A true value inicates that blanks should be retained as
|
A true value indicates that blanks should be retained as
|
||||||
blank strings. The default false value indicates that
|
blank strings. The default false value indicates that
|
||||||
blank values are to be ignored and treated as if they were
|
blank values are to be ignored and treated as if they were
|
||||||
not included.
|
not included.
|
||||||
|
|
|
@ -273,7 +273,7 @@ class StreamReader(Codec):
|
||||||
""" Resets the codec buffers used for keeping state.
|
""" Resets the codec buffers used for keeping state.
|
||||||
|
|
||||||
Note that no stream repositioning should take place.
|
Note that no stream repositioning should take place.
|
||||||
This method is primarely intended to be able to recover
|
This method is primarily intended to be able to recover
|
||||||
from decoding errors.
|
from decoding errors.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -295,7 +295,7 @@ class StreamReaderWriter:
|
||||||
work in both read and write modes.
|
work in both read and write modes.
|
||||||
|
|
||||||
The design is such that one can use the factory functions
|
The design is such that one can use the factory functions
|
||||||
returned by the codec.lookup() function to contruct the
|
returned by the codec.lookup() function to construct the
|
||||||
instance.
|
instance.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -21,7 +21,7 @@ fp.pop()
|
||||||
The latter sequence may be used recursively at (A).
|
The latter sequence may be used recursively at (A).
|
||||||
It is also allowed to use multiple push()...pop() sequences.
|
It is also allowed to use multiple push()...pop() sequences.
|
||||||
|
|
||||||
If seekable is given as 0, the class code will not do the bookeeping
|
If seekable is given as 0, the class code will not do the bookkeeping
|
||||||
it normally attempts in order to make seeks relative to the beginning of the
|
it normally attempts in order to make seeks relative to the beginning of the
|
||||||
current file part. This may be useful when using MultiFile with a non-
|
current file part. This may be useful when using MultiFile with a non-
|
||||||
seekable stream object.
|
seekable stream object.
|
||||||
|
|
|
@ -84,7 +84,7 @@ class Completer:
|
||||||
"""Compute matches when text contains a dot.
|
"""Compute matches when text contains a dot.
|
||||||
|
|
||||||
Assuming the text is of the form NAME.NAME....[NAME], and is
|
Assuming the text is of the form NAME.NAME....[NAME], and is
|
||||||
evaluabable in the globals of __main__, it will be evaluated
|
evaluatable in the globals of __main__, it will be evaluated
|
||||||
and its attributes (as revealed by dir()) are used as possible
|
and its attributes (as revealed by dir()) are used as possible
|
||||||
completions. (For class instances, class members are are also
|
completions. (For class instances, class members are are also
|
||||||
considered.)
|
considered.)
|
||||||
|
|
|
@ -20,7 +20,7 @@ for WORDSIZE in "BHil":
|
||||||
if len(array.array(WORDSIZE, [0]).tostring()) == _sre.getcodesize():
|
if len(array.array(WORDSIZE, [0]).tostring()) == _sre.getcodesize():
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
raise RuntimeError, "cannot find a useable array type"
|
raise RuntimeError, "cannot find a usable array type"
|
||||||
|
|
||||||
def _compile(code, pattern, flags):
|
def _compile(code, pattern, flags):
|
||||||
# internal: compile a (sub)pattern
|
# internal: compile a (sub)pattern
|
||||||
|
|
|
@ -118,7 +118,7 @@ def join(words, sep = ' '):
|
||||||
"""join(list [,sep]) -> string
|
"""join(list [,sep]) -> string
|
||||||
|
|
||||||
Return a string composed of the words in list, with
|
Return a string composed of the words in list, with
|
||||||
intervening occurences of sep. The default separator is a
|
intervening occurrences of sep. The default separator is a
|
||||||
single space.
|
single space.
|
||||||
|
|
||||||
(joinfields and join are synonymous)
|
(joinfields and join are synonymous)
|
||||||
|
|
|
@ -62,7 +62,7 @@ def main(use_rgbimg=1):
|
||||||
image = imageop.grey2rgb(greyimage, width, height)
|
image = imageop.grey2rgb(greyimage, width, height)
|
||||||
|
|
||||||
# Convert a 8-bit deep greyscale image to a 1-bit deep image by
|
# Convert a 8-bit deep greyscale image to a 1-bit deep image by
|
||||||
# tresholding all the pixels. The resulting image is tightly packed
|
# thresholding all the pixels. The resulting image is tightly packed
|
||||||
# and is probably only useful as an argument to mono2grey.
|
# and is probably only useful as an argument to mono2grey.
|
||||||
if verbose:
|
if verbose:
|
||||||
print 'grey2mono'
|
print 'grey2mono'
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import thread
|
import thread
|
||||||
# Start empty thread to initialise thread mechanics (and global lock!)
|
# Start empty thread to initialize thread mechanics (and global lock!)
|
||||||
# This thread will finish immediately thus won't make much influence on
|
# This thread will finish immediately thus won't make much influence on
|
||||||
# test results by itself, only by that fact that it initialises global lock
|
# test results by itself, only by that fact that it initializes global lock
|
||||||
thread.start_new_thread(lambda : 1, ())
|
thread.start_new_thread(lambda : 1, ())
|
||||||
|
|
||||||
import test.pystone
|
import test.pystone
|
||||||
|
|
|
@ -117,7 +117,7 @@ def format_exception(etype, value, tb, limit = None):
|
||||||
have the same meaning as the corresponding arguments to
|
have the same meaning as the corresponding arguments to
|
||||||
print_exception(). The return value is a list of strings, each
|
print_exception(). The return value is a list of strings, each
|
||||||
ending in a newline and some containing internal newlines. When
|
ending in a newline and some containing internal newlines. When
|
||||||
these lines are contatenated and printed, exactly the same text is
|
these lines are concatenated and printed, exactly the same text is
|
||||||
printed as does print_exception()."""
|
printed as does print_exception()."""
|
||||||
if tb:
|
if tb:
|
||||||
list = ['Traceback (most recent call last):\n']
|
list = ['Traceback (most recent call last):\n']
|
||||||
|
|
|
@ -4,7 +4,7 @@ class UserList:
|
||||||
def __init__(self, initlist=None):
|
def __init__(self, initlist=None):
|
||||||
self.data = []
|
self.data = []
|
||||||
if initlist is not None:
|
if initlist is not None:
|
||||||
# XXX should this accept an arbitary sequence?
|
# XXX should this accept an arbitrary sequence?
|
||||||
if type(initlist) == type(self.data):
|
if type(initlist) == type(self.data):
|
||||||
self.data[:] = initlist
|
self.data[:] = initlist
|
||||||
elif isinstance(initlist, UserList):
|
elif isinstance(initlist, UserList):
|
||||||
|
|
|
@ -120,10 +120,10 @@ decoding_map = {
|
||||||
0x00d0: None, # UNDEFINED
|
0x00d0: None, # UNDEFINED
|
||||||
0x00d1: None, # UNDEFINED
|
0x00d1: None, # UNDEFINED
|
||||||
0x00d2: None, # UNDEFINED
|
0x00d2: None, # UNDEFINED
|
||||||
0x00d3: None, # UNDEFINEDS
|
0x00d3: None, # UNDEFINED
|
||||||
0x00d4: None, # UNDEFINED
|
0x00d4: None, # UNDEFINED
|
||||||
0x00d5: None, # UNDEFINED
|
0x00d5: None, # UNDEFINED
|
||||||
0x00d6: None, # UNDEFINEDE
|
0x00d6: None, # UNDEFINED
|
||||||
0x00d7: None, # UNDEFINED
|
0x00d7: None, # UNDEFINED
|
||||||
0x00d8: None, # UNDEFINED
|
0x00d8: None, # UNDEFINED
|
||||||
0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT
|
0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT
|
||||||
|
|
|
@ -56,7 +56,7 @@ class Para:
|
||||||
#
|
#
|
||||||
# Tab to a given position (relative to the current left indent):
|
# Tab to a given position (relative to the current left indent):
|
||||||
# remove all stretch, add fixed space up to the new indent.
|
# remove all stretch, add fixed space up to the new indent.
|
||||||
# If the current position is already beying the tab stop,
|
# If the current position is already at the tab stop,
|
||||||
# don't add any new space (but still remove the stretch)
|
# don't add any new space (but still remove the stretch)
|
||||||
def tabto(self, tab):
|
def tabto(self, tab):
|
||||||
total = 0
|
total = 0
|
||||||
|
|
|
@ -64,7 +64,7 @@ assignments to sys.path).
|
||||||
(2) A package's *import domain*, contained in the per-package variable
|
(2) A package's *import domain*, contained in the per-package variable
|
||||||
__domain__, defines a list of *packages* that are searched (using
|
__domain__, defines a list of *packages* that are searched (using
|
||||||
their respective module search paths) to satisfy imports. It is
|
their respective module search paths) to satisfy imports. It is
|
||||||
initialized to the list cosisting of the package itself, its parent
|
initialized to the list consisting of the package itself, its parent
|
||||||
package, its parent's parent, and so on, ending with the root package
|
package, its parent's parent, and so on, ending with the root package
|
||||||
(the nameless package containing all top-level packages and modules,
|
(the nameless package containing all top-level packages and modules,
|
||||||
whose module search path is None, implying sys.path).
|
whose module search path is None, implying sys.path).
|
||||||
|
|
|
@ -36,7 +36,7 @@ class FileDialog:
|
||||||
and pattern arguments, overriding the values passed in (it does
|
and pattern arguments, overriding the values passed in (it does
|
||||||
not keep track of the default argument!). If no key is specified,
|
not keep track of the default argument!). If no key is specified,
|
||||||
the dialog keeps no memory of previous state. Note that memory is
|
the dialog keeps no memory of previous state. Note that memory is
|
||||||
kept even when the dialog is cancelled. (All this emulates the
|
kept even when the dialog is canceled. (All this emulates the
|
||||||
behavior of the Macintosh file selection dialogs.)
|
behavior of the Macintosh file selection dialogs.)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -277,7 +277,7 @@ class Tester:
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def dnd_enter(self, source, event):
|
def dnd_enter(self, source, event):
|
||||||
self.canvas.focus_set() # Show higlight border
|
self.canvas.focus_set() # Show highlight border
|
||||||
x, y = source.where(self.canvas, event)
|
x, y = source.where(self.canvas, event)
|
||||||
x1, y1, x2, y2 = source.canvas.bbox(source.id)
|
x1, y1, x2, y2 = source.canvas.bbox(source.id)
|
||||||
dx, dy = x2-x1, y2-y1
|
dx, dy = x2-x1, y2-y1
|
||||||
|
|
|
@ -117,7 +117,7 @@ class Event:
|
||||||
Enter, KeyPress, KeyRelease,
|
Enter, KeyPress, KeyRelease,
|
||||||
Leave, Motion)
|
Leave, Motion)
|
||||||
state - state as a string (Visibility)
|
state - state as a string (Visibility)
|
||||||
time - when the event occured
|
time - when the event occurred
|
||||||
x - x-position of the mouse
|
x - x-position of the mouse
|
||||||
y - y-position of the mouse
|
y - y-position of the mouse
|
||||||
x_root - x-position of the mouse on the screen
|
x_root - x-position of the mouse on the screen
|
||||||
|
@ -129,7 +129,7 @@ class Event:
|
||||||
keysym - keysym of the the event as a string (KeyPress, KeyRelease)
|
keysym - keysym of the the event as a string (KeyPress, KeyRelease)
|
||||||
keysym_num - keysym of the event as a number (KeyPress, KeyRelease)
|
keysym_num - keysym of the event as a number (KeyPress, KeyRelease)
|
||||||
type - type of the event as a number
|
type - type of the event as a number
|
||||||
widget - widget in which the event occured
|
widget - widget in which the event occurred
|
||||||
delta - delta of wheel movement (MouseWheel)
|
delta - delta of wheel movement (MouseWheel)
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
@ -409,7 +409,7 @@ class Misc:
|
||||||
The focus order first goes to the next child, then to
|
The focus order first goes to the next child, then to
|
||||||
the children of the child recursively and then to the
|
the children of the child recursively and then to the
|
||||||
next sibling which is higher in the stacking order. A
|
next sibling which is higher in the stacking order. A
|
||||||
widget is ommited if it has the takefocus resource set
|
widget is omitted if it has the takefocus resource set
|
||||||
to 0."""
|
to 0."""
|
||||||
name = self.tk.call('tk_focusNext', self._w)
|
name = self.tk.call('tk_focusNext', self._w)
|
||||||
if not name: return None
|
if not name: return None
|
||||||
|
@ -529,7 +529,7 @@ class Misc:
|
||||||
def option_readfile(self, fileName, priority = None):
|
def option_readfile(self, fileName, priority = None):
|
||||||
"""Read file FILENAME into the option database.
|
"""Read file FILENAME into the option database.
|
||||||
|
|
||||||
An optional second paramter gives the numeric
|
An optional second parameter gives the numeric
|
||||||
priority."""
|
priority."""
|
||||||
self.tk.call('option', 'readfile', fileName, priority)
|
self.tk.call('option', 'readfile', fileName, priority)
|
||||||
def selection_clear(self, **kw):
|
def selection_clear(self, **kw):
|
||||||
|
@ -639,7 +639,7 @@ class Misc:
|
||||||
"""Return geometry string for this widget in the form "widthxheight+X+Y"."""
|
"""Return geometry string for this widget in the form "widthxheight+X+Y"."""
|
||||||
return self.tk.call('winfo', 'geometry', self._w)
|
return self.tk.call('winfo', 'geometry', self._w)
|
||||||
def winfo_height(self):
|
def winfo_height(self):
|
||||||
"""Return heigth of this widget."""
|
"""Return height of this widget."""
|
||||||
return getint(
|
return getint(
|
||||||
self.tk.call('winfo', 'height', self._w))
|
self.tk.call('winfo', 'height', self._w))
|
||||||
def winfo_id(self):
|
def winfo_id(self):
|
||||||
|
@ -754,7 +754,7 @@ class Misc:
|
||||||
return self._nametowidget(self.tk.call(
|
return self._nametowidget(self.tk.call(
|
||||||
'winfo', 'toplevel', self._w))
|
'winfo', 'toplevel', self._w))
|
||||||
def winfo_viewable(self):
|
def winfo_viewable(self):
|
||||||
"""Return true if the widget and all its higher anchestors are mapped."""
|
"""Return true if the widget and all its higher ancestors are mapped."""
|
||||||
return getint(
|
return getint(
|
||||||
self.tk.call('winfo', 'viewable', self._w))
|
self.tk.call('winfo', 'viewable', self._w))
|
||||||
def winfo_visual(self):
|
def winfo_visual(self):
|
||||||
|
@ -1135,7 +1135,7 @@ class Misc:
|
||||||
cell. If COL2 and ROW2 are given the bounding box
|
cell. If COL2 and ROW2 are given the bounding box
|
||||||
starts at that cell.
|
starts at that cell.
|
||||||
|
|
||||||
The returned integers specify the offset of the uppler left
|
The returned integers specify the offset of the upper left
|
||||||
corner in the master widget and the width and height.
|
corner in the master widget and the width and height.
|
||||||
"""
|
"""
|
||||||
args = ('grid', 'bbox', self._w)
|
args = ('grid', 'bbox', self._w)
|
||||||
|
@ -1268,7 +1268,7 @@ class Misc:
|
||||||
|
|
||||||
class CallWrapper:
|
class CallWrapper:
|
||||||
"""Internal class. Stores function to call when some user
|
"""Internal class. Stores function to call when some user
|
||||||
defined Tcl function is called e.g. after an event occured."""
|
defined Tcl function is called e.g. after an event occurred."""
|
||||||
def __init__(self, func, subst, widget):
|
def __init__(self, func, subst, widget):
|
||||||
"""Store FUNC, SUBST and WIDGET as members."""
|
"""Store FUNC, SUBST and WIDGET as members."""
|
||||||
self.func = func
|
self.func = func
|
||||||
|
@ -1316,7 +1316,7 @@ class Wm:
|
||||||
def wm_command(self, value=None):
|
def wm_command(self, value=None):
|
||||||
"""Store VALUE in WM_COMMAND property. It is the command
|
"""Store VALUE in WM_COMMAND property. It is the command
|
||||||
which shall be used to invoke the application. Return current
|
which shall be used to invoke the application. Return current
|
||||||
commmand if VALUE is None."""
|
command if VALUE is None."""
|
||||||
return self.tk.call('wm', 'command', self._w, value)
|
return self.tk.call('wm', 'command', self._w, value)
|
||||||
command = wm_command
|
command = wm_command
|
||||||
def wm_deiconify(self):
|
def wm_deiconify(self):
|
||||||
|
@ -1335,7 +1335,7 @@ class Wm:
|
||||||
return self.tk.call('wm', 'frame', self._w)
|
return self.tk.call('wm', 'frame', self._w)
|
||||||
frame = wm_frame
|
frame = wm_frame
|
||||||
def wm_geometry(self, newGeometry=None):
|
def wm_geometry(self, newGeometry=None):
|
||||||
"""Set geometry to NEWGEOMETRY of the form =widthxheigth+x+y. Return
|
"""Set geometry to NEWGEOMETRY of the form =widthxheight+x+y. Return
|
||||||
current value if None is given."""
|
current value if None is given."""
|
||||||
return self.tk.call('wm', 'geometry', self._w, newGeometry)
|
return self.tk.call('wm', 'geometry', self._w, newGeometry)
|
||||||
geometry = wm_geometry
|
geometry = wm_geometry
|
||||||
|
@ -1623,7 +1623,7 @@ class Place:
|
||||||
relative to width of master (1.0 is the same width
|
relative to width of master (1.0 is the same width
|
||||||
as the master)
|
as the master)
|
||||||
relheight=amount - height of this widget between 0.0 and 1.0
|
relheight=amount - height of this widget between 0.0 and 1.0
|
||||||
relative to heigth of master (1.0 is the same
|
relative to height of master (1.0 is the same
|
||||||
height as the master)
|
height as the master)
|
||||||
bordermode="inside" or "outside" - whether to take border width of master widget
|
bordermode="inside" or "outside" - whether to take border width of master widget
|
||||||
into account
|
into account
|
||||||
|
@ -1913,12 +1913,12 @@ class Canvas(Widget):
|
||||||
sequence, func, add)
|
sequence, func, add)
|
||||||
def canvasx(self, screenx, gridspacing=None):
|
def canvasx(self, screenx, gridspacing=None):
|
||||||
"""Return the canvas x coordinate of pixel position SCREENX rounded
|
"""Return the canvas x coordinate of pixel position SCREENX rounded
|
||||||
to nearest muliple of GRIDSPACING units."""
|
to nearest multiple of GRIDSPACING units."""
|
||||||
return getdouble(self.tk.call(
|
return getdouble(self.tk.call(
|
||||||
self._w, 'canvasx', screenx, gridspacing))
|
self._w, 'canvasx', screenx, gridspacing))
|
||||||
def canvasy(self, screeny, gridspacing=None):
|
def canvasy(self, screeny, gridspacing=None):
|
||||||
"""Return the canvas y coordinate of pixel position SCREENY rounded
|
"""Return the canvas y coordinate of pixel position SCREENY rounded
|
||||||
to nearest muliple of GRIDSPACING units."""
|
to nearest multiple of GRIDSPACING units."""
|
||||||
return getdouble(self.tk.call(
|
return getdouble(self.tk.call(
|
||||||
self._w, 'canvasy', screeny, gridspacing))
|
self._w, 'canvasy', screeny, gridspacing))
|
||||||
def coords(self, *args):
|
def coords(self, *args):
|
||||||
|
@ -2609,7 +2609,7 @@ class Text(Widget):
|
||||||
width, wrap, xscrollcommand, yscrollcommand."""
|
width, wrap, xscrollcommand, yscrollcommand."""
|
||||||
Widget.__init__(self, master, 'text', cnf, kw)
|
Widget.__init__(self, master, 'text', cnf, kw)
|
||||||
def bbox(self, *args):
|
def bbox(self, *args):
|
||||||
"""Return a tuple of (x,y,width,heigth) which gives the bounding
|
"""Return a tuple of (x,y,width,height) which gives the bounding
|
||||||
box of the visible part of the character at the index in ARGS."""
|
box of the visible part of the character at the index in ARGS."""
|
||||||
return self._getints(
|
return self._getints(
|
||||||
self.tk.call((self._w, 'bbox') + args)) or None
|
self.tk.call((self._w, 'bbox') + args)) or None
|
||||||
|
@ -2674,7 +2674,7 @@ class Text(Widget):
|
||||||
"""Return the index in the form line.char for INDEX."""
|
"""Return the index in the form line.char for INDEX."""
|
||||||
return self.tk.call(self._w, 'index', index)
|
return self.tk.call(self._w, 'index', index)
|
||||||
def insert(self, index, chars, *args):
|
def insert(self, index, chars, *args):
|
||||||
"""Insert CHARS before the charaters at INDEX. An additional
|
"""Insert CHARS before the characters at INDEX. An additional
|
||||||
tag can be given in ARGS. Additional CHARS and tags can follow in ARGS."""
|
tag can be given in ARGS. Additional CHARS and tags can follow in ARGS."""
|
||||||
self.tk.call((self._w, 'insert', index, chars) + args)
|
self.tk.call((self._w, 'insert', index, chars) + args)
|
||||||
def mark_gravity(self, markName, direction=None):
|
def mark_gravity(self, markName, direction=None):
|
||||||
|
@ -2728,7 +2728,7 @@ class Text(Widget):
|
||||||
self.tk.call(self._w, 'see', index)
|
self.tk.call(self._w, 'see', index)
|
||||||
def tag_add(self, tagName, index1, *args):
|
def tag_add(self, tagName, index1, *args):
|
||||||
"""Add tag TAGNAME to all characters between INDEX1 and index2 in ARGS.
|
"""Add tag TAGNAME to all characters between INDEX1 and index2 in ARGS.
|
||||||
Addtional pairs of indices may follow in ARGS."""
|
Additional pairs of indices may follow in ARGS."""
|
||||||
self.tk.call(
|
self.tk.call(
|
||||||
(self._w, 'tag', 'add', tagName, index1) + args)
|
(self._w, 'tag', 'add', tagName, index1) + args)
|
||||||
def tag_unbind(self, tagName, sequence, funcid=None):
|
def tag_unbind(self, tagName, sequence, funcid=None):
|
||||||
|
|
|
@ -48,7 +48,7 @@ class Chooser(Dialog):
|
||||||
# to simplify application code, the color chooser returns
|
# to simplify application code, the color chooser returns
|
||||||
# an RGB tuple together with the Tk color string
|
# an RGB tuple together with the Tk color string
|
||||||
if not result:
|
if not result:
|
||||||
return None, None # cancelled
|
return None, None # canceled
|
||||||
r, g, b = widget.winfo_rgb(result)
|
r, g, b = widget.winfo_rgb(result)
|
||||||
return (r/256, g/256, b/256), result
|
return (r/256, g/256, b/256), result
|
||||||
|
|
||||||
|
|
|
@ -268,7 +268,7 @@ def getdefaultlocale(envvars=('LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG')):
|
||||||
setlocale(LC_ALL, "") runs using the portable 'C' locale.
|
setlocale(LC_ALL, "") runs using the portable 'C' locale.
|
||||||
Calling setlocale(LC_ALL, "") lets it use the default locale as
|
Calling setlocale(LC_ALL, "") lets it use the default locale as
|
||||||
defined by the LANG variable. Since we don't want to interfere
|
defined by the LANG variable. Since we don't want to interfere
|
||||||
with the current locale setting we thus emulate the behaviour
|
with the current locale setting we thus emulate the behavior
|
||||||
in the way described above.
|
in the way described above.
|
||||||
|
|
||||||
To maintain compatibility with other platforms, not only the
|
To maintain compatibility with other platforms, not only the
|
||||||
|
|
|
@ -627,7 +627,7 @@ class Folder:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def removefromallsequences(self, list):
|
def removefromallsequences(self, list):
|
||||||
"""Remove one or more messages from all sequeuces (including last)
|
"""Remove one or more messages from all sequences (including last)
|
||||||
-- but not from 'cur'!!!"""
|
-- but not from 'cur'!!!"""
|
||||||
if hasattr(self, 'last') and self.last in list:
|
if hasattr(self, 'last') and self.last in list:
|
||||||
del self.last
|
del self.last
|
||||||
|
|
|
@ -21,7 +21,7 @@ fp.pop()
|
||||||
The latter sequence may be used recursively at (A).
|
The latter sequence may be used recursively at (A).
|
||||||
It is also allowed to use multiple push()...pop() sequences.
|
It is also allowed to use multiple push()...pop() sequences.
|
||||||
|
|
||||||
If seekable is given as 0, the class code will not do the bookeeping
|
If seekable is given as 0, the class code will not do the bookkeeping
|
||||||
it normally attempts in order to make seeks relative to the beginning of the
|
it normally attempts in order to make seeks relative to the beginning of the
|
||||||
current file part. This may be useful when using MultiFile with a non-
|
current file part. This may be useful when using MultiFile with a non-
|
||||||
seekable stream object.
|
seekable stream object.
|
||||||
|
|
|
@ -219,7 +219,7 @@ class NNTP:
|
||||||
- date: string 'yymmdd' indicating the date
|
- date: string 'yymmdd' indicating the date
|
||||||
- time: string 'hhmmss' indicating the time
|
- time: string 'hhmmss' indicating the time
|
||||||
Return:
|
Return:
|
||||||
- resp: server response if succesful
|
- resp: server response if successful
|
||||||
- list: list of newsgroup names"""
|
- list: list of newsgroup names"""
|
||||||
|
|
||||||
return self.longcmd('NEWGROUPS ' + date + ' ' + time)
|
return self.longcmd('NEWGROUPS ' + date + ' ' + time)
|
||||||
|
@ -230,7 +230,7 @@ class NNTP:
|
||||||
- date: string 'yymmdd' indicating the date
|
- date: string 'yymmdd' indicating the date
|
||||||
- time: string 'hhmmss' indicating the time
|
- time: string 'hhmmss' indicating the time
|
||||||
Return:
|
Return:
|
||||||
- resp: server response if succesful
|
- resp: server response if successful
|
||||||
- list: list of article ids"""
|
- list: list of article ids"""
|
||||||
|
|
||||||
cmd = 'NEWNEWS ' + group + ' ' + date + ' ' + time
|
cmd = 'NEWNEWS ' + group + ' ' + date + ' ' + time
|
||||||
|
@ -238,7 +238,7 @@ class NNTP:
|
||||||
|
|
||||||
def list(self):
|
def list(self):
|
||||||
"""Process a LIST command. Return:
|
"""Process a LIST command. Return:
|
||||||
- resp: server response if succesful
|
- resp: server response if successful
|
||||||
- list: list of (group, last, first, flag) (strings)"""
|
- list: list of (group, last, first, flag) (strings)"""
|
||||||
|
|
||||||
resp, list = self.longcmd('LIST')
|
resp, list = self.longcmd('LIST')
|
||||||
|
@ -251,7 +251,7 @@ class NNTP:
|
||||||
"""Process a GROUP command. Argument:
|
"""Process a GROUP command. Argument:
|
||||||
- group: the group name
|
- group: the group name
|
||||||
Returns:
|
Returns:
|
||||||
- resp: server response if succesful
|
- resp: server response if successful
|
||||||
- count: number of articles (string)
|
- count: number of articles (string)
|
||||||
- first: first article number (string)
|
- first: first article number (string)
|
||||||
- last: last article number (string)
|
- last: last article number (string)
|
||||||
|
@ -275,7 +275,7 @@ class NNTP:
|
||||||
|
|
||||||
def help(self):
|
def help(self):
|
||||||
"""Process a HELP command. Returns:
|
"""Process a HELP command. Returns:
|
||||||
- resp: server response if succesful
|
- resp: server response if successful
|
||||||
- list: list of strings"""
|
- list: list of strings"""
|
||||||
|
|
||||||
return self.longcmd('HELP')
|
return self.longcmd('HELP')
|
||||||
|
@ -303,7 +303,7 @@ class NNTP:
|
||||||
"""Process a STAT command. Argument:
|
"""Process a STAT command. Argument:
|
||||||
- id: article number or message id
|
- id: article number or message id
|
||||||
Returns:
|
Returns:
|
||||||
- resp: server response if succesful
|
- resp: server response if successful
|
||||||
- nr: the article number
|
- nr: the article number
|
||||||
- id: the article id"""
|
- id: the article id"""
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ class NNTP:
|
||||||
"""Process a HEAD command. Argument:
|
"""Process a HEAD command. Argument:
|
||||||
- id: article number or message id
|
- id: article number or message id
|
||||||
Returns:
|
Returns:
|
||||||
- resp: server response if succesful
|
- resp: server response if successful
|
||||||
- nr: article number
|
- nr: article number
|
||||||
- id: message id
|
- id: message id
|
||||||
- list: the lines of the article's header"""
|
- list: the lines of the article's header"""
|
||||||
|
@ -338,7 +338,7 @@ class NNTP:
|
||||||
"""Process a BODY command. Argument:
|
"""Process a BODY command. Argument:
|
||||||
- id: article number or message id
|
- id: article number or message id
|
||||||
Returns:
|
Returns:
|
||||||
- resp: server response if succesful
|
- resp: server response if successful
|
||||||
- nr: article number
|
- nr: article number
|
||||||
- id: message id
|
- id: message id
|
||||||
- list: the lines of the article's body"""
|
- list: the lines of the article's body"""
|
||||||
|
@ -349,7 +349,7 @@ class NNTP:
|
||||||
"""Process an ARTICLE command. Argument:
|
"""Process an ARTICLE command. Argument:
|
||||||
- id: article number or message id
|
- id: article number or message id
|
||||||
Returns:
|
Returns:
|
||||||
- resp: server response if succesful
|
- resp: server response if successful
|
||||||
- nr: article number
|
- nr: article number
|
||||||
- id: message id
|
- id: message id
|
||||||
- list: the lines of the article"""
|
- list: the lines of the article"""
|
||||||
|
@ -358,7 +358,7 @@ class NNTP:
|
||||||
|
|
||||||
def slave(self):
|
def slave(self):
|
||||||
"""Process a SLAVE command. Returns:
|
"""Process a SLAVE command. Returns:
|
||||||
- resp: server response if succesful"""
|
- resp: server response if successful"""
|
||||||
|
|
||||||
return self.shortcmd('SLAVE')
|
return self.shortcmd('SLAVE')
|
||||||
|
|
||||||
|
@ -367,7 +367,7 @@ class NNTP:
|
||||||
- hdr: the header type (e.g. 'subject')
|
- hdr: the header type (e.g. 'subject')
|
||||||
- str: an article nr, a message id, or a range nr1-nr2
|
- str: an article nr, a message id, or a range nr1-nr2
|
||||||
Returns:
|
Returns:
|
||||||
- resp: server response if succesful
|
- resp: server response if successful
|
||||||
- list: list of (nr, value) strings"""
|
- list: list of (nr, value) strings"""
|
||||||
|
|
||||||
pat = re.compile('^([0-9]+) ?(.*)\n?')
|
pat = re.compile('^([0-9]+) ?(.*)\n?')
|
||||||
|
@ -384,7 +384,7 @@ class NNTP:
|
||||||
- start: start of range
|
- start: start of range
|
||||||
- end: end of range
|
- end: end of range
|
||||||
Returns:
|
Returns:
|
||||||
- resp: server response if succesful
|
- resp: server response if successful
|
||||||
- list: list of (art-nr, subject, poster, date,
|
- list: list of (art-nr, subject, poster, date,
|
||||||
id, references, size, lines)"""
|
id, references, size, lines)"""
|
||||||
|
|
||||||
|
@ -409,7 +409,7 @@ class NNTP:
|
||||||
"""Process an XGTITLE command (optional server extension) Arguments:
|
"""Process an XGTITLE command (optional server extension) Arguments:
|
||||||
- group: group name wildcard (i.e. news.*)
|
- group: group name wildcard (i.e. news.*)
|
||||||
Returns:
|
Returns:
|
||||||
- resp: server response if succesful
|
- resp: server response if successful
|
||||||
- list: list of (name,title) strings"""
|
- list: list of (name,title) strings"""
|
||||||
|
|
||||||
line_pat = re.compile("^([^ \t]+)[ \t]+(.*)$")
|
line_pat = re.compile("^([^ \t]+)[ \t]+(.*)$")
|
||||||
|
@ -425,7 +425,7 @@ class NNTP:
|
||||||
"""Process an XPATH command (optional server extension) Arguments:
|
"""Process an XPATH command (optional server extension) Arguments:
|
||||||
- id: Message id of article
|
- id: Message id of article
|
||||||
Returns:
|
Returns:
|
||||||
resp: server response if succesful
|
resp: server response if successful
|
||||||
path: directory path to article"""
|
path: directory path to article"""
|
||||||
|
|
||||||
resp = self.shortcmd("XPATH " + id)
|
resp = self.shortcmd("XPATH " + id)
|
||||||
|
@ -442,7 +442,7 @@ class NNTP:
|
||||||
"""Process the DATE command. Arguments:
|
"""Process the DATE command. Arguments:
|
||||||
None
|
None
|
||||||
Returns:
|
Returns:
|
||||||
resp: server response if succesful
|
resp: server response if successful
|
||||||
date: Date suitable for newnews/newgroups commands etc.
|
date: Date suitable for newnews/newgroups commands etc.
|
||||||
time: Time suitable for newnews/newgroups commands etc."""
|
time: Time suitable for newnews/newgroups commands etc."""
|
||||||
|
|
||||||
|
@ -463,7 +463,7 @@ class NNTP:
|
||||||
"""Process a POST command. Arguments:
|
"""Process a POST command. Arguments:
|
||||||
- f: file containing the article
|
- f: file containing the article
|
||||||
Returns:
|
Returns:
|
||||||
- resp: server response if succesful"""
|
- resp: server response if successful"""
|
||||||
|
|
||||||
resp = self.shortcmd('POST')
|
resp = self.shortcmd('POST')
|
||||||
# Raises error_??? if posting is not allowed
|
# Raises error_??? if posting is not allowed
|
||||||
|
@ -486,7 +486,7 @@ class NNTP:
|
||||||
- id: message-id of the article
|
- id: message-id of the article
|
||||||
- f: file containing the article
|
- f: file containing the article
|
||||||
Returns:
|
Returns:
|
||||||
- resp: server response if succesful
|
- resp: server response if successful
|
||||||
Note that if the server refuses the article an exception is raised."""
|
Note that if the server refuses the article an exception is raised."""
|
||||||
|
|
||||||
resp = self.shortcmd('IHAVE ' + id)
|
resp = self.shortcmd('IHAVE ' + id)
|
||||||
|
@ -507,7 +507,7 @@ class NNTP:
|
||||||
|
|
||||||
def quit(self):
|
def quit(self):
|
||||||
"""Process a QUIT command and close the socket. Returns:
|
"""Process a QUIT command and close the socket. Returns:
|
||||||
- resp: server response if succesful"""
|
- resp: server response if successful"""
|
||||||
|
|
||||||
resp = self.shortcmd('QUIT')
|
resp = self.shortcmd('QUIT')
|
||||||
self.file.close()
|
self.file.close()
|
||||||
|
|
|
@ -218,7 +218,7 @@ def execvp(file, args):
|
||||||
|
|
||||||
Execute the executable file (which is searched for along $PATH)
|
Execute the executable file (which is searched for along $PATH)
|
||||||
with argument list args, replacing the current process.
|
with argument list args, replacing the current process.
|
||||||
args may be a list or tupe of strings. """
|
args may be a list or tuple of strings. """
|
||||||
_execvpe(file, args)
|
_execvpe(file, args)
|
||||||
|
|
||||||
def execvpe(file, args, env):
|
def execvpe(file, args, env):
|
||||||
|
@ -227,7 +227,7 @@ def execvpe(file, args, env):
|
||||||
Execute the executable file (which is searched for along $PATH)
|
Execute the executable file (which is searched for along $PATH)
|
||||||
with argument list args and environment env , replacing the
|
with argument list args and environment env , replacing the
|
||||||
current process.
|
current process.
|
||||||
args may be a list or tupe of strings. """
|
args may be a list or tuple of strings. """
|
||||||
_execvpe(file, args, env)
|
_execvpe(file, args, env)
|
||||||
|
|
||||||
_notfound = None
|
_notfound = None
|
||||||
|
|
|
@ -191,7 +191,7 @@ class Pdb(bdb.Bdb, cmd.Cmd):
|
||||||
if bp:
|
if bp:
|
||||||
bp.bpprint()
|
bp.bpprint()
|
||||||
return
|
return
|
||||||
# parse arguments; comma has lowest precendence
|
# parse arguments; comma has lowest precedence
|
||||||
# and cannot occur in filename
|
# and cannot occur in filename
|
||||||
filename = None
|
filename = None
|
||||||
lineno = None
|
lineno = None
|
||||||
|
|
|
@ -59,7 +59,7 @@ class POP3:
|
||||||
POP3(hostname, port=110)
|
POP3(hostname, port=110)
|
||||||
|
|
||||||
NB: the POP protocol locks the mailbox from user
|
NB: the POP protocol locks the mailbox from user
|
||||||
authorisation until QUIT, so be sure to get in, suck
|
authorization until QUIT, so be sure to get in, suck
|
||||||
the messages, and quit, each time you access the
|
the messages, and quit, each time you access the
|
||||||
mailbox.
|
mailbox.
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# This is a simple little module I wrote to make life easier. I didn't
|
# This is a simple little module I wrote to make life easier. I didn't
|
||||||
# see anything quite like it in the library, though I may have overlooked
|
# see anything quite like it in the library, though I may have overlooked
|
||||||
# something. I wrote this when I was trying to read some heavily nested
|
# something. I wrote this when I was trying to read some heavily nested
|
||||||
# tuples with fairly non-descriptive content. This is modelled very much
|
# tuples with fairly non-descriptive content. This is modeled very much
|
||||||
# after Lisp/Scheme - style pretty-printing of lists. If you find it
|
# after Lisp/Scheme - style pretty-printing of lists. If you find it
|
||||||
# useful, thank small children who sleep at night.
|
# useful, thank small children who sleep at night.
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ Some of the functions in this module takes flags as optional parameters:
|
||||||
M MULTILINE "^" matches the beginning of lines as well as the string.
|
M MULTILINE "^" matches the beginning of lines as well as the string.
|
||||||
"$" matches the end of lines as well as the string.
|
"$" matches the end of lines as well as the string.
|
||||||
S DOTALL "." matches any character at all, including the newline.
|
S DOTALL "." matches any character at all, including the newline.
|
||||||
X VERBOSE Ignore whitespaces and comments for nicer looking RE's.
|
X VERBOSE Ignore whitespace and comments for nicer looking RE's.
|
||||||
|
|
||||||
This module also defines an exception 'error'.
|
This module also defines an exception 'error'.
|
||||||
|
|
||||||
|
|
|
@ -98,9 +98,9 @@ class Profile:
|
||||||
subfunctions
|
subfunctions
|
||||||
[ 2] = Cumulative time spent in this frame's function, including time in
|
[ 2] = Cumulative time spent in this frame's function, including time in
|
||||||
all subfunctions to this frame.
|
all subfunctions to this frame.
|
||||||
[-3] = Name of the function that corresonds to this frame.
|
[-3] = Name of the function that corresponds to this frame.
|
||||||
[-2] = Actual frame that we correspond to (used to sync exception handling)
|
[-2] = Actual frame that we correspond to (used to sync exception handling)
|
||||||
[-1] = Our parent 6-tuple (corresonds to frame.f_back)
|
[-1] = Our parent 6-tuple (corresponds to frame.f_back)
|
||||||
|
|
||||||
Timing data for each function is stored as a 5-tuple in the dictionary
|
Timing data for each function is stored as a 5-tuple in the dictionary
|
||||||
self.timings[]. The index is always the name stored in self.cur[4].
|
self.timings[]. The index is always the name stored in self.cur[4].
|
||||||
|
@ -205,7 +205,7 @@ class Profile:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
# SLOW generic dispatch rountine for timer returning lists of numbers
|
# SLOW generic dispatch routine for timer returning lists of numbers
|
||||||
|
|
||||||
def trace_dispatch_l(self, frame, event, arg):
|
def trace_dispatch_l(self, frame, event, arg):
|
||||||
t = self.get_time() - self.t
|
t = self.get_time() - self.t
|
||||||
|
@ -368,7 +368,7 @@ class Profile:
|
||||||
#******************************************************************
|
#******************************************************************
|
||||||
# The following calculates the overhead for using a profiler. The
|
# The following calculates the overhead for using a profiler. The
|
||||||
# problem is that it takes a fair amount of time for the profiler
|
# problem is that it takes a fair amount of time for the profiler
|
||||||
# to stop the stopwatch (from the time it recieves an event).
|
# to stop the stopwatch (from the time it receives an event).
|
||||||
# Similarly, there is a delay from the time that the profiler
|
# Similarly, there is a delay from the time that the profiler
|
||||||
# re-starts the stopwatch before the user's code really gets to
|
# re-starts the stopwatch before the user's code really gets to
|
||||||
# continue. The following code tries to measure the difference on
|
# continue. The following code tries to measure the difference on
|
||||||
|
|
|
@ -49,16 +49,16 @@ class Stats:
|
||||||
The big change from the previous Profiler (in terms of raw functionality)
|
The big change from the previous Profiler (in terms of raw functionality)
|
||||||
is that an "add()" method has been provided to combine Stats from
|
is that an "add()" method has been provided to combine Stats from
|
||||||
several distinct profile runs. Both the constructor and the add()
|
several distinct profile runs. Both the constructor and the add()
|
||||||
method now take arbitrarilly many file names as arguments.
|
method now take arbitrarily many file names as arguments.
|
||||||
|
|
||||||
All the print methods now take an argument that indicats how many lines
|
All the print methods now take an argument that indicates how many lines
|
||||||
to print. If the arg is a floating point number between 0 and 1.0, then
|
to print. If the arg is a floating point number between 0 and 1.0, then
|
||||||
it is taken as a decimal percentage of the availabel lines to be printed
|
it is taken as a decimal percentage of the available lines to be printed
|
||||||
(e.g., .1 means print 10% of all available lines). If it is an integer,
|
(e.g., .1 means print 10% of all available lines). If it is an integer,
|
||||||
it is taken to mean the number of lines of data that you wish to have
|
it is taken to mean the number of lines of data that you wish to have
|
||||||
printed.
|
printed.
|
||||||
|
|
||||||
The sort_stats() method now processes some additionaly options (i.e., in
|
The sort_stats() method now processes some additional options (i.e., in
|
||||||
addition to the old -1, 0, 1, or 2). It takes an arbitrary number of quoted
|
addition to the old -1, 0, 1, or 2). It takes an arbitrary number of quoted
|
||||||
strings to select the sort order. For example sort_stats('time', 'name')
|
strings to select the sort order. For example sort_stats('time', 'name')
|
||||||
sorts on the major key of "internal function time", and on the minor
|
sorts on the major key of "internal function time", and on the minor
|
||||||
|
@ -165,7 +165,7 @@ class Stats:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# list the tuple indicies and directions for sorting,
|
# list the tuple indices and directions for sorting,
|
||||||
# along with some printable description
|
# along with some printable description
|
||||||
sort_arg_dict_default = {\
|
sort_arg_dict_default = {\
|
||||||
"calls" : (((1,-1), ), "call count"),\
|
"calls" : (((1,-1), ), "call count"),\
|
||||||
|
@ -447,7 +447,7 @@ class Stats:
|
||||||
|
|
||||||
class TupleComp:
|
class TupleComp:
|
||||||
"""This class provides a generic function for comparing any two tuples.
|
"""This class provides a generic function for comparing any two tuples.
|
||||||
Each instance records a list of tuple-indicies (from most significant
|
Each instance records a list of tuple-indices (from most significant
|
||||||
to least significant), and sort direction (ascending or decending) for
|
to least significant), and sort direction (ascending or decending) for
|
||||||
each tuple-index. The compare functions can then be used as the function
|
each tuple-index. The compare functions can then be used as the function
|
||||||
argument to the system sort() function when a list of tuples need to be
|
argument to the system sort() function when a list of tuples need to be
|
||||||
|
|
|
@ -193,7 +193,7 @@ class Message:
|
||||||
|
|
||||||
You may override this method if your application wants
|
You may override this method if your application wants
|
||||||
to bend the rules, e.g. to strip trailing whitespace,
|
to bend the rules, e.g. to strip trailing whitespace,
|
||||||
or to recognise MH template separators ('--------').
|
or to recognize MH template separators ('--------').
|
||||||
For convenience (e.g. for code reading from sockets) a
|
For convenience (e.g. for code reading from sockets) a
|
||||||
line consisting of \r\n also matches.
|
line consisting of \r\n also matches.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -84,7 +84,7 @@ class Completer:
|
||||||
"""Compute matches when text contains a dot.
|
"""Compute matches when text contains a dot.
|
||||||
|
|
||||||
Assuming the text is of the form NAME.NAME....[NAME], and is
|
Assuming the text is of the form NAME.NAME....[NAME], and is
|
||||||
evaluabable in the globals of __main__, it will be evaluated
|
evaluatable in the globals of __main__, it will be evaluated
|
||||||
and its attributes (as revealed by dir()) are used as possible
|
and its attributes (as revealed by dir()) are used as possible
|
||||||
completions. (For class instances, class members are are also
|
completions. (For class instances, class members are are also
|
||||||
considered.)
|
considered.)
|
||||||
|
|
|
@ -88,7 +88,7 @@ class SMTPSenderRefused(SMTPResponseException):
|
||||||
|
|
||||||
class SMTPRecipientsRefused(SMTPException):
|
class SMTPRecipientsRefused(SMTPException):
|
||||||
"""All recipient addresses refused.
|
"""All recipient addresses refused.
|
||||||
The errors for each recipient are accessable thru the attribute
|
The errors for each recipient are accessible through the attribute
|
||||||
'recipients', which is a dictionary of exactly the same sort as
|
'recipients', which is a dictionary of exactly the same sort as
|
||||||
SMTP.sendmail() returns.
|
SMTP.sendmail() returns.
|
||||||
"""
|
"""
|
||||||
|
@ -323,7 +323,7 @@ class SMTP:
|
||||||
if code<>250:
|
if code<>250:
|
||||||
return (code,msg)
|
return (code,msg)
|
||||||
self.does_esmtp=1
|
self.does_esmtp=1
|
||||||
#parse the ehlo responce -ddm
|
#parse the ehlo response -ddm
|
||||||
resp=string.split(self.ehlo_resp,'\n')
|
resp=string.split(self.ehlo_resp,'\n')
|
||||||
del resp[0]
|
del resp[0]
|
||||||
for each in resp:
|
for each in resp:
|
||||||
|
|
|
@ -172,7 +172,7 @@ CH_UNICODE = {
|
||||||
# flags
|
# flags
|
||||||
SRE_FLAG_TEMPLATE = 1 # template mode (disable backtracking)
|
SRE_FLAG_TEMPLATE = 1 # template mode (disable backtracking)
|
||||||
SRE_FLAG_IGNORECASE = 2 # case insensitive
|
SRE_FLAG_IGNORECASE = 2 # case insensitive
|
||||||
SRE_FLAG_LOCALE = 4 # honour system locale
|
SRE_FLAG_LOCALE = 4 # honor system locale
|
||||||
SRE_FLAG_MULTILINE = 8 # treat target as multiline string
|
SRE_FLAG_MULTILINE = 8 # treat target as multiline string
|
||||||
SRE_FLAG_DOTALL = 16 # treat target as a single string
|
SRE_FLAG_DOTALL = 16 # treat target as a single string
|
||||||
SRE_FLAG_UNICODE = 32 # use unicode locale
|
SRE_FLAG_UNICODE = 32 # use unicode locale
|
||||||
|
|
|
@ -116,7 +116,7 @@ def join(words, sep = ' '):
|
||||||
"""join(list [,sep]) -> string
|
"""join(list [,sep]) -> string
|
||||||
|
|
||||||
Return a string composed of the words in list, with
|
Return a string composed of the words in list, with
|
||||||
intervening occurences of sep. The default separator is a
|
intervening occurrences of sep. The default separator is a
|
||||||
single space.
|
single space.
|
||||||
|
|
||||||
(joinfields and join are synonymous)
|
(joinfields and join are synonymous)
|
||||||
|
|
|
@ -118,7 +118,7 @@ def join(words, sep = ' '):
|
||||||
"""join(list [,sep]) -> string
|
"""join(list [,sep]) -> string
|
||||||
|
|
||||||
Return a string composed of the words in list, with
|
Return a string composed of the words in list, with
|
||||||
intervening occurences of sep. The default separator is a
|
intervening occurrences of sep. The default separator is a
|
||||||
single space.
|
single space.
|
||||||
|
|
||||||
(joinfields and join are synonymous)
|
(joinfields and join are synonymous)
|
||||||
|
|
|
@ -63,7 +63,7 @@ This returns an instance of a class with the following public methods:
|
||||||
tell() -- return the current position
|
tell() -- return the current position
|
||||||
close() -- close the instance (make it unusable)
|
close() -- close the instance (make it unusable)
|
||||||
The position returned by tell() and the position given to setpos()
|
The position returned by tell() and the position given to setpos()
|
||||||
are compatible and have nothing to do with the actual postion in the
|
are compatible and have nothing to do with the actual position in the
|
||||||
file.
|
file.
|
||||||
The close() method is called automatically when the class instance
|
The close() method is called automatically when the class instance
|
||||||
is destroyed.
|
is destroyed.
|
||||||
|
@ -170,7 +170,7 @@ class Au_read:
|
||||||
if self._hdr_size < 24:
|
if self._hdr_size < 24:
|
||||||
raise Error, 'header size too small'
|
raise Error, 'header size too small'
|
||||||
if self._hdr_size > 100:
|
if self._hdr_size > 100:
|
||||||
raise Error, 'header size rediculously large'
|
raise Error, 'header size ridiculously large'
|
||||||
self._data_size = _read_u32(file)
|
self._data_size = _read_u32(file)
|
||||||
if self._data_size != AUDIO_UNKNOWN_SIZE:
|
if self._data_size != AUDIO_UNKNOWN_SIZE:
|
||||||
self._data_size = int(self._data_size)
|
self._data_size = int(self._data_size)
|
||||||
|
|
|
@ -42,7 +42,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0,
|
||||||
exclude=0, single=0, randomize=0):
|
exclude=0, single=0, randomize=0):
|
||||||
"""Execute a test suite.
|
"""Execute a test suite.
|
||||||
|
|
||||||
This also parses command-line options and modifies its behaviour
|
This also parses command-line options and modifies its behavior
|
||||||
accordingly.
|
accordingly.
|
||||||
|
|
||||||
tests -- a list of strings containing test names (optional)
|
tests -- a list of strings containing test names (optional)
|
||||||
|
|
|
@ -62,7 +62,7 @@ def main(use_rgbimg=1):
|
||||||
image = imageop.grey2rgb(greyimage, width, height)
|
image = imageop.grey2rgb(greyimage, width, height)
|
||||||
|
|
||||||
# Convert a 8-bit deep greyscale image to a 1-bit deep image by
|
# Convert a 8-bit deep greyscale image to a 1-bit deep image by
|
||||||
# tresholding all the pixels. The resulting image is tightly packed
|
# thresholding all the pixels. The resulting image is tightly packed
|
||||||
# and is probably only useful as an argument to mono2grey.
|
# and is probably only useful as an argument to mono2grey.
|
||||||
if verbose:
|
if verbose:
|
||||||
print 'grey2mono'
|
print 'grey2mono'
|
||||||
|
|
|
@ -66,7 +66,7 @@ if pid == pty.CHILD:
|
||||||
pass
|
pass
|
||||||
except:
|
except:
|
||||||
# We don't want this error to propagate, escape the call to
|
# We don't want this error to propagate, escape the call to
|
||||||
# os._exit(), and cause very peculiar behaviour in the calling
|
# os._exit(), and cause very peculiar behavior in the calling
|
||||||
# regrtest.py !
|
# regrtest.py !
|
||||||
debug("Some other error was raised.")
|
debug("Some other error was raised.")
|
||||||
os._exit(1)
|
os._exit(1)
|
||||||
|
|
|
@ -58,7 +58,7 @@ def WriteTestData(root_key):
|
||||||
def ReadTestData(root_key):
|
def ReadTestData(root_key):
|
||||||
# Check we can get default value for this key.
|
# Check we can get default value for this key.
|
||||||
val = QueryValue(root_key, test_key_name)
|
val = QueryValue(root_key, test_key_name)
|
||||||
assert val=="Default value", "Registry didnt give back the correct value"
|
assert val=="Default value", "Registry didn't give back the correct value"
|
||||||
|
|
||||||
key = OpenKey(root_key, test_key_name)
|
key = OpenKey(root_key, test_key_name)
|
||||||
# Read the sub-keys
|
# Read the sub-keys
|
||||||
|
@ -70,9 +70,9 @@ def ReadTestData(root_key):
|
||||||
data = EnumValue(sub_key, index)
|
data = EnumValue(sub_key, index)
|
||||||
except EnvironmentError:
|
except EnvironmentError:
|
||||||
break
|
break
|
||||||
assert data in test_data, "didnt read back the correct test data."
|
assert data in test_data, "Didn't read back the correct test data"
|
||||||
index = index + 1
|
index = index + 1
|
||||||
assert index==len(test_data), "Didnt read the correct number of items"
|
assert index==len(test_data), "Didn't read the correct number of items"
|
||||||
# Check I can directly access each item
|
# Check I can directly access each item
|
||||||
for value_name, value_data, value_type in test_data:
|
for value_name, value_data, value_type in test_data:
|
||||||
read_val, read_typ = QueryValueEx(sub_key, value_name)
|
read_val, read_typ = QueryValueEx(sub_key, value_name)
|
||||||
|
|
|
@ -76,7 +76,7 @@ def _toaiff(filename, temps):
|
||||||
temps.append(fname)
|
temps.append(fname)
|
||||||
sts = uncompress.copy(filename, fname)
|
sts = uncompress.copy(filename, fname)
|
||||||
if sts:
|
if sts:
|
||||||
raise error, filename + ': uncomress failed'
|
raise error, filename + ': uncompress failed'
|
||||||
else:
|
else:
|
||||||
fname = filename
|
fname = filename
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -117,7 +117,7 @@ def format_exception(etype, value, tb, limit = None):
|
||||||
have the same meaning as the corresponding arguments to
|
have the same meaning as the corresponding arguments to
|
||||||
print_exception(). The return value is a list of strings, each
|
print_exception(). The return value is a list of strings, each
|
||||||
ending in a newline and some containing internal newlines. When
|
ending in a newline and some containing internal newlines. When
|
||||||
these lines are contatenated and printed, exactly the same text is
|
these lines are concatenated and printed, exactly the same text is
|
||||||
printed as does print_exception()."""
|
printed as does print_exception()."""
|
||||||
if tb:
|
if tb:
|
||||||
list = ['Traceback (most recent call last):\n']
|
list = ['Traceback (most recent call last):\n']
|
||||||
|
|
|
@ -773,7 +773,7 @@ def basejoin(base, url):
|
||||||
# just return it
|
# just return it
|
||||||
return url
|
return url
|
||||||
host, basepath = splithost(basepath) # inherit host
|
host, basepath = splithost(basepath) # inherit host
|
||||||
basepath, basetag = splittag(basepath) # remove extraneuous cruft
|
basepath, basetag = splittag(basepath) # remove extraneous cruft
|
||||||
basepath, basequery = splitquery(basepath) # idem
|
basepath, basequery = splitquery(basepath) # idem
|
||||||
if path[:1] != '/':
|
if path[:1] != '/':
|
||||||
# non-absolute path name
|
# non-absolute path name
|
||||||
|
|
|
@ -456,7 +456,7 @@ class HTTPRedirectHandler(BaseHandler):
|
||||||
http_error_301 = http_error_302
|
http_error_301 = http_error_302
|
||||||
|
|
||||||
inf_msg = "The HTTP server returned a redirect error that would" \
|
inf_msg = "The HTTP server returned a redirect error that would" \
|
||||||
"lead to an inifinte loop.\n" \
|
"lead to an infinite loop.\n" \
|
||||||
"The last 302 error message was:\n"
|
"The last 302 error message was:\n"
|
||||||
|
|
||||||
class ProxyHandler(BaseHandler):
|
class ProxyHandler(BaseHandler):
|
||||||
|
|
|
@ -30,7 +30,7 @@ This returns an instance of a class with the following public methods:
|
||||||
tell() -- return the current position
|
tell() -- return the current position
|
||||||
close() -- close the instance (make it unusable)
|
close() -- close the instance (make it unusable)
|
||||||
The position returned by tell() and the position given to setpos()
|
The position returned by tell() and the position given to setpos()
|
||||||
are compatible and have nothing to do with the actual postion in the
|
are compatible and have nothing to do with the actual position in the
|
||||||
file.
|
file.
|
||||||
The close() method is called automatically when the class instance
|
The close() method is called automatically when the class instance
|
||||||
is destroyed.
|
is destroyed.
|
||||||
|
|
|
@ -50,7 +50,7 @@ class XMLReader:
|
||||||
def setLocale(self, locale):
|
def setLocale(self, locale):
|
||||||
"""Allow an application to set the locale for errors and warnings.
|
"""Allow an application to set the locale for errors and warnings.
|
||||||
|
|
||||||
SAX parsers are not required to provide localisation for errors
|
SAX parsers are not required to provide localization for errors
|
||||||
and warnings; if they cannot support the requested locale,
|
and warnings; if they cannot support the requested locale,
|
||||||
however, they must throw a SAX exception. Applications may
|
however, they must throw a SAX exception. Applications may
|
||||||
request a locale change in the middle of a parse."""
|
request a locale change in the middle of a parse."""
|
||||||
|
|
|
@ -143,7 +143,7 @@ class XMLParser:
|
||||||
self.__seen_starttag = 0
|
self.__seen_starttag = 0
|
||||||
self.__use_namespaces = 0
|
self.__use_namespaces = 0
|
||||||
self.__namespaces = {'xml':None} # xml is implicitly declared
|
self.__namespaces = {'xml':None} # xml is implicitly declared
|
||||||
# backward compatipibility hack: if elements not overridden,
|
# backward compatibility hack: if elements not overridden,
|
||||||
# fill it in ourselves
|
# fill it in ourselves
|
||||||
if self.elements is XMLParser.elements:
|
if self.elements is XMLParser.elements:
|
||||||
self.__fixelements()
|
self.__fixelements()
|
||||||
|
|
|
@ -57,7 +57,7 @@ static char cStringIO_module_documentation[] =
|
||||||
"This module provides a simple useful replacement for\n"
|
"This module provides a simple useful replacement for\n"
|
||||||
"the StringIO module that is written in C. It does not provide the\n"
|
"the StringIO module that is written in C. It does not provide the\n"
|
||||||
"full generality of StringIO, but it provides enough for most\n"
|
"full generality of StringIO, but it provides enough for most\n"
|
||||||
"applications and is especially useful in conjuction with the\n"
|
"applications and is especially useful in conjunction with the\n"
|
||||||
"pickle module.\n"
|
"pickle module.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Usage:\n"
|
"Usage:\n"
|
||||||
|
|
|
@ -22,7 +22,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
* fine but a program with two threads using forms will probably crash (unless
|
* fine but a program with two threads using forms will probably crash (unless
|
||||||
* the program takes precaution to ensure that only one thread can be in
|
* the program takes precaution to ensure that only one thread can be in
|
||||||
* this module at any time). This will have to be fixed some time.
|
* this module at any time). This will have to be fixed some time.
|
||||||
* (A fix will probably also have to synchronise with the gl module).
|
* (A fix will probably also have to synchronize with the gl module).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
|
|
@ -92,7 +92,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
* That's it!
|
* That's it!
|
||||||
*
|
*
|
||||||
* Well, almost. Once we have determined prefix and exec_prefix, the
|
* Well, almost. Once we have determined prefix and exec_prefix, the
|
||||||
* preprocesor variable PYTHONPATH is used to construct a path. Each
|
* preprocessor variable PYTHONPATH is used to construct a path. Each
|
||||||
* relative path on PYTHONPATH is prefixed with prefix. Then the directory
|
* relative path on PYTHONPATH is prefixed with prefix. Then the directory
|
||||||
* containing the shared library modules is appended. The environment
|
* containing the shared library modules is appended. The environment
|
||||||
* variable $PYTHONPATH is inserted in front of it all. Finally, the
|
* variable $PYTHONPATH is inserted in front of it all. Finally, the
|
||||||
|
|
|
@ -10,7 +10,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
|
||||||
/* IMGFILE module - Interface to sgi libimage */
|
/* IMGFILE module - Interface to sgi libimage */
|
||||||
|
|
||||||
/* XXX This modele should be done better at some point. It should return
|
/* XXX This module should be done better at some point. It should return
|
||||||
** an object of image file class, and have routines to manipulate these
|
** an object of image file class, and have routines to manipulate these
|
||||||
** image files in a neater way (so you can get rgb images off a greyscale
|
** image files in a neater way (so you can get rgb images off a greyscale
|
||||||
** file, for instance, or do a straight display without having to get the
|
** file, for instance, or do a straight display without having to get the
|
||||||
|
|
|
@ -143,7 +143,7 @@ MD5Update(MD5_CTX *context, unsigned char *input, unsigned int inputLen)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MD5 finalization. Ends an MD5 message-digest operation, writing the
|
/* MD5 finalization. Ends an MD5 message-digest operation, writing the
|
||||||
the message digest and zeroizing the context.
|
the message digest and zeroing the context.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
MD5Final(unsigned char digest[16], MD5_CTX *context)
|
MD5Final(unsigned char digest[16], MD5_CTX *context)
|
||||||
|
|
|
@ -145,7 +145,7 @@ algorithm (see also Internet RFC 1321). Its use is quite\n\
|
||||||
straightforward: use the new() to create an md5 object. You can now\n\
|
straightforward: use the new() to create an md5 object. You can now\n\
|
||||||
feed this object with arbitrary strings using the update() method, and\n\
|
feed this object with arbitrary strings using the update() method, and\n\
|
||||||
at any point you can ask it for the digest (a strong kind of 128-bit\n\
|
at any point you can ask it for the digest (a strong kind of 128-bit\n\
|
||||||
checksum, a.k.a. ``fingerprint'') of the contatenation of the strings\n\
|
checksum, a.k.a. ``fingerprint'') of the concatenation of the strings\n\
|
||||||
fed to it so far using the digest() method.\n\
|
fed to it so far using the digest() method.\n\
|
||||||
\n\
|
\n\
|
||||||
Functions:\n\
|
Functions:\n\
|
||||||
|
|
|
@ -701,7 +701,7 @@ static PyTypeObject mmap_object_type = {
|
||||||
a larger map size, there is no point because all the useful operations
|
a larger map size, there is no point because all the useful operations
|
||||||
(len(), slicing(), sequence indexing) are limited by a C int.
|
(len(), slicing(), sequence indexing) are limited by a C int.
|
||||||
|
|
||||||
Returns -1 on error, with an apprpriate Python exception raised. On
|
Returns -1 on error, with an appropriate Python exception raised. On
|
||||||
success, the map size is returned. */
|
success, the map size is returned. */
|
||||||
static int
|
static int
|
||||||
_GetMapSize(PyObject *o)
|
_GetMapSize(PyObject *o)
|
||||||
|
|
|
@ -1635,8 +1635,8 @@ static const char mp_test_magic[MP_TEST_SIZE] = {'\xAA','\xAA','\xAA','\xAA'};
|
||||||
static mp_test_error( location )
|
static mp_test_error( location )
|
||||||
int *location;
|
int *location;
|
||||||
{
|
{
|
||||||
/* assumptions: *alloc returns address dividable by 4,
|
/* assumptions: *alloc returns address divisible by 4,
|
||||||
mpz_* routines allocate in chunks dividable by four */
|
mpz_* routines allocate in chunks divisible by four */
|
||||||
fprintf(stderr, "MP_TEST_ERROR: location holds 0x%08d\n", *location );
|
fprintf(stderr, "MP_TEST_ERROR: location holds 0x%08d\n", *location );
|
||||||
Py_FatalError("MP_TEST_ERROR");
|
Py_FatalError("MP_TEST_ERROR");
|
||||||
} /* static mp_test_error() */
|
} /* static mp_test_error() */
|
||||||
|
|
|
@ -66,7 +66,7 @@ typedef int (*SeqInserter) (PyObject* sequence,
|
||||||
int index,
|
int index,
|
||||||
PyObject* element);
|
PyObject* element);
|
||||||
|
|
||||||
/* The function below is copyrigthed by Stichting Mathematisch Centrum. The
|
/* The function below is copyrighted by Stichting Mathematisch Centrum. The
|
||||||
* original copyright statement is included below, and continues to apply
|
* original copyright statement is included below, and continues to apply
|
||||||
* in full to the function immediately following. All other material is
|
* in full to the function immediately following. All other material is
|
||||||
* original, copyrighted by Fred L. Drake, Jr. and Virginia Polytechnic
|
* original, copyrighted by Fred L. Drake, Jr. and Virginia Polytechnic
|
||||||
|
@ -2403,7 +2403,7 @@ validate_node(node *tree)
|
||||||
res = validate_compound_stmt(tree);
|
res = validate_compound_stmt(tree);
|
||||||
break;
|
break;
|
||||||
/*
|
/*
|
||||||
* Fundemental statements.
|
* Fundamental statements.
|
||||||
*/
|
*/
|
||||||
case expr_stmt:
|
case expr_stmt:
|
||||||
res = validate_expr_stmt(tree);
|
res = validate_expr_stmt(tree);
|
||||||
|
@ -2552,7 +2552,7 @@ validate_file_input(node *tree)
|
||||||
else
|
else
|
||||||
res = validate_newline(CHILD(tree, j));
|
res = validate_newline(CHILD(tree, j));
|
||||||
}
|
}
|
||||||
/* This stays in to prevent any internal failues from getting to the
|
/* This stays in to prevent any internal failures from getting to the
|
||||||
* user. Hopefully, this won't be needed. If a user reports getting
|
* user. Hopefully, this won't be needed. If a user reports getting
|
||||||
* this, we have some debugging to do.
|
* this, we have some debugging to do.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1360,7 +1360,7 @@ Execute a path with arguments and environment, replacing current process.\n\
|
||||||
\n\
|
\n\
|
||||||
path: path of executable file\n\
|
path: path of executable file\n\
|
||||||
args: tuple or list of arguments\n\
|
args: tuple or list of arguments\n\
|
||||||
env: dictonary of strings mapping to strings";
|
env: dictionary of strings mapping to strings";
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
posix_execve(PyObject *self, PyObject *args)
|
posix_execve(PyObject *self, PyObject *args)
|
||||||
|
@ -1558,7 +1558,7 @@ Execute a path with arguments and environment, replacing current process.\n\
|
||||||
mode: mode of process creation\n\
|
mode: mode of process creation\n\
|
||||||
path: path of executable file\n\
|
path: path of executable file\n\
|
||||||
args: tuple or list of arguments\n\
|
args: tuple or list of arguments\n\
|
||||||
env: dictonary of strings mapping to strings";
|
env: dictionary of strings mapping to strings";
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
posix_spawnve(PyObject *self, PyObject *args)
|
posix_spawnve(PyObject *self, PyObject *args)
|
||||||
|
@ -1700,7 +1700,7 @@ posix_fork(PyObject *self, PyObject *args)
|
||||||
#include <libutil.h>
|
#include <libutil.h>
|
||||||
#else
|
#else
|
||||||
/* BSDI does not supply a prototype for the 'openpty' and 'forkpty'
|
/* BSDI does not supply a prototype for the 'openpty' and 'forkpty'
|
||||||
functions, eventhough they are included in libutil. */
|
functions, even though they are included in libutil. */
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
extern int openpty(int *, int *, char *, struct termios *, struct winsize *);
|
extern int openpty(int *, int *, char *, struct termios *, struct winsize *);
|
||||||
extern int forkpty(int *, char *, struct termios *, struct winsize *);
|
extern int forkpty(int *, char *, struct termios *, struct winsize *);
|
||||||
|
@ -3897,7 +3897,7 @@ posix_tmpnam(PyObject *self, PyObject *args)
|
||||||
/* This is used for fpathconf(), pathconf(), confstr() and sysconf().
|
/* This is used for fpathconf(), pathconf(), confstr() and sysconf().
|
||||||
* It maps strings representing configuration variable names to
|
* It maps strings representing configuration variable names to
|
||||||
* integer values, allowing those functions to be called with the
|
* integer values, allowing those functions to be called with the
|
||||||
* magic names instead of poluting the module's namespace with tons of
|
* magic names instead of polluting the module's namespace with tons of
|
||||||
* rarely-used constants. There are three separate tables that use
|
* rarely-used constants. There are three separate tables that use
|
||||||
* these definitions.
|
* these definitions.
|
||||||
*
|
*
|
||||||
|
|
|
@ -493,7 +493,7 @@ if ((options & ~PUBLIC_STUDY_OPTIONS) != 0)
|
||||||
|
|
||||||
caseless = ((re->options | options) & PCRE_CASELESS) != 0;
|
caseless = ((re->options | options) & PCRE_CASELESS) != 0;
|
||||||
|
|
||||||
/* For an anchored pattern, or an unchored pattern that has a first char, or a
|
/* For an anchored pattern, or an unanchored pattern that has a first char, or a
|
||||||
multiline pattern that matches only at "line starts", no further processing at
|
multiline pattern that matches only at "line starts", no further processing at
|
||||||
present. */
|
present. */
|
||||||
|
|
||||||
|
@ -1636,8 +1636,8 @@ for (;; ptr++)
|
||||||
*code++ = (repeat_min & 255);
|
*code++ = (repeat_min & 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the mininum is 1 and the previous item was a character string,
|
/* If the minimum is 1 and the previous item was a character string,
|
||||||
we either have to put back the item that got cancelled if the string
|
we either have to put back the item that got canceled if the string
|
||||||
length was 1, or add the character back onto the end of a longer
|
length was 1, or add the character back onto the end of a longer
|
||||||
string. For a character type nothing need be done; it will just get
|
string. For a character type nothing need be done; it will just get
|
||||||
put back naturally. Note that the final character is always going to
|
put back naturally. Note that the final character is always going to
|
||||||
|
@ -1649,7 +1649,7 @@ for (;; ptr++)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For a single negated character we also have to put back the
|
/* For a single negated character we also have to put back the
|
||||||
item that got cancelled. */
|
item that got canceled. */
|
||||||
|
|
||||||
else if (*previous == OP_NOT) code++;
|
else if (*previous == OP_NOT) code++;
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ typedef struct match_state
|
||||||
/* Structure to encapsulate the stack. */
|
/* Structure to encapsulate the stack. */
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
/* index into the curent page. If index == 0 and you need
|
/* index into the current page. If index == 0 and you need
|
||||||
* to pop an item, move to the previous page and set index
|
* to pop an item, move to the previous page and set index
|
||||||
* = STACK_PAGE_SIZE - 1. Otherwise decrement index to
|
* = STACK_PAGE_SIZE - 1. Otherwise decrement index to
|
||||||
* push a page. If index == STACK_PAGE_SIZE and you need
|
* push a page. If index == STACK_PAGE_SIZE and you need
|
||||||
|
|
|
@ -119,7 +119,7 @@ int re_match(regexp_t compiled, unsigned char *string, int size, int pos,
|
||||||
|
|
||||||
int re_search(regexp_t compiled, unsigned char *string, int size, int startpos,
|
int re_search(regexp_t compiled, unsigned char *string, int size, int startpos,
|
||||||
int range, regexp_registers_t regs);
|
int range, regexp_registers_t regs);
|
||||||
/* This rearches for a substring matching the regexp. This returns the
|
/* This searches for a substring matching the regexp. This returns the
|
||||||
* first index at which a match is found. range specifies at how many
|
* first index at which a match is found. range specifies at how many
|
||||||
* positions to try matching; positive values indicate searching
|
* positions to try matching; positive values indicate searching
|
||||||
* forwards, and negative values indicate searching backwards. mstop
|
* forwards, and negative values indicate searching backwards. mstop
|
||||||
|
|
|
@ -70,8 +70,8 @@ resource_getrusage(PyObject *self, PyObject *args)
|
||||||
ru.ru_msgsnd, /* messages sent */
|
ru.ru_msgsnd, /* messages sent */
|
||||||
ru.ru_msgrcv, /* messages received */
|
ru.ru_msgrcv, /* messages received */
|
||||||
ru.ru_nsignals, /* signals received */
|
ru.ru_nsignals, /* signals received */
|
||||||
ru.ru_nvcsw, /* voluntary context switchs */
|
ru.ru_nvcsw, /* voluntary context switches */
|
||||||
ru.ru_nivcsw /* involuntary context switchs */
|
ru.ru_nivcsw /* involuntary context switches */
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -553,7 +553,7 @@ expandrow(unsigned char *optr, unsigned char *iptr, int z)
|
||||||
* represents one pixel. xsize and ysize specify the dimensions of
|
* represents one pixel. xsize and ysize specify the dimensions of
|
||||||
* the pixel array. zsize specifies what kind of image file to
|
* the pixel array. zsize specifies what kind of image file to
|
||||||
* write out. if zsize is 1, the luminance of the pixels are
|
* write out. if zsize is 1, the luminance of the pixels are
|
||||||
* calculated, and a sinlge channel black and white image is saved.
|
* calculated, and a single channel black and white image is saved.
|
||||||
* If zsize is 3, an RGB image file is saved. If zsize is 4, an
|
* If zsize is 3, an RGB image file is saved. If zsize is 4, an
|
||||||
* RGBA image file is saved.
|
* RGBA image file is saved.
|
||||||
*
|
*
|
||||||
|
|
|
@ -23,7 +23,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
|
|
||||||
/* This creates an encryption and decryption engine I am calling
|
/* This creates an encryption and decryption engine I am calling
|
||||||
a rotor due to the original design was a harware rotor with
|
a rotor due to the original design was a hardware rotor with
|
||||||
contacts used in Germany during WWII.
|
contacts used in Germany during WWII.
|
||||||
|
|
||||||
Rotor Module:
|
Rotor Module:
|
||||||
|
@ -43,7 +43,7 @@ Rotor Objects:
|
||||||
NOTE: the {en,de}cryptmore() methods use the setup that was
|
NOTE: the {en,de}cryptmore() methods use the setup that was
|
||||||
established via the {en,de}crypt calls. They will NOT
|
established via the {en,de}crypt calls. They will NOT
|
||||||
re-initalize the rotors unless: 1) They have not been
|
re-initalize the rotors unless: 1) They have not been
|
||||||
initalized with {en,de}crypt since the last setkey() call;
|
initialized with {en,de}crypt since the last setkey() call;
|
||||||
2) {en,de}crypt has not been called for this rotor yet.
|
2) {en,de}crypt has not been called for this rotor yet.
|
||||||
|
|
||||||
NOTE: you MUST use the SAME key in rotor.newrotor()
|
NOTE: you MUST use the SAME key in rotor.newrotor()
|
||||||
|
@ -209,7 +209,7 @@ rotorobj_new(int num_rotors, char *key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* These routines impliment the rotor itself */
|
/* These routines implement the rotor itself */
|
||||||
|
|
||||||
/* Here is a fairly sophisticated {en,de}cryption system. It is based on
|
/* Here is a fairly sophisticated {en,de}cryption system. It is based on
|
||||||
the idea of a "rotor" machine. A bunch of rotors, each with a
|
the idea of a "rotor" machine. A bunch of rotors, each with a
|
||||||
|
@ -217,7 +217,7 @@ rotorobj_new(int num_rotors, char *key)
|
||||||
after encrypting one character. The current state of the rotors is
|
after encrypting one character. The current state of the rotors is
|
||||||
used to encrypt one character.
|
used to encrypt one character.
|
||||||
|
|
||||||
The code is smart enought to tell if your alphabet has a number of
|
The code is smart enough to tell if your alphabet has a number of
|
||||||
characters equal to a power of two. If it does, it uses logical
|
characters equal to a power of two. If it does, it uses logical
|
||||||
operations, if not it uses div and mod (both require a division).
|
operations, if not it uses div and mod (both require a division).
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,7 @@ static char joinfields__doc__[] =
|
||||||
joinfields(list [,sep]) -> string\n\
|
joinfields(list [,sep]) -> string\n\
|
||||||
\n\
|
\n\
|
||||||
Return a string composed of the words in list, with\n\
|
Return a string composed of the words in list, with\n\
|
||||||
intervening occurences of sep. Sep defaults to a single\n\
|
intervening occurrences of sep. Sep defaults to a single\n\
|
||||||
space.\n\
|
space.\n\
|
||||||
\n\
|
\n\
|
||||||
(join and joinfields are synonymous)";
|
(join and joinfields are synonymous)";
|
||||||
|
@ -1040,10 +1040,10 @@ static int mymemcnt(char *mem, int len, char *pat, int pat_len)
|
||||||
/*
|
/*
|
||||||
mymemreplace
|
mymemreplace
|
||||||
|
|
||||||
Return a string in which all occurences of PAT in memory STR are
|
Return a string in which all occurrences of PAT in memory STR are
|
||||||
replaced with SUB.
|
replaced with SUB.
|
||||||
|
|
||||||
If length of PAT is less than length of STR or there are no occurences
|
If length of PAT is less than length of STR or there are no occurrences
|
||||||
of PAT in STR, then the original string is returned. Otherwise, a new
|
of PAT in STR, then the original string is returned. Otherwise, a new
|
||||||
string is allocated here and returned.
|
string is allocated here and returned.
|
||||||
|
|
||||||
|
|
|
@ -258,7 +258,7 @@ sad_obufcount(sadobject *self, PyObject *args)
|
||||||
PyErr_SetFromErrno(SunAudioError);
|
PyErr_SetFromErrno(SunAudioError);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* x_ocount is in bytes, wheras play.samples is in frames */
|
/* x_ocount is in bytes, whereas play.samples is in frames */
|
||||||
/* we want frames */
|
/* we want frames */
|
||||||
return PyInt_FromLong(self->x_ocount / (ai.play.channels *
|
return PyInt_FromLong(self->x_ocount / (ai.play.channels *
|
||||||
ai.play.precision / 8) -
|
ai.play.precision / 8) -
|
||||||
|
|
|
@ -36,7 +36,7 @@ Revision history:
|
||||||
- Changed arg parsing to use PyArg_ParseTuple.
|
- Changed arg parsing to use PyArg_ParseTuple.
|
||||||
- Added PyErr_Clear() call(s) where needed.
|
- Added PyErr_Clear() call(s) where needed.
|
||||||
- Fix core dumps if user message contains format specifiers.
|
- Fix core dumps if user message contains format specifiers.
|
||||||
- Change openlog arg defaults to match normal syslog behaviour.
|
- Change openlog arg defaults to match normal syslog behavior.
|
||||||
- Plug memory leak in openlog().
|
- Plug memory leak in openlog().
|
||||||
- Fix setlogmask() to return previous mask value.
|
- Fix setlogmask() to return previous mask value.
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ InitNotifier()
|
||||||
* None.
|
* None.
|
||||||
*
|
*
|
||||||
* Side effects:
|
* Side effects:
|
||||||
* Clears the notifier intialization flag.
|
* Clears the notifier initialization flag.
|
||||||
*
|
*
|
||||||
*----------------------------------------------------------------------
|
*----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -202,7 +202,7 @@ Tcl_CreateEventSource(setupProc, checkProc, clientData)
|
||||||
* None.
|
* None.
|
||||||
*
|
*
|
||||||
* Side effects:
|
* Side effects:
|
||||||
* The given event source is cancelled, so its procedure will
|
* The given event source is canceled, so its procedure will
|
||||||
* never again be called. If no such source exists, nothing
|
* never again be called. If no such source exists, nothing
|
||||||
* happens.
|
* happens.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1077,7 +1077,7 @@ static int instance_contains(PyInstanceObject *inst, PyObject *member)
|
||||||
}
|
}
|
||||||
func = instance_getattr(inst, __contains__);
|
func = instance_getattr(inst, __contains__);
|
||||||
if(func == NULL) {
|
if(func == NULL) {
|
||||||
/* fall back to previous behaviour */
|
/* fall back to previous behavior */
|
||||||
int i, cmp_res;
|
int i, cmp_res;
|
||||||
|
|
||||||
if(!PyErr_ExceptionMatches(PyExc_AttributeError))
|
if(!PyErr_ExceptionMatches(PyExc_AttributeError))
|
||||||
|
@ -1160,7 +1160,7 @@ PyInstance_DoBinOp(PyObject *v, PyObject *w, char *opname, char *ropname,
|
||||||
return result;
|
return result;
|
||||||
if (halfbinop(w, v, ropname, &result, thisfunc, 1) <= 0)
|
if (halfbinop(w, v, ropname, &result, thisfunc, 1) <= 0)
|
||||||
return result;
|
return result;
|
||||||
/* Sigh -- special case for comnparisons */
|
/* Sigh -- special case for comparisons */
|
||||||
if (strcmp(opname, "__cmp__") == 0) {
|
if (strcmp(opname, "__cmp__") == 0) {
|
||||||
long c = (v < w) ? -1 : (v > w) ? 1 : 0;
|
long c = (v < w) ? -1 : (v > w) ? 1 : 0;
|
||||||
return PyInt_FromLong(c);
|
return PyInt_FromLong(c);
|
||||||
|
|
|
@ -185,7 +185,7 @@ lookdict(dictobject *mp, PyObject *key, register long hash)
|
||||||
/* Cycle through GF(2^n)-{0} */
|
/* Cycle through GF(2^n)-{0} */
|
||||||
incr = incr << 1;
|
incr = incr << 1;
|
||||||
if (incr > mask)
|
if (incr > mask)
|
||||||
incr ^= mp->ma_poly; /* This will implicitely clear
|
incr ^= mp->ma_poly; /* This will implicitly clear
|
||||||
the highest bit */
|
the highest bit */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -311,7 +311,7 @@ int_sub(PyIntObject *v, PyIntObject *w)
|
||||||
/*
|
/*
|
||||||
Integer overflow checking used to be done using a double, but on 64
|
Integer overflow checking used to be done using a double, but on 64
|
||||||
bit machines (where both long and double are 64 bit) this fails
|
bit machines (where both long and double are 64 bit) this fails
|
||||||
because the double doesn't have enouvg precision. John Tromp suggests
|
because the double doesn't have enough precision. John Tromp suggests
|
||||||
the following algorithm:
|
the following algorithm:
|
||||||
|
|
||||||
Suppose again we normalize a and b to be nonnegative.
|
Suppose again we normalize a and b to be nonnegative.
|
||||||
|
|
|
@ -337,7 +337,7 @@ do_cmp(PyObject *v, PyObject *w)
|
||||||
|
|
||||||
PyObject *_PyCompareState_Key;
|
PyObject *_PyCompareState_Key;
|
||||||
|
|
||||||
/* _PyCompareState_nesting is incremented beforing call compare (for
|
/* _PyCompareState_nesting is incremented before calling compare (for
|
||||||
some types) and decremented on exit. If the count exceeds the
|
some types) and decremented on exit. If the count exceeds the
|
||||||
nesting limit, enable code to detect circular data structures.
|
nesting limit, enable code to detect circular data structures.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -283,7 +283,7 @@ string_print(PyStringObject *op, FILE *fp, int flags)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* figure out which quote to use; single is prefered */
|
/* figure out which quote to use; single is preferred */
|
||||||
quote = '\'';
|
quote = '\'';
|
||||||
if (strchr(op->ob_sval, '\'') && !strchr(op->ob_sval, '"'))
|
if (strchr(op->ob_sval, '\'') && !strchr(op->ob_sval, '"'))
|
||||||
quote = '"';
|
quote = '"';
|
||||||
|
@ -321,7 +321,7 @@ string_repr(register PyStringObject *op)
|
||||||
register char *p;
|
register char *p;
|
||||||
int quote;
|
int quote;
|
||||||
|
|
||||||
/* figure out which quote to use; single is prefered */
|
/* figure out which quote to use; single is preferred */
|
||||||
quote = '\'';
|
quote = '\'';
|
||||||
if (strchr(op->ob_sval, '\'') && !strchr(op->ob_sval, '"'))
|
if (strchr(op->ob_sval, '\'') && !strchr(op->ob_sval, '"'))
|
||||||
quote = '"';
|
quote = '"';
|
||||||
|
@ -1416,10 +1416,10 @@ mymemcnt(const char *mem, int len, const char *pat, int pat_len)
|
||||||
/*
|
/*
|
||||||
mymemreplace
|
mymemreplace
|
||||||
|
|
||||||
Return a string in which all occurences of PAT in memory STR are
|
Return a string in which all occurrences of PAT in memory STR are
|
||||||
replaced with SUB.
|
replaced with SUB.
|
||||||
|
|
||||||
If length of PAT is less than length of STR or there are no occurences
|
If length of PAT is less than length of STR or there are no occurrences
|
||||||
of PAT in STR, then the original string is returned. Otherwise, a new
|
of PAT in STR, then the original string is returned. Otherwise, a new
|
||||||
string is allocated here and returned.
|
string is allocated here and returned.
|
||||||
|
|
||||||
|
@ -1689,7 +1689,7 @@ string_expandtabs(PyStringObject *self, PyObject *args)
|
||||||
if (!PyArg_ParseTuple(args, "|i:expandtabs", &tabsize))
|
if (!PyArg_ParseTuple(args, "|i:expandtabs", &tabsize))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* First pass: determine size of ouput string */
|
/* First pass: determine size of output string */
|
||||||
i = j = 0;
|
i = j = 0;
|
||||||
e = PyString_AS_STRING(self) + PyString_GET_SIZE(self);
|
e = PyString_AS_STRING(self) + PyString_GET_SIZE(self);
|
||||||
for (p = PyString_AS_STRING(self); p < e; p++)
|
for (p = PyString_AS_STRING(self); p < e; p++)
|
||||||
|
|
|
@ -3198,7 +3198,7 @@ int PyUnicode_Compare(PyObject *left,
|
||||||
if (v == NULL)
|
if (v == NULL)
|
||||||
goto onError;
|
goto onError;
|
||||||
|
|
||||||
/* Shortcut for emtpy or interned objects */
|
/* Shortcut for empty or interned objects */
|
||||||
if (v == u) {
|
if (v == u) {
|
||||||
Py_DECREF(u);
|
Py_DECREF(u);
|
||||||
Py_DECREF(v);
|
Py_DECREF(v);
|
||||||
|
@ -3385,7 +3385,7 @@ unicode_expandtabs(PyUnicodeObject *self, PyObject *args)
|
||||||
if (!PyArg_ParseTuple(args, "|i:expandtabs", &tabsize))
|
if (!PyArg_ParseTuple(args, "|i:expandtabs", &tabsize))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* First pass: determine size of ouput string */
|
/* First pass: determine size of output string */
|
||||||
i = j = 0;
|
i = j = 0;
|
||||||
e = self->str + self->length;
|
e = self->str + self->length;
|
||||||
for (p = self->str; p < e; p++)
|
for (p = self->str; p < e; p++)
|
||||||
|
|
|
@ -658,7 +658,7 @@ PyWinObject_CloseHKEY(PyObject *obHandle)
|
||||||
** Note that fixupMultiSZ and countString have both had changes
|
** Note that fixupMultiSZ and countString have both had changes
|
||||||
** made to support "incorrect strings". The registry specification
|
** made to support "incorrect strings". The registry specification
|
||||||
** calls for strings to be terminated with 2 null bytes. It seems
|
** calls for strings to be terminated with 2 null bytes. It seems
|
||||||
** some commercial packages install strings whcich dont conform,
|
** some commercial packages install strings which dont conform,
|
||||||
** causing this code to fail - however, "regedit" etc still work
|
** causing this code to fail - however, "regedit" etc still work
|
||||||
** with these strings (ie only we dont!).
|
** with these strings (ie only we dont!).
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -575,7 +575,7 @@ printssdfa(xx_nstates, xx_state, nbits, ll, msg)
|
||||||
equivalent to another oner. This is NOT Algorithm 3.3 from
|
equivalent to another oner. This is NOT Algorithm 3.3 from
|
||||||
[Aho&Ullman 77]. It does not always finds the minimal DFA,
|
[Aho&Ullman 77]. It does not always finds the minimal DFA,
|
||||||
but it does usually make a much smaller one... (For an example
|
but it does usually make a much smaller one... (For an example
|
||||||
of sub-optimal behaviour, try S: x a b+ | y a b+.)
|
of sub-optimal behavior, try S: x a b+ | y a b+.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -2769,7 +2769,7 @@ build_class(methods, bases, name)
|
||||||
/* Call the base's *type*, if it is callable.
|
/* Call the base's *type*, if it is callable.
|
||||||
This code is a hook for Donald Beaudry's
|
This code is a hook for Donald Beaudry's
|
||||||
and Jim Fulton's type extensions. In
|
and Jim Fulton's type extensions. In
|
||||||
unexended Python it will never be triggered
|
unextended Python it will never be triggered
|
||||||
since its types are not callable.
|
since its types are not callable.
|
||||||
Ditto: call the bases's *class*, if it has
|
Ditto: call the bases's *class*, if it has
|
||||||
one. This makes the same thing possible
|
one. This makes the same thing possible
|
||||||
|
|
|
@ -146,7 +146,7 @@ PyObject *_PyCodec_Lookup(const char *encoding)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert the encoding to a normalized Python string: all
|
/* Convert the encoding to a normalized Python string: all
|
||||||
characters are converted to lower case, spaces and hypens are
|
characters are converted to lower case, spaces and hyphens are
|
||||||
replaced with underscores. */
|
replaced with underscores. */
|
||||||
v = normalizestring(encoding);
|
v = normalizestring(encoding);
|
||||||
if (v == NULL)
|
if (v == NULL)
|
||||||
|
@ -427,7 +427,7 @@ void _PyCodecRegistry_Init()
|
||||||
_PyCodec_SearchCache = PyDict_New();
|
_PyCodec_SearchCache = PyDict_New();
|
||||||
if (_PyCodec_SearchPath == NULL ||
|
if (_PyCodec_SearchPath == NULL ||
|
||||||
_PyCodec_SearchCache == NULL)
|
_PyCodec_SearchCache == NULL)
|
||||||
Py_FatalError("can't intialize codec registry");
|
Py_FatalError("can't initialize codec registry");
|
||||||
}
|
}
|
||||||
|
|
||||||
void _PyCodecRegistry_Fini()
|
void _PyCodecRegistry_Fini()
|
||||||
|
|
|
@ -189,7 +189,7 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
|
||||||
/*
|
/*
|
||||||
-- Invoke load() with L_NOAUTODEFER leaving the imported symbols
|
-- Invoke load() with L_NOAUTODEFER leaving the imported symbols
|
||||||
-- of the shared module unresolved. Thus we have to resolve them
|
-- of the shared module unresolved. Thus we have to resolve them
|
||||||
-- explicitely with loadbind. The new module is loaded, then we
|
-- explicitly with loadbind. The new module is loaded, then we
|
||||||
-- resolve its symbols using the list of already loaded modules
|
-- resolve its symbols using the list of already loaded modules
|
||||||
-- (only those that belong to the python executable). Get these
|
-- (only those that belong to the python executable). Get these
|
||||||
-- with loadquery(L_GETINFO).
|
-- with loadquery(L_GETINFO).
|
||||||
|
|
|
@ -162,7 +162,7 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!NSIsSymbolNameDefined(funcname)) {
|
if (!NSIsSymbolNameDefined(funcname)) {
|
||||||
/* UnlinkModule() isn't implimented in current versions, but calling it does no harm */
|
/* UnlinkModule() isn't implemented in current versions, but calling it does no harm */
|
||||||
NSUnLinkModule(newModule, FALSE);
|
NSUnLinkModule(newModule, FALSE);
|
||||||
PyErr_Format(PyExc_ImportError,
|
PyErr_Format(PyExc_ImportError,
|
||||||
"Loaded module does not contain symbol %.200s",
|
"Loaded module does not contain symbol %.200s",
|
||||||
|
|
|
@ -183,7 +183,7 @@ static PyObject* get_self(PyObject* args)
|
||||||
{
|
{
|
||||||
PyObject* self = PyTuple_GetItem(args, 0);
|
PyObject* self = PyTuple_GetItem(args, 0);
|
||||||
if (!self) {
|
if (!self) {
|
||||||
/* Watch out for being called to early in the bootstapping process */
|
/* Watch out for being called to early in the bootstrapping process */
|
||||||
if (PyExc_TypeError) {
|
if (PyExc_TypeError) {
|
||||||
PyErr_SetString(PyExc_TypeError,
|
PyErr_SetString(PyExc_TypeError,
|
||||||
"unbound method must be called with class instance 1st argument");
|
"unbound method must be called with class instance 1st argument");
|
||||||
|
|
|
@ -13,7 +13,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
/* XXX There are several unchecked sprintf or strcat calls in this file.
|
/* XXX There are several unchecked sprintf or strcat calls in this file.
|
||||||
XXX The only way these can become a danger is if some C code in the
|
XXX The only way these can become a danger is if some C code in the
|
||||||
XXX Python source (or in an extension) uses ridiculously long names
|
XXX Python source (or in an extension) uses ridiculously long names
|
||||||
XXX or riduculously deep nesting in format strings. */
|
XXX or ridiculously deep nesting in format strings. */
|
||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ int Py_UnicodeFlag = 0; /* Needed by compile.c */
|
||||||
|
|
||||||
static int initialized = 0;
|
static int initialized = 0;
|
||||||
|
|
||||||
/* API to access the initialized flag -- useful for eroteric use */
|
/* API to access the initialized flag -- useful for esoteric use */
|
||||||
|
|
||||||
int
|
int
|
||||||
Py_IsInitialized()
|
Py_IsInitialized()
|
||||||
|
|
|
@ -69,7 +69,7 @@ double strtod(str, ptr)
|
||||||
register char *sp, *dp;
|
register char *sp, *dp;
|
||||||
register int c;
|
register int c;
|
||||||
char *buforg, *buflim;
|
char *buforg, *buflim;
|
||||||
char buffer[64]; /* 45-digit significand + */
|
char buffer[64]; /* 45-digit significant + */
|
||||||
/* 13-digit exponent */
|
/* 13-digit exponent */
|
||||||
sp = str;
|
sp = str;
|
||||||
while (*sp == ' ') sp++;
|
while (*sp == ' ') sp++;
|
||||||
|
|
|
@ -13,7 +13,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
#include <lwp/stackdep.h>
|
#include <lwp/stackdep.h>
|
||||||
|
|
||||||
#define STACKSIZE 1000 /* stacksize for a thread */
|
#define STACKSIZE 1000 /* stacksize for a thread */
|
||||||
#define NSTACKS 2 /* # stacks to be put in cache initialy */
|
#define NSTACKS 2 /* # stacks to be put in cache initially */
|
||||||
|
|
||||||
struct lock {
|
struct lock {
|
||||||
int lock_locked;
|
int lock_locked;
|
||||||
|
|
|
@ -122,7 +122,7 @@ PyThread_type_lock PyThread_allocate_lock(void)
|
||||||
PyThread_init_thread();
|
PyThread_init_thread();
|
||||||
|
|
||||||
DosCreateMutexSem(NULL, /* Sem name */
|
DosCreateMutexSem(NULL, /* Sem name */
|
||||||
&aLock, /* the semaphone */
|
&aLock, /* the semaphore */
|
||||||
0, /* shared ? */
|
0, /* shared ? */
|
||||||
0); /* initial state */
|
0); /* initial state */
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""Extension management for Windows.
|
"""Extension management for Windows.
|
||||||
|
|
||||||
Under Windows it is unlikely the .obj files are of use, as special compiler options
|
Under Windows it is unlikely the .obj files are of use, as special compiler options
|
||||||
are needed (primarily to toggle the behaviour of "public" symbols.
|
are needed (primarily to toggle the behavior of "public" symbols.
|
||||||
|
|
||||||
I dont consider it worth parsing the MSVC makefiles for compiler options. Even if
|
I dont consider it worth parsing the MSVC makefiles for compiler options. Even if
|
||||||
we get it just right, a specific freeze application may have specific compiler
|
we get it just right, a specific freeze application may have specific compiler
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue