Loads set name from SET_FILE, looks up album_id on fb, 
        it it doesn't exists, creates album. Returns album id and album name
554077
def _get_album(self,directory):
        
        if not self._connectToFB():
            print("%s - Couldn't connect to fb"%(directory))
            return None,None


        # Load sets from SET_FILE
        _sets=self._load_sets(directory)

        # Only grab the first set, FB supports only one set per photo
        myset=_sets[0]

        logger.debug("Getting album id for %s"%(myset))

        # Connect to fb and get dicionary of photosets
        psets=self._getphotosets()

        # create if it doesn't exist
        if myset not in psets:
            logger.info('set [%s] not in fb sets, will create set'%(myset))
            self._createphotoset(myset)
            # Now reaload photosets from fb
            psets=self._getphotosets()

        # Return the album id, album name
        return psets[myset]['id'],myset
1035173
def _load_image_set_index(self, shuffle):
        
        self.num_images = 0
        for db in self.imdbs:
            self.num_images += db.num_images
        indices = list(range(self.num_images))
        if shuffle:
            random.shuffle(indices)
        return indices
913488
def __load_settings_from_file(self):
        
        filename = self.get_base_path() + 'settings.json'

        if not exists(filename):
            raise OneLogin_Saml2_Error(
                'Settings file not found: %s',
                OneLogin_Saml2_Error.SETTINGS_FILE_NOT_FOUND,
                filename
            )

        # In the php toolkit instead of being a json file it is a php file and
        # it is directly included
        with open(filename, 'r') as json_data:
            settings = json.loads(json_data.read())

        advanced_filename = self.get_base_path() + 'advanced_settings.json'
        if exists(advanced_filename):
            with open(advanced_filename, 'r') as json_data:
                settings.update(json.loads(json_data.read()))  # Merge settings

        return self.__load_settings_from_dict(settings)
1061836
def create(self, name, **kwds):
        
        result = self._client.post("/album/create.json",
                                   name=name, **kwds)["result"]
        return Album(self._client, result)
751281
def get(self, file_id: Union[str, bson.ObjectId]) -> [typing.BinaryIO, str, datetime.datetime]:
        
        if isinstance(file_id, str):
            file_id = bson.ObjectId(file_id)
        file = self._fs.get(file_id)
        return file, file.filename, file.upload_date
618576
def get_album_by_mbid(self, mbid):
        """"""

        params = {"mbid": mbid}

        doc = _Request(self, "album.getInfo", params).execute(True)

        return Album(_extract(doc, "artist"), _extract(doc, "name"), self)
1103016
def set_from_file(file_name):
    
    if type(file_name) != str:
        raise TypeError('file_name must be str')
    global _config_file_name
    _config_file_name = file_name
    # Try to open the file and get the json data into a dictionary
    with open(file_name, "r") as file:
        data = yaml.load(file)
    # each value found will overwrite the same value in the config
    _list_merge(data, _config)
913679
def list_build_set_records(id=None, name=None, page_size=200, page_index=0, sort="", q=""):
    
    content = list_build_set_records_raw(id, name, page_size, page_index, sort, q)
    if content:
        return utils.format_json_list(content)
1171935
def from_filename(cls, filename):
        
        if not filename:
            logger.error('No filename specified')
            return None

        if not os.path.exists(filename):
            logger.error("Err: File '%s' does not exist", filename)
            return None

        if os.path.isdir(filename):
            logger.error("Err: File '%s' is a directory", filename)
            return None

        try:
            audiofile = eyed3.load(filename)
        except Exception as error:
            print(type(error), error)
            return None

        # Sometimes eyed3 may return a null object and not raise any exceptions
        if audiofile is None:
            return None

        tags = audiofile.tag
        album = tags.album
        title = tags.title
        lyrics = ''.join([l.text for l in tags.lyrics])
        artist = tags.album_artist
        if not artist:
            artist = tags.artist

        song = cls(artist, title, album, lyrics)
        song.filename = filename
        return song
962641
def view(self, album, **kwds):
        
        result = self._client.get("/album/%s/view.json" %
                                  self._extract_id(album),
                                  **kwds)["result"]
        return Album(self._client, result)
1249403
def get_album(self, object_id, relation=None, **kwargs):
        
        return self.get_object("album", object_id, relation=relation, **kwargs)
701955
def load_from_filename(self, file_name, sep='\n'):
        """"""
        fp = open(file_name, 'rb')
        n = self.load_from_file(fp, sep)
        fp.close()
        return n
1045710
def filedet(name, fobj=None, suffix=None):
    
    name = name or (fobj and fobj.name) or suffix
    separated = name.split('.')
    if len(separated) == 1:
        raise FiledetException('file name error.')

    key = '.' + separated[-1]
    return _file_type_map.get(key)
888425
public function getNames()
    {
        $this->write("Loading set list... ");

        // On the first pass through the following loop, we want to get the
        // first page of sets without using a resumption token:
        $params = [];

        $setNames = [];

        // Grab set information until we have it all (at which point we will
        // break out of this otherwise-infinite loop):
        do {
            // Process current page of results:
            $response = $this->sendRequest('ListSets', $params);
            if (isset($response->ListSets->set)) {
                foreach ($response->ListSets->set as $current) {
                    $spec = (string)$current->setSpec;
                    $name = (string)$current->setName;
                    if (!empty($spec)) {
                        $setNames[$spec] = $name;
                    }
                }
            }

            // Is there a resumption token?  If so, continue looping; if not,
            // we're done!
            $params['resumptionToken']
                = !empty($response->ListSets->resumptionToken)
                ? (string)$response->ListSets->resumptionToken : '';
        } while (!empty($params['resumptionToken']));
        $this->writeLine("found " . count($setNames));
        return $setNames;
    }
522653
def load_array(self, fn, name):
        

        if os.path.exists(fn + '.npz'):
            array = np.load(fn + '.npz')
            try:
                setattr(self, name, array['arr_0'])
            except Exception, e:
                print e
            finally:
                array.close()

        else:
            raise RuntimeError("File %s does not exist." % (fn + '.npz'))
1323362
def get_albums(self):
        
        return itunespy.lookup(id=self.artist_id, entity=itunespy.entities['album'])[1:]
731001
def albums_in_collection(start=nil,count=nil,sort=nil,query=nil)
      api.getAlbumsInCollection self,start,count,sort,query
    end