<commit_before>import pylast
import random
import threading
import Queue
import time
from pyechonest import config, artist, song

config.ECHO_NEST_API_KEY = "***REMOVED***"

class echoArtistThread(threading.Thread):
    def __init__(self, queue, artist_list):
        threading.Thread.__init__(self)
        self.queue = queue
        self.artist_list = artist_list

    def run(self):
        while True:
            try:
                a = self.queue.get()
                ar = artist.Artist(a)
                l = ar.get_songs()
                self.artist_list.append({'artist':ar,'songs':l})
                self.queue.task_done()
            except:
                self.queue.task_done()

class echoThread(threading.Thread):
    def __init__(self, queue, songs_list):
        threading.Thread.__init__(self)
        self.queue = queue
        self.songs_list = songs_list

    def run(self):
        while True:
            try:
                s = self.queue.get() # get artist from queue
                self.songs_list.append(s.get_audio_summary())
                self.queue.task_done()
            except:
                self.queue.task_done()

            #the_artist = artist.Artist(a)
            #songs = the_artist.get_songs()[:num_songs]<commit_msg>using finally correctly<commit_after>import pylast
import random
import threading
import Queue
import time
from pyechonest import config, artist, song

config.ECHO_NEST_API_KEY = "***REMOVED***"

class echoArtistThread(threading.Thread):
    def __init__(self, queue, artist_list):
        threading.Thread.__init__(self)
        self.queue = queue
        self.artist_list = artist_list

    def run(self):
        while True:
            try:
                a = self.queue.get()
                ar = artist.Artist(a)
                l = ar.get_songs()
                self.artist_list.append({'artist':ar,'songs':l})
            finally:
                self.queue.task_done()

class echoThread(threading.Thread):
    def __init__(self, queue, songs_list):
        threading.Thread.__init__(self)
        self.queue = queue
        self.songs_list = songs_list

    def run(self):
        while True:
            try:
                s = self.queue.get() # get artist from queue
                self.songs_list.append(s.get_audio_summary())
            finally:
                self.queue.task_done()

            #the_artist = artist.Artist(a)
            #songs = the_artist.get_songs()[:num_songs]
{'fraction_non_alphanumeric': 0.1011326860841424, 'fraction_numerical': 0.0, 'mean_word_length': 1.961676646706587, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1473726', 'n_tokens_mistral': 760, 'n_tokens_neox': 733, 'n_words': 147}