def import_locations(self, marker_file):
        """Parse Xearth data files.

        ``import_locations()`` returns a dictionary with keys containing the
        xearth_ name, and values consisting of a :class:`Xearth` object and
        a string containing any comment found in the marker file.

        It expects Xearth marker files in the following format::

            # Comment

            52.015     -0.221 "Home"          # James Rowe's home
            52.6333    -2.5   "Telford"

        Any empty line or line starting with a '#' is ignored.  All data lines
        are whitespace-normalised, so actual layout should have no effect.  The
        above file processed by ``import_locations()`` will return the
        following ``dict`` object::

            {'Home': point.Point(52.015, -0.221, "James Rowe's home"),
             'Telford': point.Point(52.6333, -2.5, None)}

        Note:
            This function also handles the extended xplanet_ marker files whose
            points can optionally contain added xplanet specific keywords for
            defining colours and fonts.

        Args:
            marker_file (iter): Xearth marker data to read
        Returns:
            dict: Named locations with optional comments

        .. _xearth: http://hewgill.com/xearth/original/
        .. _xplanet: http://xplanet.sourceforge.net/
        """
        self._marker_file = marker_file
        data = utils.prepare_read(marker_file)

        for line in data:
            line = line.strip()
            if not line or line.startswith('#'):
                continue
            chunk = line.split('#')
            data = chunk[0]
            comment = chunk[1].strip() if len(chunk) == 2 else None
            # Need maximum split of 2, because name may contain whitespace
            latitude, longitude, name = data.split(None, 2)
            name = name.strip()
            # Find matching start and end quote, and keep only the contents
            name = name[1:name.find(name[0], 1)]
            self[name.strip()] = Xearth(latitude, longitude, comment)
def import_locations ( self , marker_file ) : self . _marker_file = marker_file data = utils . prepare_read ( marker_file ) for line in data : line = line . strip ( ) if not line or line . startswith ( '#' ) : continue chunk = line . split ( '#' ) data = chunk [ 0 ] comment = chunk [ 1 ] . strip ( ) if len ( chunk ) == 2 else None latitude , longitude , name = data . split ( None , 2 ) name = name . strip ( ) name = name [ 1 : name . find ( name [ 0 ] , 1 ) ] self [ name . strip ( ) ] = Xearth ( latitude , longitude , comment )
Parse Xearth data files.

        ``import_locations()`` returns a dictionary with keys containing the
        xearth_ name, and values consisting of a :class:`Xearth` object and
        a string containing any comment found in the marker file.

        It expects Xearth marker files in the following format::

            # Comment

            52.015     -0.221 "Home"          # James Rowe's home
            52.6333    -2.5   "Telford"

        Any empty line or line starting with a '#' is ignored.  All data lines
        are whitespace-normalised, so actual layout should have no effect.  The
        above file processed by ``import_locations()`` will return the
        following ``dict`` object::

            {'Home': point.Point(52.015, -0.221, "James Rowe's home"),
             'Telford': point.Point(52.6333, -2.5, None)}

        Note:
            This function also handles the extended xplanet_ marker files whose
            points can optionally contain added xplanet specific keywords for
            defining colours and fonts.

        Args:
            marker_file (iter): Xearth marker data to read
        Returns:
            dict: Named locations with optional comments

        .. _xearth: http://hewgill.com/xearth/original/
        .. _xplanet: http://xplanet.sourceforge.net/