• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python util.deprecated函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了deprecated函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, host='127.0.0.1', port=8098, prefix='riak',
                 mapred_prefix='mapred', transport_class=None,
                 client_id=None, solr_transport_class=None,
                 bucket_class_factory=None):
        """
        Construct a new ``RiakClient`` object.

        :param host: Hostname or IP address
        :type host: string
        :param port: Port number
        :type port: integer
        :param prefix: Interface prefix
        :type prefix: string
        :param mapred_prefix: MapReduce prefix
        :type mapred_prefix: string
        :param transport_class: Transport class to use
        :type transport_class: :class:`RiakTransport`
        :param solr_transport_class: HTTP-based transport class for Solr interface queries
        :param bucket_class_factory: Callable that given a bucket name returns a class to use
        :type bucket_class_factory: callable
        """
        if transport_class is None:
            transport_class = RiakHttpTransport

        if callable(bucket_class_factory):
            self.bucket_class_factory = bucket_class_factory
        else:
            self.bucket_class_factory = lambda name: RiakBucket

        api = getattr(transport_class, 'api', 1)
        if api >= 2:
            hostports = [ (host, port), ]
            self._cm = transport_class.default_cm(hostports)

            ### we need to allow additional transport options. make this an
            ### argument to __init__ ?
            transport_options = { }

            self._transport = transport_class(self._cm,
                                              prefix=prefix,
                                              mapred_prefix=mapred_prefix,
                                              client_id=client_id,
                                              **transport_options)
        else:
            deprecated('please upgrade the transport to the new API')
            self._cm = None
            self._transport = transport_class(host, port, client_id=client_id)

        self._r = "default"
        self._w = "default"
        self._dw = "default"
        self._rw = "default"
        self._encoders = {'application/json':json.dumps,
                          'text/json':json.dumps}
        self._decoders = {'application/json':json.loads,
                          'text/json':json.loads}
        self._solr = None
        self._host = host
        self._port = port
开发者ID:Kulipa,项目名称:riak-python-client,代码行数:59,代码来源:client.py


示例2: get_transport

 def get_transport(self):
     """
     Get the transport instance the client is using for it's
     connection. DEPRECATED
     """
     deprecated("get_transport is deprecated, use client, " +
                "bucket, or object methods instead")
     return None
开发者ID:avalente,项目名称:riak-python-client,代码行数:8,代码来源:__init__.py


示例3: __init__

    def __init__(self, host='127.0.0.1', port=8098, prefix='riak',
                 mapred_prefix='mapred', transport_class=None,
                 client_id=None, solr_transport_class=None,
                 transport_options=None):
        """
        Construct a new ``RiakClient`` object.

        :param host: Hostname or IP address
        :type host: string
        :param port: Port number
        :type port: integer
        :param prefix: Interface prefix
        :type prefix: string
        :param mapred_prefix: MapReduce prefix
        :type mapred_prefix: string
        :param transport_class: transport class to use
        :type transport_class: :class:`RiakTransport`
        :param solr_transport_class: HTTP-based transport class for Solr interface queries
        :type transport_class: :class:`RiakHttpTransport`
        :param transport_options: Optional key-value args to pass to the transport constuctor
        :type transport_options: dict
        """
        if transport_class is None:
            transport_class = RiakHttpTransport

        api = getattr(transport_class, 'api', 1)
        if api >= 2:
            hostports = [ (host, port), ]
            self._cm = transport_class.default_cm(hostports)

            # If no transport options are provided, then default to the
            # empty dict, otherwise just pass through what we are provided.
            if transport_options is None:
                transport_options = {}

            self._transport = transport_class(self._cm,
                                              prefix=prefix,
                                              mapred_prefix=mapred_prefix,
                                              client_id=client_id,
                                              **transport_options)
        else:
            deprecated('please upgrade the transport to the new API')
            self._cm = None
            self._transport = transport_class(host, port, client_id=client_id)

        self._r = "default"
        self._w = "default"
        self._dw = "default"
        self._rw = "default"
        self._pr = "default"
        self._pw = "default"
        self._encoders = {'application/json': json.dumps,
                          'text/json': json.dumps}
        self._decoders = {'application/json': json.loads,
                          'text/json': json.loads}
        self._solr = None
        self._host = host
        self._port = port
开发者ID:darkdarkfruit,项目名称:riak-python-client,代码行数:58,代码来源:client.py


示例4: get_client_id

    def get_client_id(self):
        """
        Get the ``client_id`` for this ``RiakClient`` instance.
        DEPRECATED

        :rtype: string
        """
        deprecated(
            "``get_client_id`` is deprecated, use the ``client_id`` property")
        return self.client_id
开发者ID:avalente,项目名称:riak-python-client,代码行数:10,代码来源:__init__.py


示例5: solr

    def solr(self):
        """
        Returns a RiakSearch object which can access search indexes.

        .. deprecated:: 2.0.0
           Use the ``fulltext_*`` methods instead.
        """
        deprecated("``solr`` is deprecated, use ``fulltext_search``,"
                   " ``fulltext_add`` and ``fulltext_delete`` directly")
        return RiakSearch(self)
开发者ID:issackelly,项目名称:riak-python-client,代码行数:10,代码来源:__init__.py


示例6: get_transport

    def get_transport(self):
        """
        Get the transport instance the client is using for it's
        connection.

        .. deprecated:: 2.0.0
           There is no equivalent to this method, it will return ``None``.
        """
        deprecated("get_transport is deprecated, use client, " +
                   "bucket, or object methods instead")
        return None
开发者ID:issackelly,项目名称:riak-python-client,代码行数:11,代码来源:__init__.py


示例7: __init__

    def __init__(self, protocol='http', transport_options={}, nodes=None,
                 credentials=None, **unused_args):
        """
        Construct a new ``RiakClient`` object.

        :param protocol: the preferred protocol, defaults to 'http'
        :type protocol: string
        :param nodes: a list of node configurations,
           where each configuration is a dict containing the keys
           'host', 'http_port', and 'pb_port'
        :type nodes: list
        :param transport_options: Optional key-value args to pass to
                                  the transport constructor
        :type transport_options: dict
        :param credentials: optional object of security info
        :type credentials: SecurityCreds or dict
        """
        unused_args = unused_args.copy()

        if 'port' in unused_args:
            deprecated("port option is deprecated, use http_port or pb_port,"
                       " or the nodes option. Your given port of %r will be "
                       "used as the %s port unless already set" %
                       (unused_args['port'], protocol))
            unused_args['already_warned_port'] = True
            if (protocol == 'http' and
                    'http_port' not in unused_args):
                unused_args['http_port'] = unused_args['port']
            elif protocol == 'pbc' and 'pb_port' not in unused_args:
                unused_args['pb_port'] = unused_args['port']

        if 'transport_class' in unused_args:
            deprecated(
                "transport_class is deprecated, use the protocol option")

        if nodes is None:
            self.nodes = [self._create_node(unused_args), ]
        else:
            self.nodes = [self._create_node(n) for n in nodes]

        self.protocol = protocol or 'http'
        self.resolver = default_resolver
        self._credentials = self._create_credentials(credentials)
        self._http_pool = RiakHttpPool(self, **transport_options)
        self._pb_pool = RiakPbcPool(self, **transport_options)

        self._encoders = {'application/json': default_encoder,
                          'text/json': default_encoder,
                          'text/plain': str}
        self._decoders = {'application/json': json.loads,
                          'text/json': json.loads,
                          'text/plain': str}
        self._buckets = WeakValueDictionary()
        self._bucket_types = WeakValueDictionary()
开发者ID:goller,项目名称:riak-python-client,代码行数:54,代码来源:__init__.py


示例8: set_client_id

    def set_client_id(self, client_id):
        """
        Set the client_id for this ``RiakClient`` instance.
        DEPRECATED

        :param client_id: The new client_id.
        :type client_id: string
        """
        deprecated(
            "``set_client_id`` is deprecated, use the ``client_id`` property")
        self.client_id = client_id
        return self
开发者ID:avalente,项目名称:riak-python-client,代码行数:12,代码来源:__init__.py


示例9: get_client_id

    def get_client_id(self):
        """
        Get the client identifier.

        .. deprecated:: 2.0.0
           Use the :attr:`client_id` attribute instead.

        :rtype: string
        """
        deprecated(
            "``get_client_id`` is deprecated, use the ``client_id`` property")
        return self.client_id
开发者ID:issackelly,项目名称:riak-python-client,代码行数:12,代码来源:__init__.py


示例10: set_client_id

    def set_client_id(self, client_id):
        """
        Set the client identifier.

        .. deprecated:: 2.0.0
           Use the :attr:`client_id` attribute instead.

        :param client_id: The new client_id.
        :type client_id: string
        """
        deprecated(
            "``set_client_id`` is deprecated, use the ``client_id`` property")
        self.client_id = client_id
        return self
开发者ID:issackelly,项目名称:riak-python-client,代码行数:14,代码来源:__init__.py


示例11: get_binary

    def get_binary(self, key, r=None, pr=None):
        """
        Retrieve a binary/string object from Riak.

        :param key: Name of the key.
        :type key: string
        :param r: R-Value of the request (defaults to bucket's R)
        :type r: integer
        :param pr: PR-Value of the request (defaults to bucket's PR)
        :type pr: integer
        :rtype: :class:`RiakObject <riak.riak_object.RiakObject>`
        """
        deprecated('RiakBucket.get_binary is deprecated, '
                   'use RiakBucket.get')
        return self.get(key, r=r, pr=pr)
开发者ID:Atilla,项目名称:riak-python-client,代码行数:15,代码来源:bucket.py


示例12: new_binary_from_file

    def new_binary_from_file(self, key, filename):
        """
        Create a new Riak object in the bucket, using the contents of
        the specified file. This is a shortcut for :meth:`new`, where the
        ``encoded_data`` and ``content_type`` are set for you.

        .. deprecated:: 2.0.0
           Use :meth:`new_from_file` instead.

        :param key: the key of the new object
        :type key: string
        :param filename: the file to read the contents from
        :type filename: string
        :rtype: :class:`RiakObject <riak.riak_object.RiakObject>`
        """
        deprecated('RiakBucket.new_binary_from_file is deprecated, use '
                   'RiakBucket.new_from_file')
        return self.new_from_file(key, filename)
开发者ID:ThoughtLeadr,项目名称:riak-python-client,代码行数:18,代码来源:bucket.py


示例13: __init__

    def __init__(self, host='127.0.0.1', http_port=8098, pb_port=8087,
                 **unused_args):
        """
        Creates a node.

        :param host: an IP address or hostname
        :type host: string
        :param http_port: the HTTP port of the node
        :type http_port: integer
        :param pb_port: the Protcol Buffers port of the node
        :type pb_port: integer
        """

        if 'port' in unused_args and 'already_warned_port' not in unused_args:
            deprecated("port option is deprecated, use http_port or pb_port")

        self.host = host
        self.http_port = http_port
        self.pb_port = pb_port
        self.error_rate = Decaying()
开发者ID:goller,项目名称:riak-python-client,代码行数:20,代码来源:node.py


示例14: get_binary

    def get_binary(self, key, r=None, pr=None, timeout=None):
        """
        Retrieve a binary/string object from Riak.

        .. deprecated:: 2.0.0
           Use :meth:`get` instead.

        :param key: Name of the key.
        :type key: string
        :param r: R-Value of the request (defaults to bucket's R)
        :type r: integer
        :param pr: PR-Value of the request (defaults to bucket's PR)
        :type pr: integer
        :param timeout: a timeout value in milliseconds
        :type timeout: int
        :rtype: :class:`RiakObject <riak.riak_object.RiakObject>`
        """
        deprecated('RiakBucket.get_binary is deprecated, '
                   'use RiakBucket.get')
        return self.get(key, r=r, pr=pr, timeout=timeout)
开发者ID:ThoughtLeadr,项目名称:riak-python-client,代码行数:20,代码来源:bucket.py


示例15: new_binary

    def new_binary(self, key=None, data=None,
                   content_type='application/octet-stream'):
        """
        Create a new :class:`RiakObject <riak.riak_object.RiakObject>`
        that will be stored as plain text/binary. A shortcut for
        manually instantiating a :class:`RiakObject
        <riak.riak_object.RiakObject>`.

        :param key: Name of the key.
        :type key: string
        :param data: The data to store.
        :type data: object
        :param content_type: The content type of the object.
        :type content_type: string
        :rtype: :class:`RiakObject <riak.riak_object.RiakObject>`
        """
        deprecated('RiakBucket.new_binary is deprecated, '
                   'use RiakBucket.new with the encoded_data '
                   'param instead of data')
        return self.new(key, encoded_data=data, content_type=content_type)
开发者ID:Atilla,项目名称:riak-python-client,代码行数:20,代码来源:bucket.py


示例16: __init__

    def __init__(self, protocol='http', transport_options={},
                 nodes=None, **unused_args):
        """
        Construct a new ``RiakClient`` object.

        :param protocol: the preferred protocol, defaults to 'http'
        :type protocol: string
        :param nodes: a list of node configurations,
           where each configuration is a dict containing the keys
           'host', 'http_port', and 'pb_port'
        :type nodes: list
        :param transport_options: Optional key-value args to pass to
                                  the transport constuctor
        :type transport_options: dict
        """
        if 'port' in unused_args:
            deprecated("port option is deprecated, use http_port or pb_port,"
                      + " or the nodes option")

        if 'transport_class' in unused_args:
            deprecated(
                "transport_class is deprecated, use the protocol option")

        if nodes is None:
            self.nodes = [self._create_node(unused_args), ]
        else:
            self.nodes = [self._create_node(n) for n in nodes]

        self.protocol = protocol or 'http'

        self._http_pool = RiakHttpPool(self, **transport_options)
        self._pb_pool = RiakPbcPool(self, **transport_options)

        self._encoders = {'application/json': json.dumps,
                          'text/json': json.dumps}
        self._decoders = {'application/json': json.loads,
                          'text/json': json.loads}
        self._buckets = WeakValueDictionary()
开发者ID:sorenh,项目名称:riak-python-client,代码行数:38,代码来源:__init__.py


示例17: get_encoded_data

 def get_encoded_data(self):
     deprecated("`get_encoded_data` is deprecated, use the `encoded_data`"
                " property")
     return self.encoded_data
开发者ID:pawskow,项目名称:riak-python-client,代码行数:4,代码来源:riak_object.py


示例18: new_binary_from_file

 def new_binary_from_file(self, key, filename):
     deprecated('RiakBucket.new_binary_from_file is deprecated, use '
                'RiakBucket.new_from_file')
     return self.new_from_file(key, filename)
开发者ID:Atilla,项目名称:riak-python-client,代码行数:4,代码来源:bucket.py


示例19: set_encoded_data

 def set_encoded_data(self, value):
     deprecated("`set_encoded_data` is deprecated, use the `encoded_data`"
                " property")
     self.encoded_data = value
开发者ID:pawskow,项目名称:riak-python-client,代码行数:4,代码来源:riak_object.py


示例20: get_sibling

 def get_sibling(self, index):
     deprecated("RiakObject.get_sibling is deprecated, use the "
                "siblings property instead")
     return self.siblings[index]
开发者ID:wkral,项目名称:riak-python-client,代码行数:4,代码来源:riak_object.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.str_to_bytes函数代码示例发布时间:2022-05-26
下一篇:
Python util.decode_index_value函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap