コード例 #1
0
ファイル: Remote.py プロジェクト: HelioGuilherme66/RIDE
 def _handle_binary_in_string(self, arg):
     try:
         if not is_bytes(arg):
             arg = arg.encode('ASCII')
     except UnicodeError:
         raise ValueError('Cannot represent %r as binary.' % arg)
     return xmlrpclib.Binary(arg)
コード例 #2
0
ファイル: Remote.py プロジェクト: 357112130/robotframework
 def _handle_binary_in_string(self, arg):
     try:
         if not is_bytes(arg):
             arg = arg.encode('ASCII')
     except UnicodeError:
         raise ValueError('Cannot represent %r as binary.' % arg)
     return xmlrpclib.Binary(arg)
コード例 #3
0
ファイル: dynamicmethods.py プロジェクト: yvdhi/RIDE
 def _to_string(self, value):
     if is_unicode(value):
         return value
     if is_bytes(value):
         return value.decode('UTF-8')
     if is_tuple(value):
         return f"{value[0]}={value[1]}"
     raise DataError('Return value must be string.')
コード例 #4
0
ファイル: String.py プロジェクト: HelioGuilherme66/RIDE
    def should_be_byte_string(self, item, msg=None):
        """Fails if the given ``item`` is not a byte string.

        Use `Should Be Unicode String` if you want to verify the ``item`` is a
        Unicode string, or `Should Be String` if both Unicode and byte strings
        are fine. See `Should Be String` for more details about Unicode strings
        and byte strings.

        The default error message can be overridden with the optional
        ``msg`` argument.
        """
        if not is_bytes(item):
            self._fail(msg, "'%s' is not a byte string.", item)
コード例 #5
0
    def should_be_byte_string(self, item, msg=None):
        """Fails if the given ``item`` is not a byte string.

        Use `Should Be Unicode String` if you want to verify the ``item`` is a
        Unicode string, or `Should Be String` if both Unicode and byte strings
        are fine. See `Should Be String` for more details about Unicode strings
        and byte strings.

        The default error message can be overridden with the optional
        ``msg`` argument.
        """
        if not is_bytes(item):
            self._fail(msg, "'%s' is not a byte string.", item)
コード例 #6
0
ファイル: Remote.py プロジェクト: HelioGuilherme66/RIDE
 def _string_contains_binary(self, arg):
     return (self.binary.search(arg) or
             is_bytes(arg) and self.non_ascii.search(arg))
コード例 #7
0
 def _contains_binary(self, arg):
     return (self.binary.search(arg) or is_bytes(arg) and not IRONPYTHON
             and self.non_ascii.search(arg))
コード例 #8
0
ファイル: Remote.py プロジェクト: Garjy/RIDE
 def _contains_binary(self, arg):
     return (self.binary.search(arg) or
             is_bytes(arg) and not IRONPYTHON and
             self.non_ascii.search(arg))
コード例 #9
0
 def _to_string(self, value):
     if is_unicode(value):
         return value
     if is_bytes(value):
         return value.decode('UTF-8')
     raise DataError('Return value must be string.')
コード例 #10
0
ファイル: Remote.py プロジェクト: 357112130/robotframework
 def _string_contains_binary(self, arg):
     return (self.binary.search(arg)
             or is_bytes(arg) and self.non_ascii.search(arg))
コード例 #11
0
 def _to_string(self, value):
     if is_unicode(value):
         return value
     if is_bytes(value):
         return value.decode('UTF-8')
     raise DataError('Return value must be string.')