

def func(self):
    '\n        Do the copying.\n        '
    caller = self.caller
    if (not self.rhs):
        string = 'Usage:\n            @cpattr[/switch] <obj>/<attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]\n            @cpattr[/switch] <obj>/<attr> = <obj1> [,<obj2>,<obj3>,...]\n            @cpattr[/switch] <attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]\n            @cpattr[/switch] <attr> = <obj1>[,<obj2>,<obj3>,...]'
        caller.msg(string)
        return
    lhs_objattr = self.lhs_objattr
    to_objs = self.rhs_objattr
    from_obj_name = lhs_objattr[0]['name']
    from_obj_attrs = lhs_objattr[0]['attrs']
    if (not from_obj_attrs):
        from_obj_attrs = [from_obj_name]
        from_obj = self.caller
    else:
        from_obj = caller.search(from_obj_name)
    if ((not from_obj) or (not to_objs)):
        caller.msg('You have to supply both source object and target(s).')
        return
    if ('move' in self.switches):
        clear = True
    else:
        clear = False
    if (not self.check_from_attr(from_obj, from_obj_attrs[0], clear=clear)):
        return
    for attr in from_obj_attrs:
        if (not self.check_has_attr(from_obj, attr)):
            return
    if ((len(from_obj_attrs) != len(set(from_obj_attrs))) and clear):
        self.caller.msg('{RCannot have duplicate source names when moving!')
        return
    string = ''
    for to_obj in to_objs:
        to_obj_name = to_obj['name']
        to_obj_attrs = to_obj['attrs']
        to_obj = caller.search(to_obj_name)
        if (not to_obj):
            string += ("\nCould not find object '%s'" % to_obj_name)
            continue
        for (inum, from_attr) in enumerate(from_obj_attrs):
            try:
                to_attr = to_obj_attrs[inum]
            except IndexError:
                to_attr = from_attr
            if (not self.check_to_attr(to_obj, caller)):
                continue
            value = self.get_attr(from_obj, from_attr)
            to_obj.attributes.add(to_attr, value)
            if (clear and (not ((from_obj == to_obj) and (from_attr == to_attr)))):
                from_obj.attributes.remove(from_attr)
                string += ('\nMoved %s.%s -> %s.%s. (value: %s)' % (from_obj.name, from_attr, to_obj_name, to_attr, repr(value)))
            else:
                string += ('\nCopied %s.%s -> %s.%s. (value: %s)' % (from_obj.name, from_attr, to_obj_name, to_attr, repr(value)))
    caller.msg(string)

dataset/ETHPy150Open evennia/evennia/evennia/commands/default/building.py CmdCpAttr.func/VarMisuse@342/700 `to_attr`->`caller`