<commit_before>'''

Button for "Dr Who" themed sound & light box


'''


from __future__ import print_function
import RPi.GPIO as GPIO
import os
import time
import inspect
from glob import glob
from indicators import Indicators

GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)

FILETYPES = ['*.wav', '*.mp[1234]', '*.m4[ab]' ,'*.ogg', '*.flac', '*.oga', '*.aac']
PATTERNS = []
for ft in FILETYPES:
    PATTERNS.append(ft)
    PATTERNS.append(ft.upper())

class TardisButton(object):

    __number = 0

    def __init__(self, pin, player, latching=False, dir=None):
        self.pin = pin
        self.player = player
        GPIO.setup(pin, GPIO.IN)

        # enumerate this instance
        TardisButton.__number += 1
        self.__name = str(TardisButton.__number)

        # Grab a light
        self.light = Indicators()
        self.light.on()

        # which file to play next
        self.__next = 0

        # Where do we find our data files?
        if dir:
            self.__dir = dir
        else:
            dir = os.path.dirname(os.path.abspath(
                                  inspect.getfile(inspect.currentframe())))
            self.__dir = os.path.join(dir, 'Sounds', self.__name)

        # Scan for data files
        self._getFiles()

        # are we active
        self.enable()

        # Add a callback
        if latching:
            type = GPIO.BOTH
        else:<commit_msg>Create paths, ensure permissions are ok<commit_after>'''

Button for "Dr Who" themed sound & light box


'''


from __future__ import print_function
import RPi.GPIO as GPIO
import os
import time
import inspect
from glob import glob
from indicators import Indicators

GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)

FILETYPES = ['*.wav', '*.mp[1234]', '*.m4[ab]' ,'*.ogg', '*.flac', '*.oga', '*.aac']
PATTERNS = []
for ft in FILETYPES:
    PATTERNS.append(ft)
    PATTERNS.append(ft.upper())

class TardisButton(object):

    __number = 0

    def __init__(self, pin, player, latching=False, dir=None):
        self.pin = pin
        self.player = player
        GPIO.setup(pin, GPIO.IN)

        # enumerate this instance
        TardisButton.__number += 1
        self.__name = str(TardisButton.__number)

        # Grab a light
        self.light = Indicators()
        self.light.on()

        # which file to play next
        self.__next = 0

        # Where do we find our data files?
        if dir:
            self.__dir = dir
        else:
            dir = os.path.dirname(os.path.abspath(
                                  inspect.getfile(inspect.currentframe())))
            self.__dir = os.path.join(dir, 'Sounds', self.__name)

        # Create directory if it doesn't exist
        try:
            subprocess.call(['mkdir', '-p', self.__dir])
        except:
            pass
        # Set Permissions
        try:
            subprocess.call(['chown', '-R', 'pi.pi', self.__dir, '..', '..', 'Sounds'])
        except:
            pass

        # Scan for data files
        self._getFiles()

        # are we active
        self.enable()

        # Add a callback
        if latching:
            type = GPIO.BOTH
        else:
{'fraction_non_alphanumeric': 0.11870845204178537, 'fraction_numerical': 0.005064893953782843, 'mean_word_length': 1.9588014981273407, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5747832', 'n_tokens_mistral': 1014, 'n_tokens_neox': 957, 'n_words': 266}