コード例 #1
0
    def issuperset(self, other):
        """Test whether every element in other is in this set.

        @param other: A set with which to test.
        """
        if isinstance(other, SharedSet):
            other = map_from_java(other.java_obj)
        return map_from_java(self.java_obj).issuperset(other)
コード例 #2
0
    def intersection(self, other):
        """Return a new set instance with elements common to both sets.

        @param other: A set with which to intersect.
        """
        if isinstance(other, SharedSet):
            other = map_from_java(other.java_obj)
        return map_from_java(self.java_obj).intersection(other)
コード例 #3
0
    def union(self, other):
        """Return a new set instance with elements from both sets.

        @param other: A set with which to unite.
        """
        if isinstance(other, SharedSet):
            other = map_from_java(other.java_obj)
        return map_from_java(self.java_obj).union(other)
コード例 #4
0
    def symmetric_difference(self, other):
        """Return a new set with elements in either this set or other but not both.

        @param other: A set with which to compute difference.
        """
        if isinstance(other, SharedSet):
            other = map_from_java(other.java_obj)
        return map_from_java(self.java_obj).symmetric_difference(other)
コード例 #5
0
    def difference(self, other):
        """Return a new set instance with elements not in other.

        @param other: A set with which to compute difference.
        """
        if isinstance(other, SharedSet):
            other = map_from_java(other.java_obj)
        return map_from_java(self.java_obj).difference(other)
コード例 #6
0
ファイル: event_bus.py プロジェクト: parroit/vert.x
 def __init__(self, message):
     self.java_obj = message
     if isinstance(message.body, org.vertx.java.core.json.JsonObject):
         self.body = map_from_java(message.body.toMap())
     elif isinstance(message.body, org.vertx.java.core.buffer.Buffer):
         self.body = Buffer(message.body)
     else:
         self.body = map_from_java(message.body)
コード例 #7
0
 def __init__(self, message):
     self.java_obj = message
     if isinstance(message.body(), org.vertx.java.core.json.JsonObject):
         self.body = map_from_java(message.body().toMap())
     elif isinstance(message.body(), org.vertx.java.core.buffer.Buffer):
         self.body = Buffer(message.body())
     else:
         self.body = map_from_java(message.body())
コード例 #8
0
def config():
    """Get config for the verticle
    @return: dict config for the verticle
    """
    if Vertx.config is None:
        Vertx.config = map_from_java(org.vertx.java.deploy.impl.VertxLocator.container.getConfig().toMap())
    return Vertx.config
コード例 #9
0
 def setdefault(self, key, default=None):
     map = map_from_java(self.java_obj)
     if key in map:
         return map[key]
     else:
         self[key] = default
         return default
コード例 #10
0
def config():
    """Get config for the verticle
    @return: dict config for the verticle
    """
    if Vertx.config is None:
        Vertx.config = map_from_java(org.vertx.java.deploy.impl.VertxLocator.
                                     container.getConfig().toMap())
    return Vertx.config
コード例 #11
0
 def update(self, other):
     if isinstance(other, SharedHash):
         other = map_from_java(other.java_obj)
     if isinstance(other, dict):
         items = other.items()
     else:
         items = other
     for key, value in items():
         self[key] = value
コード例 #12
0
 def headers(self):
     """Get all the headers in the response.
     If the response contains multiple headers with the same key, the values
     will be concatenated together into a single header with the same key value, with each value separated by a comma,
     as specified by {http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.htmlsec4.2}.
     return a dictionary of headers.
     """
     if self.headers_dict is None:
         self.headers_dict = map_from_java(self.java_obj.headers())
     return self.headers_dict
コード例 #13
0
    def update(self, other):
        """Update the set with all elements from the given set.

        @param other: A set of elements to add.
        """
        if isinstance(other, SharedSet):
            other = map_from_java(other.java_obj)
        for item in other:
            self.add(item)
        return self
コード例 #14
0
    def difference_update(self, other):
        """Update the set, removing elements from other.

        @param other: A set of elements to remove.
        """
        if isinstance(other, SharedSet):
            other = map_from_java(other.java_obj)
        for item in other:
            if item in self:
                self.remove(item)
        return self
コード例 #15
0
ファイル: sock_js.py プロジェクト: fregaham/mod-lang-jython
 def handleAuthorise(self, message, session_id, handler):
     if self._authorise_handler is not None:
         async_handler = AsyncHandler(handler)
         def func(result):
             if isinstance(result, Exception):
                 org.vertx.java.core.impl.DefaultFutureResult().setHandler(handler).setFailure(result)
             else:
                 org.vertx.java.core.impl.DefaultFutureResult().setHandler(handler).setResult(bool(result))
         result = self._authorise_handler(map_from_java(message), session_id, func)
         return result if result is not None else True
     return True
コード例 #16
0
 def handleAuthorise(self, message, session_id, handler):
     if self._authorise_handler is not None:
         async_handler = AsyncHandler(handler)
         def func(result):
             if isinstance(result, Exception):
                 org.vertx.java.core.impl.DefaultFutureResult().setHandler(handler).setFailure(result)
             else:
                 org.vertx.java.core.impl.DefaultFutureResult().setHandler(handler).setResult(bool(result))
         result = self._authorise_handler(map_from_java(message), session_id, func)
         return result if result is not None else True
     return True
コード例 #17
0
 def trailers(self):
     """Get all the trailers in the response.
     If the response contains multiple trailers with the same key, the values
     will be concatenated together into a single header with the same key value, with each value separated by a comma,
     as specified by {http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.htmlsec4.2}.
     Trailers will only be available in the response if the server has sent a HTTP chunked response where headers have
     been inserted by the server on the last chunk. In such a case they won't be available on the client until the last chunk has
     been received.
     
     return a dictionary of trailers."""
     if self.trailers_dict is None:
       self.trailers_dict = map_from_java(self.java_obj.trailers())
     return self.trailers_dict
コード例 #18
0
    def symmetric_difference_update(self, other):
        """Update the set with elements existing on one set or the other but not both.

        @param other: A set of elements with which to update.
        """
        if isinstance(other, SharedSet):
            other = map_from_java(other.java_obj)
        for item in other:
            if item in self:
                self.remove(item)
            else:
                self.add(item)
        return self
コード例 #19
0
    def intersection_update(self, other):
        """Update the set with only elements found in both sets.

        @param other: A set of elements to add.
        """
        if isinstance(other, SharedSet):
            other = map_from_java(other.java_obj)
        iter = self.java_obj.iterator()
        while iter.hasNext():
            obj = iter.next()
            if obj not in other:
                self.remove(obj)
        for item in other:
            self.add(item)
        return self
コード例 #20
0
ファイル: messaging.py プロジェクト: vineethvarghese/vertigo
 def __init__(self, message):
   self._message = message
   self._body = map_from_java(message.body().toMap())
コード例 #21
0
ファイル: network.py プロジェクト: hendarmawan/vertigo-python
 def get_config(self):
     """Returns the component configuration."""
     return map_from_java(self.java_obj.getConfig())
コード例 #22
0
 def handleSendOrPub(self, j_sock, send, message, address):
     if self._send_or_pub_handler is not None:
         result = self._send_or_pub_handler(SockJSSocket(j_sock), send,
                                            map_from_java(message), address)
         return result if result is not None else True
     return True
コード例 #23
0
ファイル: definition.py プロジェクト: vineethvarghese/vertigo
 def get_config(self):
   return map_from_java(self._def.config().toMap())
コード例 #24
0
 def items(self):
     return map_from_java(self.java_obj).items()
コード例 #25
0
 def __iter__(self):
     return map_from_java(self.java_obj).__iter__()
コード例 #26
0
 def has_key(self, key):
     return map_from_java(self.java_obj).has_key(key)
コード例 #27
0
 def itervalues(self):
     return map_from_java(self.java_obj).itervalues()
コード例 #28
0
ファイル: vertx.py プロジェクト: fregaham/mod-lang-jython
def env():
    """Get environment variables for the verticle
    @return: dict containing environment variables
    """
    return map_from_java(java.lang.System.getenv())
コード例 #29
0
 def trailers(self):
     """ Get a copy of the trailers as a dictionary """
     return map_from_java(self.java_obj.trailers())
コード例 #30
0
 def pop(self, key, *args, **kwargs):
     return map_from_java(self.java_obj).pop(key, *args, **kwargs)
コード例 #31
0
 def get(self, key, default=None):
     return map_from_java(self.java_obj).get(key, default)
コード例 #32
0
 def __iter__(self):
     return iter(map_from_java(self.java_obj))
コード例 #33
0
ファイル: vertx.py プロジェクト: fregaham/mod-lang-jython
def config():
    """Get config for the verticle
    @return: dict config for the verticle
    """
    return map_from_java(org.vertx.java.platform.impl.JythonVerticleFactory.
                         container.config().toMap())
コード例 #34
0
def config():
    """Get config for the verticle
    @return: dict config for the verticle
    """
    return map_from_java(org.vertx.java.platform.impl.JythonVerticleFactory.container.config().toMap())
コード例 #35
0
ファイル: sock_js.py プロジェクト: fregaham/mod-lang-jython
 def handleSendOrPub(self, j_sock, send, message, address):
     if self._send_or_pub_handler is not None:
         result = self._send_or_pub_handler(SockJSSocket(j_sock), send, map_from_java(message), address)
         return result if result is not None else True
     return True
コード例 #36
0
def env():
    """Get environment variables for the verticle
    @return: dict containing environment variables
    """
    return map_from_java(java.lang.System.getenv())
コード例 #37
0
 def keys(self):
     return map_from_java(self.java_obj).keys()
コード例 #38
0
 def values(self):
     return map_from_java(self.java_obj).values()