Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ad0790e5
Commit
ad0790e5
authored
Apr 20, 2011
by
Éric Araujo
Browse files
Options
Browse Files
Download
Plain Diff
Branch merge
parents
58de6ee8
f8e1b607
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
33 deletions
+54
-33
Doc/c-api/intro.rst
Doc/c-api/intro.rst
+1
-2
Doc/documenting/markup.rst
Doc/documenting/markup.rst
+21
-4
Lib/dbm/__init__.py
Lib/dbm/__init__.py
+12
-10
Lib/distutils/command/sdist.py
Lib/distutils/command/sdist.py
+14
-11
Lib/distutils/tests/test_register.py
Lib/distutils/tests/test_register.py
+3
-3
Lib/heapq.py
Lib/heapq.py
+3
-3
No files found.
Doc/c-api/intro.rst
View file @
ad0790e5
...
@@ -511,13 +511,12 @@ interpreter can only be used after the interpreter has been initialized.
...
@@ -511,13 +511,12 @@ interpreter can only be used after the interpreter has been initialized.
module: builtins
module: builtins
module: __main__
module: __main__
module: sys
module: sys
module: exceptions
triple: module; search; path
triple: module; search; path
single: path (in module sys)
single: path (in module sys)
The basic initialization function is :cfunc:`Py_Initialize`. This initializes
The basic initialization function is :cfunc:`Py_Initialize`. This initializes
the table of loaded modules, and creates the fundamental modules
the table of loaded modules, and creates the fundamental modules
:mod:`builtins`, :mod:`__main__`,
:mod:`sys`, and :mod:`exception
s`. It also
:mod:`builtins`, :mod:`__main__`,
and :mod:`sy
s`. It also
initializes the module search path (``sys.path``).
initializes the module search path (``sys.path``).
.. index:: single: PySys_SetArgv()
.. index:: single: PySys_SetArgv()
...
...
Doc/documenting/markup.rst
View file @
ad0790e5
...
@@ -152,7 +152,7 @@ The directives are:
...
@@ -152,7 +152,7 @@ The directives are:
Describes
global
data
in
a
module
,
including
both
variables
and
values
used
Describes
global
data
in
a
module
,
including
both
variables
and
values
used
as
"defined constants."
Class
and
object
attributes
are
not
documented
as
"defined constants."
Class
and
object
attributes
are
not
documented
using
this
environment
.
using
this
directive
.
..
describe
::
exception
..
describe
::
exception
...
@@ -165,7 +165,7 @@ The directives are:
...
@@ -165,7 +165,7 @@ The directives are:
parameters
,
enclosing
optional
parameters
in
brackets
.
Default
values
can
be
parameters
,
enclosing
optional
parameters
in
brackets
.
Default
values
can
be
given
if
it
enhances
clarity
.
For
example
::
given
if
it
enhances
clarity
.
For
example
::
..
function
::
Timer
.
repeat
([
repeat
=
3
[,
number
=
1000000
]])
..
function
::
repeat
([
repeat
=
3
[,
number
=
1000000
]])
Object
methods
are
not
documented
using
this
directive
.
Bound
object
methods
Object
methods
are
not
documented
using
this
directive
.
Bound
object
methods
placed
in
the
module
namespace
as
part
of
the
public
interface
of
the
module
placed
in
the
module
namespace
as
part
of
the
public
interface
of
the
module
...
@@ -186,13 +186,30 @@ The directives are:
...
@@ -186,13 +186,30 @@ The directives are:
Describes
an
object
data
attribute
.
The
description
should
include
Describes
an
object
data
attribute
.
The
description
should
include
information
about
the
type
of
the
data
to
be
expected
and
whether
it
may
be
information
about
the
type
of
the
data
to
be
expected
and
whether
it
may
be
changed
directly
.
changed
directly
.
This
directive
should
be
nested
in
a
class
directive
,
like
in
this
example
::
..
class
::
Spam
Description
of
the
class
.
..
data
::
ham
Description
of
the
attribute
.
If
is
also
possible
to
document
an
attribute
outside
of
a
class
directive
,
for
example
if
the
documentation
for
different
attributes
and
methods
is
split
in
multiple
sections
.
The
class
name
should
then
be
included
explicitly
::
..
data
::
Spam
.
eggs
..
describe
::
method
..
describe
::
method
Describes
an
object
method
.
The
parameters
should
not
include
the
``
self
``
Describes
an
object
method
.
The
parameters
should
not
include
the
``
self
``
parameter
.
The
description
should
include
similar
information
to
that
parameter
.
The
description
should
include
similar
information
to
that
described
for
``
function
``.
described
for
``
function
``.
This
method
should
be
nested
in
a
class
method
,
like
in
the
example
above
.
..
describe
::
opcode
..
describe
::
opcode
...
...
Lib/dbm/__init__.py
View file @
ad0790e5
...
@@ -24,16 +24,8 @@ It has the following interface (key and data are strings):
...
@@ -24,16 +24,8 @@ It has the following interface (key and data are strings):
list = d.keys() # return a list of all existing keys (slow!)
list = d.keys() # return a list of all existing keys (slow!)
Future versions may change the order in which implementations are
Future versions may change the order in which implementations are
tested for existence, add interfaces to other dbm-like
tested for existence, a
nd a
dd interfaces to other dbm-like
implementations.
implementations.
The open function has an optional second argument. This can be 'r',
for read-only access, 'w', for read-write access of an existing
database, 'c' for read-write access to a new or existing database, and
'n' for read-write access to a new database. The default is 'r'.
Note: 'r' and 'w' fail if the database doesn't exist; 'c' creates it
only if it doesn't exist; and 'n' always creates a new database.
"""
"""
__all__
=
[
'open'
,
'whichdb'
,
'error'
,
'error'
]
__all__
=
[
'open'
,
'whichdb'
,
'error'
,
'error'
]
...
@@ -54,7 +46,17 @@ _modules = {}
...
@@ -54,7 +46,17 @@ _modules = {}
error
=
(
error
,
IOError
)
error
=
(
error
,
IOError
)
def
open
(
file
,
flag
=
'r'
,
mode
=
0o666
):
def
open
(
file
,
flag
=
'r'
,
mode
=
0o666
):
"""Open or create database at path given by *file*.
Optional argument *flag* can be 'r' (default) for read-only access, 'w'
for read-write access of an existing database, 'c' for read-write access
to a new or existing database, and 'n' for read-write access to a new
database.
Note: 'r' and 'w' fail if the database doesn't exist; 'c' creates it
only if it doesn't exist; and 'n' always creates a new database.
"""
global
_defaultmod
global
_defaultmod
if
_defaultmod
is
None
:
if
_defaultmod
is
None
:
for
name
in
_names
:
for
name
in
_names
:
...
...
Lib/distutils/command/sdist.py
View file @
ad0790e5
...
@@ -294,6 +294,7 @@ class sdist(Command):
...
@@ -294,6 +294,7 @@ class sdist(Command):
join_lines
=
1
,
lstrip_ws
=
1
,
rstrip_ws
=
1
,
join_lines
=
1
,
lstrip_ws
=
1
,
rstrip_ws
=
1
,
collapse_join
=
1
)
collapse_join
=
1
)
try
:
while
True
:
while
True
:
line
=
template
.
readline
()
line
=
template
.
readline
()
if
line
is
None
:
# end of file
if
line
is
None
:
# end of file
...
@@ -305,6 +306,8 @@ class sdist(Command):
...
@@ -305,6 +306,8 @@ class sdist(Command):
self
.
warn
(
"%s, line %d: %s"
%
(
template
.
filename
,
self
.
warn
(
"%s, line %d: %s"
%
(
template
.
filename
,
template
.
current_line
,
template
.
current_line
,
msg
))
msg
))
finally
:
template
.
close
()
def
prune_file_list
(
self
):
def
prune_file_list
(
self
):
"""Prune off branches that might slip into the file list as created
"""Prune off branches that might slip into the file list as created
...
...
Lib/distutils/tests/test_register.py
View file @
ad0790e5
...
@@ -137,7 +137,7 @@ class RegisterTestCase(PyPIRCCommandTestCase):
...
@@ -137,7 +137,7 @@ class RegisterTestCase(PyPIRCCommandTestCase):
# let's see what the server received : we should
# let's see what the server received : we should
# have 2 similar requests
# have 2 similar requests
self
.
assert
True
(
self
.
conn
.
reqs
,
2
)
self
.
assert
Equal
(
len
(
self
.
conn
.
reqs
)
,
2
)
req1
=
dict
(
self
.
conn
.
reqs
[
0
].
headers
)
req1
=
dict
(
self
.
conn
.
reqs
[
0
].
headers
)
req2
=
dict
(
self
.
conn
.
reqs
[
1
].
headers
)
req2
=
dict
(
self
.
conn
.
reqs
[
1
].
headers
)
...
@@ -169,7 +169,7 @@ class RegisterTestCase(PyPIRCCommandTestCase):
...
@@ -169,7 +169,7 @@ class RegisterTestCase(PyPIRCCommandTestCase):
del
register_module
.
input
del
register_module
.
input
# we should have send a request
# we should have send a request
self
.
assert
True
(
self
.
conn
.
reqs
,
1
)
self
.
assert
Equal
(
len
(
self
.
conn
.
reqs
)
,
1
)
req
=
self
.
conn
.
reqs
[
0
]
req
=
self
.
conn
.
reqs
[
0
]
headers
=
dict
(
req
.
headers
)
headers
=
dict
(
req
.
headers
)
self
.
assertEqual
(
headers
[
'Content-length'
],
'608'
)
self
.
assertEqual
(
headers
[
'Content-length'
],
'608'
)
...
@@ -187,7 +187,7 @@ class RegisterTestCase(PyPIRCCommandTestCase):
...
@@ -187,7 +187,7 @@ class RegisterTestCase(PyPIRCCommandTestCase):
del
register_module
.
input
del
register_module
.
input
# we should have send a request
# we should have send a request
self
.
assert
True
(
self
.
conn
.
reqs
,
1
)
self
.
assert
Equal
(
len
(
self
.
conn
.
reqs
)
,
1
)
req
=
self
.
conn
.
reqs
[
0
]
req
=
self
.
conn
.
reqs
[
0
]
headers
=
dict
(
req
.
headers
)
headers
=
dict
(
req
.
headers
)
self
.
assertEqual
(
headers
[
'Content-length'
],
'290'
)
self
.
assertEqual
(
headers
[
'Content-length'
],
'290'
)
...
...
Lib/heapq.py
View file @
ad0790e5
...
@@ -172,7 +172,7 @@ def heappushpop(heap, item):
...
@@ -172,7 +172,7 @@ def heappushpop(heap, item):
return
item
return
item
def
heapify
(
x
):
def
heapify
(
x
):
"""Transform list into a heap, in-place, in O(len(
heap
)) time."""
"""Transform list into a heap, in-place, in O(len(
x
)) time."""
n
=
len
(
x
)
n
=
len
(
x
)
# Transform bottom-up. The largest index there's any point to looking at
# Transform bottom-up. The largest index there's any point to looking at
# is the largest with a child index in-range, so must have 2*i + 1 < n,
# is the largest with a child index in-range, so must have 2*i + 1 < n,
...
@@ -363,7 +363,7 @@ def nsmallest(n, iterable, key=None):
...
@@ -363,7 +363,7 @@ def nsmallest(n, iterable, key=None):
return
[
min
(
chain
(
head
,
it
))]
return
[
min
(
chain
(
head
,
it
))]
return
[
min
(
chain
(
head
,
it
),
key
=
key
)]
return
[
min
(
chain
(
head
,
it
),
key
=
key
)]
# When n>=size, it's faster to use sort()
# When n>=size, it's faster to use sort
ed
()
try
:
try
:
size
=
len
(
iterable
)
size
=
len
(
iterable
)
except
(
TypeError
,
AttributeError
):
except
(
TypeError
,
AttributeError
):
...
@@ -401,7 +401,7 @@ def nlargest(n, iterable, key=None):
...
@@ -401,7 +401,7 @@ def nlargest(n, iterable, key=None):
return
[
max
(
chain
(
head
,
it
))]
return
[
max
(
chain
(
head
,
it
))]
return
[
max
(
chain
(
head
,
it
),
key
=
key
)]
return
[
max
(
chain
(
head
,
it
),
key
=
key
)]
# When n>=size, it's faster to use sort()
# When n>=size, it's faster to use sort
ed
()
try
:
try
:
size
=
len
(
iterable
)
size
=
len
(
iterable
)
except
(
TypeError
,
AttributeError
):
except
(
TypeError
,
AttributeError
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment