当前位置: 首页>>代码示例>>Python>>正文


Python deprecate.deprecatedModuleAttribute函数代码示例

本文整理汇总了Python中twisted.python.deprecate.deprecatedModuleAttribute函数的典型用法代码示例。如果您正苦于以下问题:Python deprecatedModuleAttribute函数的具体用法?Python deprecatedModuleAttribute怎么用?Python deprecatedModuleAttribute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了deprecatedModuleAttribute函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的twisted.python.deprecate.deprecatedModuleAttribute函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。