Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
46f484ee
Kaydet (Commit)
46f484ee
authored
Mar 21, 2014
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge
üst
a00c2407
ed6783f3
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
59 additions
and
78 deletions
+59
-78
apiref.rst
Doc/distutils/apiref.rst
+1
-1
extending.rst
Doc/faq/extending.rst
+2
-2
enum.rst
Doc/library/enum.rst
+3
-3
os.path.rst
Doc/library/os.path.rst
+1
-1
os.rst
Doc/library/os.rst
+2
-2
__init__.py
Lib/collections/__init__.py
+1
-3
config.py
Lib/logging/config.py
+44
-61
os.py
Lib/os.py
+2
-2
socketmodule.c
Modules/socketmodule.c
+3
-3
No files found.
Doc/distutils/apiref.rst
Dosyayı görüntüle @
46f484ee
...
@@ -993,7 +993,7 @@ directories.
...
@@ -993,7 +993,7 @@ directories.
Files in *src* that begin with :file:`.nfs` are skipped (more information on
Files in *src* that begin with :file:`.nfs` are skipped (more information on
these files is available in answer D2 of the `NFS FAQ page
these files is available in answer D2 of the `NFS FAQ page
<http://nfs.sourceforge.net/#section_d>`_.
<http://nfs.sourceforge.net/#section_d>`_
)
.
.. versionchanged:: 3.3.1
.. versionchanged:: 3.3.1
NFS files are ignored.
NFS files are ignored.
...
...
Doc/faq/extending.rst
Dosyayı görüntüle @
46f484ee
...
@@ -95,8 +95,8 @@ To test the type of an object, first make sure it isn't *NULL*, and then use
...
@@ -95,8 +95,8 @@ To test the type of an object, first make sure it isn't *NULL*, and then use
There is also a high-level API to Python objects which is provided by the
There is also a high-level API to Python objects which is provided by the
so-called 'abstract' interface -- read ``Include/abstract.h`` for further
so-called 'abstract' interface -- read ``Include/abstract.h`` for further
details. It allows interfacing with any kind of Python sequence using calls
details. It allows interfacing with any kind of Python sequence using calls
like :c:func:`PySequence_Length`, :c:func:`PySequence_GetItem`, etc.
)
as well
like :c:func:`PySequence_Length`, :c:func:`PySequence_GetItem`, etc. as well
as many other useful protocols such as numbers (:c:func:`PyNumber_Index` et
.
as many other useful protocols such as numbers (:c:func:`PyNumber_Index` et
al.) and mappings in the PyMapping APIs.
al.) and mappings in the PyMapping APIs.
...
...
Doc/library/enum.rst
Dosyayı görüntüle @
46f484ee
...
@@ -442,7 +442,7 @@ The complete signature is::
...
@@ -442,7 +442,7 @@ The complete signature is::
:value: What the new Enum class will record as its name.
:value: What the new Enum class will record as its name.
:names: The Enum members. This can be a whitespace or comma sep
e
rated string
:names: The Enum members. This can be a whitespace or comma sep
a
rated string
(values will start at 1)::
(values will start at 1)::
'red green blue' | 'red,green,blue' | 'red, green, blue'
'red green blue' | 'red,green,blue' | 'red, green, blue'
...
@@ -453,7 +453,7 @@ The complete signature is::
...
@@ -453,7 +453,7 @@ The complete signature is::
or a mapping::
or a mapping::
{'chartr
ue
se': 7, 'sea_green': 11, 'rosemary': 42}
{'chartr
eu
se': 7, 'sea_green': 11, 'rosemary': 42}
:module: name of module where new Enum class can be found.
:module: name of module where new Enum class can be found.
...
@@ -543,7 +543,7 @@ Some rules:
...
@@ -543,7 +543,7 @@ Some rules:
add methods and don't specify another data type such as :class:`int` or
add methods and don't specify another data type such as :class:`int` or
:class:`str`.
:class:`str`.
3. When another data type is mixed in, the :attr:`value` attribute is *not the
3. When another data type is mixed in, the :attr:`value` attribute is *not the
same* as the enum member itself, although it is equival
a
nt and will compare
same* as the enum member itself, although it is equival
e
nt and will compare
equal.
equal.
4. %-style formatting: `%s` and `%r` call :class:`Enum`'s :meth:`__str__` and
4. %-style formatting: `%s` and `%r` call :class:`Enum`'s :meth:`__str__` and
:meth:`__repr__` respectively; other codes (such as `%i` or `%h` for
:meth:`__repr__` respectively; other codes (such as `%i` or `%h` for
...
...
Doc/library/os.path.rst
Dosyayı görüntüle @
46f484ee
...
@@ -242,7 +242,7 @@ the :mod:`glob` module.)
...
@@ -242,7 +242,7 @@ the :mod:`glob` module.)
links encountered in the path (if they are supported by the operating system).
links encountered in the path (if they are supported by the operating system).
.. function:: relpath(path, start=
None
)
.. function:: relpath(path, start=
os.curdir
)
Return a relative filepath to *path* either from the current directory or
Return a relative filepath to *path* either from the current directory or
from an optional *start* directory. This is a path computation: the
from an optional *start* directory. This is a path computation: the
...
...
Doc/library/os.rst
Dosyayı görüntüle @
46f484ee
...
@@ -1607,7 +1607,7 @@ features:
...
@@ -1607,7 +1607,7 @@ features:
The *dir_fd* argument.
The *dir_fd* argument.
.. function:: makedirs(
path
, mode=0o777, exist_ok=False)
.. function:: makedirs(
name
, mode=0o777, exist_ok=False)
.. index::
.. index::
single: directory; creating
single: directory; creating
...
@@ -1763,7 +1763,7 @@ features:
...
@@ -1763,7 +1763,7 @@ features:
The *dir_fd* argument.
The *dir_fd* argument.
.. function:: removedirs(
path
)
.. function:: removedirs(
name
)
.. index:: single: directory; deleting
.. index:: single: directory; deleting
...
...
Lib/collections/__init__.py
Dosyayı görüntüle @
46f484ee
...
@@ -274,9 +274,7 @@ class {typename}(tuple):
...
@@ -274,9 +274,7 @@ class {typename}(tuple):
return OrderedDict(zip(self._fields, self))
return OrderedDict(zip(self._fields, self))
def _asdict(self):
def _asdict(self):
'''Return a new OrderedDict which maps field names to their values.
'Return a new OrderedDict which maps field names to their values.'
This method is obsolete. Use vars(nt) or nt.__dict__ instead.
'''
return self.__dict__
return self.__dict__
def __getnewargs__(self):
def __getnewargs__(self):
...
...
Lib/logging/config.py
Dosyayı görüntüle @
46f484ee
# Copyright 2001-201
3
by Vinay Sajip. All Rights Reserved.
# Copyright 2001-201
4
by Vinay Sajip. All Rights Reserved.
#
#
# Permission to use, copy, modify, and distribute this software and its
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# documentation for any purpose and without fee is hereby granted,
...
@@ -19,13 +19,19 @@ Configuration functions for the logging package for Python. The core package
...
@@ -19,13 +19,19 @@ Configuration functions for the logging package for Python. The core package
is based on PEP 282 and comments thereto in comp.lang.python, and influenced
is based on PEP 282 and comments thereto in comp.lang.python, and influenced
by Apache's log4j system.
by Apache's log4j system.
Copyright (C) 2001-201
3
Vinay Sajip. All Rights Reserved.
Copyright (C) 2001-201
4
Vinay Sajip. All Rights Reserved.
To use, simply 'import logging' and log away!
To use, simply 'import logging' and log away!
"""
"""
import
sys
,
logging
,
logging
.
handlers
,
struct
,
traceback
,
re
import
errno
import
io
import
io
import
logging
import
logging.handlers
import
re
import
struct
import
sys
import
traceback
try
:
try
:
import
_thread
as
thread
import
_thread
as
thread
...
@@ -38,10 +44,7 @@ from socketserver import ThreadingTCPServer, StreamRequestHandler
...
@@ -38,10 +44,7 @@ from socketserver import ThreadingTCPServer, StreamRequestHandler
DEFAULT_LOGGING_CONFIG_PORT
=
9030
DEFAULT_LOGGING_CONFIG_PORT
=
9030
if
sys
.
platform
==
"win32"
:
RESET_ERROR
=
errno
.
ECONNRESET
RESET_ERROR
=
10054
#WSAECONNRESET
else
:
RESET_ERROR
=
104
#ECONNRESET
#
#
# The following code implements a socket listener for on-the-fly
# The following code implements a socket listener for on-the-fly
...
@@ -274,23 +277,14 @@ def valid_ident(s):
...
@@ -274,23 +277,14 @@ def valid_ident(s):
return
True
return
True
# The ConvertingXXX classes are wrappers around standard Python containers,
class
ConvertingMixin
(
object
):
# and they serve to convert any suitable values in the container. The
"""For ConvertingXXX's, this mixin class provides common functions"""
# conversion converts base dicts, lists and tuples to their wrapped
# equivalents, whereas strings which match a conversion format are converted
# appropriately.
#
# Each wrapper should have a configurator attribute holding the actual
# configurator to use for conversion.
class
ConvertingDict
(
dict
):
def
convert_with_key
(
self
,
key
,
value
,
replace
=
True
):
"""A converting dictionary wrapper."""
def
__getitem__
(
self
,
key
):
value
=
dict
.
__getitem__
(
self
,
key
)
result
=
self
.
configurator
.
convert
(
value
)
result
=
self
.
configurator
.
convert
(
value
)
#If the converted value is different, save for next time
#If the converted value is different, save for next time
if
value
is
not
result
:
if
value
is
not
result
:
if
replace
:
self
[
key
]
=
result
self
[
key
]
=
result
if
type
(
result
)
in
(
ConvertingDict
,
ConvertingList
,
if
type
(
result
)
in
(
ConvertingDict
,
ConvertingList
,
ConvertingTuple
):
ConvertingTuple
):
...
@@ -298,62 +292,55 @@ class ConvertingDict(dict):
...
@@ -298,62 +292,55 @@ class ConvertingDict(dict):
result
.
key
=
key
result
.
key
=
key
return
result
return
result
def
get
(
self
,
key
,
default
=
None
):
def
convert
(
self
,
value
):
value
=
dict
.
get
(
self
,
key
,
default
)
result
=
self
.
configurator
.
convert
(
value
)
result
=
self
.
configurator
.
convert
(
value
)
#If the converted value is different, save for next time
if
value
is
not
result
:
if
value
is
not
result
:
self
[
key
]
=
result
if
type
(
result
)
in
(
ConvertingDict
,
ConvertingList
,
if
type
(
result
)
in
(
ConvertingDict
,
ConvertingList
,
ConvertingTuple
):
ConvertingTuple
):
result
.
parent
=
self
result
.
parent
=
self
result
.
key
=
key
return
result
return
result
# The ConvertingXXX classes are wrappers around standard Python containers,
# and they serve to convert any suitable values in the container. The
# conversion converts base dicts, lists and tuples to their wrapped
# equivalents, whereas strings which match a conversion format are converted
# appropriately.
#
# Each wrapper should have a configurator attribute holding the actual
# configurator to use for conversion.
class
ConvertingDict
(
dict
,
ConvertingMixin
):
"""A converting dictionary wrapper."""
def
__getitem__
(
self
,
key
):
value
=
dict
.
__getitem__
(
self
,
key
)
return
self
.
convert_with_key
(
key
,
value
)
def
get
(
self
,
key
,
default
=
None
):
value
=
dict
.
get
(
self
,
key
,
default
)
return
self
.
convert_with_key
(
key
,
value
)
def
pop
(
self
,
key
,
default
=
None
):
def
pop
(
self
,
key
,
default
=
None
):
value
=
dict
.
pop
(
self
,
key
,
default
)
value
=
dict
.
pop
(
self
,
key
,
default
)
result
=
self
.
configurator
.
convert
(
value
)
return
self
.
convert_with_key
(
key
,
value
,
replace
=
False
)
if
value
is
not
result
:
if
type
(
result
)
in
(
ConvertingDict
,
ConvertingList
,
ConvertingTuple
):
result
.
parent
=
self
result
.
key
=
key
return
result
class
ConvertingList
(
list
):
class
ConvertingList
(
list
,
ConvertingMixin
):
"""A converting list wrapper."""
"""A converting list wrapper."""
def
__getitem__
(
self
,
key
):
def
__getitem__
(
self
,
key
):
value
=
list
.
__getitem__
(
self
,
key
)
value
=
list
.
__getitem__
(
self
,
key
)
result
=
self
.
configurator
.
convert
(
value
)
return
self
.
convert_with_key
(
key
,
value
)
#If the converted value is different, save for next time
if
value
is
not
result
:
self
[
key
]
=
result
if
type
(
result
)
in
(
ConvertingDict
,
ConvertingList
,
ConvertingTuple
):
result
.
parent
=
self
result
.
key
=
key
return
result
def
pop
(
self
,
idx
=-
1
):
def
pop
(
self
,
idx
=-
1
):
value
=
list
.
pop
(
self
,
idx
)
value
=
list
.
pop
(
self
,
idx
)
result
=
self
.
configurator
.
convert
(
value
)
return
self
.
convert
(
value
)
if
value
is
not
result
:
if
type
(
result
)
in
(
ConvertingDict
,
ConvertingList
,
ConvertingTuple
):
result
.
parent
=
self
return
result
class
ConvertingTuple
(
tuple
):
class
ConvertingTuple
(
tuple
,
ConvertingMixin
):
"""A converting tuple wrapper."""
"""A converting tuple wrapper."""
def
__getitem__
(
self
,
key
):
def
__getitem__
(
self
,
key
):
value
=
tuple
.
__getitem__
(
self
,
key
)
value
=
tuple
.
__getitem__
(
self
,
key
)
result
=
self
.
configurator
.
convert
(
value
)
# Can't replace a tuple entry.
if
value
is
not
result
:
return
self
.
convert_with_key
(
key
,
value
,
replace
=
False
)
if
type
(
result
)
in
(
ConvertingDict
,
ConvertingList
,
ConvertingTuple
):
result
.
parent
=
self
result
.
key
=
key
return
result
class
BaseConfigurator
(
object
):
class
BaseConfigurator
(
object
):
"""
"""
...
@@ -867,11 +854,7 @@ def listen(port=DEFAULT_LOGGING_CONFIG_PORT, verify=None):
...
@@ -867,11 +854,7 @@ def listen(port=DEFAULT_LOGGING_CONFIG_PORT, verify=None):
if
self
.
server
.
ready
:
if
self
.
server
.
ready
:
self
.
server
.
ready
.
set
()
self
.
server
.
ready
.
set
()
except
OSError
as
e
:
except
OSError
as
e
:
if
not
isinstance
(
e
.
args
,
tuple
):
if
e
.
errno
!=
RESET_ERROR
:
raise
else
:
errcode
=
e
.
args
[
0
]
if
errcode
!=
RESET_ERROR
:
raise
raise
class
ConfigSocketReceiver
(
ThreadingTCPServer
):
class
ConfigSocketReceiver
(
ThreadingTCPServer
):
...
...
Lib/os.py
Dosyayı görüntüle @
46f484ee
...
@@ -216,7 +216,7 @@ def _get_masked_mode(mode):
...
@@ -216,7 +216,7 @@ def _get_masked_mode(mode):
# (Inspired by Eric Raymond; the doc strings are mostly his)
# (Inspired by Eric Raymond; the doc strings are mostly his)
def
makedirs
(
name
,
mode
=
0
o777
,
exist_ok
=
False
):
def
makedirs
(
name
,
mode
=
0
o777
,
exist_ok
=
False
):
"""makedirs(
path
[, mode=0o777][, exist_ok=False])
"""makedirs(
name
[, mode=0o777][, exist_ok=False])
Super-mkdir; create a leaf directory and all intermediate ones.
Super-mkdir; create a leaf directory and all intermediate ones.
Works like mkdir, except that any intermediate path segment (not
Works like mkdir, except that any intermediate path segment (not
...
@@ -260,7 +260,7 @@ def makedirs(name, mode=0o777, exist_ok=False):
...
@@ -260,7 +260,7 @@ def makedirs(name, mode=0o777, exist_ok=False):
raise
raise
def
removedirs
(
name
):
def
removedirs
(
name
):
"""removedirs(
path
)
"""removedirs(
name
)
Super-rmdir; remove a leaf directory and all empty intermediate
Super-rmdir; remove a leaf directory and all empty intermediate
ones. Works like rmdir except that, if the leaf directory is
ones. Works like rmdir except that, if the leaf directory is
...
...
Modules/socketmodule.c
Dosyayı görüntüle @
46f484ee
...
@@ -1165,7 +1165,7 @@ makesockaddr(SOCKET_T sockfd, struct sockaddr *addr, size_t addrlen, int proto)
...
@@ -1165,7 +1165,7 @@ makesockaddr(SOCKET_T sockfd, struct sockaddr *addr, size_t addrlen, int proto)
}
}
#endif
#endif
#ifdef
HAVE_LINUX_CAN_H
#ifdef
AF_CAN
case
AF_CAN
:
case
AF_CAN
:
{
{
struct
sockaddr_can
*
a
=
(
struct
sockaddr_can
*
)
addr
;
struct
sockaddr_can
*
a
=
(
struct
sockaddr_can
*
)
addr
;
...
@@ -1589,7 +1589,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
...
@@ -1589,7 +1589,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
}
}
#endif
#endif
#if
def HAVE_LINUX_CAN_H
#if
defined(AF_CAN) && defined(CAN_RAW) && defined(CAN_BCM)
case
AF_CAN
:
case
AF_CAN
:
switch
(
s
->
sock_proto
)
{
switch
(
s
->
sock_proto
)
{
case
CAN_RAW
:
case
CAN_RAW
:
...
@@ -1796,7 +1796,7 @@ getsockaddrlen(PySocketSockObject *s, socklen_t *len_ret)
...
@@ -1796,7 +1796,7 @@ getsockaddrlen(PySocketSockObject *s, socklen_t *len_ret)
}
}
#endif
#endif
#ifdef
HAVE_LINUX_CAN_H
#ifdef
AF_CAN
case
AF_CAN
:
case
AF_CAN
:
{
{
*
len_ret
=
sizeof
(
struct
sockaddr_can
);
*
len_ret
=
sizeof
(
struct
sockaddr_can
);
...
...
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