本文整理汇总了Python中twisted.python.deprecate.deprecatedModuleAttribute函数的典型用法代码示例。如果您正苦于以下问题:Python deprecatedModuleAttribute函数的具体用法?Python deprecatedModuleAttribute怎么用?Python deprecatedModuleAttribute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了deprecatedModuleAttribute函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_wrappedModule
def test_wrappedModule(self):
"""
Deprecating an attribute in a module replaces and wraps that module
instance, in C{sys.modules}, with a
L{twisted.python.deprecate._ModuleProxy} instance but only if it hasn't
already been wrapped.
"""
sys.modules[self._testModuleName] = mod = types.ModuleType('foo')
self.addCleanup(sys.modules.pop, self._testModuleName)
setattr(mod, 'first', 1)
setattr(mod, 'second', 2)
deprecate.deprecatedModuleAttribute(
Version('Twisted', 8, 0, 0),
'message',
self._testModuleName,
'first')
proxy = sys.modules[self._testModuleName]
self.assertNotEqual(proxy, mod)
deprecate.deprecatedModuleAttribute(
Version('Twisted', 8, 0, 0),
'message',
self._testModuleName,
'second')
self.assertIs(proxy, sys.modules[self._testModuleName])
开发者ID:JohnDoes95,项目名称:project_parser,代码行数:29,代码来源:test_deprecate.py
示例2: test_not_catched_warning
def test_not_catched_warning(self):
buildbot_module = new.module('buildbot_module')
buildbot_module.deprecated_attr = 1
with mock.patch.dict(sys.modules,
{'buildbot_module': buildbot_module}):
deprecatedModuleAttribute(Version("Buildbot", 0, 9, 0),
"test message",
"buildbot_module",
"deprecated_attr")
# Overwrite with Twisted's module wrapper.
import buildbot_module
warnings = self.flushWarnings([self.test_not_catched_warning])
self.assertEqual(len(warnings), 0)
# Should produce warning
buildbot_module.deprecated_attr
warnings = self.flushWarnings([self.test_not_catched_warning])
self.assertEqual(len(warnings), 1)
self.assertEqual(warnings[0]['category'], DeprecationWarning)
self.assertIn("test message", warnings[0]['message'])
开发者ID:595796726,项目名称:buildbot,代码行数:23,代码来源:test_worker_transition.py
示例3: get_path
def get_path(self):
return self.get_encoded_path()
def get_url(self):
return self.get_encoded_url()
# Backwards compatibility layer. For deprecation.
def URLContext(service_endpoint, bucket=None, object_name=None):
args = (service_endpoint,)
for s in (bucket, object_name):
if s is not None:
args += (s.decode("utf-8"),)
return s3_url_context(*args)
deprecatedModuleAttribute(
Version("txAWS", 0, 3, 0),
"See txaws.s3.client.query",
__name__,
"Query",
)
deprecatedModuleAttribute(
Version("txAWS", 0, 3, 0),
"See txaws.s3.client.s3_url_context",
__name__,
"URLContext",
)
开发者ID:mithrandi,项目名称:txaws,代码行数:29,代码来源:client.py
示例4: getPythonContainers
def getPythonContainers(meth):
"""Walk up the Python tree from method 'meth', finding its class, its module
and all containing packages."""
containers = []
containers.append(meth.im_class)
moduleName = meth.im_class.__module__
while moduleName is not None:
module = sys.modules.get(moduleName, None)
if module is None:
module = __import__(moduleName)
containers.append(module)
moduleName = getattr(module, '__module__', None)
return containers
deprecate.deprecatedModuleAttribute(
versions.Version("Twisted", 12, 3, 0),
"This function never worked correctly. Implement lookup on your own.",
__name__, "getPythonContainers")
def _runSequentially(callables, stopOnFirstError=False):
"""
Run the given callables one after the other. If a callable returns a
Deferred, wait until it has finished before running the next callable.
@param callables: An iterable of callables that take no parameters.
@param stopOnFirstError: If True, then stop running callables as soon as
one raises an exception or fires an errback. False by default.
@return: A L{Deferred} that fires a list of C{(flag, value)} tuples. Each
开发者ID:geodrinx,项目名称:gearthview,代码行数:32,代码来源:util.py
示例5: areDone
def areDone(self, avatarId):
"""
Override to determine if the authentication is finished for a given
avatarId.
@param avatarId: the avatar returned by the first checker. For
this checker to function correctly, all the checkers must
return the same avatar ID.
"""
return True
deprecatedModuleAttribute(
Version("Twisted", 15, 0, 0),
("Please use twisted.conch.checkers.SSHPublicKeyChecker, "
"initialized with an instance of "
"twisted.conch.checkers.UNIXAuthorizedKeysFiles instead."),
__name__, "SSHPublicKeyDatabase")
class IAuthorizedKeysDB(Interface):
"""
An object that provides valid authorized ssh keys mapped to usernames.
@since: 15.0
"""
def getAuthorizedKeys(avatarId):
"""
Gets an iterable of authorized keys that are valid for the given
C{avatarId}.
开发者ID:12019,项目名称:OpenWrt_Luci_Lua,代码行数:32,代码来源:checkers.py
示例6: it
The same channel will be re-used as long as it doesn't get closed.
"""
if self._channel and not self._channel.closed:
# If the channel is already there and still opened, just return
# it (the client will be still connected and working as well).
return succeed(self._channel)
pending = Deferred()
self._pending_requests.append(pending)
return pending
QueueManager = DeprecatedQueueManager # For backward compatibility
deprecatedModuleAttribute(
Version("txlongpoll", 4, 0, 0),
"Use txlongpoll.notification.NotificationSource instead.",
__name__,
"QueueManager")
class FrontEndAjax(Resource):
"""
A web resource which, when rendered with a C{'uuid'} in the request
arguments, will return the raw data from the message queue associated with
that UUID.
"""
isLeaf = True
def __init__(self, source):
"""
@param source: The NotificationSource to fetch notifications from.
开发者ID:CanonicalLtd,项目名称:txlongpoll,代码行数:30,代码来源:frontend.py
示例7: Copyright
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Twisted Runner: Run and monitor processes.
"""
from twisted.python.versions import Version
from twisted.python.deprecate import deprecatedModuleAttribute
from twisted._version import version
__version__ = version.short()
deprecatedModuleAttribute(
Version("Twisted", 16, 0, 0),
"Use twisted.__version__ instead.",
"twisted.runner", "__version__")
开发者ID:Architektor,项目名称:PySnip,代码行数:17,代码来源:__init__.py
示例8: _MethodType
"""
func = cls.__dict__[name]
if _PY3:
return _MethodType(func, self)
return _MethodType(func, self, cls)
from incremental import Version
from twisted.python.deprecate import deprecatedModuleAttribute
from collections import OrderedDict
deprecatedModuleAttribute(
Version("Twisted", 15, 5, 0),
"Use collections.OrderedDict instead.",
"twisted.python.compat",
"OrderedDict")
if _PY3:
from base64 import encodebytes as _b64encodebytes
from base64 import decodebytes as _b64decodebytes
else:
from base64 import encodestring as _b64encodebytes
from base64 import decodestring as _b64decodebytes
def _bytesChr(i):
"""
Like L{chr} but always works on ASCII, returning L{bytes}.
开发者ID:esabelhaus,项目名称:secret-octo-dubstep,代码行数:31,代码来源:compat.py
示例9: deprecatedModuleAttribute
# This file is part of Buildbot. Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright Buildbot Team Members
from twisted.python.deprecate import deprecatedModuleAttribute
from twisted.python.versions import Version
from buildbot.buildslave.ec2 import EC2LatentBuildSlave
deprecatedModuleAttribute(Version("Buildbot", 0, 8, 8),
"It has been moved to buildbot.buildslave.ec2",
"buildbot.ec2buildslave", "EC2LatentBuildSlave")
_hush_pyflakes = [
EC2LatentBuildSlave,
]
开发者ID:ABI-Software,项目名称:buildbot,代码行数:27,代码来源:ec2buildslave.py
示例10: ProcessDone
Emitted when L{IReactorProcess.spawnProcess} is called in a way which may
result in termination of the created child process not being reported.
Deprecated in Twisted 10.0.
"""
MESSAGE = (
"spawnProcess called, but the SIGCHLD handler is not "
"installed. This probably means you have not yet "
"called reactor.run, or called "
"reactor.run(installSignalHandler=0). You will probably "
"never see this process finish, and it may become a "
"zombie process.")
deprecate.deprecatedModuleAttribute(
Version("Twisted", 10, 0, 0),
"There is no longer any potential for zombie process.",
__name__,
"PotentialZombieWarning")
class ProcessDone(ConnectionDone):
"""A process has ended without apparent errors"""
def __init__(self, status):
Exception.__init__(self, "process finished with exit code 0")
self.exitCode = 0
self.signal = None
self.status = status
开发者ID:JohnDoes95,项目名称:project_parser,代码行数:29,代码来源:error.py
示例11: imports
# Import reflect first, so that circular imports (between deprecate and
# reflect) don't cause headaches.
import twisted.python.reflect
from twisted.python.versions import Version
from twisted.python.deprecate import deprecatedModuleAttribute
# Known module-level attributes.
DEPRECATED_ATTRIBUTE = 42
ANOTHER_ATTRIBUTE = 'hello'
version = Version('Twisted', 8, 0, 0)
message = 'Oh noes!'
deprecatedModuleAttribute(
version,
message,
__name__,
'DEPRECATED_ATTRIBUTE')
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:21,代码来源:deprecatedattributes.py
示例12: globals
import types
for tran in 'TCP UNIX SSL UDP UNIXDatagram Multicast'.split():
for side in 'Server Client'.split():
if tran == "Multicast" and side == "Client":
continue
base = globals()['_Abstract'+side]
doc = _doc[side] % vars()
klass = types.ClassType(tran+side, (base,),
{'method': tran, '__doc__': doc})
globals()[tran+side] = klass
deprecatedModuleAttribute(
Version("Twisted", 13, 1, 0),
"It relies upon IReactorUDP.connectUDP "
"which was removed in Twisted 10. "
"Use twisted.application.internet.UDPServer instead.",
"twisted.application.internet", "UDPClient")
class TimerService(_VolatileDataService):
"""
Service to periodically call a function
Every C{step} seconds call the given function with the given arguments.
The service starts the calls when it starts, and cancels them
when it stops.
@ivar clock: Source of time. This defaults to L{None} which is
causes L{twisted.internet.reactor} to be used.
开发者ID:AlexanderHerlan,项目名称:syncpy,代码行数:32,代码来源:internet.py
示例13: object
_DEFAULT = object()
def acquireAttribute(objects, attr, default=_DEFAULT):
"""Go through the list 'objects' sequentially until we find one which has
attribute 'attr', then return the value of that attribute. If not found,
return 'default' if set, otherwise, raise AttributeError. """
for obj in objects:
if hasattr(obj, attr):
return getattr(obj, attr)
if default is not _DEFAULT:
return default
raise AttributeError('attribute %r not found in %r' % (attr, objects))
deprecate.deprecatedModuleAttribute(
versions.Version("Twisted", 10, 1, 0),
"Please use twisted.python.reflect.namedAny instead.",
__name__, "findObject")
def findObject(name):
"""Get a fully-named package, module, module-global object or attribute.
Forked from twisted.python.reflect.namedAny.
Returns a tuple of (bool, obj). If bool is True, the named object exists
and is returned as obj. If bool is False, the named object does not exist
and the value of obj is unspecified.
"""
names = name.split('.')
topLevelPackage = None
moduleNames = names[:]
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:32,代码来源:util.py
示例14: parse
from twisted.python.versions import Version
from twisted.python.compat import _PY3
from twisted.application.internet import StreamServerEndpointService
def parse(description, factory, default='tcp'):
"""
This function is deprecated as of Twisted 10.2.
@see: L{twisted.internet.endpoints.server}
"""
return endpoints._parseServer(description, factory, default)
deprecatedModuleAttribute(
Version("Twisted", 10, 2, 0),
"in favor of twisted.internet.endpoints.serverFromString",
__name__, "parse")
_DEFAULT = object()
def service(description, factory, default=_DEFAULT, reactor=None):
"""
Return the service corresponding to a description.
@param description: The description of the listening port, in the syntax
described by L{twisted.internet.endpoints.server}.
@type description: C{str}
开发者ID:Architektor,项目名称:PySnip,代码行数:31,代码来源:strports.py
示例15: deprecatedModuleAttribute
attrs.append(insults.BLINK)
if self.reverseVideo:
attrs.append(insults.REVERSE_VIDEO)
if self.foreground != WHITE:
attrs.append(FOREGROUND + self.foreground)
if self.background != BLACK:
attrs.append(BACKGROUND + self.background)
if attrs:
return '\x1b[' + ';'.join(map(str, attrs)) + 'm'
return ''
CharacterAttribute = _FormattingState
deprecatedModuleAttribute(
Version('Twisted', 13, 1, 0),
'Use twisted.conch.insults.text.assembleFormattedText instead.',
'twisted.conch.insults.helper',
'CharacterAttribute')
# XXX - need to support scroll regions and scroll history
class TerminalBuffer(protocol.Protocol):
"""
An in-memory terminal emulator.
"""
implements(insults.ITerminalTransport)
for keyID in ('UP_ARROW', 'DOWN_ARROW', 'RIGHT_ARROW', 'LEFT_ARROW',
'HOME', 'INSERT', 'DELETE', 'END', 'PGUP', 'PGDN',
'F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', 'F9',
开发者ID:0004c,项目名称:VTK,代码行数:31,代码来源:helper.py
示例16: install
timeout = 0.1
# See comment for identical line in GtkReactor.simulate.
self._simtag = gtk.timeout_add((timeout * 1010), self.simulate)
def install():
"""Configure the twisted mainloop to be run inside the gtk mainloop.
"""
reactor = GtkReactor()
from twisted.internet.main import installReactor
installReactor(reactor)
return reactor
deprecate.deprecatedModuleAttribute(deprecatedSince, deprecationMessage,
__name__, "install")
def portableInstall():
"""Configure the twisted mainloop to be run inside the gtk mainloop.
"""
reactor = PortableGtkReactor()
from twisted.internet.main import installReactor
installReactor(reactor)
return reactor
deprecate.deprecatedModuleAttribute(deprecatedSince, deprecationMessage,
__name__, "portableInstall")
if runtime.platform.getType() != 'posix':
开发者ID:0004c,项目名称:VTK,代码行数:32,代码来源:gtkreactor.py
示例17: reallyDel
self.__dict__.clear()
self.__dict__.update(v)
else:
self.__dict__[k]=v
def reallyDel(self, k):
"""
*actually* del self.k without incurring side-effects. This is a
hook to be overridden by subclasses.
"""
del self.__dict__[k]
# just in case
OriginalAccessor = Accessor
deprecatedModuleAttribute(
Version("Twisted", 12, 1, 0),
"OriginalAccessor is a reference to class twisted.python.reflect.Accessor "
"which is deprecated.", "twisted.python.reflect", "OriginalAccessor")
class Summer(Accessor):
"""
Extend from this class to get the capability to maintain 'related
sums'. Have a tuple in your class like the following::
sums=(('amount','credit','credit_total'),
('amount','debit','debit_total'))
and the 'credit_total' member of the 'credit' member of self will
always be incremented when the 'amount' member of self is
incremented, similiarly for the debit versions.
"""
开发者ID:AmirKhooj,项目名称:VTK,代码行数:32,代码来源:reflect.py
示例18: deprecatedModuleAttribute
import stringprep
from encodings import idna
# We require Unicode version 3.2.
from unicodedata import ucd_3_2_0 as unicodedata
from twisted.python.versions import Version
from twisted.python.deprecate import deprecatedModuleAttribute
from zope.interface import Interface, implementer
crippled = False
deprecatedModuleAttribute(
Version("Twisted", 13, 1, 0),
"crippled is always False",
__name__,
"crippled")
class ILookupTable(Interface):
"""
Interface for character lookup classes.
"""
def lookup(c):
"""
Return whether character is in this table.
"""
开发者ID:wellbehavedsoftware,项目名称:wbs-graphite,代码行数:30,代码来源:xmpp_stringprep.py
示例19: Version
import ipaddr
import re
from twisted.python import deprecate
from twisted.python.versions import Version
PORTSPEC_LENGTH = 16
re_ipv6 = re.compile("\[([a-fA-F0-9:]+)\]:(.*$)")
re_ipv4 = re.compile("((?:\d{1,3}\.?){4}):(.*$)")
deprecate.deprecatedModuleAttribute(
Version('bridgedb', 0, 0, 1),
"Removed due to 'bridgedb.Bridges.PortList' being moved to "\
"'bridgedb.parse.addr.PortList.",
"bridgedb.Bridges",
"PORTSPEC_LENGTH")
deprecate.deprecatedModuleAttribute(
Version('bridgedb', 0, 0, 1),
"Attribute 'bridgedb.Bridges.re_ipv4' was removed due to "\
"'bridgedb.Bridges.parseORAddressLine' moving to "\
"'bridgedb.parse.networkstatus.",
"bridgedb.Bridges",
"re_ipv4")
deprecate.deprecatedModuleAttribute(
Version('bridgedb', 0, 0, 1),
"Attribute 'bridgedb.Bridges.re_ipv6' was removed due to "\
"'bridgedb.Bridges.parseORAddressLine' moving to "\
开发者ID:gsathya,项目名称:bridgedb,代码行数:31,代码来源:deprecated.py
示例20: Copyright
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Chat protocols.
"""
from twisted.python import deprecate, versions
deprecate.deprecatedModuleAttribute(
versions.Version("Twisted", 15, 1, 0), "MSN has shutdown.", __name__,
"msn")
开发者ID:12019,项目名称:OpenWrt_Luci_Lua,代码行数:13,代码来源:__init__.py
注:本文中的twisted.python.deprecate.deprecatedModuleAttribute函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论