mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
Branch merge.
I moved the NEWS entry for the reindent fix to the right release section.
This commit is contained in:
commit
9e1af03fbb
23 changed files with 89 additions and 87 deletions
|
@ -431,7 +431,8 @@ Glossary
|
||||||
|
|
||||||
mapping
|
mapping
|
||||||
A container object that supports arbitrary key lookups and implements the
|
A container object that supports arbitrary key lookups and implements the
|
||||||
methods specified in the :class:`Mapping` or :class:`MutableMapping`
|
methods specified in the :class:`~collections.Mapping` or
|
||||||
|
:class:`~collections.MutableMapping`
|
||||||
:ref:`abstract base classes <collections-abstract-base-classes>`. Examples
|
:ref:`abstract base classes <collections-abstract-base-classes>`. Examples
|
||||||
include :class:`dict`, :class:`collections.defaultdict`,
|
include :class:`dict`, :class:`collections.defaultdict`,
|
||||||
:class:`collections.OrderedDict` and :class:`collections.Counter`.
|
:class:`collections.OrderedDict` and :class:`collections.Counter`.
|
||||||
|
|
|
@ -72,7 +72,7 @@ In that case, you would download the installer appropriate to your platform and
|
||||||
do the obvious thing with it: run it if it's an executable installer, ``rpm
|
do the obvious thing with it: run it if it's an executable installer, ``rpm
|
||||||
--install`` it if it's an RPM, etc. You don't need to run Python or a setup
|
--install`` it if it's an RPM, etc. You don't need to run Python or a setup
|
||||||
script, you don't need to compile anything---you might not even need to read any
|
script, you don't need to compile anything---you might not even need to read any
|
||||||
instructions (although it's always a good idea to do so anyways).
|
instructions (although it's always a good idea to do so anyway).
|
||||||
|
|
||||||
Of course, things will not always be that easy. You might be interested in a
|
Of course, things will not always be that easy. You might be interested in a
|
||||||
module distribution that doesn't have an easy-to-use installer for your
|
module distribution that doesn't have an easy-to-use installer for your
|
||||||
|
|
|
@ -14,7 +14,7 @@ the standard audio interface for Linux and recent versions of FreeBSD.
|
||||||
ALSA is in the standard kernel as of 2.5.x. Presumably if you
|
ALSA is in the standard kernel as of 2.5.x. Presumably if you
|
||||||
use ALSA, you'll have to make sure its OSS compatibility layer
|
use ALSA, you'll have to make sure its OSS compatibility layer
|
||||||
is active to use ossaudiodev, but you're gonna need it for the vast
|
is active to use ossaudiodev, but you're gonna need it for the vast
|
||||||
majority of Linux audio apps anyways.
|
majority of Linux audio apps anyway.
|
||||||
|
|
||||||
Sounds like things are also complicated for other BSDs. In response
|
Sounds like things are also complicated for other BSDs. In response
|
||||||
to my python-dev query, Thomas Wouters said:
|
to my python-dev query, Thomas Wouters said:
|
||||||
|
|
|
@ -598,24 +598,24 @@ occurs within the definition of a class.
|
||||||
Name mangling is helpful for letting subclasses override methods without
|
Name mangling is helpful for letting subclasses override methods without
|
||||||
breaking intraclass method calls. For example::
|
breaking intraclass method calls. For example::
|
||||||
|
|
||||||
class Mapping:
|
class Mapping:
|
||||||
def __init__(self, iterable):
|
def __init__(self, iterable):
|
||||||
self.items_list = []
|
self.items_list = []
|
||||||
self.__update(iterable)
|
self.__update(iterable)
|
||||||
|
|
||||||
def update(self, iterable):
|
def update(self, iterable):
|
||||||
for item in iterable:
|
for item in iterable:
|
||||||
self.items_list.append(item)
|
self.items_list.append(item)
|
||||||
|
|
||||||
__update = update # private copy of original update() method
|
__update = update # private copy of original update() method
|
||||||
|
|
||||||
class MappingSubclass(Mapping):
|
class MappingSubclass(Mapping):
|
||||||
|
|
||||||
def update(self, keys, values):
|
def update(self, keys, values):
|
||||||
# provides new signature for update()
|
# provides new signature for update()
|
||||||
# but does not break __init__()
|
# but does not break __init__()
|
||||||
for item in zip(keys, values):
|
for item in zip(keys, values):
|
||||||
self.items_list.append(item)
|
self.items_list.append(item)
|
||||||
|
|
||||||
Note that the mangling rules are designed mostly to avoid accidents; it still is
|
Note that the mangling rules are designed mostly to avoid accidents; it still is
|
||||||
possible to access or modify a variable that is considered private. This can
|
possible to access or modify a variable that is considered private. This can
|
||||||
|
|
|
@ -4,17 +4,10 @@ Tests common to list and UserList.UserList
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
from functools import cmp_to_key
|
||||||
|
|
||||||
from test import support, seq_tests
|
from test import support, seq_tests
|
||||||
|
|
||||||
def CmpToKey(mycmp):
|
|
||||||
'Convert a cmp= function into a key= function'
|
|
||||||
class K(object):
|
|
||||||
def __init__(self, obj):
|
|
||||||
self.obj = obj
|
|
||||||
def __lt__(self, other):
|
|
||||||
return mycmp(self.obj, other.obj) == -1
|
|
||||||
return K
|
|
||||||
|
|
||||||
class CommonTest(seq_tests.CommonTest):
|
class CommonTest(seq_tests.CommonTest):
|
||||||
|
|
||||||
|
@ -443,7 +436,7 @@ class CommonTest(seq_tests.CommonTest):
|
||||||
return 1
|
return 1
|
||||||
else: # a > b
|
else: # a > b
|
||||||
return -1
|
return -1
|
||||||
u.sort(key=CmpToKey(revcmp))
|
u.sort(key=cmp_to_key(revcmp))
|
||||||
self.assertEqual(u, self.type2test([2,1,0,-1,-2]))
|
self.assertEqual(u, self.type2test([2,1,0,-1,-2]))
|
||||||
|
|
||||||
# The following dumps core in unpatched Python 1.5:
|
# The following dumps core in unpatched Python 1.5:
|
||||||
|
@ -456,7 +449,7 @@ class CommonTest(seq_tests.CommonTest):
|
||||||
else: # xmod > ymod
|
else: # xmod > ymod
|
||||||
return 1
|
return 1
|
||||||
z = self.type2test(range(12))
|
z = self.type2test(range(12))
|
||||||
z.sort(key=CmpToKey(myComparison))
|
z.sort(key=cmp_to_key(myComparison))
|
||||||
|
|
||||||
self.assertRaises(TypeError, z.sort, 2)
|
self.assertRaises(TypeError, z.sort, 2)
|
||||||
|
|
||||||
|
@ -468,7 +461,8 @@ class CommonTest(seq_tests.CommonTest):
|
||||||
return -1
|
return -1
|
||||||
else: # x > y
|
else: # x > y
|
||||||
return 1
|
return 1
|
||||||
self.assertRaises(ValueError, z.sort, key=CmpToKey(selfmodifyingComparison))
|
self.assertRaises(ValueError, z.sort,
|
||||||
|
key=cmp_to_key(selfmodifyingComparison))
|
||||||
|
|
||||||
self.assertRaises(TypeError, z.sort, 42, 42, 42, 42)
|
self.assertRaises(TypeError, z.sort, 42, 42, 42, 42)
|
||||||
|
|
||||||
|
|
|
@ -2,18 +2,11 @@ from test import support
|
||||||
import random
|
import random
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
|
from functools import cmp_to_key
|
||||||
|
|
||||||
verbose = support.verbose
|
verbose = support.verbose
|
||||||
nerrors = 0
|
nerrors = 0
|
||||||
|
|
||||||
def CmpToKey(mycmp):
|
|
||||||
'Convert a cmp= function into a key= function'
|
|
||||||
class K(object):
|
|
||||||
def __init__(self, obj):
|
|
||||||
self.obj = obj
|
|
||||||
def __lt__(self, other):
|
|
||||||
return mycmp(self.obj, other.obj) == -1
|
|
||||||
return K
|
|
||||||
|
|
||||||
def check(tag, expected, raw, compare=None):
|
def check(tag, expected, raw, compare=None):
|
||||||
global nerrors
|
global nerrors
|
||||||
|
@ -23,7 +16,7 @@ def check(tag, expected, raw, compare=None):
|
||||||
|
|
||||||
orig = raw[:] # save input in case of error
|
orig = raw[:] # save input in case of error
|
||||||
if compare:
|
if compare:
|
||||||
raw.sort(key=CmpToKey(compare))
|
raw.sort(key=cmp_to_key(compare))
|
||||||
else:
|
else:
|
||||||
raw.sort()
|
raw.sort()
|
||||||
|
|
||||||
|
@ -108,7 +101,7 @@ class TestBase(unittest.TestCase):
|
||||||
print(" Checking against an insane comparison function.")
|
print(" Checking against an insane comparison function.")
|
||||||
print(" If the implementation isn't careful, this may segfault.")
|
print(" If the implementation isn't careful, this may segfault.")
|
||||||
s = x[:]
|
s = x[:]
|
||||||
s.sort(key=CmpToKey(lambda a, b: int(random.random() * 3) - 1))
|
s.sort(key=cmp_to_key(lambda a, b: int(random.random() * 3) - 1))
|
||||||
check("an insane function left some permutation", x, s)
|
check("an insane function left some permutation", x, s)
|
||||||
|
|
||||||
if len(x) >= 2:
|
if len(x) >= 2:
|
||||||
|
@ -165,12 +158,12 @@ class TestBugs(unittest.TestCase):
|
||||||
L.pop()
|
L.pop()
|
||||||
return (x > y) - (x < y)
|
return (x > y) - (x < y)
|
||||||
L = [1,2]
|
L = [1,2]
|
||||||
self.assertRaises(ValueError, L.sort, key=CmpToKey(mutating_cmp))
|
self.assertRaises(ValueError, L.sort, key=cmp_to_key(mutating_cmp))
|
||||||
def mutating_cmp(x, y):
|
def mutating_cmp(x, y):
|
||||||
L.append(3)
|
L.append(3)
|
||||||
del L[:]
|
del L[:]
|
||||||
return (x > y) - (x < y)
|
return (x > y) - (x < y)
|
||||||
self.assertRaises(ValueError, L.sort, key=CmpToKey(mutating_cmp))
|
self.assertRaises(ValueError, L.sort, key=cmp_to_key(mutating_cmp))
|
||||||
memorywaster = [memorywaster]
|
memorywaster = [memorywaster]
|
||||||
|
|
||||||
#==============================================================================
|
#==============================================================================
|
||||||
|
@ -185,7 +178,7 @@ class TestDecorateSortUndecorate(unittest.TestCase):
|
||||||
def my_cmp(x, y):
|
def my_cmp(x, y):
|
||||||
xlower, ylower = x.lower(), y.lower()
|
xlower, ylower = x.lower(), y.lower()
|
||||||
return (xlower > ylower) - (xlower < ylower)
|
return (xlower > ylower) - (xlower < ylower)
|
||||||
copy.sort(key=CmpToKey(my_cmp))
|
copy.sort(key=cmp_to_key(my_cmp))
|
||||||
|
|
||||||
def test_baddecorator(self):
|
def test_baddecorator(self):
|
||||||
data = 'The quick Brown fox Jumped over The lazy Dog'.split()
|
data = 'The quick Brown fox Jumped over The lazy Dog'.split()
|
||||||
|
@ -261,8 +254,8 @@ class TestDecorateSortUndecorate(unittest.TestCase):
|
||||||
def my_cmp_reversed(x, y):
|
def my_cmp_reversed(x, y):
|
||||||
x0, y0 = x[0], y[0]
|
x0, y0 = x[0], y[0]
|
||||||
return (y0 > x0) - (y0 < x0)
|
return (y0 > x0) - (y0 < x0)
|
||||||
data.sort(key=CmpToKey(my_cmp), reverse=True)
|
data.sort(key=cmp_to_key(my_cmp), reverse=True)
|
||||||
copy1.sort(key=CmpToKey(my_cmp_reversed))
|
copy1.sort(key=cmp_to_key(my_cmp_reversed))
|
||||||
self.assertEqual(data, copy1)
|
self.assertEqual(data, copy1)
|
||||||
copy2.sort(key=lambda x: x[0], reverse=True)
|
copy2.sort(key=lambda x: x[0], reverse=True)
|
||||||
self.assertEqual(data, copy2)
|
self.assertEqual(data, copy2)
|
||||||
|
|
65
Misc/NEWS
65
Misc/NEWS
|
@ -10,6 +10,12 @@ What's New in Python 3.2.2?
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #11603: Fix a crash when __str__ is rebound as __repr__. Patch by
|
||||||
|
Andreas Stührk.
|
||||||
|
|
||||||
|
- Issue #11321: Fix a crash with multiple imports of the _pickle module when
|
||||||
|
embedding Python. Patch by Andreas Stührk.
|
||||||
|
|
||||||
- Verify the types of AST strings and identifiers provided by the user before
|
- Verify the types of AST strings and identifiers provided by the user before
|
||||||
compiling them.
|
compiling them.
|
||||||
|
|
||||||
|
@ -26,8 +32,6 @@ Core and Builtins
|
||||||
deallocator calls one of the methods on the type (e.g. when subclassing
|
deallocator calls one of the methods on the type (e.g. when subclassing
|
||||||
IOBase). Diagnosis and patch by Davide Rizzo.
|
IOBase). Diagnosis and patch by Davide Rizzo.
|
||||||
|
|
||||||
- Issue #9611, #9015: FileIO.read() clamps the length to INT_MAX on Windows.
|
|
||||||
|
|
||||||
- When a generator yields, do not retain the caller's exception state on the
|
- When a generator yields, do not retain the caller's exception state on the
|
||||||
generator.
|
generator.
|
||||||
|
|
||||||
|
@ -37,11 +41,6 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
- Issue #12102: Document that buffered files must be flushed before being used
|
|
||||||
with mmap. Patch by Steffen Daode Nurpmeso.
|
|
||||||
|
|
||||||
- Issue #12560: Build libpython.so on OpenBSD. Patch by Stefan Sperling.
|
|
||||||
|
|
||||||
- Issue #1813: Fix codec lookup under Turkish locales.
|
- Issue #1813: Fix codec lookup under Turkish locales.
|
||||||
|
|
||||||
- Issue #12591: Improve support of "universal newlines" in the subprocess
|
- Issue #12591: Improve support of "universal newlines" in the subprocess
|
||||||
|
@ -51,12 +50,10 @@ Library
|
||||||
a read1() method), and add an undocumented *write_through* parameter to
|
a read1() method), and add an undocumented *write_through* parameter to
|
||||||
mandate unbuffered writes.
|
mandate unbuffered writes.
|
||||||
|
|
||||||
|
- Issue #9611, #9015: FileIO.read() clamps the length to INT_MAX on Windows.
|
||||||
|
|
||||||
- Issue #10883: Fix socket leaks in urllib.request when using FTP.
|
- Issue #10883: Fix socket leaks in urllib.request when using FTP.
|
||||||
|
|
||||||
- Issue #12592: Make Python build on OpenBSD 5 (and future major releases).
|
|
||||||
|
|
||||||
- Issue #12372: POSIX semaphores are broken on AIX: don't use them.
|
|
||||||
|
|
||||||
- Issue #12571: Add a plat-linux3 directory mirroring the plat-linux2
|
- Issue #12571: Add a plat-linux3 directory mirroring the plat-linux2
|
||||||
directory, so that "import DLFCN" and other similar imports work on
|
directory, so that "import DLFCN" and other similar imports work on
|
||||||
Linux 3.0.
|
Linux 3.0.
|
||||||
|
@ -67,16 +64,10 @@ Library
|
||||||
- Close the call queue in concurrent.futures.ProcessPoolExecutor when
|
- Close the call queue in concurrent.futures.ProcessPoolExecutor when
|
||||||
shutdown() is called, without waiting for the garbage collector to kick in.
|
shutdown() is called, without waiting for the garbage collector to kick in.
|
||||||
|
|
||||||
- Issue #11603: Fix a crash when __str__ is rebound as __repr__. Patch by
|
|
||||||
Andreas Stührk.
|
|
||||||
|
|
||||||
- Issue #11321: Fix a crash with multiple imports of the _pickle module when
|
|
||||||
embedding Python. Patch by Andreas Stührk.
|
|
||||||
|
|
||||||
- Issue #12502: asyncore: fix polling loop with AF_UNIX sockets.
|
- Issue #12502: asyncore: fix polling loop with AF_UNIX sockets.
|
||||||
|
|
||||||
- Issue #4376: ctypes now supports nested structures in a endian different than
|
- Issue #4376: ctypes now supports nested structures with an endianness
|
||||||
the parent structure. Patch by Vlad Riscutia.
|
different than that of the parent structure. Patch by Vlad Riscutia.
|
||||||
|
|
||||||
- Raise ValueError when attempting to set the _CHUNK_SIZE attribute of a
|
- Raise ValueError when attempting to set the _CHUNK_SIZE attribute of a
|
||||||
TextIOWrapper to a huge value, not TypeError.
|
TextIOWrapper to a huge value, not TypeError.
|
||||||
|
@ -85,15 +76,15 @@ Library
|
||||||
if the process has only one pipe.
|
if the process has only one pipe.
|
||||||
|
|
||||||
- Issue #12451: pydoc: html_getfile() now uses tokenize.open() to support
|
- Issue #12451: pydoc: html_getfile() now uses tokenize.open() to support
|
||||||
Python scripts using a encoding different than UTF-8 (read the coding cookie
|
Python modules using a encoding different than UTF-8 (reading the coding
|
||||||
of the script).
|
cookie of the module).
|
||||||
|
|
||||||
- Issue #12451: pydoc: importfile() now opens the Python script in binary mode,
|
- Issue #12451: pydoc: importfile() now opens the Python module in binary mode,
|
||||||
instead of text mode using the locale encoding, to avoid encoding issues.
|
instead of text mode using the locale encoding, to avoid encoding issues.
|
||||||
|
|
||||||
- Issue #12451: runpy: run_path() now opens the Python script in binary mode,
|
- Issue #12451: runpy: run_path() now opens the Python module in binary mode,
|
||||||
instead of text mode using the locale encoding, to support other encodings
|
instead of text mode using the locale encoding, to support other encodings
|
||||||
than UTF-8 (scripts using the coding cookie).
|
than UTF-8 (modules using the coding cookie).
|
||||||
|
|
||||||
- Issue #12451: xml.dom.pulldom: parse() now opens files in binary mode instead
|
- Issue #12451: xml.dom.pulldom: parse() now opens files in binary mode instead
|
||||||
of the text mode (using the locale encoding) to avoid encoding issues.
|
of the text mode (using the locale encoding) to avoid encoding issues.
|
||||||
|
@ -108,6 +99,21 @@ Extension Modules
|
||||||
C-API
|
C-API
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
Build
|
||||||
|
-----
|
||||||
|
|
||||||
|
- Issue #12560: Build libpython.so on OpenBSD. Patch by Stefan Sperling.
|
||||||
|
|
||||||
|
- Issue #12592: Make Python build on OpenBSD 5 (and future major releases).
|
||||||
|
|
||||||
|
- Issue #12372: POSIX semaphores are broken on AIX: don't use them.
|
||||||
|
|
||||||
|
Tools/Demos
|
||||||
|
-----------
|
||||||
|
|
||||||
|
- Issue #10639: reindent.py no longer converts newlines and will raise
|
||||||
|
an error if attempting to convert a file with mixed newlines.
|
||||||
|
|
||||||
Tests
|
Tests
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
@ -227,9 +233,6 @@ Library
|
||||||
greater or equal to the default value, the value with which the interpreter
|
greater or equal to the default value, the value with which the interpreter
|
||||||
was built.
|
was built.
|
||||||
|
|
||||||
- Issue #12404: Remove C89 incompatible code from mmap module. Patch by Akira
|
|
||||||
Kitada.
|
|
||||||
|
|
||||||
- Issue #12383: Fix subprocess module with env={}: don't copy the environment
|
- Issue #12383: Fix subprocess module with env={}: don't copy the environment
|
||||||
variables, start with an empty environment.
|
variables, start with an empty environment.
|
||||||
|
|
||||||
|
@ -296,6 +299,9 @@ Library
|
||||||
Extension Modules
|
Extension Modules
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #12404: Remove C89 incompatible code from mmap module. Patch by Akira
|
||||||
|
Kitada.
|
||||||
|
|
||||||
- Issue #12221: Replace pyexpat.__version__ with the Python version.
|
- Issue #12221: Replace pyexpat.__version__ with the Python version.
|
||||||
|
|
||||||
Build
|
Build
|
||||||
|
@ -310,11 +316,6 @@ Build
|
||||||
"make install" creates symlinks in --prefix bin for the "-32" files in the
|
"make install" creates symlinks in --prefix bin for the "-32" files in the
|
||||||
framework bin directory like the installer does.
|
framework bin directory like the installer does.
|
||||||
|
|
||||||
Tools/Demos
|
|
||||||
-----------
|
|
||||||
|
|
||||||
- Issue #10639: reindent.py no longer converts newlines and will raise
|
|
||||||
an error if attempting to convert a file with mixed newlines.
|
|
||||||
|
|
||||||
Tests
|
Tests
|
||||||
-----
|
-----
|
||||||
|
|
|
@ -57,7 +57,7 @@ typedef struct {
|
||||||
int error; /* see WFERR_* values */
|
int error; /* see WFERR_* values */
|
||||||
int depth;
|
int depth;
|
||||||
/* If fp == NULL, the following are valid: */
|
/* If fp == NULL, the following are valid: */
|
||||||
PyObject * readable; /* Stream-like object being read from */
|
PyObject *readable; /* Stream-like object being read from */
|
||||||
PyObject *str;
|
PyObject *str;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
char *end;
|
char *end;
|
||||||
|
@ -470,7 +470,7 @@ typedef WFILE RFILE; /* Same struct with different invariants */
|
||||||
static int
|
static int
|
||||||
r_string(char *s, int n, RFILE *p)
|
r_string(char *s, int n, RFILE *p)
|
||||||
{
|
{
|
||||||
char * ptr;
|
char *ptr;
|
||||||
int read, left;
|
int read, left;
|
||||||
|
|
||||||
if (!p->readable) {
|
if (!p->readable) {
|
||||||
|
@ -569,7 +569,7 @@ r_long(RFILE *p)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
r_long64(RFILE *p)
|
r_long64(RFILE *p)
|
||||||
{
|
{
|
||||||
PyObject * result = NULL;
|
PyObject *result = NULL;
|
||||||
long lo4 = r_long(p);
|
long lo4 = r_long(p);
|
||||||
long hi4 = r_long(p);
|
long hi4 = r_long(p);
|
||||||
|
|
||||||
|
|
1
Tools/scripts/abitype.py
Normal file → Executable file
1
Tools/scripts/abitype.py
Normal file → Executable file
|
@ -1,3 +1,4 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
# This script converts a C file to use the PEP 384 type definition API
|
# This script converts a C file to use the PEP 384 type definition API
|
||||||
# Usage: abitype.py < old_code > new_code
|
# Usage: abitype.py < old_code > new_code
|
||||||
import re, sys
|
import re, sys
|
||||||
|
|
0
Tools/scripts/cleanfuture.py
Normal file → Executable file
0
Tools/scripts/cleanfuture.py
Normal file → Executable file
0
Tools/scripts/combinerefs.py
Normal file → Executable file
0
Tools/scripts/combinerefs.py
Normal file → Executable file
0
Tools/scripts/db2pickle.py
Normal file → Executable file
0
Tools/scripts/db2pickle.py
Normal file → Executable file
1
Tools/scripts/diff.py
Normal file → Executable file
1
Tools/scripts/diff.py
Normal file → Executable file
|
@ -1,3 +1,4 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
""" Command line interface to difflib.py providing diffs in four formats:
|
""" Command line interface to difflib.py providing diffs in four formats:
|
||||||
|
|
||||||
* ndiff: lists every line and highlights interline changes.
|
* ndiff: lists every line and highlights interline changes.
|
||||||
|
|
0
Tools/scripts/find_recursionlimit.py
Normal file → Executable file
0
Tools/scripts/find_recursionlimit.py
Normal file → Executable file
0
Tools/scripts/get-remote-certificate.py
Normal file → Executable file
0
Tools/scripts/get-remote-certificate.py
Normal file → Executable file
25
Tools/scripts/mailerdaemon.py
Normal file → Executable file
25
Tools/scripts/mailerdaemon.py
Normal file → Executable file
|
@ -1,4 +1,5 @@
|
||||||
"""mailerdaemon - classes to parse mailer-daemon messages"""
|
#!/usr/bin/env python3
|
||||||
|
"""Classes to parse mailer-daemon messages."""
|
||||||
|
|
||||||
import calendar
|
import calendar
|
||||||
import email.message
|
import email.message
|
||||||
|
@ -6,7 +7,10 @@ import re
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
Unparseable = 'mailerdaemon.Unparseable'
|
|
||||||
|
class Unparseable(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ErrorMessage(email.message.Message):
|
class ErrorMessage(email.message.Message):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -18,8 +22,10 @@ class ErrorMessage(email.message.Message):
|
||||||
if not sub:
|
if not sub:
|
||||||
return 0
|
return 0
|
||||||
sub = sub.lower()
|
sub = sub.lower()
|
||||||
if sub.startswith('waiting mail'): return 1
|
if sub.startswith('waiting mail'):
|
||||||
if 'warning' in sub: return 1
|
return 1
|
||||||
|
if 'warning' in sub:
|
||||||
|
return 1
|
||||||
self.sub = sub
|
self.sub = sub
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@ -145,14 +151,17 @@ def emparse_list(fp, sub):
|
||||||
errors.append(' '.join((email.strip()+': '+reason).split()))
|
errors.append(' '.join((email.strip()+': '+reason).split()))
|
||||||
return errors
|
return errors
|
||||||
|
|
||||||
EMPARSERS = [emparse_list, ]
|
EMPARSERS = [emparse_list]
|
||||||
|
|
||||||
def sort_numeric(a, b):
|
def sort_numeric(a, b):
|
||||||
a = int(a)
|
a = int(a)
|
||||||
b = int(b)
|
b = int(b)
|
||||||
if a < b: return -1
|
if a < b:
|
||||||
elif a > b: return 1
|
return -1
|
||||||
else: return 0
|
elif a > b:
|
||||||
|
return 1
|
||||||
|
else:
|
||||||
|
return 0
|
||||||
|
|
||||||
def parsedir(dir, modify):
|
def parsedir(dir, modify):
|
||||||
os.chdir(dir)
|
os.chdir(dir)
|
||||||
|
|
1
Tools/scripts/make_ctype.py
Normal file → Executable file
1
Tools/scripts/make_ctype.py
Normal file → Executable file
|
@ -1,3 +1,4 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
"""Script that generates the ctype.h-replacement in stringobject.c."""
|
"""Script that generates the ctype.h-replacement in stringobject.c."""
|
||||||
|
|
||||||
NAMES = ("LOWER", "UPPER", "ALPHA", "DIGIT", "XDIGIT", "ALNUM", "SPACE")
|
NAMES = ("LOWER", "UPPER", "ALPHA", "DIGIT", "XDIGIT", "ALNUM", "SPACE")
|
||||||
|
|
0
Tools/scripts/md5sum.py
Normal file → Executable file
0
Tools/scripts/md5sum.py
Normal file → Executable file
1
Tools/scripts/patchcheck.py
Normal file → Executable file
1
Tools/scripts/patchcheck.py
Normal file → Executable file
|
@ -1,3 +1,4 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import shutil
|
import shutil
|
||||||
|
|
0
Tools/scripts/pickle2db.py
Normal file → Executable file
0
Tools/scripts/pickle2db.py
Normal file → Executable file
0
Tools/scripts/pysource.py
Normal file → Executable file
0
Tools/scripts/pysource.py
Normal file → Executable file
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
# Make a reST file compliant to our pre-commit hook.
|
# Make a reST file compliant to our pre-commit hook.
|
||||||
# Currently just remove trailing whitespace.
|
# Currently just remove trailing whitespace.
|
||||||
|
|
0
Tools/scripts/svneol.py
Normal file → Executable file
0
Tools/scripts/svneol.py
Normal file → Executable file
Loading…
Add table
Add a link
Reference in a new issue