# ID, USB product ID. BOARD_IDS = set([ (0x0D28, 0x0204), # micro:bit USB VID, PID (0x239A, 0x800B), # Adafruit Feather M0 CDC only USB VID, PID (0x239A, 0x8016), # Adafruit Feather M0 CDC + MSC USB VID, PID (0x239A, 0x8013), # Adafruit Metro M0 CDC only USB VID, PID (0x239A, 0x8015) # Adafruit Metro Mo CDC + MSC USB VID, PID ]) #: The user's home directory. HOME_DIRECTORY = os.path.expanduser('~') # Name of the directory within the home folder to use by default WORKSPACE_NAME = 'mu_code' #: The default directory for application data (i.e., configuration). DATA_DIR = appdirs.user_data_dir(appname='mu', appauthor='python') #: The default directory for application logs. LOG_DIR = appdirs.user_log_dir(appname='mu', appauthor='python') #: The path to the log file for the application. LOG_FILE = os.path.join(LOG_DIR, 'mu.log') #: Regex to match pycodestyle (PEP8) output. STYLE_REGEX = re.compile(r'.*:(\d+):(\d+):\s+(.*)') #: Regex to match flake8 output. FLAKE_REGEX = re.compile(r'.*:(\d+):\s+(.*)') #: Regex to match false positive flake errors if microbit.* is expanded. EXPAND_FALSE_POSITIVE = re.compile(r"^'microbit\.(\w+)' imported but unused$") #: The text to which "from microbit import *" should be expanded. EXPANDED_IMPORT = ("from microbit import pin15, pin2, pin0, pin1, " " pin3, pin6, pin4, i2c, pin5, pin7, pin8, Image, " "pin9, pin14, pin16, reset, pin19, temperature, " "sleep, pin20, button_a, button_b, running_time, " "accelerometer, display, uart, spi, panic, pin13, " "pin12, pin11, pin10, compass")
from pycodestyle import StyleGuide, Checker from mu.contrib import uflash, appdirs, microfs from mu import __version__ #: USB product ID. MICROBIT_PID = 516 #: USB vendor ID. MICROBIT_VID = 3368 #: The user's home directory. HOME_DIRECTORY = os.path.expanduser('~') #: The default directory for Python scripts. PYTHON_DIRECTORY = os.path.join(HOME_DIRECTORY, 'python') #: The default directory for application data. DATA_DIR = appdirs.user_data_dir('mu', 'python') #: The default directory for application logs. LOG_DIR = appdirs.user_log_dir('mu', 'python') #: The path to the JSON file containing application settings. SETTINGS_FILE = os.path.join(DATA_DIR, 'settings.json') #: The path to the log file for the application. LOG_FILE = os.path.join(LOG_DIR, 'mu.log') #: Regex to match pycodestyle (PEP8) output. STYLE_REGEX = re.compile(r'.*:(\d+):(\d+):\s+(.*)') #: Regex to match flake8 output. FLAKE_REGEX = re.compile(r'.*:(\d+):\s+(.*)') logger = logging.getLogger(__name__) def find_microbit(): """ Returns the port for the first microbit it finds connected to the host
from mu.contrib import uflash, appdirs, microfs from mu import __version__ #: USB product ID. MICROBIT_PID = 516 #: USB vendor ID. MICROBIT_VID = 3368 #: The user's home directory. HOME_DIRECTORY = os.path.expanduser('~') #: The default directory for Python scripts. PYTHON_DIRECTORY = os.path.join(HOME_DIRECTORY, 'python') #: The default directory for application data. DATA_DIR = appdirs.user_data_dir('mu', 'python') #: The default directory for application logs. LOG_DIR = appdirs.user_log_dir('mu', 'python') #: The path to the JSON file containing application settings. SETTINGS_FILE = os.path.join(DATA_DIR, 'settings.json') #: The path to the log file for the application. LOG_FILE = os.path.join(LOG_DIR, 'mu.log') #: Regex to match pycodestyle (PEP8) output. STYLE_REGEX = re.compile(r'.*:(\d+):(\d+):\s+(.*)') #: Regex to match flake8 output. FLAKE_REGEX = re.compile(r'.*:(\d+):\s+(.*)') #: Regex to match false positive flake errors if microbit.* is expanded. EXPAND_FALSE_POSITIVE = re.compile(r"^'microbit\.(\w+)' imported but unused$") #: The text to which "from microbit import *" should be expanded. EXPANDED_IMPORT = ("from microbit import pin15, pin2, pin0, pin1, " " pin3, pin6, pin4, i2c, pin5, pin7, pin8, Image, " "pin9, pin14, pin16, reset, pin19, temperature, " "sleep, pin20, button_a, button_b, running_time, "