Sets the return parameter with description and rtype if any
488524
def _set_return(self):
        """"""
        # TODO: manage return retrieved from element code (external)
        # TODO: manage different in/out styles
        if type(self.docs['in']['return']) is list and self.dst.style['out'] not in ['groups', 'numpydoc', 'google']:
            # TODO: manage return names
            # manage not setting return if not mandatory for numpy
            lst = self.docs['in']['return']
            if lst:
                if lst[0][0] is not None:
                    self.docs['out']['return'] = "%s-> %s" % (lst[0][0], lst[0][1])
                else:
                    self.docs['out']['return'] = lst[0][1]
                self.docs['out']['rtype'] = lst[0][2]
        else:
            self.docs['out']['return'] = self.docs['in']['return']
            self.docs['out']['rtype'] = self.docs['in']['rtype']
350325
def any(cls, result_key, func):
        
        def scanner(self, obj):
            current_value = getattr(self, result_key, None)
            setattr(self, result_key, current_value or func(obj))

        cls._scan(result_key, scanner)
979095
def insert_parameter(self, pname, ptype):
        ""
        index = self.insert_id(pname, SharedData.KINDS.PARAMETER, SharedData.KINDS.PARAMETER, ptype)
        #set parameter's attribute to it's ordinal number
        self.table[index].set_attribute("Index", self.shared.function_params)
        #set parameter's type in param_types list of a function
        self.table[self.shared.function_index].param_types.append(ptype)
        return index
512591
def config_set(self, parameter, value):
        """"""
        if not isinstance(parameter, str):
            raise TypeError("parameter must be str")
        fut = self.execute(b'CONFIG', b'SET', parameter, value)
        return wait_ok(fut)
431452
def set_parameter(self, name, value):
        """"""
        self.lib.tdSetDeviceParameter(self.id, name, str(value))
578411
def _set_raw_return(self, sep):
        
        raw = ''
        if self.dst.style['out'] == 'numpydoc':
            raw += '\n'
            spaces = ' ' * 4
            with_space = lambda s: '\n'.join([self.docs['out']['spaces'] + spaces + l.lstrip() if i > 0 else l for i, l in enumerate(s.splitlines())])
            raw += self.dst.numpydoc.get_key_section_header('return', self.docs['out']['spaces'])
            if self.docs['out']['rtype']:
                rtype = self.docs['out']['rtype']
            else:
                rtype = 'type'
            # case of several returns
            if type(self.docs['out']['return']) is list:
                for ret_elem in self.docs['out']['return']:
                    # if tuple (name, desc, rtype) else string desc
                    if type(ret_elem) is tuple and len(ret_elem) == 3:
                        rtype = ret_elem[2]
                        if rtype is None:
                            rtype = ''
                        raw += self.docs['out']['spaces']
                        if ret_elem[0]:
                            raw += ret_elem[0] + ' : '
                        raw += rtype + '\n' + self.docs['out']['spaces'] + spaces + with_space(ret_elem[1]).strip() + '\n'
                    else:
                        # There can be a problem
                        raw += self.docs['out']['spaces'] + rtype + '\n'
                        raw += self.docs['out']['spaces'] + spaces + with_space(str(ret_elem)).strip() + '\n'
            # case of a unique return
            elif self.docs['out']['return'] is not None:
                raw += self.docs['out']['spaces'] + rtype
                raw += '\n' + self.docs['out']['spaces'] + spaces + with_space(self.docs['out']['return']).strip() + '\n'
        elif self.dst.style['out'] == 'google':
            raw += '\n'
            spaces = ' ' * 2
            with_space = lambda s: '\n'.join([self.docs['out']['spaces'] + spaces +\
                                                    l.lstrip() if i > 0 else\
                                                    l for i, l in enumerate(s.splitlines())])
            raw += self.dst.googledoc.get_key_section_header('return', self.docs['out']['spaces'])
            if self.docs['out']['rtype']:
                rtype = self.docs['out']['rtype']
            else:
                rtype = None
            # case of several returns
            if type(self.docs['out']['return']) is list:
                for ret_elem in self.docs['out']['return']:
                    # if tuple (name=None, desc, rtype) else string desc
                    if type(ret_elem) is tuple and len(ret_elem) == 3:
                        rtype = ret_elem[2]
                        if rtype is None:
                            rtype = ''
                        raw += self.docs['out']['spaces'] + spaces
                        raw += rtype + ': ' + with_space(ret_elem[1]).strip() + '\n'
                    else:
                        # There can be a problem
                        if rtype:
                            raw += self.docs['out']['spaces'] + spaces + rtype + ': '
                            raw += with_space(str(ret_elem)).strip() + '\n'
                        else:
                            raw += self.docs['out']['spaces'] + spaces + with_space(str(ret_elem)).strip() + '\n'
            # case of a unique return
            elif self.docs['out']['return'] is not None:
                if rtype:
                    raw += self.docs['out']['spaces'] + spaces + rtype + ': '
                    raw += with_space(self.docs['out']['return']).strip() + '\n'
                else:
                    raw += self.docs['out']['spaces'] + spaces + with_space(self.docs['out']['return']).strip() + '\n'
        elif self.dst.style['out'] == 'groups':
            pass
        else:
            with_space = lambda s: '\n'.join([self.docs['out']['spaces'] + l if i > 0 else l for i, l in enumerate(s.splitlines())])
            if self.docs['out']['return']:
                if not self.docs['out']['params']:
                    raw += '\n'
                raw += self.docs['out']['spaces'] + self.dst.get_key('return', 'out') + sep + with_space(self.docs['out']['return'].rstrip()).strip() + '\n'
            if self.docs['out']['rtype']:
                if not self.docs['out']['params']:
                    raw += '\n'
                raw += self.docs['out']['spaces'] + self.dst.get_key('rtype', 'out') + sep + self.docs['out']['rtype'].rstrip() + '\n'
        return raw
327329
def set_parameter(self, name, value):
        
        if not self._in_valid_interval(name, value):
            raise ValueError(self._get_value_error_message_for_invalid_prarameter(name, value))

        #if name in self._parameters:
        #    print "Parameter %s already existed. It's old value will be replaced with %s" % (name, value)

        self._parameters[name] = value
111304
def _setauto(self, s, length, offset):
        """"""
        # As s can be so many different things it's important to do the checks
        # in the correct order, as some types are also other allowed types.
        # So basestring must be checked before Iterable
        # and bytes/bytearray before Iterable but after basestring!
        if isinstance(s, Bits):
            if length is None:
                length = s.len - offset
            self._setbytes_unsafe(s._datastore.rawbytes, length, s._offset + offset)
            return
        if isinstance(s, file):
            if offset is None:
                offset = 0
            if length is None:
                length = os.path.getsize(s.name) * 8 - offset
            byteoffset, offset = divmod(offset, 8)
            bytelength = (length + byteoffset * 8 + offset + 7) // 8 - byteoffset
            m = MmapByteArray(s, bytelength, byteoffset)
            if length + byteoffset * 8 + offset > m.filelength * 8:
                raise CreationError("File is not long enough for specified "
                                    "length and offset.")
            self._datastore = ConstByteStore(m, length, offset)
            return
        if length is not None:
            raise CreationError("The length keyword isn't applicable to this initialiser.")
        if offset:
            raise CreationError("The offset keyword isn't applicable to this initialiser.")
        if isinstance(s, basestring):
            bs = self._converttobitstring(s)
            assert bs._offset == 0
            self._setbytes_unsafe(bs._datastore.rawbytes, bs.length, 0)
            return
        if isinstance(s, (bytes, bytearray)):
            self._setbytes_unsafe(bytearray(s), len(s) * 8, 0)
            return
        if isinstance(s, array.array):
            b = s.tostring()
            self._setbytes_unsafe(bytearray(b), len(b) * 8, 0)
            return
        if isinstance(s, numbers.Integral):
            # Initialise with s zero bits.
            if s < 0:
                msg = "Can't create bitstring of negative length {0}."
                raise CreationError(msg, s)
            data = bytearray((s + 7) // 8)
            self._datastore = ByteStore(data, s, 0)
            return
        if isinstance(s, collections.Iterable):
            # Evaluate each item as True or False and set bits to 1 or 0.
            self._setbin_unsafe(''.join(str(int(bool(x))) for x in s))
            return
        raise TypeError("Cannot initialise bitstring from {0}.".format(type(s)))
567220
def set_parameters(self, parameter, value):
        
        if parameter == 'lo':
            self.parameters['lo'] = 1 / value
        else:
            self.parameters[parameter] = value
514726
def describe(self):
        """"""
        desc = {
            'name': self.name,
            'description': self.description,
            # the Parameter might not have a type at all
            'type': self.type or 'unknown',
        }
        for attr in ['min', 'max', 'allowed', 'default']:
            v = getattr(self, attr)
            if v is not None:
                desc[attr] = v
        return desc
1277013
def _set_attr(self, **kwargs):
        
        keys = c_str_array(kwargs.keys())
        vals = c_str_array([str(s) for s in kwargs.values()])
        num_args = mx_uint(len(kwargs))
        check_call(_LIB.MXSymbolSetAttrs(
            self.handle, num_args, keys, vals))
716699
def do_retval(self, arg):
        
        locals = self.get_locals(self.curframe)
        if '__return__' in locals:
            self.message(bdb.safe_repr(locals['__return__']))
        else:
            self.error('Not yet returned!')
506917
def set_description(self, description):
        """"""
        self.head.description.attr(content=description)
        return self
44287
def throw(self, type, value=None, traceback=None):  # pylint: disable=redefined-builtin
        """"""
        return self.__wrapped__.throw(type, value, traceback)
94758
def setRect(self, *args):
        
        if len(args) == 1:
            if isinstance(args[0], tuple):
                x, y, w, h = args[0]
            elif isinstance(args[0], Region):
                x = Region.getX()
                y = Region.getY()
                w = Region.getW()
                h = Region.getH()
            else:
                raise TypeError("Unrecognized arguments for setRect")
        elif len(args) == 4:
            x, y, w, h = args
        else:
            raise TypeError("Unrecognized arguments for setRect")
        self.setX(x)
        self.setY(y)
        self.setW(w)
        self.setH(h)
        return self
656579
def and_return_result_of(self, return_value):
        
        if not check_func_takes_args(return_value):
            self._return_value = lambda *args, **kwargs: return_value()
        else:
            self._return_value = return_value

        return self
742099
def set_parameters(self, **args):
        """"""
        for k, v in self.PARAMETERS.items():
            new_value = args.get(k)
            if new_value != None:
                if not _same_type(new_value, v):
                    raise Exception(
                        "On processor {0}, argument {1} takes something like {2}, but {3} was given".format(self, k, v,
                                                                                                            new_value))
                setattr(self, k, new_value)
        not_used = set(args.keys()).difference(set(self.PARAMETERS.keys()))
        not_given = set(self.PARAMETERS.keys()).difference(set(args.keys()))
        return not_used, not_given