资源简介
python276_bin.zip
代码片段和文件信息
# Copyright 2007 Google Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
“““Abstract base Classes (ABCs) according to PEP 3119.“““
import types
from _weakrefset import WeakSet
# Instance of old-style class
class _C: pass
_InstanceType = type(_C())
def abstractmethod(funcobj):
“““A decorator indicating abstract methods.
Requires that the metaclass is ABCmeta or derived from it. A
class that has a metaclass derived from ABCmeta cannot be
instantiated unless all of its abstract methods are overridden.
The abstract methods can be called using any of the normal
‘super‘ call mechanisms.
Usage:
class C:
__metaclass__ = ABCmeta
@abstractmethod
def my_abstract_method(self ...):
...
“““
funcobj.__isabstractmethod__ = True
return funcobj
class abstractproperty(property):
“““A decorator indicating abstract properties.
Requires that the metaclass is ABCmeta or derived from it. A
class that has a metaclass derived from ABCmeta cannot be
instantiated unless all of its abstract properties are overridden.
The abstract properties can be called using any of the normal
‘super‘ call mechanisms.
Usage:
class C:
__metaclass__ = ABCmeta
@abstractproperty
def my_abstract_property(self):
...
This defines a read-only property; you can also define a read-write
abstract property using the ‘long‘ form of property declaration:
class C:
__metaclass__ = ABCmeta
def getx(self): ...
def setx(self value): ...
x = abstractproperty(getx setx)
“““
__isabstractmethod__ = True
class ABCmeta(type):
“““metaclass for defining Abstract base Classes (ABCs).
Use this metaclass to create an ABC. An ABC can be subclassed
directly and then acts as a mix-in class. You can also register
unrelated concrete classes (even built-in classes) and unrelated
ABCs as ‘virtual subclasses‘ -- these and their descendants will
be considered subclasses of the registering ABC by the built-in
issubclass() function but the registering ABC won‘t show up in
their MRO (Method Resolution Order) nor will method
implementations defined by the registering ABC be callable (not
even via super()).
“““
# A global counter that is incremented each time a class is
# registered as a virtual subclass of anything. It forces the
# negative cache to be cleared before its next use.
_abc_invalidation_counter = 0
def __new__(mcls name bases namespace):
cls = super(ABCmeta mcls).__new__(mcls name bases namespace)
# Compute set of abstract method names
abstracts = set(name
for name value in namespace.items()
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-11-15 10:55 python276_bin\DLLs\
文件 1012224 2013-11-10 19:25 python276_bin\DLLs\_bsddb.pyd
文件 87552 2013-11-10 19:24 python276_bin\DLLs\_ctypes.pyd
文件 15872 2013-11-10 19:24 python276_bin\DLLs\_ctypes_test.pyd
文件 128512 2013-11-10 19:24 python276_bin\DLLs\_elementtree.pyd
文件 358400 2013-11-10 19:24 python276_bin\DLLs\_hashlib.pyd
文件 48128 2013-11-10 19:24 python276_bin\DLLs\_msi.pyd
文件 27136 2013-11-10 19:24 python276_bin\DLLs\_multiprocessing.pyd
文件 44544 2013-11-10 19:24 python276_bin\DLLs\_socket.pyd
文件 47616 2013-11-10 19:24 python276_bin\DLLs\_sqlite3.pyd
文件 899584 2013-11-10 19:24 python276_bin\DLLs\_ssl.pyd
文件 32768 2013-11-10 19:24 python276_bin\DLLs\_testcapi.pyd
文件 68608 2013-11-10 19:24 python276_bin\DLLs\bz2.pyd
文件 19790 2011-03-08 08:39 python276_bin\DLLs\py.ico
文件 19790 2011-03-08 08:39 python276_bin\DLLs\pyc.ico
文件 127488 2013-11-10 19:24 python276_bin\DLLs\pyexpat.pyd
文件 10240 2013-11-10 19:24 python276_bin\DLLs\select.pyd
文件 426496 2013-11-10 19:23 python276_bin\DLLs\sqlite3.dll
文件 686080 2013-11-10 19:24 python276_bin\DLLs\unicodedata.pyd
文件 9216 2013-11-10 19:24 python276_bin\DLLs\winsound.pyd
目录 0 2013-11-15 10:55 python276_bin\include\
文件 46411 2011-05-30 04:53 python276_bin\include\abstract.h
文件 1144 2011-03-08 08:43 python276_bin\include\asdl.h
文件 243 2011-03-08 08:43 python276_bin\include\ast.h
文件 824 2011-03-08 08:39 python276_bin\include\bitset.h
文件 948 2011-03-08 08:43 python276_bin\include\boolob
文件 955 2011-03-08 08:43 python276_bin\include\bufferob
文件 1998 2011-03-08 08:43 python276_bin\include\bytearrayob
文件 2879 2011-03-08 08:43 python276_bin\include\bytes_methods.h
文件 1179 2011-03-08 08:43 python276_bin\include\bytesob
文件 679 2011-03-08 08:43 python276_bin\include\cellob
............此处省略2190个文件信息
评论
共有 条评论