def load(self, path):
        """Loads the data from `path` into the catalogue.

        :param path: path to catalogue file
        :type path: `str`

        """
        fieldnames = ['work', 'label']
        with open(path, 'r', encoding='utf-8', newline='') as fh:
            reader = csv.DictReader(fh, delimiter=' ', fieldnames=fieldnames,
                                    skipinitialspace=True)
            for row in reader:
                work, label = row['work'], row['label']
                if label:
                    if label not in self._ordered_labels:
                        self._ordered_labels.append(label)
                    if work in self:
                        raise MalformedCatalogueError(
                            CATALOGUE_WORK_RELABELLED_ERROR.format(work))
                    self[work] = label
def load ( self , path ) : fieldnames = [ 'work' , 'label' ] with open ( path , 'r' , encoding = 'utf-8' , newline = '' ) as fh : reader = csv . DictReader ( fh , delimiter = ' ' , fieldnames = fieldnames , skipinitialspace = True ) for row in reader : work , label = row [ 'work' ] , row [ 'label' ] if label : if label not in self . _ordered_labels : self . _ordered_labels . append ( label ) if work in self : raise MalformedCatalogueError ( CATALOGUE_WORK_RELABELLED_ERROR . format ( work ) ) self [ work ] = label
Loads the data from `path` into the catalogue.

        :param path: path to catalogue file
        :type path: `str`