def load_attachments(self, source, skeleton):
self.targets = {}<EOL>self.offsets = {}<EOL>filename = source<EOL>if isinstance(source, str):<EOL><INDENT>source = open(source)<EOL><DEDENT>else:<EOL><INDENT>filename = '<STR_LIT>'.format(id(source))<EOL><DEDENT>for i, line in enumerate(source):<EOL><INDENT>tokens = line.split('<STR_LIT:#>')[<NUM_LIT:0>].strip().split()<EOL>if not tokens:<EOL><INDENT>continue<EOL><DEDENT>label = tokens.pop(<NUM_LIT:0>)<EOL>if label not in self.channels:<EOL><INDENT>logging.info('<STR_LIT>', filename, i, label)<EOL>continue<EOL><DEDENT>if not tokens:<EOL><INDENT>continue<EOL><DEDENT>name = tokens.pop(<NUM_LIT:0>)<EOL>bodies = [b for b in skeleton.bodies if b.name == name]<EOL>if len(bodies) != <NUM_LIT:1>:<EOL><INDENT>logging.info('<STR_LIT>',<EOL>filename, i, len(bodies), name)<EOL>continue<EOL><DEDENT>b = self.targets[label] = bodies[<NUM_LIT:0>]<EOL>o = self.offsets[label] =np.array(list(map(float, tokens))) * b.dimensions / <NUM_LIT:2><EOL>logging.info('<STR_LIT>', label, b.name, o)<EOL><DEDENT>
Load attachment configuration from the given text source.

        The attachment configuration file has a simple format. After discarding
        Unix-style comments (any part of a line that starts with the pound (#)
        character), each line in the file is then expected to have the following
        format::

            marker-name body-name X Y Z

        The marker name must correspond to an existing "channel" in our marker
        data. The body name must correspond to a rigid body in the skeleton. The
        X, Y, and Z coordinates specify the body-relative offsets where the
        marker should be attached: 0 corresponds to the center of the body along
        the given axis, while -1 and 1 correspond to the minimal (maximal,
        respectively) extent of the body's bounding box along the corresponding
        dimension.

        Parameters
        ----------
        source : str or file-like
            A filename or file-like object that we can use to obtain text
            configuration that describes how markers are attached to skeleton
            bodies.

        skeleton : :class:`pagoda.skeleton.Skeleton`
            The skeleton to attach our marker data to.