示例#1
0
def rename_kwargs(func_name, kwargs, aliases):
    for alias, new in aliases.items():
        if alias in kwargs:
            if new in kwargs:
                raise InvalidParamException(
                    '{} received both {} and {}'.format(func_name, alias, new))
            # Manually invoke the deprecated decorator with an empty lambda
            # to signal deprecation
            deprecated(deprecated_in='1.1',
                       removed_in='2.0',
                       current_version=cloudbridge.__version__,
                       details='{} is deprecated, use {} instead'.format(
                           alias, new))(lambda: None)()
            kwargs[new] = kwargs.pop(alias)
示例#2
0
def deprecated_since_06(func):
    import deprecation

    return deprecation.deprecated(
        deprecated_in=0.6,
        removed_in=0.8,
        details="This function is part of the legacy templating system.")(func)
示例#3
0
def deprecate(func):
    return deprecation.deprecated(
        deprecated_in='0.24.0',
        removed_in='1.0.0',
        details='Use the fsleyes.layout module')(func)
        with ElasticSearchContainer() as es:
            connection_url = es.get_url()
    """
    def __init__(self, image="elasticsearch:7.5.0", port_to_expose=9200):
        super(ElasticSearchContainer, self).__init__(image)
        self.port_to_expose = port_to_expose
        self.with_exposed_ports(self.port_to_expose)
        self.with_env('transport.host', '127.0.0.1')
        self.with_env('http.host', '0.0.0.0')
        self.with_env('discovery.zen.minimum_master_nodes', '1')

    @wait_container_is_ready()
    def _connect(self):
        res = urllib.request.urlopen(self.get_url())
        if res.status != 200:
            raise Exception()

    def get_url(self):
        host = self.get_container_host_ip()
        port = self.get_exposed_port(self.port_to_expose)
        return 'http://{}:{}'.format(host, port)

    def start(self):
        super().start()
        self._connect()
        return self


ElasticsearchContainer = deprecated(details='Use `ElasticSearchContainer` with a capital S instead '
                                    'of `ElasticsearchContainer`.')(ElasticSearchContainer)
示例#5
0
def deprecatedemo4():
    """Demonstrate that deprecate() also works in a local scope."""
    deprecated('demo4', 'demo4 is no more.')
示例#6
0
import doctest
from zope.testing import renormalizing
import os
import re
import shutil
import sys
import tempfile
import unittest
import warnings
import zope.deprecation

# Used in doctests
from deprecation import deprecated
demo1 = 1
deprecated('demo1', 'demo1 is no more.')

demo2 = 2
deprecated('demo2', 'demo2 is no more.')

demo3 = 3
deprecated('demo3', 'demo3 is no more.')

demo4 = 4


def deprecatedemo4():
    """Demonstrate that deprecate() also works in a local scope."""
    deprecated('demo4', 'demo4 is no more.')

示例#7
0
文件: tests.py 项目: nak/Penumbra
def deprecatedemo4():
    """Demonstrate that deprecate() also works in a local scope."""
    deprecated('demo4', 'demo4 is no more.')
示例#8
0
文件: tests.py 项目: nak/Penumbra
from zope.testing import doctest
from zope.testing import renormalizing
import os
import re
import shutil
import sys
import tempfile
import unittest
import warnings
import zope.deprecation

# Used in doctests
from deprecation import deprecated
demo1 = 1
deprecated('demo1', 'demo1 is no more.')

demo2 = 2
deprecated('demo2', 'demo2 is no more.')

demo3 = 3
deprecated('demo3', 'demo3 is no more.')

demo4 = 4
def deprecatedemo4():
    """Demonstrate that deprecate() also works in a local scope."""
    deprecated('demo4', 'demo4 is no more.')

def warn(message, type_, stacklevel):
    print "From tests.py's showwarning():"
    
示例#9
0
def deprecated(deprecated_in: str = None, removed_in: str = None, details=""):
    return deprecation.deprecated(deprecated_in=deprecated_in,
                                  removed_in=removed_in,
                                  current_version=version.version,
                                  details=details)