├── .gitattributes ├── .gitignore ├── .gitmodules ├── .travis.yml ├── ACKNOWLEDGEMENTS ├── CODECONVENTIONS.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── docs ├── Makefile ├── README.md ├── conf.py ├── differences │ └── index_template.txt ├── esp8266 │ ├── general.rst │ ├── img │ │ └── adafruit_products_pinoutstop.jpg │ ├── quickref.rst │ └── tutorial │ │ ├── adc.rst │ │ ├── dht.rst │ │ ├── filesystem.rst │ │ ├── index.rst │ │ ├── intro.rst │ │ ├── neopixel.rst │ │ ├── network_basics.rst │ │ ├── network_tcp.rst │ │ ├── nextsteps.rst │ │ ├── onewire.rst │ │ ├── pins.rst │ │ ├── powerctrl.rst │ │ ├── pwm.rst │ │ └── repl.rst ├── esp8266_index.rst ├── library │ ├── _thread.rst │ ├── array.rst │ ├── btree.rst │ ├── builtins.rst │ ├── cmath.rst │ ├── esp.rst │ ├── framebuf.rst │ ├── gc.rst │ ├── index.rst │ ├── lcd160cr.rst │ ├── machine.ADC.rst │ ├── machine.I2C.rst │ ├── machine.Pin.rst │ ├── machine.RTC.rst │ ├── machine.SD.rst │ ├── machine.SPI.rst │ ├── machine.Signal.rst │ ├── machine.Timer.rst │ ├── machine.UART.rst │ ├── machine.WDT.rst │ ├── machine.rst │ ├── math.rst │ ├── micropython.rst │ ├── network.rst │ ├── pyb.ADC.rst │ ├── pyb.Accel.rst │ ├── pyb.CAN.rst │ ├── pyb.DAC.rst │ ├── pyb.ExtInt.rst │ ├── pyb.I2C.rst │ ├── pyb.LCD.rst │ ├── pyb.LED.rst │ ├── pyb.Pin.rst │ ├── pyb.RTC.rst │ ├── pyb.SPI.rst │ ├── pyb.Servo.rst │ ├── pyb.Switch.rst │ ├── pyb.Timer.rst │ ├── pyb.UART.rst │ ├── pyb.USB_HID.rst │ ├── pyb.USB_VCP.rst │ ├── pyb.rst │ ├── sys.rst │ ├── ubinascii.rst │ ├── ucollections.rst │ ├── uctypes.rst │ ├── uerrno.rst │ ├── uhashlib.rst │ ├── uheapq.rst │ ├── uio.rst │ ├── ujson.rst │ ├── uos.rst │ ├── ure.rst │ ├── uselect.rst │ ├── usocket.rst │ ├── ussl.rst │ ├── ustruct.rst │ ├── utime.rst │ ├── uzlib.rst │ └── wipy.rst ├── license.rst ├── make.bat ├── pyboard │ ├── general.rst │ ├── hardware │ │ └── index.rst │ ├── quickref.rst │ └── tutorial │ │ ├── accel.rst │ │ ├── amp_skin.rst │ │ ├── assembler.rst │ │ ├── debounce.rst │ │ ├── fading_led.rst │ │ ├── img │ │ ├── fading_leds_breadboard_fritzing.png │ │ ├── pyboard_servo.jpg │ │ ├── pyboard_usb_micro.jpg │ │ ├── skin_amp_1.jpg │ │ ├── skin_amp_2.jpg │ │ ├── skin_lcd_1.jpg │ │ └── skin_lcd_2.jpg │ │ ├── index.rst │ │ ├── intro.rst │ │ ├── lcd160cr_skin.rst │ │ ├── lcd_skin.rst │ │ ├── leds.rst │ │ ├── pass_through.rst │ │ ├── power_ctrl.rst │ │ ├── repl.rst │ │ ├── reset.rst │ │ ├── script.rst │ │ ├── servo.rst │ │ ├── switch.rst │ │ ├── timer.rst │ │ └── usb_mouse.rst ├── pyboard_index.rst ├── readthedocs │ └── settings │ │ └── local_settings.py ├── reference │ ├── asm_thumb2_arith.rst │ ├── asm_thumb2_compare.rst │ ├── asm_thumb2_directives.rst │ ├── asm_thumb2_float.rst │ ├── asm_thumb2_hints_tips.rst │ ├── asm_thumb2_index.rst │ ├── asm_thumb2_label_branch.rst │ ├── asm_thumb2_ldr.rst │ ├── asm_thumb2_logical_bit.rst │ ├── asm_thumb2_misc.rst │ ├── asm_thumb2_mov.rst │ ├── asm_thumb2_stack.rst │ ├── asm_thumb2_str.rst │ ├── constrained.rst │ ├── glossary.rst │ ├── index.rst │ ├── isr_rules.rst │ ├── packages.rst │ ├── repl.rst │ └── speed_python.rst ├── sphinx_selective_exclude │ ├── LICENSE │ ├── README.md │ ├── __init__.py │ ├── eager_only.py │ ├── modindex_exclude.py │ └── search_auto_exclude.py ├── static │ ├── customstyle.css │ └── favicon.ico ├── templates │ ├── layout.html │ ├── replace.inc │ ├── topindex.html │ └── versions.html ├── unix_index.rst ├── wipy │ ├── general.rst │ ├── quickref.rst │ └── tutorial │ │ ├── blynk.rst │ │ ├── index.rst │ │ ├── intro.rst │ │ ├── repl.rst │ │ ├── reset.rst │ │ ├── timer.rst │ │ └── wlan.rst └── wipy_index.rst ├── drivers ├── README.md ├── bus │ ├── qspi.h │ ├── softqspi.c │ ├── softspi.c │ └── spi.h ├── cc3000 │ ├── inc │ │ ├── cc3000_common.h │ │ ├── ccspi.h │ │ ├── data_types.h │ │ ├── evnt_handler.h │ │ ├── hci.h │ │ ├── host_driver_version.h │ │ ├── inet_ntop.h │ │ ├── inet_pton.h │ │ ├── netapp.h │ │ ├── nvmem.h │ │ ├── patch_prog.h │ │ ├── security.h │ │ ├── socket.h │ │ └── wlan.h │ └── src │ │ ├── cc3000_common.c │ │ ├── ccspi.c │ │ ├── evnt_handler.c │ │ ├── hci.c │ │ ├── inet_ntop.c │ │ ├── inet_pton.c │ │ ├── netapp.c │ │ ├── nvmem.c │ │ ├── patch.c │ │ ├── patch_prog.c │ │ ├── security.c │ │ ├── socket.c │ │ └── wlan.c ├── cc3100 │ ├── inc │ │ ├── device.h │ │ ├── driver.h │ │ ├── flowcont.h │ │ ├── fs.h │ │ ├── netapp.h │ │ ├── netcfg.h │ │ ├── nonos.h │ │ ├── objInclusion.h │ │ ├── protocol.h │ │ ├── simplelink.h │ │ ├── socket.h │ │ ├── spawn.h │ │ ├── trace.h │ │ ├── wlan.h │ │ └── wlan_rx_filters.h │ └── src │ │ ├── device.c │ │ ├── driver.c │ │ ├── flowcont.c │ │ ├── fs.c │ │ ├── netapp.c │ │ ├── netcfg.c │ │ ├── nonos.c │ │ ├── socket.c │ │ ├── spawn.c │ │ └── wlan.c ├── dht │ ├── dht.c │ ├── dht.h │ └── dht.py ├── display │ ├── lcd160cr.py │ ├── lcd160cr_test.py │ └── ssd1306.py ├── memory │ ├── spiflash.c │ └── spiflash.h ├── nrf24l01 │ ├── nrf24l01.py │ └── nrf24l01test.py ├── onewire │ ├── ds18x20.py │ └── onewire.py ├── sdcard │ ├── sdcard.py │ └── sdtest.py └── wiznet5k │ ├── README.md │ ├── ethernet │ ├── socket.c │ ├── socket.h │ ├── w5200 │ │ ├── w5200.c │ │ └── w5200.h │ ├── w5500 │ │ ├── w5500.c │ │ └── w5500.h │ ├── wizchip_conf.c │ └── wizchip_conf.h │ └── internet │ ├── dhcp │ ├── dhcp.c │ └── dhcp.h │ └── dns │ ├── dns.c │ └── dns.h ├── examples ├── SDdatalogger │ ├── README.md │ ├── boot.py │ ├── cardreader.py │ └── datalogger.py ├── accel_i2c.py ├── accellog.py ├── asmled.py ├── asmsum.py ├── conwaylife.py ├── embedding │ ├── Makefile │ ├── Makefile.upylib │ ├── README.md │ ├── hello-embed.c │ ├── mpconfigport.h │ └── mpconfigport_minimal.h ├── hwapi │ ├── README.md │ ├── button_led.py │ ├── button_reaction.py │ ├── hwconfig_console.py │ ├── hwconfig_dragonboard410c.py │ ├── hwconfig_esp8266_esp12.py │ ├── hwconfig_pyboard.py │ ├── hwconfig_z_96b_carbon.py │ ├── hwconfig_z_frdm_k64f.py │ ├── soft_pwm.py │ ├── soft_pwm2_uasyncio.py │ └── soft_pwm_uasyncio.py ├── ledangle.py ├── mandel.py ├── micropython.py ├── network │ ├── http_client.py │ ├── http_client_ssl.py │ ├── http_server.py │ ├── http_server_simplistic.py │ ├── http_server_simplistic_commented.py │ └── http_server_ssl.py ├── pins.py ├── pyb.py ├── switch.py └── unix │ ├── ffi_example.py │ └── machine_bios.py ├── extmod ├── crypto-algorithms │ ├── sha256.c │ └── sha256.h ├── lwip-include │ ├── arch │ │ ├── cc.h │ │ └── perf.h │ └── lwipopts.h ├── machine_i2c.c ├── machine_i2c.h ├── machine_mem.c ├── machine_mem.h ├── machine_pinbase.c ├── machine_pinbase.h ├── machine_pulse.c ├── machine_pulse.h ├── machine_signal.c ├── machine_signal.h ├── machine_spi.c ├── machine_spi.h ├── misc.h ├── modbtree.c ├── modframebuf.c ├── modlwip.c ├── modonewire.c ├── modubinascii.c ├── modubinascii.h ├── moductypes.c ├── moduhashlib.c ├── moduheapq.c ├── modujson.c ├── modurandom.c ├── modure.c ├── moduselect.c ├── modussl_axtls.c ├── modussl_mbedtls.c ├── modutimeq.c ├── moduzlib.c ├── modwebrepl.c ├── modwebsocket.c ├── modwebsocket.h ├── re1.5 │ ├── charclass.c │ ├── compilecode.c │ ├── dumpcode.c │ ├── re1.5.h │ └── recursiveloop.c ├── uos_dupterm.c ├── utime_mphal.c ├── utime_mphal.h ├── uzlib │ ├── adler32.c │ ├── crc32.c │ ├── tinf.h │ ├── tinfgzip.c │ ├── tinflate.c │ └── tinfzlib.c ├── vfs.c ├── vfs.h ├── vfs_fat.c ├── vfs_fat.h ├── vfs_fat_diskio.c ├── vfs_fat_file.c ├── vfs_reader.c ├── virtpin.c └── virtpin.h ├── lib ├── README.md ├── cmsis │ └── inc │ │ ├── cmsis_armcc.h │ │ ├── cmsis_armcc_V6.h │ │ ├── cmsis_gcc.h │ │ ├── core_cm0.h │ │ ├── core_cm0plus.h │ │ ├── core_cm3.h │ │ ├── core_cm4.h │ │ ├── core_cm7.h │ │ ├── core_cmFunc.h │ │ ├── core_cmInstr.h │ │ ├── core_cmSimd.h │ │ ├── core_sc000.h │ │ └── core_sc300.h ├── embed │ └── abort_.c ├── libc │ └── string0.c ├── libm │ ├── acoshf.c │ ├── asinfacosf.c │ ├── asinhf.c │ ├── atan2f.c │ ├── atanf.c │ ├── atanhf.c │ ├── ef_rem_pio2.c │ ├── ef_sqrt.c │ ├── erf_lgamma.c │ ├── fdlibm.h │ ├── fmodf.c │ ├── kf_cos.c │ ├── kf_rem_pio2.c │ ├── kf_sin.c │ ├── kf_tan.c │ ├── libm.h │ ├── log1pf.c │ ├── math.c │ ├── nearbyintf.c │ ├── roundf.c │ ├── sf_cos.c │ ├── sf_erf.c │ ├── sf_frexp.c │ ├── sf_ldexp.c │ ├── sf_modf.c │ ├── sf_sin.c │ ├── sf_tan.c │ ├── thumb_vfp_sqrtf.c │ ├── wf_lgamma.c │ └── wf_tgamma.c ├── libm_dbl │ ├── README │ ├── __cos.c │ ├── __expo2.c │ ├── __fpclassify.c │ ├── __rem_pio2.c │ ├── __rem_pio2_large.c │ ├── __signbit.c │ ├── __sin.c │ ├── __tan.c │ ├── acos.c │ ├── acosh.c │ ├── asin.c │ ├── asinh.c │ ├── atan.c │ ├── atan2.c │ ├── atanh.c │ ├── ceil.c │ ├── cos.c │ ├── cosh.c │ ├── erf.c │ ├── exp.c │ ├── expm1.c │ ├── floor.c │ ├── fmod.c │ ├── frexp.c │ ├── ldexp.c │ ├── lgamma.c │ ├── libm.h │ ├── log.c │ ├── log10.c │ ├── log1p.c │ ├── modf.c │ ├── nearbyint.c │ ├── pow.c │ ├── rint.c │ ├── scalbn.c │ ├── sin.c │ ├── sinh.c │ ├── sqrt.c │ ├── tan.c │ ├── tanh.c │ ├── tgamma.c │ └── trunc.c ├── memzip │ ├── README.md │ ├── import.c │ ├── lexermemzip.c │ ├── make-memzip.py │ ├── memzip.c │ └── memzip.h ├── mp-readline │ ├── readline.c │ └── readline.h ├── netutils │ ├── netutils.c │ └── netutils.h ├── oofatfs │ ├── diskio.h │ ├── ff.c │ ├── ff.h │ ├── ffconf.h │ └── option │ │ ├── ccsbcs.c │ │ └── unicode.c ├── timeutils │ ├── timeutils.c │ └── timeutils.h ├── tinytest │ ├── README │ ├── tinytest.c │ ├── tinytest.h │ └── tinytest_macros.h ├── upytesthelper │ ├── upytesthelper.c │ └── upytesthelper.h └── utils │ ├── interrupt_char.c │ ├── interrupt_char.h │ ├── printf.c │ ├── pyexec.c │ ├── pyexec.h │ ├── stdout_helpers.c │ └── sys_stdio_mphal.c ├── logo ├── 1bit-logo.png ├── FONT-LICENSE.txt ├── logo.jpg ├── micropythonpowered-art.png ├── trans-logo.png ├── upython-with-micro.jpg ├── upython-with-micro.png ├── vector-logo-2-BW.svg ├── vector-logo-2.png ├── vector-logo-3.png ├── vector-logo-R2000.dxf ├── vector-logo-inkscape_master.svg ├── vector-logo.svg ├── vector-text-R2000.dxf └── vector-text.svg ├── mpy-cross ├── .gitignore ├── Makefile ├── README.md ├── gccollect.c ├── main.c ├── mpconfigport.h ├── mphalport.h └── qstrdefsport.h ├── ports ├── arty │ ├── .gitignore │ ├── Makefile │ ├── README.md │ ├── board.c │ ├── board.h │ ├── main.c │ ├── modpyb.c │ ├── modpyb.h │ ├── modpybled.c │ ├── mpconfigport.h │ ├── mphalport.h │ └── qstrdefsport.h ├── bare-arm │ ├── Makefile │ ├── main.c │ ├── mpconfigport.h │ ├── mphalport.h │ ├── qstrdefsport.h │ └── stm32f405.ld ├── basic-badge │ ├── Makefile │ ├── badge.c │ ├── badge.h │ ├── basic_mphal.c │ ├── basic_mphal.h │ ├── board.c │ ├── board.h │ ├── disp.c │ ├── disp.h │ ├── hw.c │ ├── hw.h │ ├── main.c │ ├── modpyb.c │ ├── modpyb.h │ ├── modpybled.c │ ├── modpybswitch.c │ ├── mpconfigport.h │ ├── prebuilt │ │ ├── firmware.hex │ │ └── memoryfile.xml │ ├── qstrdefsport.h │ ├── vt100.c │ └── vt100.h ├── cc3200 │ ├── FreeRTOS │ │ ├── FreeRTOSConfig.h │ │ ├── License │ │ │ └── license.txt │ │ └── Source │ │ │ ├── croutine.c │ │ │ ├── event_groups.c │ │ │ ├── include │ │ │ ├── FreeRTOS.h │ │ │ ├── StackMacros.h │ │ │ ├── croutine.h │ │ │ ├── deprecated_definitions.h │ │ │ ├── event_groups.h │ │ │ ├── list.h │ │ │ ├── mpu_prototypes.h │ │ │ ├── mpu_wrappers.h │ │ │ ├── portable.h │ │ │ ├── projdefs.h │ │ │ ├── queue.h │ │ │ ├── semphr.h │ │ │ ├── task.h │ │ │ └── timers.h │ │ │ ├── list.c │ │ │ ├── portable │ │ │ ├── GCC │ │ │ │ └── ARM_CM3 │ │ │ │ │ ├── port.c │ │ │ │ │ └── portmacro.h │ │ │ └── MemMang │ │ │ │ └── heap_4.c │ │ │ ├── queue.c │ │ │ ├── tasks.c │ │ │ └── timers.c │ ├── Makefile │ ├── README.md │ ├── application.lds │ ├── application.mk │ ├── appsign.sh │ ├── boards │ │ ├── LAUNCHXL │ │ │ ├── mpconfigboard.h │ │ │ └── pins.csv │ │ ├── WIPY │ │ │ ├── mpconfigboard.h │ │ │ └── pins.csv │ │ ├── cc3200_af.csv │ │ ├── cc3200_prefix.c │ │ └── make-pins.py │ ├── bootmgr │ │ ├── bootgen.sh │ │ ├── bootloader.mk │ │ ├── bootmgr.h │ │ ├── bootmgr.lds │ │ ├── flc.h │ │ ├── main.c │ │ ├── relocator │ │ │ └── relocator.bin │ │ ├── runapp.s │ │ └── sl │ │ │ └── user.h │ ├── fatfs │ │ └── src │ │ │ └── drivers │ │ │ ├── sd_diskio.c │ │ │ ├── sd_diskio.h │ │ │ ├── sflash_diskio.c │ │ │ ├── sflash_diskio.h │ │ │ └── stdcmd.h │ ├── fatfs_port.c │ ├── ftp │ │ ├── ftp.c │ │ ├── ftp.h │ │ ├── updater.c │ │ └── updater.h │ ├── hal │ │ ├── adc.c │ │ ├── adc.h │ │ ├── aes.c │ │ ├── aes.h │ │ ├── cc3200_asm.h │ │ ├── cc3200_hal.c │ │ ├── cc3200_hal.h │ │ ├── cpu.c │ │ ├── cpu.h │ │ ├── crc.c │ │ ├── crc.h │ │ ├── debug.h │ │ ├── des.c │ │ ├── des.h │ │ ├── fault_registers.h │ │ ├── gpio.c │ │ ├── gpio.h │ │ ├── i2c.c │ │ ├── i2c.h │ │ ├── i2s.c │ │ ├── i2s.h │ │ ├── inc │ │ │ ├── asmdefs.h │ │ │ ├── hw_adc.h │ │ │ ├── hw_aes.h │ │ │ ├── hw_apps_config.h │ │ │ ├── hw_apps_rcm.h │ │ │ ├── hw_camera.h │ │ │ ├── hw_common_reg.h │ │ │ ├── hw_des.h │ │ │ ├── hw_dthe.h │ │ │ ├── hw_flash_ctrl.h │ │ │ ├── hw_gpio.h │ │ │ ├── hw_gprcm.h │ │ │ ├── hw_hib1p2.h │ │ │ ├── hw_hib3p3.h │ │ │ ├── hw_i2c.h │ │ │ ├── hw_ints.h │ │ │ ├── hw_mcasp.h │ │ │ ├── hw_mcspi.h │ │ │ ├── hw_memmap.h │ │ │ ├── hw_mmchs.h │ │ │ ├── hw_nvic.h │ │ │ ├── hw_ocp_shared.h │ │ │ ├── hw_shamd5.h │ │ │ ├── hw_stack_die_ctrl.h │ │ │ ├── hw_timer.h │ │ │ ├── hw_types.h │ │ │ ├── hw_uart.h │ │ │ ├── hw_udma.h │ │ │ └── hw_wdt.h │ │ ├── interrupt.c │ │ ├── interrupt.h │ │ ├── pin.c │ │ ├── pin.h │ │ ├── prcm.c │ │ ├── prcm.h │ │ ├── rom.h │ │ ├── rom_map.h │ │ ├── rom_patch.h │ │ ├── sdhost.c │ │ ├── sdhost.h │ │ ├── shamd5.c │ │ ├── shamd5.h │ │ ├── spi.c │ │ ├── spi.h │ │ ├── startup_gcc.c │ │ ├── systick.c │ │ ├── systick.h │ │ ├── timer.c │ │ ├── timer.h │ │ ├── uart.c │ │ ├── uart.h │ │ ├── utils.c │ │ ├── utils.h │ │ ├── wdt.c │ │ └── wdt.h │ ├── main.c │ ├── misc │ │ ├── FreeRTOSHooks.c │ │ ├── antenna.c │ │ ├── antenna.h │ │ ├── help.c │ │ ├── mperror.c │ │ ├── mperror.h │ │ ├── mpexception.c │ │ ├── mpexception.h │ │ ├── mpirq.c │ │ └── mpirq.h │ ├── mods │ │ ├── modmachine.c │ │ ├── modnetwork.c │ │ ├── modnetwork.h │ │ ├── modubinascii.c │ │ ├── modubinascii.h │ │ ├── moduhashlib.c │ │ ├── moduos.c │ │ ├── moduos.h │ │ ├── modusocket.c │ │ ├── modusocket.h │ │ ├── modussl.c │ │ ├── modutime.c │ │ ├── modwipy.c │ │ ├── modwlan.c │ │ ├── modwlan.h │ │ ├── pybadc.c │ │ ├── pybadc.h │ │ ├── pybflash.c │ │ ├── pybflash.h │ │ ├── pybi2c.c │ │ ├── pybi2c.h │ │ ├── pybpin.c │ │ ├── pybpin.h │ │ ├── pybrtc.c │ │ ├── pybrtc.h │ │ ├── pybsd.c │ │ ├── pybsd.h │ │ ├── pybsleep.c │ │ ├── pybsleep.h │ │ ├── pybspi.c │ │ ├── pybspi.h │ │ ├── pybtimer.c │ │ ├── pybtimer.h │ │ ├── pybuart.c │ │ ├── pybuart.h │ │ ├── pybwdt.c │ │ └── pybwdt.h │ ├── mpconfigport.h │ ├── mptask.c │ ├── mptask.h │ ├── mpthreadport.c │ ├── mpthreadport.h │ ├── qstrdefsport.h │ ├── serverstask.c │ ├── serverstask.h │ ├── simplelink │ │ ├── cc_pal.c │ │ ├── cc_pal.h │ │ ├── oslib │ │ │ ├── osi.h │ │ │ └── osi_freertos.c │ │ └── user.h │ ├── telnet │ │ ├── telnet.c │ │ └── telnet.h │ ├── tools │ │ ├── smoke.py │ │ ├── smoke.py.exp │ │ ├── uniflash.py │ │ └── update-wipy.py │ ├── util │ │ ├── cryptohash.c │ │ ├── cryptohash.h │ │ ├── fifo.c │ │ ├── fifo.h │ │ ├── gccollect.c │ │ ├── gccollect.h │ │ ├── gchelper.h │ │ ├── gchelper.s │ │ ├── random.c │ │ ├── random.h │ │ ├── sleeprestore.h │ │ ├── sleeprestore.s │ │ ├── socketfifo.c │ │ └── socketfifo.h │ └── version.h ├── esp32 │ ├── Makefile │ ├── README.md │ ├── README.ulp.md │ ├── esp32.custom_common.ld │ ├── esp32_ulp.c │ ├── espneopixel.c │ ├── esponewire.c │ ├── fatfs_port.c │ ├── gccollect.c │ ├── gccollect.h │ ├── help.c │ ├── machine_adc.c │ ├── machine_dac.c │ ├── machine_hw_spi.c │ ├── machine_pin.c │ ├── machine_pwm.c │ ├── machine_rtc.c │ ├── machine_rtc.h │ ├── machine_timer.c │ ├── machine_touchpad.c │ ├── machine_uart.c │ ├── machine_wdt.c │ ├── main.c │ ├── makeimg.py │ ├── memory.h │ ├── modesp.c │ ├── modesp.h │ ├── modesp32.c │ ├── modesp32.h │ ├── modmachine.c │ ├── modmachine.h │ ├── modnetwork.c │ ├── modnetwork.h │ ├── modsocket.c │ ├── moduhashlib.c │ ├── modules │ │ ├── _boot.py │ │ ├── apa106.py │ │ ├── dht.py │ │ ├── ds18x20.py │ │ ├── flashbdev.py │ │ ├── inisetup.py │ │ ├── neopixel.py │ │ ├── ntptime.py │ │ ├── onewire.py │ │ ├── upip.py │ │ ├── upip_utarfile.py │ │ ├── upysh.py │ │ ├── urequests.py │ │ ├── webrepl.py │ │ ├── webrepl_setup.py │ │ └── websocket_helper.py │ ├── moduos.c │ ├── modutime.c │ ├── mpconfigport.h │ ├── mphalport.c │ ├── mphalport.h │ ├── mpthreadport.c │ ├── mpthreadport.h │ ├── network_lan.c │ ├── partitions.csv │ ├── qstrdefsport.h │ ├── sdkconfig.h │ ├── uart.c │ └── uart.h ├── esp8266 │ ├── Makefile │ ├── README.md │ ├── eagle.rom.addr.v6.ld │ ├── esp8266.ld │ ├── esp8266_512k.ld │ ├── esp8266_common.ld │ ├── esp8266_ota.ld │ ├── esp_init_data.c │ ├── esp_mphal.c │ ├── esp_mphal.h │ ├── espapa102.c │ ├── espapa102.h │ ├── espneopixel.c │ ├── espneopixel.h │ ├── esppwm.c │ ├── esppwm.h │ ├── ets_alt_task.c │ ├── ets_alt_task.h │ ├── etshal.h │ ├── fatfs_port.c │ ├── gccollect.c │ ├── gccollect.h │ ├── gchelper.s │ ├── help.c │ ├── hspi.c │ ├── hspi.h │ ├── hspi_register.h │ ├── intr.c │ ├── lexerstr32.c │ ├── machine_adc.c │ ├── machine_hspi.c │ ├── machine_pin.c │ ├── machine_pwm.c │ ├── machine_rtc.c │ ├── machine_uart.c │ ├── machine_wdt.c │ ├── main.c │ ├── makeimg.py │ ├── modesp.c │ ├── modmachine.c │ ├── modmachine.h │ ├── modnetwork.c │ ├── modpyb.c │ ├── modules │ │ ├── _boot.py │ │ ├── apa102.py │ │ ├── dht.py │ │ ├── ds18x20.py │ │ ├── flashbdev.py │ │ ├── inisetup.py │ │ ├── neopixel.py │ │ ├── ntptime.py │ │ ├── onewire.py │ │ ├── port_diag.py │ │ ├── upip.py │ │ ├── upip_utarfile.py │ │ ├── webrepl.py │ │ ├── webrepl_setup.py │ │ └── websocket_helper.py │ ├── moduos.c │ ├── modutime.c │ ├── mpconfigport.h │ ├── mpconfigport_512k.h │ ├── posix_helpers.c │ ├── qstrdefsport.h │ ├── strtoll.c │ ├── uart.c │ ├── uart.h │ ├── uart_register.h │ ├── user_config.h │ └── xtirq.h ├── lofive │ ├── .gitignore │ ├── Makefile │ ├── README.md │ ├── main.c │ ├── mpconfigport.h │ ├── mphalport.h │ └── qstrdefsport.h ├── minimal │ ├── Makefile │ ├── README.md │ ├── frozentest.mpy │ ├── frozentest.py │ ├── main.c │ ├── mpconfigport.h │ ├── mphalport.h │ ├── qstrdefsport.h │ ├── stm32f405.ld │ └── uart_core.c ├── pic16bit │ ├── Makefile │ ├── board.c │ ├── board.h │ ├── main.c │ ├── modpyb.c │ ├── modpyb.h │ ├── modpybled.c │ ├── modpybswitch.c │ ├── mpconfigport.h │ ├── pic16bit_mphal.c │ ├── pic16bit_mphal.h │ ├── qstrdefsport.h │ └── unistd.h ├── picorv32 │ ├── .gitignore │ ├── Makefile │ ├── README.md │ ├── board.c │ ├── board.h │ ├── main.c │ ├── modpyb.c │ ├── modpyb.h │ ├── modpybled.c │ ├── mpconfigport.h │ ├── mphalport.h │ ├── qstrdefsport.h │ ├── rtl │ │ ├── ip_wrapper.v │ │ ├── micropython.pcf │ │ ├── micropython.v │ │ ├── picorv32.v │ │ ├── picosoc.v │ │ ├── simpleuart.v │ │ ├── spiflash.v │ │ ├── spimemio.v │ │ └── up_spram.v │ ├── sections.c │ ├── sections.lds │ └── start.s ├── qemu-arm │ ├── Makefile │ ├── Makefile.test │ ├── README.md │ ├── main.c │ ├── modmachine.c │ ├── moduos.c │ ├── mpconfigport.h │ ├── mphalport.h │ ├── qstrdefsport.h │ └── test_main.c ├── stm32 │ ├── .gitignore │ ├── Makefile │ ├── README.md │ ├── accel.c │ ├── accel.h │ ├── adc.c │ ├── adc.h │ ├── autoflash │ ├── boards │ │ ├── B_L475E_IOT01A │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32l4xx_hal_conf.h │ │ ├── CERB40 │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32f4xx_hal_conf.h │ │ ├── ESPRUINO_PICO │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32f4xx_hal_conf.h │ │ ├── HYDRABUS │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32f4xx_hal_conf.h │ │ ├── LIMIFROG │ │ │ ├── board_init.c │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32l4xx_hal_conf.h │ │ ├── NETDUINO_PLUS_2 │ │ │ ├── board_init.c │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32f4xx_hal_conf.h │ │ ├── NUCLEO_F091RC │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32f0xx_hal_conf.h │ │ ├── NUCLEO_F401RE │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32f4xx_hal_conf.h │ │ ├── NUCLEO_F411RE │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32f4xx_hal_conf.h │ │ ├── NUCLEO_F429ZI │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32f4xx_hal_conf.h │ │ ├── NUCLEO_F446RE │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32f4xx_hal_conf.h │ │ ├── NUCLEO_F746ZG │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32f7xx_hal_conf.h │ │ ├── NUCLEO_F767ZI │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32f7xx_hal_conf.h │ │ ├── NUCLEO_H743ZI │ │ │ ├── board_init.c │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32h7xx_hal_conf.h │ │ ├── NUCLEO_L476RG │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32l4xx_hal_conf.h │ │ ├── OLIMEX_E407 │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32f4xx_hal_conf.h │ │ ├── PYBLITEV10 │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32f4xx_hal_conf.h │ │ ├── PYBV10 │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32f4xx_hal_conf.h │ │ ├── PYBV11 │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32f4xx_hal_conf.h │ │ ├── PYBV3 │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32f4xx_hal_conf.h │ │ ├── PYBV4 │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32f4xx_hal_conf.h │ │ ├── STM32F411DISC │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32f4xx_hal_conf.h │ │ ├── STM32F429DISC │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32f4xx_hal_conf.h │ │ ├── STM32F439 │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32f4xx_hal_conf.h │ │ ├── STM32F4DISC │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ ├── staccel.py │ │ │ └── stm32f4xx_hal_conf.h │ │ ├── STM32F769DISC │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32f7xx_hal_conf.h │ │ ├── STM32F7DISC │ │ │ ├── board_init.c │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32f7xx_hal_conf.h │ │ ├── STM32L476DISC │ │ │ ├── bdev.c │ │ │ ├── board_init.c │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32l4xx_hal_conf.h │ │ ├── STM32L496GDISC │ │ │ ├── mpconfigboard.h │ │ │ ├── mpconfigboard.mk │ │ │ ├── pins.csv │ │ │ └── stm32l4xx_hal_conf.h │ │ ├── common_basic.ld │ │ ├── common_bl.ld │ │ ├── common_ifs.ld │ │ ├── make-pins.py │ │ ├── openocd_stm32f4.cfg │ │ ├── openocd_stm32f7.cfg │ │ ├── openocd_stm32l4.cfg │ │ ├── pllvalues.py │ │ ├── startup_stm32f0.s │ │ ├── startup_stm32f4.s │ │ ├── startup_stm32f7.s │ │ ├── startup_stm32h7.s │ │ ├── startup_stm32l4.s │ │ ├── stm32f091_af.csv │ │ ├── stm32f091xc.ld │ │ ├── stm32f401_af.csv │ │ ├── stm32f401xd.ld │ │ ├── stm32f401xe.ld │ │ ├── stm32f405.ld │ │ ├── stm32f405_af.csv │ │ ├── stm32f411.ld │ │ ├── stm32f411_af.csv │ │ ├── stm32f429.ld │ │ ├── stm32f429_af.csv │ │ ├── stm32f439.ld │ │ ├── stm32f439_af.csv │ │ ├── stm32f4xx_prefix.c │ │ ├── stm32f746.ld │ │ ├── stm32f746_af.csv │ │ ├── stm32f767.ld │ │ ├── stm32f767_af.csv │ │ ├── stm32f769.ld │ │ ├── stm32h743.ld │ │ ├── stm32h743_af.csv │ │ ├── stm32l476_af.csv │ │ ├── stm32l476xe.ld │ │ ├── stm32l476xg.ld │ │ ├── stm32l496_af.csv │ │ └── stm32l496xg.ld │ ├── bufhelper.c │ ├── bufhelper.h │ ├── can.c │ ├── can.h │ ├── dac.c │ ├── dac.h │ ├── dma.c │ ├── dma.h │ ├── extint.c │ ├── extint.h │ ├── fatfs_port.c │ ├── flash.c │ ├── flash.h │ ├── flashbdev.c │ ├── font_petme128_8x8.h │ ├── gccollect.c │ ├── gccollect.h │ ├── gchelper.s │ ├── gchelper_m0.s │ ├── help.c │ ├── i2c.c │ ├── i2c.h │ ├── i2cslave.c │ ├── i2cslave.h │ ├── irq.c │ ├── irq.h │ ├── lcd.c │ ├── lcd.h │ ├── led.c │ ├── led.h │ ├── lwip_inc │ │ ├── arch │ │ │ ├── cc.h │ │ │ └── sys_arch.h │ │ └── lwipopts.h │ ├── machine_i2c.c │ ├── main.c │ ├── make-stmconst.py │ ├── mboot │ │ ├── Makefile │ │ ├── README.md │ │ ├── main.c │ │ ├── mboot.py │ │ ├── mphalport.h │ │ └── stm32_generic.ld │ ├── modmachine.c │ ├── modmachine.h │ ├── modnetwork.c │ ├── modnetwork.h │ ├── modnwcc3k.c │ ├── modnwwiznet5k.c │ ├── modpyb.c │ ├── modstm.c │ ├── modules │ │ ├── dht.py │ │ ├── lcd160cr.py │ │ ├── lcd160cr_test.py │ │ └── onewire.py │ ├── moduos.c │ ├── modusocket.c │ ├── modutime.c │ ├── mpconfigboard_common.h │ ├── mpconfigport.h │ ├── mpconfigport.mk │ ├── mphalport.c │ ├── mphalport.h │ ├── mpthreadport.c │ ├── mpthreadport.h │ ├── pendsv.c │ ├── pendsv.h │ ├── pin.c │ ├── pin.h │ ├── pin_defs_stm32.c │ ├── pin_defs_stm32.h │ ├── pin_named_pins.c │ ├── portmodules.h │ ├── pyb_i2c.c │ ├── pybcdc.inf_template │ ├── pybthread.c │ ├── pybthread.h │ ├── qspi.c │ ├── qspi.h │ ├── qstrdefsport.h │ ├── resethandler.s │ ├── resethandler_m0.s │ ├── rng.c │ ├── rng.h │ ├── rtc.c │ ├── rtc.h │ ├── sdcard.c │ ├── sdcard.h │ ├── servo.c │ ├── servo.h │ ├── spi.c │ ├── spi.h │ ├── spibdev.c │ ├── stm32_it.c │ ├── stm32_it.h │ ├── storage.c │ ├── storage.h │ ├── system_stm32.c │ ├── system_stm32f0.c │ ├── systick.c │ ├── systick.h │ ├── timer.c │ ├── timer.h │ ├── uart.c │ ├── uart.h │ ├── usb.c │ ├── usb.h │ ├── usbd_cdc_interface.c │ ├── usbd_cdc_interface.h │ ├── usbd_conf.c │ ├── usbd_conf.h │ ├── usbd_desc.c │ ├── usbd_desc.h │ ├── usbd_hid_interface.c │ ├── usbd_hid_interface.h │ ├── usbd_msc_storage.c │ ├── usbd_msc_storage.h │ ├── usbdev │ │ ├── class │ │ │ ├── inc │ │ │ │ ├── usbd_cdc_msc_hid.h │ │ │ │ ├── usbd_cdc_msc_hid0.h │ │ │ │ ├── usbd_msc_bot.h │ │ │ │ ├── usbd_msc_data.h │ │ │ │ └── usbd_msc_scsi.h │ │ │ └── src │ │ │ │ ├── usbd_cdc_msc_hid.c │ │ │ │ ├── usbd_msc_bot.c │ │ │ │ ├── usbd_msc_data.c │ │ │ │ └── usbd_msc_scsi.c │ │ └── core │ │ │ ├── inc │ │ │ ├── usbd_core.h │ │ │ ├── usbd_ctlreq.h │ │ │ ├── usbd_def.h │ │ │ └── usbd_ioreq.h │ │ │ └── src │ │ │ ├── usbd_core.c │ │ │ ├── usbd_ctlreq.c │ │ │ └── usbd_ioreq.c │ ├── usbhost │ │ ├── Class │ │ │ ├── AUDIO │ │ │ │ ├── Inc │ │ │ │ │ └── usbh_audio.h │ │ │ │ └── Src │ │ │ │ │ └── usbh_audio.c │ │ │ ├── CDC │ │ │ │ ├── Inc │ │ │ │ │ └── usbh_cdc.h │ │ │ │ └── Src │ │ │ │ │ └── usbh_cdc.c │ │ │ ├── HID │ │ │ │ ├── Inc │ │ │ │ │ ├── usbh_hid.h │ │ │ │ │ ├── usbh_hid_keybd.h │ │ │ │ │ ├── usbh_hid_mouse.h │ │ │ │ │ ├── usbh_hid_parser.h │ │ │ │ │ └── usbh_hid_usage.h │ │ │ │ └── Src │ │ │ │ │ ├── usbh_hid.c │ │ │ │ │ ├── usbh_hid_keybd.c │ │ │ │ │ ├── usbh_hid_mouse.c │ │ │ │ │ └── usbh_hid_parser.c │ │ │ ├── MSC │ │ │ │ ├── Inc │ │ │ │ │ ├── usbh_msc.h │ │ │ │ │ ├── usbh_msc_bot.h │ │ │ │ │ └── usbh_msc_scsi.h │ │ │ │ └── Src │ │ │ │ │ ├── usbh_msc.c │ │ │ │ │ ├── usbh_msc_bot.c │ │ │ │ │ └── usbh_msc_scsi.c │ │ │ ├── MTP │ │ │ │ ├── Inc │ │ │ │ │ ├── usbh_mtp.h │ │ │ │ │ └── usbh_mtp_ptp.h │ │ │ │ └── Src │ │ │ │ │ ├── usbh_mtp.c │ │ │ │ │ └── usbh_mtp_ptp.c │ │ │ └── Template │ │ │ │ ├── Inc │ │ │ │ └── usbh_template.h │ │ │ │ └── Src │ │ │ │ └── usbh_template.c │ │ └── Core │ │ │ ├── Inc │ │ │ ├── usbh_conf_template.h │ │ │ ├── usbh_core.h │ │ │ ├── usbh_ctlreq.h │ │ │ ├── usbh_def.h │ │ │ ├── usbh_ioreq.h │ │ │ └── usbh_pipes.h │ │ │ └── Src │ │ │ ├── usbh_conf_template.c │ │ │ ├── usbh_core.c │ │ │ ├── usbh_ctlreq.c │ │ │ ├── usbh_ioreq.c │ │ │ └── usbh_pipes.c │ ├── usrsw.c │ ├── usrsw.h │ ├── wdt.c │ └── wdt.h ├── teensy │ ├── Makefile │ ├── README.md │ ├── add-memzip.sh │ ├── core │ │ ├── Arduino.h │ │ ├── HardwareSerial.h │ │ ├── analog.c │ │ ├── avr_functions.h │ │ ├── core_pins.h │ │ ├── mk20dx128.c │ │ ├── mk20dx128.h │ │ ├── pins_arduino.h │ │ ├── pins_teensy.c │ │ ├── usb_desc.c │ │ ├── usb_desc.h │ │ ├── usb_dev.c │ │ ├── usb_dev.h │ │ ├── usb_mem.c │ │ ├── usb_mem.h │ │ ├── usb_names.h │ │ ├── usb_serial.c │ │ ├── usb_serial.h │ │ └── yield.c │ ├── hal_ftm.c │ ├── hal_ftm.h │ ├── hal_gpio.c │ ├── help.c │ ├── lcd.c │ ├── led.c │ ├── led.h │ ├── lexerfrozen.c │ ├── lexermemzip.h │ ├── main.c │ ├── make-pins.py │ ├── memzip_files │ │ ├── boot.py │ │ └── main.py │ ├── mk20dx256.ld │ ├── mk20dx256_af.csv │ ├── mk20dx256_prefix.c │ ├── modpyb.c │ ├── mpconfigport.h │ ├── pin_defs_teensy.c │ ├── pin_defs_teensy.h │ ├── qstrdefsport.h │ ├── reg.c │ ├── reg.h │ ├── servo.c │ ├── servo.h │ ├── std.h │ ├── teensy_hal.c │ ├── teensy_hal.h │ ├── teensy_pins.csv │ ├── timer.c │ ├── timer.h │ ├── uart.c │ ├── usb.c │ └── usb.h ├── tinyfpga │ ├── .gitignore │ ├── Makefile │ ├── README.md │ ├── main.c │ ├── mpconfigport.h │ ├── mphalport.h │ ├── qstrdefsport.h │ ├── rtl │ │ ├── micropython.pcf │ │ ├── micropython.v │ │ ├── picorv32.v │ │ ├── picosoc.v │ │ ├── simpleuart.v │ │ ├── spiflash.v │ │ └── spimemio.v │ ├── sections.lds │ └── start.s ├── unix │ ├── .gitignore │ ├── Makefile │ ├── alloc.c │ ├── coverage-frzmpy │ │ ├── frzmpy1.py │ │ ├── frzmpy2.py │ │ ├── frzmpy_pkg1 │ │ │ └── __init__.py │ │ └── frzmpy_pkg2 │ │ │ └── mod.py │ ├── coverage-frzstr │ │ ├── frzstr1.py │ │ ├── frzstr_pkg1 │ │ │ └── __init__.py │ │ └── frzstr_pkg2 │ │ │ └── mod.py │ ├── coverage.c │ ├── fatfs_port.c │ ├── fdfile.h │ ├── file.c │ ├── gccollect.c │ ├── input.c │ ├── input.h │ ├── main.c │ ├── modffi.c │ ├── modjni.c │ ├── modmachine.c │ ├── modos.c │ ├── modtermios.c │ ├── modtime.c │ ├── modules │ │ ├── upip.py │ │ └── upip_utarfile.py │ ├── moduos_vfs.c │ ├── moduselect.c │ ├── modusocket.c │ ├── mpconfigport.h │ ├── mpconfigport.mk │ ├── mpconfigport_coverage.h │ ├── mpconfigport_fast.h │ ├── mpconfigport_freedos.h │ ├── mpconfigport_minimal.h │ ├── mpconfigport_nanbox.h │ ├── mphalport.h │ ├── mpthreadport.c │ ├── mpthreadport.h │ ├── qstrdefsport.h │ └── unix_mphal.c ├── windows │ ├── .appveyor.yml │ ├── .gitignore │ ├── Makefile │ ├── README.md │ ├── fmode.c │ ├── fmode.h │ ├── init.c │ ├── init.h │ ├── micropython.vcxproj │ ├── mpconfigport.h │ ├── mpconfigport.mk │ ├── msvc │ │ ├── common.props │ │ ├── debug.props │ │ ├── dirent.c │ │ ├── dirent.h │ │ ├── genhdr.targets │ │ ├── gettimeofday.c │ │ ├── paths.props │ │ ├── release.props │ │ ├── sources.props │ │ ├── sys │ │ │ └── time.h │ │ └── unistd.h │ ├── realpath.c │ ├── realpath.h │ ├── sleep.c │ ├── sleep.h │ ├── windows_mphal.c │ └── windows_mphal.h └── zephyr │ ├── .gitignore │ ├── CMakeLists.txt │ ├── Kbuild │ ├── Makefile │ ├── Makefile.zephyr │ ├── README.md │ ├── help.c │ ├── machine_pin.c │ ├── main.c │ ├── make-bin-testsuite │ ├── make-minimal │ ├── makeprj.py │ ├── modmachine.c │ ├── modmachine.h │ ├── modusocket.c │ ├── modutime.c │ ├── modzephyr.c │ ├── modzsensor.c │ ├── mpconfigport.h │ ├── mpconfigport_bin_testsuite.h │ ├── mpconfigport_minimal.h │ ├── mphalport.h │ ├── prj_96b_carbon.conf │ ├── prj_base.conf │ ├── prj_disco_l475_iot1.conf │ ├── prj_frdm_k64f.conf │ ├── prj_minimal.conf │ ├── prj_qemu_cortex_m3.conf │ ├── prj_qemu_x86.conf │ ├── src │ ├── Makefile │ ├── zephyr_getchar.c │ ├── zephyr_getchar.h │ └── zephyr_start.c │ ├── uart_core.c │ └── z_config.mk ├── py ├── argcheck.c ├── asmarm.c ├── asmarm.h ├── asmbase.c ├── asmbase.h ├── asmthumb.c ├── asmthumb.h ├── asmx64.c ├── asmx64.h ├── asmx86.c ├── asmx86.h ├── asmxtensa.c ├── asmxtensa.h ├── bc.c ├── bc.h ├── bc0.h ├── binary.c ├── binary.h ├── builtin.h ├── builtinevex.c ├── builtinhelp.c ├── builtinimport.c ├── compile.c ├── compile.h ├── emit.h ├── emitbc.c ├── emitcommon.c ├── emitglue.c ├── emitglue.h ├── emitinlinethumb.c ├── emitinlinextensa.c ├── emitnarm.c ├── emitnative.c ├── emitnthumb.c ├── emitnx64.c ├── emitnx86.c ├── emitnxtensa.c ├── formatfloat.c ├── formatfloat.h ├── frozenmod.c ├── frozenmod.h ├── gc.c ├── gc.h ├── grammar.h ├── lexer.c ├── lexer.h ├── makeqstrdata.py ├── makeqstrdefs.py ├── makeversionhdr.py ├── malloc.c ├── map.c ├── misc.h ├── mkenv.mk ├── mkrules.mk ├── modarray.c ├── modbuiltins.c ├── modcmath.c ├── modcollections.c ├── modgc.c ├── modio.c ├── modmath.c ├── modmicropython.c ├── modstruct.c ├── modsys.c ├── modthread.c ├── moduerrno.c ├── mpconfig.h ├── mperrno.h ├── mphal.h ├── mpprint.c ├── mpprint.h ├── mpstate.c ├── mpstate.h ├── mpthread.h ├── mpz.c ├── mpz.h ├── nativeglue.c ├── nlr.c ├── nlr.h ├── nlrsetjmp.c ├── nlrthumb.c ├── nlrx64.c ├── nlrx86.c ├── nlrxtensa.c ├── obj.c ├── obj.h ├── objarray.c ├── objarray.h ├── objattrtuple.c ├── objbool.c ├── objboundmeth.c ├── objcell.c ├── objclosure.c ├── objcomplex.c ├── objdeque.c ├── objdict.c ├── objenumerate.c ├── objexcept.c ├── objexcept.h ├── objfilter.c ├── objfloat.c ├── objfun.c ├── objfun.h ├── objgenerator.c ├── objgenerator.h ├── objgetitemiter.c ├── objint.c ├── objint.h ├── objint_longlong.c ├── objint_mpz.c ├── objlist.c ├── objlist.h ├── objmap.c ├── objmodule.c ├── objmodule.h ├── objnamedtuple.c ├── objnamedtuple.h ├── objnone.c ├── objobject.c ├── objpolyiter.c ├── objproperty.c ├── objrange.c ├── objreversed.c ├── objset.c ├── objsingleton.c ├── objslice.c ├── objstr.c ├── objstr.h ├── objstringio.c ├── objstringio.h ├── objstrunicode.c ├── objtuple.c ├── objtuple.h ├── objtype.c ├── objtype.h ├── objzip.c ├── opmethods.c ├── parse.c ├── parse.h ├── parsenum.c ├── parsenum.h ├── parsenumbase.c ├── parsenumbase.h ├── persistentcode.c ├── persistentcode.h ├── py.mk ├── pystack.c ├── pystack.h ├── qstr.c ├── qstr.h ├── qstrdefs.h ├── reader.c ├── reader.h ├── repl.c ├── repl.h ├── ringbuf.h ├── runtime.c ├── runtime.h ├── runtime0.h ├── runtime_utils.c ├── scheduler.c ├── scope.c ├── scope.h ├── sequence.c ├── showbc.c ├── smallint.c ├── smallint.h ├── stackctrl.c ├── stackctrl.h ├── stream.c ├── stream.h ├── unicode.c ├── unicode.h ├── vm.c ├── vmentrytable.h ├── vstr.c └── warning.c ├── tests ├── README ├── basics │ ├── 0prelim.py │ ├── andor.py │ ├── array1.py │ ├── array_add.py │ ├── array_construct.py │ ├── array_construct2.py │ ├── array_construct_endian.py │ ├── array_intbig.py │ ├── array_micropython.py │ ├── array_micropython.py.exp │ ├── assign1.py │ ├── async_await.py │ ├── async_await.py.exp │ ├── async_await2.py │ ├── async_await2.py.exp │ ├── async_def.py │ ├── async_def.py.exp │ ├── async_for.py │ ├── async_for.py.exp │ ├── async_for2.py │ ├── async_for2.py.exp │ ├── async_with.py │ ├── async_with.py.exp │ ├── async_with2.py │ ├── async_with2.py.exp │ ├── attrtuple1.py │ ├── bool1.py │ ├── boundmeth1.py │ ├── break.py │ ├── builtin_abs.py │ ├── builtin_abs_intbig.py │ ├── builtin_allany.py │ ├── builtin_bin.py │ ├── builtin_bin_intbig.py │ ├── builtin_callable.py │ ├── builtin_chr.py │ ├── builtin_compile.py │ ├── builtin_delattr.py │ ├── builtin_dir.py │ ├── builtin_divmod.py │ ├── builtin_divmod_intbig.py │ ├── builtin_ellipsis.py │ ├── builtin_enumerate.py │ ├── builtin_eval.py │ ├── builtin_eval_error.py │ ├── builtin_exec.py │ ├── builtin_filter.py │ ├── builtin_getattr.py │ ├── builtin_hasattr.py │ ├── builtin_hash.py │ ├── builtin_hash_gen.py │ ├── builtin_hash_intbig.py │ ├── builtin_help.py │ ├── builtin_help.py.exp │ ├── builtin_hex.py │ ├── builtin_hex_intbig.py │ ├── builtin_id.py │ ├── builtin_issubclass.py │ ├── builtin_len1.py │ ├── builtin_locals.py │ ├── builtin_map.py │ ├── builtin_minmax.py │ ├── builtin_oct.py │ ├── builtin_oct_intbig.py │ ├── builtin_ord.py │ ├── builtin_override.py │ ├── builtin_pow.py │ ├── builtin_pow3.py │ ├── builtin_pow3_intbig.py │ ├── builtin_print.py │ ├── builtin_property.py │ ├── builtin_range.py │ ├── builtin_range_attrs.py │ ├── builtin_range_binop.py │ ├── builtin_reversed.py │ ├── builtin_round.py │ ├── builtin_round_int.py │ ├── builtin_round_intbig.py │ ├── builtin_setattr.py │ ├── builtin_slice.py │ ├── builtin_sorted.py │ ├── builtin_sum.py │ ├── builtin_type.py │ ├── builtin_zip.py │ ├── bytearray1.py │ ├── bytearray_add.py │ ├── bytearray_append.py │ ├── bytearray_construct.py │ ├── bytearray_construct_array.py │ ├── bytearray_construct_endian.py │ ├── bytearray_intbig.py │ ├── bytearray_slice_assign.py │ ├── bytes.py │ ├── bytes_add.py │ ├── bytes_add_array.py │ ├── bytes_add_endian.py │ ├── bytes_compare.py │ ├── bytes_compare2.py │ ├── bytes_compare3.py │ ├── bytes_compare3.py.exp │ ├── bytes_compare_array.py │ ├── bytes_construct.py │ ├── bytes_construct_array.py │ ├── bytes_construct_endian.py │ ├── bytes_construct_intbig.py │ ├── bytes_count.py │ ├── bytes_find.py │ ├── bytes_format_modulo.py │ ├── bytes_format_modulo.py.exp │ ├── bytes_gen.py │ ├── bytes_large.py │ ├── bytes_mult.py │ ├── bytes_partition.py │ ├── bytes_replace.py │ ├── bytes_split.py │ ├── bytes_strip.py │ ├── bytes_subscr.py │ ├── class1.py │ ├── class2.py │ ├── class3.py │ ├── class_bind_self.py │ ├── class_binop.py │ ├── class_call.py │ ├── class_contains.py │ ├── class_delattr_setattr.py │ ├── class_descriptor.py │ ├── class_emptybases.py │ ├── class_getattr.py │ ├── class_inherit1.py │ ├── class_inherit_mul.py │ ├── class_inplace_op.py │ ├── class_instance_override.py │ ├── class_item.py │ ├── class_misc.py │ ├── class_new.py │ ├── class_notimpl.py │ ├── class_number.py │ ├── class_reverse_op.py │ ├── class_staticclassmethod.py │ ├── class_store.py │ ├── class_store_class.py │ ├── class_str.py │ ├── class_super.py │ ├── class_super_aslocal.py │ ├── class_super_closure.py │ ├── class_super_multinherit.py │ ├── class_super_object.py │ ├── class_use_other.py │ ├── closure1.py │ ├── closure2.py │ ├── closure_defargs.py │ ├── closure_manyvars.py │ ├── closure_namedarg.py │ ├── compare_multi.py │ ├── comprehension1.py │ ├── containment.py │ ├── continue.py │ ├── decorator.py │ ├── del_attr.py │ ├── del_deref.py │ ├── del_global.py │ ├── del_local.py │ ├── del_name.py │ ├── del_subscr.py │ ├── deque1.py │ ├── deque2.py │ ├── deque2.py.exp │ ├── dict1.py │ ├── dict2.py │ ├── dict_clear.py │ ├── dict_construct.py │ ├── dict_copy.py │ ├── dict_del.py │ ├── dict_fixed.py │ ├── dict_fixed.py.exp │ ├── dict_from_iter.py │ ├── dict_fromkeys.py │ ├── dict_fromkeys2.py │ ├── dict_get.py │ ├── dict_intern.py │ ├── dict_iterator.py │ ├── dict_pop.py │ ├── dict_popitem.py │ ├── dict_setdefault.py │ ├── dict_specialmeth.py │ ├── dict_update.py │ ├── dict_views.py │ ├── equal.py │ ├── equal_class.py │ ├── errno1.py │ ├── errno1.py.exp │ ├── except_match_tuple.py │ ├── exception1.py │ ├── exception_chain.py │ ├── exception_chain.py.exp │ ├── exceptpoly.py │ ├── exceptpoly2.py │ ├── floordivide.py │ ├── floordivide_intbig.py │ ├── for1.py │ ├── for2.py │ ├── for3.py │ ├── for_break.py │ ├── for_else.py │ ├── for_range.py │ ├── for_return.py │ ├── frozenset1.py │ ├── frozenset_add.py │ ├── frozenset_binop.py │ ├── frozenset_copy.py │ ├── frozenset_difference.py │ ├── frozenset_set.py │ ├── fun1.py │ ├── fun2.py │ ├── fun3.py │ ├── fun_annotations.py │ ├── fun_calldblstar.py │ ├── fun_calldblstar2.py │ ├── fun_calldblstar3.py │ ├── fun_callstar.py │ ├── fun_callstardblstar.py │ ├── fun_defargs.py │ ├── fun_defargs2.py │ ├── fun_error.py │ ├── fun_error2.py │ ├── fun_kwargs.py │ ├── fun_kwonly.py │ ├── fun_kwonlydef.py │ ├── fun_kwvarargs.py │ ├── fun_largestate.py │ ├── fun_name.py │ ├── fun_str.py │ ├── fun_varargs.py │ ├── gc1.py │ ├── gen_yield_from.py │ ├── gen_yield_from_close.py │ ├── gen_yield_from_ducktype.py │ ├── gen_yield_from_exc.py │ ├── gen_yield_from_executing.py │ ├── gen_yield_from_iter.py │ ├── gen_yield_from_send.py │ ├── gen_yield_from_stopped.py │ ├── gen_yield_from_throw.py │ ├── gen_yield_from_throw2.py │ ├── gen_yield_from_throw3.py │ ├── generator1.py │ ├── generator2.py │ ├── generator_args.py │ ├── generator_close.py │ ├── generator_closure.py │ ├── generator_exc.py │ ├── generator_pend_throw.py │ ├── generator_pend_throw.py.exp │ ├── generator_return.py │ ├── generator_send.py │ ├── getattr.py │ ├── getitem.py │ ├── globals_del.py │ ├── ifcond.py │ ├── ifexpr.py │ ├── int1.py │ ├── int2.py │ ├── int_big1.py │ ├── int_big_add.py │ ├── int_big_and.py │ ├── int_big_and2.py │ ├── int_big_and3.py │ ├── int_big_cmp.py │ ├── int_big_div.py │ ├── int_big_error.py │ ├── int_big_lshift.py │ ├── int_big_mod.py │ ├── int_big_mul.py │ ├── int_big_or.py │ ├── int_big_or2.py │ ├── int_big_or3.py │ ├── int_big_pow.py │ ├── int_big_rshift.py │ ├── int_big_unary.py │ ├── int_big_xor.py │ ├── int_big_xor2.py │ ├── int_big_xor3.py │ ├── int_big_zeroone.py │ ├── int_bytes.py │ ├── int_bytes_intbig.py │ ├── int_constfolding.py │ ├── int_constfolding_intbig.py │ ├── int_divmod.py │ ├── int_divmod_intbig.py │ ├── int_divzero.py │ ├── int_intbig.py │ ├── int_small.py │ ├── is_isnot.py │ ├── iter0.py │ ├── iter1.py │ ├── iter2.py │ ├── iter_of_iter.py │ ├── lambda1.py │ ├── lambda_defargs.py │ ├── lexer.py │ ├── list1.py │ ├── list_clear.py │ ├── list_compare.py │ ├── list_copy.py │ ├── list_count.py │ ├── list_extend.py │ ├── list_index.py │ ├── list_insert.py │ ├── list_mult.py │ ├── list_pop.py │ ├── list_remove.py │ ├── list_reverse.py │ ├── list_slice.py │ ├── list_slice_3arg.py │ ├── list_slice_assign.py │ ├── list_slice_assign_grow.py │ ├── list_sort.py │ ├── list_sum.py │ ├── logic_constfolding.py │ ├── memoryerror.py │ ├── memoryerror.py.exp │ ├── memoryview1.py │ ├── memoryview2.py │ ├── memoryview_gc.py │ ├── memoryview_intbig.py │ ├── module1.py │ ├── module2.py │ ├── module2.py.exp │ ├── namedtuple1.py │ ├── namedtuple_asdict.py │ ├── object1.py │ ├── object_dict.py │ ├── object_new.py │ ├── op_error.py │ ├── op_error_intbig.py │ ├── op_error_memoryview.py │ ├── op_precedence.py │ ├── ordereddict1.py │ ├── ordereddict_eq.py │ ├── ordereddict_eq.py.exp │ ├── parser.py │ ├── python34.py │ ├── python34.py.exp │ ├── return1.py │ ├── scope.py │ ├── self_type_check.py │ ├── seq_unpack.py │ ├── set_add.py │ ├── set_basic.py │ ├── set_binop.py │ ├── set_clear.py │ ├── set_comprehension.py │ ├── set_containment.py │ ├── set_copy.py │ ├── set_difference.py │ ├── set_discard.py │ ├── set_intersection.py │ ├── set_isdisjoint.py │ ├── set_isfooset.py │ ├── set_iter.py │ ├── set_iter_of_iter.py │ ├── set_pop.py │ ├── set_remove.py │ ├── set_specialmeth.py │ ├── set_symmetric_difference.py │ ├── set_type.py │ ├── set_union.py │ ├── set_unop.py │ ├── set_update.py │ ├── slice_attrs.py │ ├── slice_intbig.py │ ├── slots_bool_len.py │ ├── special_methods.py │ ├── special_methods2.py │ ├── string1.py │ ├── string_center.py │ ├── string_compare.py │ ├── string_count.py │ ├── string_cr_conversion.py │ ├── string_crlf_conversion.py │ ├── string_endswith.py │ ├── string_endswith_upy.py │ ├── string_endswith_upy.py.exp │ ├── string_escape.py │ ├── string_find.py │ ├── string_format.py │ ├── string_format2.py │ ├── string_format_error.py │ ├── string_format_modulo.py │ ├── string_format_modulo_int.py │ ├── string_index.py │ ├── string_istest.py │ ├── string_join.py │ ├── string_large.py │ ├── string_mult.py │ ├── string_partition.py │ ├── string_replace.py │ ├── string_repr.py │ ├── string_rfind.py │ ├── string_rindex.py │ ├── string_rpartition.py │ ├── string_rsplit.py │ ├── string_slice.py │ ├── string_split.py │ ├── string_splitlines.py │ ├── string_startswith.py │ ├── string_startswith_upy.py │ ├── string_startswith_upy.py.exp │ ├── string_strip.py │ ├── string_upperlow.py │ ├── struct1.py │ ├── struct1_intbig.py │ ├── struct2.py │ ├── struct_micropython.py │ ├── struct_micropython.py.exp │ ├── subclass_classmethod.py │ ├── subclass_native1.py │ ├── subclass_native2_list.py │ ├── subclass_native2_tuple.py │ ├── subclass_native3.py │ ├── subclass_native4.py │ ├── subclass_native5.py │ ├── subclass_native_buffer.py │ ├── subclass_native_call.py │ ├── subclass_native_call.py.exp │ ├── subclass_native_cmp.py │ ├── subclass_native_containment.py │ ├── subclass_native_init.py │ ├── subclass_native_iter.py │ ├── subclass_native_specmeth.py │ ├── syntaxerror.py │ ├── sys1.py │ ├── sys_getsizeof.py │ ├── true_value.py │ ├── try1.py │ ├── try2.py │ ├── try3.py │ ├── try4.py │ ├── try_as_var.py │ ├── try_continue.py │ ├── try_error.py │ ├── try_finally1.py │ ├── try_finally2.py │ ├── try_finally_loops.py │ ├── try_finally_return.py │ ├── try_finally_return2.py │ ├── try_reraise.py │ ├── try_reraise2.py │ ├── try_return.py │ ├── tuple1.py │ ├── tuple_compare.py │ ├── tuple_count.py │ ├── tuple_index.py │ ├── tuple_mult.py │ ├── types1.py │ ├── types2.py │ ├── unary_op.py │ ├── unboundlocal.py │ ├── unpack1.py │ ├── while1.py │ ├── while_cond.py │ ├── while_nest_exc.py │ ├── with1.py │ ├── with_break.py │ ├── with_continue.py │ └── with_return.py ├── bench │ ├── arrayop-1-list_inplace.py │ ├── arrayop-2-list_map.py │ ├── arrayop-3-bytearray_inplace.py │ ├── arrayop-4-bytearray_map.py │ ├── bench.py │ ├── bytealloc-1-bytes_n.py │ ├── bytealloc-2-repeat.py │ ├── bytebuf-1-inplace.py │ ├── bytebuf-2-join_map_bytes.py │ ├── bytebuf-3-bytarray_map.py │ ├── from_iter-1-list_bound.py │ ├── from_iter-2-list_unbound.py │ ├── from_iter-3-tuple_bound.py │ ├── from_iter-4-tuple_unbound.py │ ├── from_iter-5-bytes_bound.py │ ├── from_iter-6-bytes_unbound.py │ ├── from_iter-7-bytearray_bound.py │ ├── from_iter-8-bytearray_unbound.py │ ├── func_args-1.1-pos_1.py │ ├── func_args-1.2-pos_3.py │ ├── func_args-2-pos_default_2_of_3.py │ ├── func_args-3.1-kw_1.py │ ├── func_args-3.2-kw_3.py │ ├── func_builtin-1-enum_pos.py │ ├── func_builtin-2-enum_kw.py │ ├── funcall-1-inline.py │ ├── funcall-2-funcall.py │ ├── funcall-3-funcall-local.py │ ├── loop_count-1-range.py │ ├── loop_count-2-range_iter.py │ ├── loop_count-3-while_up.py │ ├── loop_count-4-while_down_gt.py │ ├── loop_count-5-while_down_ne.py │ ├── loop_count-5.1-while_down_ne_localvar.py │ ├── var-1-constant.py │ ├── var-2-global.py │ ├── var-3-local.py │ ├── var-4-arg.py │ ├── var-5-class-attr.py │ ├── var-6-instance-attr.py │ ├── var-6.1-instance-attr-5.py │ ├── var-7-instance-meth.py │ ├── var-8-namedtuple-1st.py │ └── var-8.1-namedtuple-5th.py ├── cmdline │ ├── cmd_optimise.py │ ├── cmd_optimise.py.exp │ ├── cmd_parsetree.py │ ├── cmd_parsetree.py.exp │ ├── cmd_showbc.py │ ├── cmd_showbc.py.exp │ ├── cmd_verbose.py │ ├── cmd_verbose.py.exp │ ├── repl_autocomplete.py │ ├── repl_autocomplete.py.exp │ ├── repl_basic.py │ ├── repl_basic.py.exp │ ├── repl_cont.py │ ├── repl_cont.py.exp │ ├── repl_emacs_keys.py │ └── repl_emacs_keys.py.exp ├── cpydiff │ ├── builtin_next_arg2.py │ ├── core_class_delnotimpl.py │ ├── core_class_mro.py │ ├── core_class_supermultiple.py │ ├── core_class_superproperty.py │ ├── core_function_argcount.py │ ├── core_function_userattr.py │ ├── core_generator_noexit.py │ ├── core_import_path.py │ ├── core_import_prereg.py │ ├── core_import_split_ns_pkgs.py │ ├── core_locals.py │ ├── core_locals_eval.py │ ├── modules │ │ ├── __init__.py │ │ ├── foo.py │ │ └── subpkg │ │ │ └── foo.py │ ├── modules2 │ │ └── subpkg │ │ │ └── bar.py │ ├── modules_array_containment.py │ ├── modules_array_deletion.py │ ├── modules_array_subscrstep.py │ ├── modules_deque.py │ ├── modules_json_nonserializable.py │ ├── modules_struct_fewargs.py │ ├── modules_struct_manyargs.py │ ├── modules_sys_stdassign.py │ ├── syntax_spaces.py │ ├── syntax_unicode_nameesc.py │ ├── types_bytearray_sliceassign.py │ ├── types_bytes_keywords.py │ ├── types_bytes_subscrstep.py │ ├── types_exception_chaining.py │ ├── types_exception_instancevar.py │ ├── types_exception_loops.py │ ├── types_exception_subclassinit.py │ ├── types_float_rounding.py │ ├── types_int_subclassconv.py │ ├── types_list_delete_subscrstep.py │ ├── types_list_store_noniter.py │ ├── types_list_store_subscrstep.py │ ├── types_str_endswith.py │ ├── types_str_formatsubscr.py │ ├── types_str_keywords.py │ ├── types_str_ljust_rjust.py │ ├── types_str_rsplitnone.py │ ├── types_str_subclassequality.py │ ├── types_str_subscrstep.py │ └── types_tuple_subscrstep.py ├── extmod │ ├── btree1.py │ ├── btree1.py.exp │ ├── framebuf1.py │ ├── framebuf1.py.exp │ ├── framebuf16.py │ ├── framebuf16.py.exp │ ├── framebuf2.py │ ├── framebuf2.py.exp │ ├── framebuf4.py │ ├── framebuf4.py.exp │ ├── framebuf8.py │ ├── framebuf8.py.exp │ ├── framebuf_subclass.py │ ├── framebuf_subclass.py.exp │ ├── machine1.py │ ├── machine1.py.exp │ ├── machine_pinbase.py │ ├── machine_pinbase.py.exp │ ├── machine_pulse.py │ ├── machine_pulse.py.exp │ ├── machine_signal.py │ ├── machine_signal.py.exp │ ├── ticks_diff.py │ ├── ticks_diff.py.exp │ ├── time_ms_us.py │ ├── time_ms_us.py.exp │ ├── ubinascii_a2b_base64.py │ ├── ubinascii_b2a_base64.py │ ├── ubinascii_crc32.py │ ├── ubinascii_hexlify.py │ ├── ubinascii_micropython.py │ ├── ubinascii_micropython.py.exp │ ├── ubinascii_unhexlify.py │ ├── uctypes_32bit_intbig.py │ ├── uctypes_32bit_intbig.py.exp │ ├── uctypes_array_assign_le.py │ ├── uctypes_array_assign_le.py.exp │ ├── uctypes_array_assign_native_le.py │ ├── uctypes_array_assign_native_le.py.exp │ ├── uctypes_array_assign_native_le_intbig.py │ ├── uctypes_array_assign_native_le_intbig.py.exp │ ├── uctypes_bytearray.py │ ├── uctypes_bytearray.py.exp │ ├── uctypes_byteat.py │ ├── uctypes_byteat.py.exp │ ├── uctypes_error.py │ ├── uctypes_error.py.exp │ ├── uctypes_le.py │ ├── uctypes_le.py.exp │ ├── uctypes_le_float.py │ ├── uctypes_le_float.py.exp │ ├── uctypes_native_float.py │ ├── uctypes_native_float.py.exp │ ├── uctypes_native_le.py │ ├── uctypes_native_le.py.exp │ ├── uctypes_print.py │ ├── uctypes_print.py.exp │ ├── uctypes_ptr_le.py │ ├── uctypes_ptr_le.py.exp │ ├── uctypes_ptr_native_le.py │ ├── uctypes_ptr_native_le.py.exp │ ├── uctypes_sizeof.py │ ├── uctypes_sizeof.py.exp │ ├── uctypes_sizeof_float.py │ ├── uctypes_sizeof_float.py.exp │ ├── uctypes_sizeof_native.py │ ├── uctypes_sizeof_native.py.exp │ ├── uhashlib_sha1.py │ ├── uhashlib_sha256.py │ ├── uheapq1.py │ ├── ujson_dump.py │ ├── ujson_dumps.py │ ├── ujson_dumps_extra.py │ ├── ujson_dumps_extra.py.exp │ ├── ujson_dumps_float.py │ ├── ujson_load.py │ ├── ujson_loads.py │ ├── ujson_loads_float.py │ ├── urandom_basic.py │ ├── urandom_extra.py │ ├── ure1.py │ ├── ure_debug.py │ ├── ure_debug.py.exp │ ├── ure_error.py │ ├── ure_group.py │ ├── ure_namedclass.py │ ├── ure_split.py │ ├── ure_split_empty.py │ ├── ure_split_empty.py.exp │ ├── ure_split_notimpl.py │ ├── ure_split_notimpl.py.exp │ ├── ure_stack_overflow.py │ ├── ure_stack_overflow.py.exp │ ├── ussl_basic.py │ ├── ussl_basic.py.exp │ ├── utimeq1.py │ ├── utimeq1.py.exp │ ├── utimeq_stable.py │ ├── utimeq_stable.py.exp │ ├── uzlib_decompio.py │ ├── uzlib_decompio.py.exp │ ├── uzlib_decompio_gz.py │ ├── uzlib_decompio_gz.py.exp │ ├── uzlib_decompress.py │ ├── vfs_basic.py │ ├── vfs_basic.py.exp │ ├── vfs_fat_fileio1.py │ ├── vfs_fat_fileio1.py.exp │ ├── vfs_fat_fileio2.py │ ├── vfs_fat_fileio2.py.exp │ ├── vfs_fat_more.py │ ├── vfs_fat_more.py.exp │ ├── vfs_fat_oldproto.py │ ├── vfs_fat_oldproto.py.exp │ ├── vfs_fat_ramdisk.py │ ├── vfs_fat_ramdisk.py.exp │ ├── websocket_basic.py │ └── websocket_basic.py.exp ├── feature_check │ ├── README │ ├── async_check.py │ ├── async_check.py.exp │ ├── byteorder.py │ ├── byteorder.py.exp │ ├── complex.py │ ├── complex.py.exp │ ├── const.py │ ├── const.py.exp │ ├── coverage.py │ ├── coverage.py.exp │ ├── float.py │ ├── float.py.exp │ ├── int_big.py │ ├── int_big.py.exp │ ├── native_check.py │ ├── native_check.py.exp │ ├── repl_emacs_check.py │ ├── repl_emacs_check.py.exp │ ├── reverse_ops.py │ ├── reverse_ops.py.exp │ ├── set_check.py │ └── set_check.py.exp ├── float │ ├── array_construct.py │ ├── builtin_float_hash.py │ ├── builtin_float_minmax.py │ ├── builtin_float_pow.py │ ├── builtin_float_round.py │ ├── builtin_float_round_intbig.py │ ├── bytearray_construct.py │ ├── bytes_construct.py │ ├── cmath_fun.py │ ├── cmath_fun_special.py │ ├── complex1.py │ ├── complex1_intbig.py │ ├── float1.py │ ├── float2int_doubleprec_intbig.py │ ├── float2int_fp30_intbig.py │ ├── float2int_intbig.py │ ├── float_array.py │ ├── float_compare.py │ ├── float_divmod.py │ ├── float_divmod_relaxed.py │ ├── float_format.py │ ├── float_parse.py │ ├── float_parse_doubleprec.py │ ├── float_struct.py │ ├── int_big_float.py │ ├── int_divzero.py │ ├── int_power.py │ ├── list_index.py │ ├── math_domain.py │ ├── math_domain_special.py │ ├── math_fun.py │ ├── math_fun_bool.py │ ├── math_fun_int.py │ ├── math_fun_intbig.py │ ├── math_fun_special.py │ ├── string_format.py │ ├── string_format2.py │ ├── string_format_fp30.py │ ├── string_format_modulo.py │ ├── string_format_modulo2.py │ ├── string_format_modulo2_intbig.py │ ├── string_format_modulo3.py │ ├── string_format_modulo3.py.exp │ ├── true_value.py │ └── types.py ├── import │ ├── builtin_import.py │ ├── gen_context.py │ ├── gen_context2.py │ ├── import1a.py │ ├── import1b.py │ ├── import2a.py │ ├── import3a.py │ ├── import_file.py │ ├── import_pkg1.py │ ├── import_pkg2.py │ ├── import_pkg3.py │ ├── import_pkg4.py │ ├── import_pkg5.py │ ├── import_pkg6.py │ ├── import_pkg7.py │ ├── import_pkg8.py │ ├── pkg │ │ ├── __init__.py │ │ └── mod.py │ ├── pkg2 │ │ ├── __init__.py │ │ ├── mod1.py │ │ └── mod2.py │ ├── pkg3 │ │ ├── __init__.py │ │ ├── mod1.py │ │ ├── mod2.py │ │ └── subpkg1 │ │ │ ├── __init__.py │ │ │ └── mod1.py │ ├── pkg6 │ │ ├── __init__.py │ │ └── x │ │ │ ├── __init__.py │ │ │ └── y.py │ ├── pkg7 │ │ ├── __init__.py │ │ ├── mod1.py │ │ ├── mod2.py │ │ └── subpkg1 │ │ │ ├── __init__.py │ │ │ └── subpkg2 │ │ │ ├── __init__.py │ │ │ └── mod3.py │ ├── pkg8 │ │ └── mod.py │ ├── rel_import_inv.py │ └── try_module.py ├── inlineasm │ ├── asmargs.py │ ├── asmargs.py.exp │ ├── asmbcc.py │ ├── asmbcc.py.exp │ ├── asmbitops.py │ ├── asmbitops.py.exp │ ├── asmblbx.py │ ├── asmblbx.py.exp │ ├── asmconst.py │ ├── asmconst.py.exp │ ├── asmdiv.py │ ├── asmdiv.py.exp │ ├── asmfpaddsub.py │ ├── asmfpaddsub.py.exp │ ├── asmfpcmp.py │ ├── asmfpcmp.py.exp │ ├── asmfpldrstr.py │ ├── asmfpldrstr.py.exp │ ├── asmfpmuldiv.py │ ├── asmfpmuldiv.py.exp │ ├── asmfpsqrt.py │ ├── asmfpsqrt.py.exp │ ├── asmit.py │ ├── asmit.py.exp │ ├── asmpushpop.py │ ├── asmpushpop.py.exp │ ├── asmrettype.py │ ├── asmrettype.py.exp │ ├── asmshift.py │ ├── asmshift.py.exp │ ├── asmspecialregs.py │ ├── asmspecialregs.py.exp │ ├── asmsum.py │ └── asmsum.py.exp ├── io │ ├── argv.py │ ├── buffered_writer.py │ ├── buffered_writer.py.exp │ ├── bytesio_cow.py │ ├── bytesio_ext.py │ ├── bytesio_ext2.py │ ├── bytesio_ext2.py.exp │ ├── data │ │ ├── bigfile1 │ │ ├── file1 │ │ └── file2 │ ├── file1.py │ ├── file_iter.py │ ├── file_long_read.py │ ├── file_long_read2.py │ ├── file_long_read3.py │ ├── file_readinto.py │ ├── file_readinto_len.py │ ├── file_readinto_len.py.exp │ ├── file_readline.py │ ├── file_seek.py │ ├── file_stdio.py │ ├── file_with.py │ ├── open_append.py │ ├── open_plus.py │ ├── resource_stream.py │ ├── resource_stream.py.exp │ ├── stringio1.py │ ├── stringio_with.py │ ├── write_ext.py │ └── write_ext.py.exp ├── jni │ ├── README │ ├── list.py │ ├── list.py.exp │ ├── object.py │ ├── object.py.exp │ ├── system_out.py │ └── system_out.py.exp ├── micropython │ ├── const.py │ ├── const.py.exp │ ├── const2.py │ ├── const2.py.exp │ ├── const_error.py │ ├── const_error.py.exp │ ├── const_intbig.py │ ├── const_intbig.py.exp │ ├── decorator.py │ ├── decorator.py.exp │ ├── decorator_error.py │ ├── decorator_error.py.exp │ ├── emg_exc.py │ ├── emg_exc.py.exp │ ├── extreme_exc.py │ ├── extreme_exc.py.exp │ ├── heap_lock.py │ ├── heap_lock.py.exp │ ├── heapalloc.py │ ├── heapalloc.py.exp │ ├── heapalloc_bytesio.py │ ├── heapalloc_bytesio.py.exp │ ├── heapalloc_bytesio2.py │ ├── heapalloc_bytesio2.py.exp │ ├── heapalloc_exc_raise.py │ ├── heapalloc_exc_raise.py.exp │ ├── heapalloc_inst_call.py │ ├── heapalloc_inst_call.py.exp │ ├── heapalloc_int_from_bytes.py │ ├── heapalloc_int_from_bytes.py.exp │ ├── heapalloc_iter.py │ ├── heapalloc_str.py │ ├── heapalloc_str.py.exp │ ├── heapalloc_super.py │ ├── heapalloc_super.py.exp │ ├── heapalloc_traceback.py │ ├── heapalloc_traceback.py.exp │ ├── kbd_intr.py │ ├── kbd_intr.py.exp │ ├── meminfo.py │ ├── meminfo.py.exp │ ├── memstats.py │ ├── memstats.py.exp │ ├── native_closure.py │ ├── native_closure.py.exp │ ├── native_const_intbig.py │ ├── native_const_intbig.py.exp │ ├── native_misc.py │ ├── native_misc.py.exp │ ├── opt_level.py │ ├── opt_level.py.exp │ ├── schedule.py │ ├── schedule.py.exp │ ├── stack_use.py │ ├── stack_use.py.exp │ ├── viper_addr.py │ ├── viper_addr.py.exp │ ├── viper_args.py │ ├── viper_args.py.exp │ ├── viper_binop_arith.py │ ├── viper_binop_arith.py.exp │ ├── viper_binop_comp.py │ ├── viper_binop_comp.py.exp │ ├── viper_binop_comp_imm.py │ ├── viper_binop_comp_imm.py.exp │ ├── viper_binop_divmod.py │ ├── viper_binop_divmod.py.exp │ ├── viper_binop_multi_comp.py │ ├── viper_binop_multi_comp.py.exp │ ├── viper_cond.py │ ├── viper_cond.py.exp │ ├── viper_error.py │ ├── viper_error.py.exp │ ├── viper_import.py │ ├── viper_import.py.exp │ ├── viper_misc.py │ ├── viper_misc.py.exp │ ├── viper_misc_intbig.py │ ├── viper_misc_intbig.py.exp │ ├── viper_ptr16_load.py │ ├── viper_ptr16_load.py.exp │ ├── viper_ptr16_store.py │ ├── viper_ptr16_store.py.exp │ ├── viper_ptr32_load.py │ ├── viper_ptr32_load.py.exp │ ├── viper_ptr32_store.py │ ├── viper_ptr32_store.py.exp │ ├── viper_ptr8_load.py │ ├── viper_ptr8_load.py.exp │ ├── viper_ptr8_store.py │ ├── viper_ptr8_store.py.exp │ ├── viper_subscr.py │ └── viper_subscr.py.exp ├── misc │ ├── features.py │ ├── non_compliant.py │ ├── non_compliant.py.exp │ ├── non_compliant_lexer.py │ ├── non_compliant_lexer.py.exp │ ├── print_exception.py │ ├── rge_sm.py │ └── sys_exc_info.py ├── net_hosted │ ├── README │ ├── accept_nonblock.py │ ├── accept_nonblock.py.exp │ ├── accept_timeout.py │ ├── accept_timeout.py.exp │ ├── connect_nonblock.py │ ├── connect_nonblock.py.exp │ ├── connect_poll.py │ ├── connect_poll.py.exp │ ├── ssl_getpeercert.py │ └── ssl_getpeercert.py.exp ├── net_inet │ ├── README │ ├── test_tls_sites.py │ └── test_tls_sites.py.exp ├── pyb │ ├── accel.py │ ├── accel.py.exp │ ├── adc.py │ ├── adc.py.exp │ ├── adcall.py │ ├── adcall.py.exp │ ├── can.py │ ├── can.py.exp │ ├── dac.py │ ├── dac.py.exp │ ├── extint.py │ ├── extint.py.exp │ ├── halerror.py │ ├── halerror.py.exp │ ├── i2c.py │ ├── i2c.py.exp │ ├── i2c_error.py │ ├── i2c_error.py.exp │ ├── irq.py │ ├── irq.py.exp │ ├── led.py │ ├── led.py.exp │ ├── modstm.py │ ├── modstm.py.exp │ ├── modtime.py │ ├── modtime.py.exp │ ├── pin.py │ ├── pin.py.exp │ ├── pyb1.py │ ├── pyb1.py.exp │ ├── pyb_f405.py │ ├── pyb_f405.py.exp │ ├── pyb_f411.py │ ├── pyb_f411.py.exp │ ├── rtc.py │ ├── rtc.py.exp │ ├── servo.py │ ├── servo.py.exp │ ├── spi.py │ ├── spi.py.exp │ ├── switch.py │ ├── switch.py.exp │ ├── timer.py │ ├── timer.py.exp │ ├── timer_callback.py │ ├── timer_callback.py.exp │ ├── uart.py │ └── uart.py.exp ├── pybnative │ ├── for.py │ ├── for.py.exp │ ├── while.py │ └── while.py.exp ├── pyboard.py ├── run-bench-tests ├── run-tests ├── run-tests-exp.py ├── run-tests-exp.sh ├── stress │ ├── dict_copy.py │ ├── dict_create.py │ ├── dict_create_max.py │ ├── gc_trace.py │ ├── list_sort.py │ ├── recursion.py │ ├── recursive_data.py │ ├── recursive_data.py.exp │ ├── recursive_gen.py │ ├── recursive_iternext.py │ └── recursive_iternext.py.exp ├── thread │ ├── mutate_bytearray.py │ ├── mutate_dict.py │ ├── mutate_instance.py │ ├── mutate_list.py │ ├── mutate_set.py │ ├── stress_aes.py │ ├── stress_create.py │ ├── stress_heap.py │ ├── stress_recurse.py │ ├── thread_exc1.py │ ├── thread_exc2.py │ ├── thread_exc2.py.exp │ ├── thread_exit1.py │ ├── thread_exit2.py │ ├── thread_gc1.py │ ├── thread_ident1.py │ ├── thread_lock1.py │ ├── thread_lock2.py │ ├── thread_lock3.py │ ├── thread_lock4.py │ ├── thread_qstr1.py │ ├── thread_shared1.py │ ├── thread_shared2.py │ ├── thread_sleep1.py │ ├── thread_stacksize1.py │ ├── thread_start1.py │ └── thread_start2.py ├── unicode │ ├── data │ │ ├── utf-8_1.txt │ │ └── utf-8_2.txt │ ├── file1.py │ ├── file2.py │ ├── unicode.py │ ├── unicode_chr.py │ ├── unicode_id.py │ ├── unicode_index.py │ ├── unicode_iter.py │ ├── unicode_ord.py │ ├── unicode_pos.py │ ├── unicode_str_format.py │ ├── unicode_str_modulo.py │ └── unicode_subscr.py ├── unix │ ├── extra_coverage.py │ ├── extra_coverage.py.exp │ ├── ffi_callback.py │ ├── ffi_callback.py.exp │ ├── ffi_float.py │ ├── ffi_float.py.exp │ ├── ffi_float2.py │ └── ffi_float2.py.exp └── wipy │ ├── adc.py │ ├── adc.py.exp │ ├── i2c.py │ ├── i2c.py.exp │ ├── modwipy.py │ ├── modwipy.py.exp │ ├── os.py │ ├── os.py.exp │ ├── pin.py │ ├── pin.py.exp │ ├── pin_irq.py │ ├── pin_irq.py.exp │ ├── reset │ ├── reset.py │ └── reset.py.exp │ ├── rtc.py │ ├── rtc.py.exp │ ├── sd.py │ ├── sd.py.exp │ ├── skipped │ ├── rtc_irq.py │ └── rtc_irq.py.exp │ ├── spi.py │ ├── spi.py.exp │ ├── time.py │ ├── time.py.exp │ ├── timer.py │ ├── timer.py.exp │ ├── uart.py │ ├── uart.py.exp │ ├── uart_irq.py │ ├── uart_irq.py.exp │ ├── wdt.py │ ├── wdt.py.exp │ └── wlan │ ├── machine.py │ ├── machine.py.exp │ ├── server.py │ ├── server.py.exp │ ├── wlan.py │ └── wlan.py.exp └── tools ├── .gitattributes ├── .gitignore ├── bootstrap_upip.sh ├── build-stm-latest.sh ├── cc1 ├── check_code_size.sh ├── codestats.sh ├── dfu.py ├── file2h.py ├── gen-changelog.sh ├── gen-cpydiff.py ├── gendoc.py ├── insert-usb-ids.py ├── make-frozen.py ├── mpy-tool.py ├── mpy_bin2res.py ├── mpy_cross_all.py ├── pyboard.py ├── pydfu.py ├── tinytest-codegen.py ├── upip.py └── upip_utarfile.py /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | When reporting an issue and especially submitting a pull request, please 2 | make sure that you are acquainted with Contributor Guidelines: 3 | 4 | https://github.com/micropython/micropython/wiki/ContributorGuidelines 5 | 6 | and Code Conventions: 7 | 8 | https://github.com/micropython/micropython/blob/master/CODECONVENTIONS.md 9 | -------------------------------------------------------------------------------- /docs/differences/index_template.txt: -------------------------------------------------------------------------------- 1 | .. _cpython_diffs: 2 | 3 | MicroPython differences from CPython 4 | ==================================== 5 | 6 | The operations listed in this section produce conflicting results in MicroPython when compared to standard Python. 7 | 8 | .. toctree:: 9 | :maxdepth: 2 10 | 11 | -------------------------------------------------------------------------------- /docs/esp8266/img/adafruit_products_pinoutstop.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/docs/esp8266/img/adafruit_products_pinoutstop.jpg -------------------------------------------------------------------------------- /docs/esp8266_index.rst: -------------------------------------------------------------------------------- 1 | MicroPython documentation and references 2 | ======================================== 3 | 4 | .. toctree:: 5 | 6 | esp8266/quickref.rst 7 | esp8266/general.rst 8 | esp8266/tutorial/index.rst 9 | library/index.rst 10 | reference/index.rst 11 | genrst/index.rst 12 | license.rst 13 | -------------------------------------------------------------------------------- /docs/pyboard/tutorial/img/fading_leds_breadboard_fritzing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/docs/pyboard/tutorial/img/fading_leds_breadboard_fritzing.png -------------------------------------------------------------------------------- /docs/pyboard/tutorial/img/pyboard_servo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/docs/pyboard/tutorial/img/pyboard_servo.jpg -------------------------------------------------------------------------------- /docs/pyboard/tutorial/img/pyboard_usb_micro.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/docs/pyboard/tutorial/img/pyboard_usb_micro.jpg -------------------------------------------------------------------------------- /docs/pyboard/tutorial/img/skin_amp_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/docs/pyboard/tutorial/img/skin_amp_1.jpg -------------------------------------------------------------------------------- /docs/pyboard/tutorial/img/skin_amp_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/docs/pyboard/tutorial/img/skin_amp_2.jpg -------------------------------------------------------------------------------- /docs/pyboard/tutorial/img/skin_lcd_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/docs/pyboard/tutorial/img/skin_lcd_1.jpg -------------------------------------------------------------------------------- /docs/pyboard/tutorial/img/skin_lcd_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/docs/pyboard/tutorial/img/skin_lcd_2.jpg -------------------------------------------------------------------------------- /docs/pyboard_index.rst: -------------------------------------------------------------------------------- 1 | MicroPython documentation and references 2 | ======================================== 3 | 4 | .. toctree:: 5 | 6 | pyboard/quickref.rst 7 | pyboard/general.rst 8 | pyboard/tutorial/index.rst 9 | library/index.rst 10 | reference/index.rst 11 | genrst/index.rst 12 | license.rst 13 | -------------------------------------------------------------------------------- /docs/sphinx_selective_exclude/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/docs/sphinx_selective_exclude/__init__.py -------------------------------------------------------------------------------- /docs/static/customstyle.css: -------------------------------------------------------------------------------- 1 | /* custom CSS for MicroPython docs 2 | */ 3 | 4 | .admonition-difference-to-cpython { 5 | border: 1px solid black; 6 | } 7 | 8 | .admonition-difference-to-cpython .admonition-title { 9 | margin: 4px; 10 | } 11 | -------------------------------------------------------------------------------- /docs/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/docs/static/favicon.ico -------------------------------------------------------------------------------- /docs/templates/layout.html: -------------------------------------------------------------------------------- 1 | {% extends "!layout.html" %} 2 | {% set css_files = css_files + ["_static/customstyle.css"] %} 3 | 4 | {# we change the master_doc variable so that links to the index 5 | page are to index.html instead of _index.html #} 6 | {% set master_doc = "index" %} 7 | -------------------------------------------------------------------------------- /docs/unix_index.rst: -------------------------------------------------------------------------------- 1 | MicroPython documentation and references 2 | ======================================== 3 | 4 | .. toctree:: 5 | 6 | library/index.rst 7 | reference/index.rst 8 | genrst/index.rst 9 | license.rst 10 | -------------------------------------------------------------------------------- /docs/wipy_index.rst: -------------------------------------------------------------------------------- 1 | MicroPython documentation and references 2 | ======================================== 3 | 4 | .. toctree:: 5 | 6 | wipy/quickref.rst 7 | wipy/general.rst 8 | wipy/tutorial/index.rst 9 | library/index.rst 10 | reference/index.rst 11 | genrst/index.rst 12 | license.rst 13 | -------------------------------------------------------------------------------- /drivers/README.md: -------------------------------------------------------------------------------- 1 | This directory contains drivers for specific hardware. The drivers are 2 | intended to work across multiple ports. 3 | -------------------------------------------------------------------------------- /drivers/cc3000/inc/inet_ntop.h: -------------------------------------------------------------------------------- 1 | #ifndef __INET_NTOP_H 2 | #define __INET_NTOP_H 3 | char *inet_ntop(int af, const void *addr, char *buf, size_t size); 4 | #endif /* __INET_NTOP_H */ 5 | -------------------------------------------------------------------------------- /drivers/cc3000/inc/inet_pton.h: -------------------------------------------------------------------------------- 1 | #ifndef __INET_PTON_H 2 | #define __INET_PTON_H 3 | int inet_pton(int, const char *, void *); 4 | #endif /* __INET_PTON_H */ 5 | -------------------------------------------------------------------------------- /drivers/cc3100/inc/netapp.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/drivers/cc3100/inc/netapp.h -------------------------------------------------------------------------------- /drivers/dht/dht.h: -------------------------------------------------------------------------------- 1 | #ifndef MICROPY_INCLUDED_DRIVERS_DHT_DHT_H 2 | #define MICROPY_INCLUDED_DRIVERS_DHT_DHT_H 3 | 4 | #include "py/obj.h" 5 | 6 | MP_DECLARE_CONST_FUN_OBJ_2(dht_readinto_obj); 7 | 8 | #endif // MICROPY_INCLUDED_DRIVERS_DHT_DHT_H 9 | -------------------------------------------------------------------------------- /drivers/wiznet5k/README.md: -------------------------------------------------------------------------------- 1 | This is the driver for the WIZnet5x00 series of Ethernet controllers. 2 | 3 | Adapted for MicroPython. 4 | 5 | Original source: https://github.com/Wiznet/W5500_EVB/tree/master/ioLibrary 6 | Taken on: 30 August 2014 7 | -------------------------------------------------------------------------------- /examples/SDdatalogger/cardreader.py: -------------------------------------------------------------------------------- 1 | # cardread.py 2 | # This is called when the user enters cardreader mode. It does nothing. 3 | -------------------------------------------------------------------------------- /examples/embedding/Makefile: -------------------------------------------------------------------------------- 1 | MPTOP = ../.. 2 | CFLAGS = -std=c99 -I. -I$(MPTOP) -DNO_QSTR 3 | LDFLAGS = -L. 4 | 5 | hello-embed: hello-embed.o -lmicropython 6 | 7 | -lmicropython: 8 | $(MAKE) -f $(MPTOP)/examples/embedding/Makefile.upylib MPTOP=$(MPTOP) 9 | -------------------------------------------------------------------------------- /examples/embedding/mpconfigport.h: -------------------------------------------------------------------------------- 1 | mpconfigport_minimal.h -------------------------------------------------------------------------------- /examples/hwapi/button_led.py: -------------------------------------------------------------------------------- 1 | import utime 2 | from hwconfig import LED, BUTTON 3 | 4 | # Light LED when (and while) a BUTTON is pressed 5 | 6 | while 1: 7 | LED.value(BUTTON.value()) 8 | # Don't burn CPU 9 | utime.sleep_ms(10) 10 | -------------------------------------------------------------------------------- /examples/hwapi/hwconfig_esp8266_esp12.py: -------------------------------------------------------------------------------- 1 | from machine import Pin, Signal 2 | 3 | # ESP12 module as used by many boards 4 | # Blue LED on pin 2, active low (inverted) 5 | LED = Signal(2, Pin.OUT, invert=True) 6 | -------------------------------------------------------------------------------- /examples/hwapi/hwconfig_z_frdm_k64f.py: -------------------------------------------------------------------------------- 1 | from machine import Pin, Signal 2 | 3 | # Freescale/NXP FRDM-K64F board 4 | # Blue LED on port B, pin 21 5 | LED = Signal(("GPIO_1", 21), Pin.OUT) 6 | -------------------------------------------------------------------------------- /examples/micropython.py: -------------------------------------------------------------------------------- 1 | # micropython module placeholder for CPython 2 | 3 | # Dummy function decorators 4 | 5 | def nodecor(x): 6 | return x 7 | 8 | bytecode = native = viper = nodecor 9 | -------------------------------------------------------------------------------- /extmod/lwip-include/arch/perf.h: -------------------------------------------------------------------------------- 1 | #ifndef MICROPY_INCLUDED_EXTMOD_LWIP_INCLUDE_ARCH_PERF_H 2 | #define MICROPY_INCLUDED_EXTMOD_LWIP_INCLUDE_ARCH_PERF_H 3 | 4 | #define PERF_START /* null definition */ 5 | #define PERF_STOP(x) /* null definition */ 6 | 7 | #endif // MICROPY_INCLUDED_EXTMOD_LWIP_INCLUDE_ARCH_PERF_H 8 | -------------------------------------------------------------------------------- /extmod/modwebsocket.h: -------------------------------------------------------------------------------- 1 | #ifndef MICROPY_INCLUDED_EXTMOD_MODWEBSOCKET_H 2 | #define MICROPY_INCLUDED_EXTMOD_MODWEBSOCKET_H 3 | 4 | #define FRAME_OPCODE_MASK 0x0f 5 | enum { 6 | FRAME_CONT, FRAME_TXT, FRAME_BIN, 7 | FRAME_CLOSE = 0x8, FRAME_PING, FRAME_PONG 8 | }; 9 | 10 | #endif // MICROPY_INCLUDED_EXTMOD_MODWEBSOCKET_H 11 | -------------------------------------------------------------------------------- /lib/README.md: -------------------------------------------------------------------------------- 1 | This directory contains standard, low-level C libraries with emphasis on 2 | being independent and efficient. They can be used by any port. 3 | -------------------------------------------------------------------------------- /lib/embed/abort_.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | NORETURN void abort_(void); 4 | 5 | NORETURN void abort_(void) { 6 | mp_raise_msg(&mp_type_RuntimeError, "abort() called"); 7 | } 8 | -------------------------------------------------------------------------------- /lib/libm/thumb_vfp_sqrtf.c: -------------------------------------------------------------------------------- 1 | // an implementation of sqrtf for Thumb using hardware VFP instructions 2 | 3 | #include 4 | 5 | float sqrtf(float x) { 6 | asm volatile ( 7 | "vsqrt.f32 %[r], %[x]\n" 8 | : [r] "=t" (x) 9 | : [x] "t" (x)); 10 | return x; 11 | } 12 | -------------------------------------------------------------------------------- /lib/libm_dbl/__fpclassify.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int __fpclassifyd(double x) 5 | { 6 | union {double f; uint64_t i;} u = {x}; 7 | int e = u.i>>52 & 0x7ff; 8 | if (!e) return u.i<<1 ? FP_SUBNORMAL : FP_ZERO; 9 | if (e==0x7ff) return u.i<<12 ? FP_NAN : FP_INFINITE; 10 | return FP_NORMAL; 11 | } 12 | -------------------------------------------------------------------------------- /lib/libm_dbl/__signbit.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | int __signbitd(double x) 4 | { 5 | union { 6 | double d; 7 | uint64_t i; 8 | } y = { x }; 9 | return y.i>>63; 10 | } 11 | 12 | 13 | -------------------------------------------------------------------------------- /lib/libm_dbl/ldexp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double ldexp(double x, int n) 4 | { 5 | return scalbn(x, n); 6 | } 7 | -------------------------------------------------------------------------------- /lib/libm_dbl/lgamma.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double __lgamma_r(double, int*); 4 | 5 | double lgamma(double x) { 6 | int sign; 7 | return __lgamma_r(x, &sign); 8 | } 9 | -------------------------------------------------------------------------------- /lib/libm_dbl/log10.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static const double _M_LN10 = 2.302585092994046; 4 | 5 | double log10(double x) { 6 | return log(x) / (double)_M_LN10; 7 | } 8 | -------------------------------------------------------------------------------- /lib/libm_dbl/tanh.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double tanh(double x) { 4 | return sinh(x) / cosh(x); 5 | } 6 | -------------------------------------------------------------------------------- /logo/1bit-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/logo/1bit-logo.png -------------------------------------------------------------------------------- /logo/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/logo/logo.jpg -------------------------------------------------------------------------------- /logo/micropythonpowered-art.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/logo/micropythonpowered-art.png -------------------------------------------------------------------------------- /logo/trans-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/logo/trans-logo.png -------------------------------------------------------------------------------- /logo/upython-with-micro.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/logo/upython-with-micro.jpg -------------------------------------------------------------------------------- /logo/upython-with-micro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/logo/upython-with-micro.png -------------------------------------------------------------------------------- /logo/vector-logo-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/logo/vector-logo-2.png -------------------------------------------------------------------------------- /logo/vector-logo-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/logo/vector-logo-3.png -------------------------------------------------------------------------------- /mpy-cross/.gitignore: -------------------------------------------------------------------------------- 1 | mpy-cross 2 | -------------------------------------------------------------------------------- /mpy-cross/mphalport.h: -------------------------------------------------------------------------------- 1 | // empty file 2 | -------------------------------------------------------------------------------- /mpy-cross/qstrdefsport.h: -------------------------------------------------------------------------------- 1 | // qstrs specific to this port 2 | -------------------------------------------------------------------------------- /ports/arty/.gitignore: -------------------------------------------------------------------------------- 1 | micropython -------------------------------------------------------------------------------- /ports/arty/board.h: -------------------------------------------------------------------------------- 1 | #ifndef MICROPY_INCLUDED_UPDUINO_BOARD_H 2 | #define MICROPY_INCLUDED_UPDUINO_BOARD_H 3 | 4 | void led_init(void); 5 | void led_state(int led, int state); 6 | void led_toggle(int led); 7 | 8 | #endif // MICROPY_INCLUDED_UPDUINO_BOARD_H 9 | -------------------------------------------------------------------------------- /ports/arty/mphalport.h: -------------------------------------------------------------------------------- 1 | static inline mp_uint_t mp_hal_ticks_ms(void) { return 0; } 2 | static inline void mp_hal_set_interrupt_char(char c) {} 3 | -------------------------------------------------------------------------------- /ports/arty/qstrdefsport.h: -------------------------------------------------------------------------------- 1 | // qstrs specific to this port 2 | -------------------------------------------------------------------------------- /ports/bare-arm/mphalport.h: -------------------------------------------------------------------------------- 1 | // empty file 2 | -------------------------------------------------------------------------------- /ports/bare-arm/qstrdefsport.h: -------------------------------------------------------------------------------- 1 | // qstrs specific to this port 2 | -------------------------------------------------------------------------------- /ports/basic-badge/qstrdefsport.h: -------------------------------------------------------------------------------- 1 | // qstrs specific to this port 2 | -------------------------------------------------------------------------------- /ports/cc3200/boards/LAUNCHXL/pins.csv: -------------------------------------------------------------------------------- 1 | P12,58 2 | P13,4 3 | P14,3 4 | P15,61 5 | P16,59 6 | P17,5 7 | P18,62 8 | P19,1 9 | P110,2 10 | P33,57 11 | P34,60 12 | P37,63 13 | P38,53 14 | P39,64 15 | P310,50 16 | P49,16 17 | P410,17 18 | P22,18 19 | P23,8 20 | P24,45 21 | P26,7 22 | P27,6 23 | P28,21 24 | P29,55 25 | P210,15 -------------------------------------------------------------------------------- /ports/cc3200/boards/WIPY/pins.csv: -------------------------------------------------------------------------------- 1 | L2,GP2 2 | L3,GP1 3 | L4,GP23 4 | L5,GP24 5 | L6,GP11 6 | L7,GP12 7 | L8,GP13 8 | L9,GP14 9 | L10,GP15 10 | L11,GP16 11 | L12,GP17 12 | L13,GP22 13 | L14,GP28 14 | R4,GP10 15 | R5,GP9 16 | R6,GP8 17 | R7,GP7 18 | R8,GP6 19 | R9,GP30 20 | R10,GP31 21 | R11,GP3 22 | R12,GP0 23 | R13,GP4 24 | R14,GP5 25 | HBL,GP25 26 | -------------------------------------------------------------------------------- /ports/cc3200/bootmgr/relocator/relocator.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/ports/cc3200/bootmgr/relocator/relocator.bin -------------------------------------------------------------------------------- /ports/esp32/memory.h: -------------------------------------------------------------------------------- 1 | // this is needed for extmod/crypto-algorithms/sha256.c 2 | #include 3 | -------------------------------------------------------------------------------- /ports/esp32/modesp.h: -------------------------------------------------------------------------------- 1 | void esp_neopixel_write(uint8_t pin, uint8_t *pixels, uint32_t numBytes, uint8_t timing); 2 | -------------------------------------------------------------------------------- /ports/esp32/modules/_boot.py: -------------------------------------------------------------------------------- 1 | import gc 2 | import uos 3 | from flashbdev import bdev 4 | 5 | try: 6 | if bdev: 7 | uos.mount(bdev, '/') 8 | except OSError: 9 | import inisetup 10 | vfs = inisetup.setup() 11 | 12 | gc.collect() 13 | -------------------------------------------------------------------------------- /ports/esp32/modules/apa106.py: -------------------------------------------------------------------------------- 1 | # APA106driver for MicroPython on ESP32 2 | # MIT license; Copyright (c) 2016 Damien P. George 3 | 4 | from neopixel import NeoPixel 5 | 6 | 7 | class APA106(NeoPixel): 8 | ORDER = (0, 1, 2, 3) 9 | -------------------------------------------------------------------------------- /ports/esp32/modules/dht.py: -------------------------------------------------------------------------------- 1 | ../../../drivers/dht/dht.py -------------------------------------------------------------------------------- /ports/esp32/modules/ds18x20.py: -------------------------------------------------------------------------------- 1 | ../../esp8266/modules/ds18x20.py -------------------------------------------------------------------------------- /ports/esp32/modules/ntptime.py: -------------------------------------------------------------------------------- 1 | ../../esp8266/modules/ntptime.py -------------------------------------------------------------------------------- /ports/esp32/modules/onewire.py: -------------------------------------------------------------------------------- 1 | ../../esp8266/modules/onewire.py -------------------------------------------------------------------------------- /ports/esp32/modules/upip.py: -------------------------------------------------------------------------------- 1 | ../../../tools/upip.py -------------------------------------------------------------------------------- /ports/esp32/modules/upip_utarfile.py: -------------------------------------------------------------------------------- 1 | ../../../tools/upip_utarfile.py -------------------------------------------------------------------------------- /ports/esp32/modules/upysh.py: -------------------------------------------------------------------------------- 1 | ../../../../micropython-lib/upysh/upysh.py -------------------------------------------------------------------------------- /ports/esp32/modules/urequests.py: -------------------------------------------------------------------------------- 1 | ../../../../micropython-lib/urequests/urequests.py -------------------------------------------------------------------------------- /ports/esp32/modules/webrepl.py: -------------------------------------------------------------------------------- 1 | ../../esp8266/modules/webrepl.py -------------------------------------------------------------------------------- /ports/esp32/modules/webrepl_setup.py: -------------------------------------------------------------------------------- 1 | ../../esp8266/modules/webrepl_setup.py -------------------------------------------------------------------------------- /ports/esp32/modules/websocket_helper.py: -------------------------------------------------------------------------------- 1 | ../../esp8266/modules/websocket_helper.py -------------------------------------------------------------------------------- /ports/esp32/partitions.csv: -------------------------------------------------------------------------------- 1 | # Name, Type, SubType, Offset, Size, Flags 2 | # Note: if you change the phy_init or app partition offset, make sure to change the offset in Kconfig.projbuild 3 | nvs, data, nvs, 0x9000, 0x6000, 4 | phy_init, data, phy, 0xf000, 0x1000, 5 | factory, app, factory, 0x10000, 0x180000, 6 | -------------------------------------------------------------------------------- /ports/esp8266/espneopixel.h: -------------------------------------------------------------------------------- 1 | #ifndef MICROPY_INCLUDED_ESP8266_ESPNEOPIXEL_H 2 | #define MICROPY_INCLUDED_ESP8266_ESPNEOPIXEL_H 3 | 4 | void esp_neopixel_write(uint8_t pin, uint8_t *pixels, uint32_t numBytes, bool is800KHz); 5 | 6 | #endif // MICROPY_INCLUDED_ESP8266_ESPNEOPIXEL_H 7 | -------------------------------------------------------------------------------- /ports/esp8266/ets_alt_task.h: -------------------------------------------------------------------------------- 1 | #ifndef MICROPY_INCLUDED_ESP8266_ETS_ALT_TASK_H 2 | #define MICROPY_INCLUDED_ESP8266_ETS_ALT_TASK_H 3 | 4 | extern int ets_loop_iter_disable; 5 | extern uint32_t system_time_high_word; 6 | 7 | bool ets_loop_iter(void); 8 | 9 | #endif // MICROPY_INCLUDED_ESP8266_ETS_ALT_TASK_H 10 | -------------------------------------------------------------------------------- /ports/esp8266/modules/_boot.py: -------------------------------------------------------------------------------- 1 | import gc 2 | gc.threshold((gc.mem_free() + gc.mem_alloc()) // 4) 3 | import uos 4 | from flashbdev import bdev 5 | 6 | try: 7 | if bdev: 8 | uos.mount(bdev, '/') 9 | except OSError: 10 | import inisetup 11 | inisetup.setup() 12 | 13 | gc.collect() 14 | -------------------------------------------------------------------------------- /ports/esp8266/modules/dht.py: -------------------------------------------------------------------------------- 1 | ../../../drivers/dht/dht.py -------------------------------------------------------------------------------- /ports/esp8266/modules/ds18x20.py: -------------------------------------------------------------------------------- 1 | ../../../drivers/onewire/ds18x20.py -------------------------------------------------------------------------------- /ports/esp8266/modules/onewire.py: -------------------------------------------------------------------------------- 1 | ../../../drivers/onewire/onewire.py -------------------------------------------------------------------------------- /ports/esp8266/modules/upip.py: -------------------------------------------------------------------------------- 1 | ../../../tools/upip.py -------------------------------------------------------------------------------- /ports/esp8266/modules/upip_utarfile.py: -------------------------------------------------------------------------------- 1 | ../../../tools/upip_utarfile.py -------------------------------------------------------------------------------- /ports/esp8266/user_config.h: -------------------------------------------------------------------------------- 1 | // empty 2 | -------------------------------------------------------------------------------- /ports/lofive/.gitignore: -------------------------------------------------------------------------------- 1 | micropython -------------------------------------------------------------------------------- /ports/lofive/mphalport.h: -------------------------------------------------------------------------------- 1 | static inline mp_uint_t mp_hal_ticks_ms(void) { return 0; } 2 | static inline void mp_hal_set_interrupt_char(char c) {} 3 | -------------------------------------------------------------------------------- /ports/lofive/qstrdefsport.h: -------------------------------------------------------------------------------- 1 | // qstrs specific to this port 2 | -------------------------------------------------------------------------------- /ports/minimal/frozentest.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/ports/minimal/frozentest.mpy -------------------------------------------------------------------------------- /ports/minimal/frozentest.py: -------------------------------------------------------------------------------- 1 | print('uPy') 2 | print('a long string that is not interned') 3 | print('a string that has unicode αβγ chars') 4 | print(b'bytes 1234\x01') 5 | print(123456789) 6 | for i in range(4): 7 | print(i) 8 | -------------------------------------------------------------------------------- /ports/minimal/mphalport.h: -------------------------------------------------------------------------------- 1 | static inline mp_uint_t mp_hal_ticks_ms(void) { return 0; } 2 | static inline void mp_hal_set_interrupt_char(char c) {} 3 | -------------------------------------------------------------------------------- /ports/minimal/qstrdefsport.h: -------------------------------------------------------------------------------- 1 | // qstrs specific to this port 2 | -------------------------------------------------------------------------------- /ports/pic16bit/qstrdefsport.h: -------------------------------------------------------------------------------- 1 | // qstrs specific to this port 2 | -------------------------------------------------------------------------------- /ports/pic16bit/unistd.h: -------------------------------------------------------------------------------- 1 | #ifndef MICROPY_INCLUDED_PIC16BIT_UNISTD_H 2 | #define MICROPY_INCLUDED_PIC16BIT_UNISTD_H 3 | 4 | // XC16 compiler doesn't seem to have unistd.h file 5 | 6 | #define SEEK_SET 0 7 | #define SEEK_CUR 1 8 | 9 | typedef int ssize_t; 10 | 11 | #endif // MICROPY_INCLUDED_PIC16BIT_UNISTD_H 12 | -------------------------------------------------------------------------------- /ports/picorv32/.gitignore: -------------------------------------------------------------------------------- 1 | micropython.asc 2 | micropython.blif -------------------------------------------------------------------------------- /ports/picorv32/board.h: -------------------------------------------------------------------------------- 1 | #ifndef MICROPY_INCLUDED_UPDUINO_BOARD_H 2 | #define MICROPY_INCLUDED_UPDUINO_BOARD_H 3 | 4 | void led_init(void); 5 | void led_state(int led, int state); 6 | void led_toggle(int led); 7 | 8 | #endif // MICROPY_INCLUDED_UPDUINO_BOARD_H 9 | -------------------------------------------------------------------------------- /ports/picorv32/mphalport.h: -------------------------------------------------------------------------------- 1 | static inline mp_uint_t mp_hal_ticks_ms(void) { return 0; } 2 | static inline void mp_hal_set_interrupt_char(char c) {} 3 | -------------------------------------------------------------------------------- /ports/picorv32/qstrdefsport.h: -------------------------------------------------------------------------------- 1 | // qstrs specific to this port 2 | -------------------------------------------------------------------------------- /ports/picorv32/sections.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern uint32_t _sidata, _sdata, _edata; 5 | 6 | void executable_init_sections() 7 | { 8 | for (uint32_t *src = &_sidata, *dest = &_sdata; dest < &_edata;) { 9 | *dest++ = *src++; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ports/qemu-arm/mphalport.h: -------------------------------------------------------------------------------- 1 | #define mp_hal_stdin_rx_chr() (0) 2 | #define mp_hal_stdout_tx_strn_cooked(s, l) write(1, (s), (l)) 3 | -------------------------------------------------------------------------------- /ports/qemu-arm/qstrdefsport.h: -------------------------------------------------------------------------------- 1 | // qstrs specific to this port 2 | -------------------------------------------------------------------------------- /ports/stm32/.gitignore: -------------------------------------------------------------------------------- 1 | build-*/ 2 | -------------------------------------------------------------------------------- /ports/stm32/boards/CERB40/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F405xx 3 | AF_FILE = boards/stm32f405_af.csv 4 | LD_FILES = boards/stm32f405.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/HYDRABUS/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F405xx 3 | AF_FILE = boards/stm32f405_af.csv 4 | LD_FILES = boards/stm32f405.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/LIMIFROG/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = l4 2 | CMSIS_MCU = STM32L476xx 3 | AF_FILE = boards/stm32l476_af.csv 4 | LD_FILES = boards/stm32l476xe.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08004000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/NETDUINO_PLUS_2/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F405xx 3 | AF_FILE = boards/stm32f405_af.csv 4 | LD_FILES = boards/stm32f405.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/NUCLEO_F091RC/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f0 2 | CMSIS_MCU = STM32F091xC 3 | AF_FILE = boards/stm32f091_af.csv 4 | LD_FILES = boards/stm32f091xc.ld boards/common_basic.ld 5 | 6 | # Don't include default frozen modules because MCU is tight on flash space 7 | FROZEN_MPY_DIR ?= 8 | -------------------------------------------------------------------------------- /ports/stm32/boards/NUCLEO_F401RE/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F401xE 3 | AF_FILE = boards/stm32f401_af.csv 4 | LD_FILES = boards/stm32f401xe.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/NUCLEO_F411RE/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F411xE 3 | AF_FILE = boards/stm32f411_af.csv 4 | LD_FILES = boards/stm32f411.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/NUCLEO_F429ZI/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F429xx 3 | AF_FILE = boards/stm32f429_af.csv 4 | LD_FILES = boards/stm32f429.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/NUCLEO_F446RE/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F446xx 3 | AF_FILE = boards/stm32f429_af.csv 4 | LD_FILES = boards/stm32f411.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/NUCLEO_F746ZG/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f7 2 | CMSIS_MCU = STM32F746xx 3 | AF_FILE = boards/stm32f746_af.csv 4 | LD_FILES = boards/stm32f746.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/NUCLEO_F767ZI/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f7 2 | CMSIS_MCU = STM32F767xx 3 | MICROPY_FLOAT_IMPL = double 4 | AF_FILE = boards/stm32f767_af.csv 5 | LD_FILES = boards/stm32f767.ld boards/common_ifs.ld 6 | TEXT0_ADDR = 0x08000000 7 | TEXT1_ADDR = 0x08020000 8 | -------------------------------------------------------------------------------- /ports/stm32/boards/NUCLEO_H743ZI/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = h7 2 | CMSIS_MCU = STM32H743xx 3 | MICROPY_FLOAT_IMPL = double 4 | AF_FILE = boards/stm32h743_af.csv 5 | LD_FILES = boards/stm32h743.ld boards/common_ifs.ld 6 | TEXT0_ADDR = 0x08000000 7 | TEXT1_ADDR = 0x08040000 8 | -------------------------------------------------------------------------------- /ports/stm32/boards/NUCLEO_L476RG/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = l4 2 | CMSIS_MCU = STM32L476xx 3 | AF_FILE = boards/stm32l476_af.csv 4 | LD_FILES = boards/stm32l476xg.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08004000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/OLIMEX_E407/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F407xx 3 | AF_FILE = boards/stm32f405_af.csv 4 | LD_FILES = boards/stm32f405.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/PYBLITEV10/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F411xE 3 | AF_FILE = boards/stm32f411_af.csv 4 | LD_FILES = boards/stm32f411.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/PYBV10/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F405xx 3 | AF_FILE = boards/stm32f405_af.csv 4 | LD_FILES = boards/stm32f405.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/PYBV11/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F405xx 3 | AF_FILE = boards/stm32f405_af.csv 4 | LD_FILES = boards/stm32f405.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/PYBV3/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F405xx 3 | AF_FILE = boards/stm32f405_af.csv 4 | LD_FILES = boards/stm32f405.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/PYBV4/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F405xx 3 | AF_FILE = boards/stm32f405_af.csv 4 | LD_FILES = boards/stm32f405.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/STM32F411DISC/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F411xE 3 | AF_FILE = boards/stm32f411_af.csv 4 | LD_FILES = boards/stm32f411.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/STM32F429DISC/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F429xx 3 | AF_FILE = boards/stm32f429_af.csv 4 | LD_FILES = boards/stm32f429.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/STM32F439/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F439xx 3 | AF_FILE = boards/stm32f439_af.csv 4 | LD_FILES = boards/stm32f439.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/STM32F4DISC/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f4 2 | CMSIS_MCU = STM32F407xx 3 | AF_FILE = boards/stm32f405_af.csv 4 | LD_FILES = boards/stm32f405.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/STM32F769DISC/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f7 2 | CMSIS_MCU = STM32F769xx 3 | MICROPY_FLOAT_IMPL = double 4 | AF_FILE = boards/stm32f767_af.csv 5 | LD_FILES = boards/stm32f769.ld boards/common_ifs.ld 6 | TEXT0_ADDR = 0x08000000 7 | TEXT1_ADDR = 0x08020000 8 | -------------------------------------------------------------------------------- /ports/stm32/boards/STM32F7DISC/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = f7 2 | CMSIS_MCU = STM32F746xx 3 | AF_FILE = boards/stm32f746_af.csv 4 | LD_FILES = boards/stm32f746.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08020000 7 | -------------------------------------------------------------------------------- /ports/stm32/boards/STM32L476DISC/board_init.c: -------------------------------------------------------------------------------- 1 | #include "py/mphal.h" 2 | 3 | void STM32L476DISC_board_early_init(void) { 4 | // set SPI flash WP and HOLD pins high 5 | mp_hal_pin_output(pin_E14); 6 | mp_hal_pin_output(pin_E15); 7 | mp_hal_pin_write(pin_E14, 1); 8 | mp_hal_pin_write(pin_E15, 1); 9 | } 10 | -------------------------------------------------------------------------------- /ports/stm32/boards/STM32L476DISC/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = l4 2 | CMSIS_MCU = STM32L476xx 3 | AF_FILE = boards/stm32l476_af.csv 4 | LD_FILES = boards/stm32l476xg.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08004000 7 | OPENOCD_CONFIG = boards/openocd_stm32l4.cfg 8 | -------------------------------------------------------------------------------- /ports/stm32/boards/STM32L496GDISC/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | MCU_SERIES = l4 2 | CMSIS_MCU = STM32L496xx 3 | AF_FILE = boards/stm32l496_af.csv 4 | LD_FILES = boards/stm32l496xg.ld boards/common_ifs.ld 5 | TEXT0_ADDR = 0x08000000 6 | TEXT1_ADDR = 0x08004000 7 | OPENOCD_CONFIG = boards/openocd_stm32l4.cfg 8 | -------------------------------------------------------------------------------- /ports/stm32/lwip_inc/arch/cc.h: -------------------------------------------------------------------------------- 1 | #ifndef MICROPY_INCLUDED_STM32_LWIP_ARCH_CC_H 2 | #define MICROPY_INCLUDED_STM32_LWIP_ARCH_CC_H 3 | 4 | #include 5 | #define LWIP_PLATFORM_DIAG(x) 6 | #define LWIP_PLATFORM_ASSERT(x) { assert(1); } 7 | 8 | #endif // MICROPY_INCLUDED_STM32_LWIP_ARCH_CC_H 9 | -------------------------------------------------------------------------------- /ports/stm32/lwip_inc/arch/sys_arch.h: -------------------------------------------------------------------------------- 1 | // empty 2 | -------------------------------------------------------------------------------- /ports/stm32/modules/dht.py: -------------------------------------------------------------------------------- 1 | ../../../drivers/dht/dht.py -------------------------------------------------------------------------------- /ports/stm32/modules/lcd160cr.py: -------------------------------------------------------------------------------- 1 | ../../../drivers/display/lcd160cr.py -------------------------------------------------------------------------------- /ports/stm32/modules/lcd160cr_test.py: -------------------------------------------------------------------------------- 1 | ../../../drivers/display/lcd160cr_test.py -------------------------------------------------------------------------------- /ports/stm32/modules/onewire.py: -------------------------------------------------------------------------------- 1 | ../../../drivers/onewire/onewire.py -------------------------------------------------------------------------------- /ports/stm32/mpconfigport.mk: -------------------------------------------------------------------------------- 1 | # Enable/disable extra modules 2 | 3 | # wiznet5k module for ethernet support; valid values are: 4 | # 0 : no Wiznet support 5 | # 5200 : support for W5200 module 6 | # 5500 : support for W5500 module 7 | MICROPY_PY_WIZNET5K ?= 0 8 | 9 | # cc3k module for wifi support 10 | MICROPY_PY_CC3K ?= 0 11 | -------------------------------------------------------------------------------- /ports/teensy/core/Arduino.h: -------------------------------------------------------------------------------- 1 | //#include "WProgram.h" 2 | #include "core_pins.h" 3 | #include "pins_arduino.h" 4 | -------------------------------------------------------------------------------- /ports/teensy/lcd.c: -------------------------------------------------------------------------------- 1 | #include "py/obj.h" 2 | #include "../stm32/lcd.h" 3 | 4 | void lcd_init(void) { 5 | } 6 | 7 | void lcd_print_str(const char *str) { 8 | (void)str; 9 | } 10 | 11 | void lcd_print_strn(const char *str, unsigned int len) { 12 | (void)str; 13 | (void)len; 14 | } 15 | -------------------------------------------------------------------------------- /ports/teensy/lexermemzip.h: -------------------------------------------------------------------------------- 1 | #ifndef MICROPY_INCLUDED_TEENSY_LEXERMEMZIP_H 2 | #define MICROPY_INCLUDED_TEENSY_LEXERMEMZIP_H 3 | 4 | mp_lexer_t *mp_lexer_new_from_memzip_file(const char *filename); 5 | 6 | #endif // MICROPY_INCLUDED_TEENSY_LEXERMEMZIP_H 7 | -------------------------------------------------------------------------------- /ports/teensy/memzip_files/main.py: -------------------------------------------------------------------------------- 1 | import pyb 2 | 3 | print("Executing main.py") 4 | 5 | led = pyb.LED(1) 6 | 7 | led.on() 8 | pyb.delay(100) 9 | led.off() 10 | pyb.delay(100) 11 | led.on() 12 | pyb.delay(100) 13 | led.off() 14 | 15 | 16 | -------------------------------------------------------------------------------- /ports/teensy/qstrdefsport.h: -------------------------------------------------------------------------------- 1 | // qstrs specific to this port 2 | -------------------------------------------------------------------------------- /ports/teensy/servo.h: -------------------------------------------------------------------------------- 1 | #ifndef MICROPY_INCLUDED_TEENSY_SERVO_H 2 | #define MICROPY_INCLUDED_TEENSY_SERVO_H 3 | 4 | void servo_init(void); 5 | 6 | extern const mp_obj_type_t pyb_servo_type; 7 | 8 | MP_DECLARE_CONST_FUN_OBJ_2(pyb_servo_set_obj); 9 | MP_DECLARE_CONST_FUN_OBJ_2(pyb_pwm_set_obj); 10 | 11 | #endif // MICROPY_INCLUDED_TEENSY_SERVO_H 12 | -------------------------------------------------------------------------------- /ports/tinyfpga/.gitignore: -------------------------------------------------------------------------------- 1 | micropython.asc 2 | micropython.blif -------------------------------------------------------------------------------- /ports/tinyfpga/mphalport.h: -------------------------------------------------------------------------------- 1 | static inline mp_uint_t mp_hal_ticks_ms(void) { return 0; } 2 | static inline void mp_hal_set_interrupt_char(char c) {} 3 | -------------------------------------------------------------------------------- /ports/tinyfpga/qstrdefsport.h: -------------------------------------------------------------------------------- 1 | // qstrs specific to this port 2 | -------------------------------------------------------------------------------- /ports/unix/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | build-fast 3 | build-minimal 4 | build-coverage 5 | build-nanbox 6 | build-freedos 7 | micropython 8 | micropython_fast 9 | micropython_minimal 10 | micropython_coverage 11 | micropython_nanbox 12 | micropython_freedos* 13 | *.py 14 | *.gcov 15 | -------------------------------------------------------------------------------- /ports/unix/coverage-frzmpy/frzmpy1.py: -------------------------------------------------------------------------------- 1 | print('frzmpy1') 2 | -------------------------------------------------------------------------------- /ports/unix/coverage-frzmpy/frzmpy2.py: -------------------------------------------------------------------------------- 1 | raise ZeroDivisionError 2 | -------------------------------------------------------------------------------- /ports/unix/coverage-frzmpy/frzmpy_pkg1/__init__.py: -------------------------------------------------------------------------------- 1 | # test frozen package with __init__.py 2 | print('frzmpy_pkg1.__init__') 3 | x = 1 4 | -------------------------------------------------------------------------------- /ports/unix/coverage-frzmpy/frzmpy_pkg2/mod.py: -------------------------------------------------------------------------------- 1 | # test frozen package without __init__.py 2 | print('frzmpy_pkg2.mod') 3 | class Foo: 4 | x = 1 5 | -------------------------------------------------------------------------------- /ports/unix/coverage-frzstr/frzstr1.py: -------------------------------------------------------------------------------- 1 | print('frzstr1') 2 | -------------------------------------------------------------------------------- /ports/unix/coverage-frzstr/frzstr_pkg1/__init__.py: -------------------------------------------------------------------------------- 1 | # test frozen package with __init__.py 2 | print('frzstr_pkg1.__init__') 3 | x = 1 4 | -------------------------------------------------------------------------------- /ports/unix/coverage-frzstr/frzstr_pkg2/mod.py: -------------------------------------------------------------------------------- 1 | # test frozen package without __init__.py 2 | print('frzstr_pkg2.mod') 3 | class Foo: 4 | x = 1 5 | -------------------------------------------------------------------------------- /ports/unix/fatfs_port.c: -------------------------------------------------------------------------------- 1 | #include "lib/oofatfs/ff.h" 2 | 3 | DWORD get_fattime(void) { 4 | return 0; 5 | } 6 | -------------------------------------------------------------------------------- /ports/unix/input.h: -------------------------------------------------------------------------------- 1 | #ifndef MICROPY_INCLUDED_UNIX_INPUT_H 2 | #define MICROPY_INCLUDED_UNIX_INPUT_H 3 | 4 | char *prompt(char *p); 5 | void prompt_read_history(void); 6 | void prompt_write_history(void); 7 | 8 | #endif // MICROPY_INCLUDED_UNIX_INPUT_H 9 | -------------------------------------------------------------------------------- /ports/unix/modules/upip.py: -------------------------------------------------------------------------------- 1 | ../../../tools/upip.py -------------------------------------------------------------------------------- /ports/unix/modules/upip_utarfile.py: -------------------------------------------------------------------------------- 1 | ../../../tools/upip_utarfile.py -------------------------------------------------------------------------------- /ports/windows/.gitignore: -------------------------------------------------------------------------------- 1 | *.user 2 | *.*sdf 3 | *.suo 4 | *.sln 5 | *.exe 6 | *.pdb 7 | *.ilk 8 | *.filters 9 | /build/* 10 | .vs/* 11 | *.VC.*db 12 | -------------------------------------------------------------------------------- /ports/zephyr/.gitignore: -------------------------------------------------------------------------------- 1 | outdir/ 2 | -------------------------------------------------------------------------------- /ports/zephyr/Kbuild: -------------------------------------------------------------------------------- 1 | #subdir-ccflags-y += -I$(SOURCE_DIR)/../mylib/include 2 | 3 | obj-y += src/ 4 | -------------------------------------------------------------------------------- /ports/zephyr/prj_96b_carbon.conf: -------------------------------------------------------------------------------- 1 | # TODO: Enable networking 2 | CONFIG_NETWORKING=y 3 | -------------------------------------------------------------------------------- /ports/zephyr/prj_disco_l475_iot1.conf: -------------------------------------------------------------------------------- 1 | # Sensors 2 | CONFIG_HTS221=y 3 | CONFIG_LIS3MDL=y 4 | CONFIG_LPS22HB=y 5 | CONFIG_LSM6DSL=y 6 | -------------------------------------------------------------------------------- /ports/zephyr/prj_frdm_k64f.conf: -------------------------------------------------------------------------------- 1 | # Networking drivers 2 | CONFIG_NET_L2_ETHERNET=y 3 | -------------------------------------------------------------------------------- /ports/zephyr/prj_minimal.conf: -------------------------------------------------------------------------------- 1 | CONFIG_STDOUT_CONSOLE=y 2 | CONFIG_CONSOLE_HANDLER=y 3 | CONFIG_UART_CONSOLE_DEBUG_SERVER_HOOKS=y 4 | CONFIG_NEWLIB_LIBC=y 5 | CONFIG_FLOAT=y 6 | CONFIG_MAIN_STACK_SIZE=4096 7 | -------------------------------------------------------------------------------- /ports/zephyr/prj_qemu_cortex_m3.conf: -------------------------------------------------------------------------------- 1 | # Interrupt-driven UART console has emulation artifacts under QEMU, 2 | # disable it 3 | CONFIG_CONSOLE_PULL=n 4 | 5 | # Networking drivers 6 | # SLIP driver for QEMU 7 | CONFIG_NET_SLIP_TAP=y 8 | -------------------------------------------------------------------------------- /ports/zephyr/prj_qemu_x86.conf: -------------------------------------------------------------------------------- 1 | # Interrupt-driven UART console has emulation artifacts under QEMU, 2 | # disable it 3 | CONFIG_CONSOLE_PULL=n 4 | 5 | # Networking drivers 6 | # SLIP driver for QEMU 7 | CONFIG_NET_SLIP_TAP=y 8 | 9 | # Default RAM easily overflows with uPy and networking 10 | CONFIG_RAM_SIZE=320 11 | -------------------------------------------------------------------------------- /tests/basics/0prelim.py: -------------------------------------------------------------------------------- 1 | # all tests need print to work! make sure it does work 2 | 3 | print(1) 4 | print('abc') 5 | -------------------------------------------------------------------------------- /tests/basics/andor.py: -------------------------------------------------------------------------------- 1 | # test short circuit expressions outside if conditionals 2 | print(() or 1) 3 | print((1,) or 1) 4 | print(() and 1) 5 | print((1,) and 1) 6 | -------------------------------------------------------------------------------- /tests/basics/array_construct2.py: -------------------------------------------------------------------------------- 1 | try: 2 | from array import array 3 | except ImportError: 4 | print("SKIP") 5 | raise SystemExit 6 | 7 | # construct from something with unknown length (requires generators) 8 | print(array('i', (i for i in range(10)))) 9 | -------------------------------------------------------------------------------- /tests/basics/array_construct_endian.py: -------------------------------------------------------------------------------- 1 | # test construction of array.array from different objects 2 | 3 | try: 4 | from array import array 5 | except ImportError: 6 | print("SKIP") 7 | raise SystemExit 8 | 9 | # raw copy from bytes, bytearray 10 | print(array('h', b'12')) 11 | -------------------------------------------------------------------------------- /tests/basics/array_micropython.py.exp: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | -------------------------------------------------------------------------------- /tests/basics/assign1.py: -------------------------------------------------------------------------------- 1 | # test assignments 2 | 3 | a = 1 4 | print(a) 5 | 6 | a = b = 2 7 | print(a, b) 8 | 9 | a = b = c = 3 10 | print(a, b, c) 11 | 12 | -------------------------------------------------------------------------------- /tests/basics/async_await.py.exp: -------------------------------------------------------------------------------- 1 | 4 2 | 3 3 | 2 4 | 1 5 | 0 6 | 0 7 | 1 8 | 0 9 | 0 10 | 2 11 | 1 12 | 0 13 | 0 14 | 1 15 | 0 16 | 0 17 | 3 18 | 2 19 | 1 20 | 0 21 | 0 22 | 1 23 | 0 24 | 0 25 | 2 26 | 1 27 | 0 28 | 0 29 | 1 30 | 0 31 | 0 32 | finished 33 | -------------------------------------------------------------------------------- /tests/basics/async_await2.py.exp: -------------------------------------------------------------------------------- 1 | wait value: 1 2 | return from send: message from wait(1) 3 | wait got back: message from main 4 | x = 100 5 | got StopIteration 6 | -------------------------------------------------------------------------------- /tests/basics/async_def.py: -------------------------------------------------------------------------------- 1 | # test async def 2 | 3 | def dec(f): 4 | print('decorator') 5 | return f 6 | 7 | # test definition with a decorator 8 | @dec 9 | async def foo(): 10 | print('foo') 11 | 12 | coro = foo() 13 | try: 14 | coro.send(None) 15 | except StopIteration: 16 | print('StopIteration') 17 | -------------------------------------------------------------------------------- /tests/basics/async_def.py.exp: -------------------------------------------------------------------------------- 1 | decorator 2 | foo 3 | StopIteration 4 | -------------------------------------------------------------------------------- /tests/basics/async_for.py.exp: -------------------------------------------------------------------------------- 1 | init 2 | aiter 3 | anext 4 | a 5 | anext 6 | b 7 | anext 8 | c 9 | anext 10 | finished 11 | -------------------------------------------------------------------------------- /tests/basics/async_with.py.exp: -------------------------------------------------------------------------------- 1 | enter 2 | body 3 | exit None None 4 | finished 5 | enter 6 | 1 7 | exit error 8 | ValueError 9 | -------------------------------------------------------------------------------- /tests/basics/async_with2.py.exp: -------------------------------------------------------------------------------- 1 | enter 2 | f start: 10 3 | coro yielded: 11 4 | coro yielded: 12 5 | f returned: 13 6 | body start 7 | f start: 30 8 | coro yielded: 31 9 | coro yielded: 32 10 | body f returned: 33 11 | body end 12 | exit None None 13 | f start: 20 14 | coro yielded: 21 15 | coro yielded: 22 16 | f returned: 23 17 | finished 18 | -------------------------------------------------------------------------------- /tests/basics/bool1.py: -------------------------------------------------------------------------------- 1 | # tests for bool objects 2 | 3 | # basic logic 4 | print(not False) 5 | print(not True) 6 | print(False and True) 7 | print(False or True) 8 | 9 | # unary operators 10 | print(+True) 11 | print(-True) 12 | 13 | # unsupported unary op 14 | try: 15 | len(False) 16 | except TypeError: 17 | print('TypeError') 18 | -------------------------------------------------------------------------------- /tests/basics/break.py: -------------------------------------------------------------------------------- 1 | while True: 2 | break 3 | 4 | for i in range(4): 5 | print('one', i) 6 | if i > 2: 7 | break 8 | print('two', i) 9 | 10 | for i in [1, 2, 3, 4]: 11 | if i == 3: 12 | break 13 | print(i) 14 | -------------------------------------------------------------------------------- /tests/basics/builtin_abs.py: -------------------------------------------------------------------------------- 1 | # test builtin abs 2 | 3 | print(abs(False)) 4 | print(abs(True)) 5 | print(abs(1)) 6 | print(abs(-1)) 7 | -------------------------------------------------------------------------------- /tests/basics/builtin_bin.py: -------------------------------------------------------------------------------- 1 | # test builtin bin function 2 | 3 | print(bin(1)) 4 | print(bin(-1)) 5 | print(bin(15)) 6 | print(bin(-15)) 7 | 8 | print(bin(12345)) 9 | print(bin(0b10101)) 10 | 11 | print(bin(0b10101010101010101010)) 12 | -------------------------------------------------------------------------------- /tests/basics/builtin_bin_intbig.py: -------------------------------------------------------------------------------- 1 | # test builtin bin function 2 | 3 | print(bin(12345678901234567890)) 4 | -------------------------------------------------------------------------------- /tests/basics/builtin_chr.py: -------------------------------------------------------------------------------- 1 | # test builtin chr (whether or not we support unicode) 2 | 3 | print(chr(65)) 4 | 5 | try: 6 | chr(0x110000) 7 | except ValueError: 8 | print("ValueError") 9 | 10 | -------------------------------------------------------------------------------- /tests/basics/builtin_divmod.py: -------------------------------------------------------------------------------- 1 | # test builtin divmod 2 | 3 | print(divmod(0, 2)) 4 | print(divmod(3, 4)) 5 | print(divmod(20, 3)) 6 | 7 | try: 8 | divmod(1, 0) 9 | except ZeroDivisionError: 10 | print("ZeroDivisionError") 11 | 12 | try: 13 | divmod('a', 'b') 14 | except TypeError: 15 | print("TypeError") 16 | -------------------------------------------------------------------------------- /tests/basics/builtin_divmod_intbig.py: -------------------------------------------------------------------------------- 1 | # test builtin divmod 2 | 3 | try: 4 | divmod(1 << 65, 0) 5 | except ZeroDivisionError: 6 | print("ZeroDivisionError") 7 | 8 | # bignum 9 | l = (1 << 65) + 123 10 | print(divmod(3, l)) 11 | print(divmod(l, 5)) 12 | print(divmod(l + 3, l)) 13 | print(divmod(l * 20, l + 2)) 14 | -------------------------------------------------------------------------------- /tests/basics/builtin_ellipsis.py: -------------------------------------------------------------------------------- 1 | # tests that .../Ellipsis exists 2 | 3 | print(...) 4 | print(Ellipsis) 5 | 6 | print(... == Ellipsis) 7 | -------------------------------------------------------------------------------- /tests/basics/builtin_eval.py: -------------------------------------------------------------------------------- 1 | # builtin eval 2 | 3 | try: 4 | eval 5 | except NameError: 6 | print("SKIP") 7 | raise SystemExit 8 | 9 | eval('1 + 2') 10 | eval('1 + 2\n') 11 | eval('1 + 2\n\n#comment\n') 12 | 13 | x = 4 14 | eval('x') 15 | 16 | eval('lambda x: x + 10')(-5) 17 | 18 | y = 6 19 | eval('lambda: y * 2')() 20 | -------------------------------------------------------------------------------- /tests/basics/builtin_eval_error.py: -------------------------------------------------------------------------------- 1 | # test if eval raises SyntaxError 2 | 3 | try: 4 | eval 5 | except NameError: 6 | print("SKIP") 7 | raise SystemExit 8 | 9 | try: 10 | print(eval("[1,,]")) 11 | except SyntaxError: 12 | print("SyntaxError") 13 | -------------------------------------------------------------------------------- /tests/basics/builtin_filter.py: -------------------------------------------------------------------------------- 1 | try: 2 | filter 3 | except: 4 | print("SKIP") 5 | raise SystemExit 6 | 7 | print(list(filter(lambda x: x & 1, range(-3, 4)))) 8 | print(list(filter(None, range(-3, 4)))) 9 | -------------------------------------------------------------------------------- /tests/basics/builtin_hash_gen.py: -------------------------------------------------------------------------------- 1 | # test builtin hash function, on generators 2 | 3 | def gen(): 4 | yield 5 | 6 | print(type(hash(gen))) 7 | print(type(hash(gen()))) 8 | -------------------------------------------------------------------------------- /tests/basics/builtin_hex.py: -------------------------------------------------------------------------------- 1 | # test builtin hex function 2 | 3 | print(hex(1)) 4 | print(hex(-1)) 5 | print(hex(15)) 6 | print(hex(-15)) 7 | 8 | print(hex(12345)) 9 | print(hex(0x12345)) 10 | -------------------------------------------------------------------------------- /tests/basics/builtin_hex_intbig.py: -------------------------------------------------------------------------------- 1 | # test builtin hex function 2 | 3 | print(hex(12345678901234567890)) 4 | print(hex(0x12345678901234567890)) 5 | -------------------------------------------------------------------------------- /tests/basics/builtin_id.py: -------------------------------------------------------------------------------- 1 | print(id(1) == id(2)) 2 | print(id(None) == id(None)) 3 | # This can't be true per Python semantics, just CPython implementation detail 4 | #print(id([]) == id([])) 5 | 6 | l = [1, 2] 7 | print(id(l) == id(l)) 8 | 9 | f = lambda:None 10 | print(id(f) == id(f)) 11 | -------------------------------------------------------------------------------- /tests/basics/builtin_issubclass.py: -------------------------------------------------------------------------------- 1 | # test builtin issubclass 2 | 3 | class A: 4 | pass 5 | 6 | print(issubclass(A, A)) 7 | print(issubclass(A, (A,))) 8 | 9 | try: 10 | issubclass(A, 1) 11 | except TypeError: 12 | print('TypeError') 13 | 14 | try: 15 | issubclass('a', 1) 16 | except TypeError: 17 | print('TypeError') 18 | -------------------------------------------------------------------------------- /tests/basics/builtin_len1.py: -------------------------------------------------------------------------------- 1 | # builtin len 2 | 3 | print(len(())) 4 | print(len((1,))) 5 | print(len((1, 2))) 6 | 7 | print(len([])) 8 | x = [1, 2, 3] 9 | print(len(x)) 10 | 11 | f = len 12 | print(f({})) 13 | print(f({1:2, 3:4})) 14 | -------------------------------------------------------------------------------- /tests/basics/builtin_locals.py: -------------------------------------------------------------------------------- 1 | # test builtin locals() 2 | 3 | x = 123 4 | print(locals()['x']) 5 | 6 | class A: 7 | y = 1 8 | def f(self): 9 | pass 10 | 11 | print('x' in locals()) 12 | print(locals()['y']) 13 | print('f' in locals()) 14 | -------------------------------------------------------------------------------- /tests/basics/builtin_map.py: -------------------------------------------------------------------------------- 1 | print(list(map(lambda x: x & 1, range(-3, 4)))) 2 | print(list(map(abs, range(-3, 4)))) 3 | print(list(map(tuple, [[i] for i in range(-3, 4)]))) 4 | print(list(map(pow, range(4), range(4)))) 5 | -------------------------------------------------------------------------------- /tests/basics/builtin_oct.py: -------------------------------------------------------------------------------- 1 | # test builtin oct function 2 | 3 | print(oct(1)) 4 | print(oct(-1)) 5 | print(oct(15)) 6 | print(oct(-15)) 7 | 8 | print(oct(12345)) 9 | print(oct(0o12345)) 10 | -------------------------------------------------------------------------------- /tests/basics/builtin_oct_intbig.py: -------------------------------------------------------------------------------- 1 | # test builtin oct function 2 | 3 | print(oct(12345678901234567890)) 4 | print(oct(0o12345670123456701234)) 5 | -------------------------------------------------------------------------------- /tests/basics/builtin_pow.py: -------------------------------------------------------------------------------- 1 | # test builtin pow() with integral values 2 | # 2 arg version 3 | 4 | print(pow(0, 1)) 5 | print(pow(1, 0)) 6 | print(pow(-2, 3)) 7 | print(pow(3, 8)) 8 | -------------------------------------------------------------------------------- /tests/basics/builtin_round.py: -------------------------------------------------------------------------------- 1 | # test round() with integral values 2 | 3 | tests = [ 4 | False, True, 5 | 0, 1, -1, 10 6 | ] 7 | for t in tests: 8 | print(round(t)) 9 | -------------------------------------------------------------------------------- /tests/basics/builtin_slice.py: -------------------------------------------------------------------------------- 1 | # test builtin slice 2 | 3 | # print slice 4 | class A: 5 | def __getitem__(self, idx): 6 | print(idx) 7 | return idx 8 | s = A()[1:2:3] 9 | 10 | # check type 11 | print(type(s) is slice) 12 | -------------------------------------------------------------------------------- /tests/basics/builtin_sum.py: -------------------------------------------------------------------------------- 1 | # test builtin "sum" 2 | 3 | tests = ( 4 | (), 5 | [], 6 | [0], 7 | [1], 8 | [0, 1, 2], 9 | range(10), 10 | ) 11 | 12 | for test in tests: 13 | print(sum(test)) 14 | print(sum(test, -2)) 15 | -------------------------------------------------------------------------------- /tests/basics/builtin_type.py: -------------------------------------------------------------------------------- 1 | # test builtin type 2 | 3 | print(type(int)) 4 | 5 | try: 6 | type() 7 | except TypeError: 8 | print('TypeError') 9 | 10 | try: 11 | type(1, 2) 12 | except TypeError: 13 | print('TypeError') 14 | -------------------------------------------------------------------------------- /tests/basics/builtin_zip.py: -------------------------------------------------------------------------------- 1 | try: 2 | zip 3 | set 4 | except NameError: 5 | print("SKIP") 6 | raise SystemExit 7 | 8 | print(list(zip())) 9 | print(list(zip([1], set([2, 3])))) 10 | -------------------------------------------------------------------------------- /tests/basics/bytearray_append.py: -------------------------------------------------------------------------------- 1 | # test bytearray.append method 2 | 3 | a = bytearray(4) 4 | print(a) 5 | 6 | # append should append a single byte 7 | a.append(2) 8 | print(a) 9 | 10 | # a should not be modified if append fails 11 | try: 12 | a.append(None) 13 | except TypeError: 14 | print('TypeError') 15 | print(a) 16 | -------------------------------------------------------------------------------- /tests/basics/bytearray_construct.py: -------------------------------------------------------------------------------- 1 | # test construction of bytearray from different objects 2 | 3 | # bytes, tuple, list 4 | print(bytearray(b'123')) 5 | print(bytearray((1, 2))) 6 | print(bytearray([1, 2])) 7 | -------------------------------------------------------------------------------- /tests/basics/bytearray_construct_array.py: -------------------------------------------------------------------------------- 1 | # test construction of bytearray from different objects 2 | try: 3 | from array import array 4 | except ImportError: 5 | print("SKIP") 6 | raise SystemExit 7 | 8 | # arrays 9 | print(bytearray(array('b', [1, 2]))) 10 | print(bytearray(array('h', [0x101, 0x202]))) 11 | -------------------------------------------------------------------------------- /tests/basics/bytearray_construct_endian.py: -------------------------------------------------------------------------------- 1 | # test construction of bytearray from different objects 2 | try: 3 | from array import array 4 | except ImportError: 5 | print("SKIP") 6 | raise SystemExit 7 | 8 | # arrays 9 | print(bytearray(array('h', [1, 2]))) 10 | print(bytearray(array('I', [1, 2]))) 11 | -------------------------------------------------------------------------------- /tests/basics/bytearray_intbig.py: -------------------------------------------------------------------------------- 1 | print(bytearray(2**65 - (2**65 - 1))) 2 | -------------------------------------------------------------------------------- /tests/basics/bytes_add.py: -------------------------------------------------------------------------------- 1 | # test bytes + other 2 | 3 | print(b"123" + b"456") 4 | print(b"123" + bytearray(2)) 5 | 6 | print(b"123" + b"") # RHS is empty, can be optimised 7 | print(b"" + b"123") # LHS is empty, can be optimised 8 | print(b"" + bytearray(1)) # LHS is empty but can't be optimised 9 | -------------------------------------------------------------------------------- /tests/basics/bytes_add_array.py: -------------------------------------------------------------------------------- 1 | # test bytes + other 2 | try: 3 | import array 4 | except ImportError: 5 | print("SKIP") 6 | raise SystemExit 7 | 8 | # should be byteorder-neutral 9 | print(b"123" + array.array('h', [0x1515])) 10 | 11 | print(b"\x01\x02" + array.array('b', [1, 2])) 12 | -------------------------------------------------------------------------------- /tests/basics/bytes_add_endian.py: -------------------------------------------------------------------------------- 1 | # test bytes + other 2 | try: 3 | import array 4 | except ImportError: 5 | print("SKIP") 6 | raise SystemExit 7 | 8 | print(b"123" + array.array('i', [1])) 9 | -------------------------------------------------------------------------------- /tests/basics/bytes_compare2.py: -------------------------------------------------------------------------------- 1 | print(b"1" == 1) 2 | print(b"123" == bytearray(b"123")) 3 | print(b'123' < bytearray(b"124")) 4 | print(b'123' > bytearray(b"122")) 5 | print(bytearray(b"23") in b"1234") 6 | -------------------------------------------------------------------------------- /tests/basics/bytes_compare3.py.exp: -------------------------------------------------------------------------------- 1 | ######## 2 | False 3 | ######## 4 | False 5 | -------------------------------------------------------------------------------- /tests/basics/bytes_compare_array.py: -------------------------------------------------------------------------------- 1 | try: 2 | import array 3 | except ImportError: 4 | print("SKIP") 5 | raise SystemExit 6 | 7 | print(array.array('b', [1, 2]) in b'\x01\x02\x03') 8 | # CPython gives False here 9 | #print(b"\x01\x02\x03" == array.array("B", [1, 2, 3])) 10 | -------------------------------------------------------------------------------- /tests/basics/bytes_construct_array.py: -------------------------------------------------------------------------------- 1 | # test construction of bytes from different objects 2 | try: 3 | from array import array 4 | except ImportError: 5 | print("SKIP") 6 | raise SystemExit 7 | 8 | # arrays 9 | print(bytes(array('b', [1, 2]))) 10 | print(bytes(array('h', [0x101, 0x202]))) 11 | -------------------------------------------------------------------------------- /tests/basics/bytes_construct_endian.py: -------------------------------------------------------------------------------- 1 | # test construction of bytes from different objects 2 | 3 | try: 4 | from array import array 5 | except ImportError: 6 | print("SKIP") 7 | raise SystemExit 8 | 9 | # arrays 10 | print(bytes(array('h', [1, 2]))) 11 | print(bytes(array('I', [1, 2]))) 12 | -------------------------------------------------------------------------------- /tests/basics/bytes_construct_intbig.py: -------------------------------------------------------------------------------- 1 | # test construction of bytes from different objects 2 | 3 | # long ints 4 | print(ord(bytes([14953042807679334000 & 0xff]))) 5 | -------------------------------------------------------------------------------- /tests/basics/bytes_format_modulo.py: -------------------------------------------------------------------------------- 1 | # This test requires CPython3.5 2 | print(b"%%" % ()) 3 | print(b"=%d=" % 1) 4 | print(b"=%d=%d=" % (1, 2)) 5 | 6 | print(b"=%s=" % b"str") 7 | print(b"=%r=" % b"str") 8 | -------------------------------------------------------------------------------- /tests/basics/bytes_format_modulo.py.exp: -------------------------------------------------------------------------------- 1 | b'%' 2 | b'=1=' 3 | b'=1=2=' 4 | b'=str=' 5 | b"=b'str'=" 6 | -------------------------------------------------------------------------------- /tests/basics/bytes_gen.py: -------------------------------------------------------------------------------- 1 | # construct a bytes object from a generator 2 | def gen(): 3 | for i in range(4): 4 | yield i 5 | print(bytes(gen())) 6 | -------------------------------------------------------------------------------- /tests/basics/bytes_mult.py: -------------------------------------------------------------------------------- 1 | # basic multiplication 2 | print(b'0' * 5) 3 | 4 | # check negative, 0, positive; lhs and rhs multiplication 5 | for i in (-4, -2, 0, 2, 4): 6 | print(i * b'12') 7 | print(b'12' * i) 8 | 9 | # check that we don't modify existing object 10 | a = b'123' 11 | c = a * 3 12 | print(a, c) 13 | -------------------------------------------------------------------------------- /tests/basics/bytes_subscr.py: -------------------------------------------------------------------------------- 1 | # test [...] of bytes 2 | 3 | print(b'123'[0]) 4 | print(b'123'[1]) 5 | print(b'123'[-1]) 6 | 7 | try: 8 | b'123'[1] = 4 9 | except TypeError: 10 | print('TypeError') 11 | 12 | try: 13 | del b'123'[1] 14 | except TypeError: 15 | print('TypeError') 16 | -------------------------------------------------------------------------------- /tests/basics/class_call.py: -------------------------------------------------------------------------------- 1 | class C1: 2 | def __call__(self, val): 3 | print('call', val) 4 | return 'item' 5 | 6 | class C2: 7 | 8 | def __getattr__(self, k): 9 | pass 10 | 11 | c1 = C1() 12 | print(c1(1)) 13 | 14 | c2 = C2() 15 | try: 16 | print(c2(1)) 17 | except TypeError: 18 | print("TypeError") 19 | -------------------------------------------------------------------------------- /tests/basics/class_emptybases.py: -------------------------------------------------------------------------------- 1 | class A(): 2 | pass 3 | -------------------------------------------------------------------------------- /tests/basics/class_instance_override.py: -------------------------------------------------------------------------------- 1 | # test that we can override a class method with an instance method 2 | 3 | class A: 4 | def foo(self): 5 | return 1 6 | 7 | a = A() 8 | print(a.foo()) 9 | a.foo = lambda:2 10 | print(a.foo()) 11 | -------------------------------------------------------------------------------- /tests/basics/class_misc.py: -------------------------------------------------------------------------------- 1 | # converting user instance to buffer 2 | class C: 3 | pass 4 | 5 | c = C() 6 | try: 7 | d = bytearray(c) 8 | except TypeError: 9 | print('TypeError') 10 | -------------------------------------------------------------------------------- /tests/basics/class_store.py: -------------------------------------------------------------------------------- 1 | # store to class vs instance 2 | 3 | class C: 4 | pass 5 | 6 | c = C() 7 | c.x = 1 8 | print(c.x) 9 | C.x = 2 10 | C.y = 3 11 | print(c.x, c.y) 12 | print(C.x, C.y) 13 | print(C().x, C().y) 14 | c = C() 15 | print(c.x) 16 | c.x = 4 17 | print(c.x) 18 | -------------------------------------------------------------------------------- /tests/basics/class_super_aslocal.py: -------------------------------------------------------------------------------- 1 | # test using the name "super" as a local variable 2 | 3 | class A: 4 | def foo(self): 5 | super = [1, 2] 6 | super.pop() 7 | print(super) 8 | 9 | A().foo() 10 | -------------------------------------------------------------------------------- /tests/basics/class_super_multinherit.py: -------------------------------------------------------------------------------- 1 | # test super with multiple inheritance 2 | 3 | class A: 4 | def foo(self): 5 | print('A.foo') 6 | 7 | class B: 8 | def foo(self): 9 | print('B.foo') 10 | 11 | class C(A, B): 12 | def foo(self): 13 | print('C.foo') 14 | super().foo() 15 | 16 | C().foo() 17 | -------------------------------------------------------------------------------- /tests/basics/class_use_other.py: -------------------------------------------------------------------------------- 1 | # check that we can use an instance of B in a method of A 2 | 3 | class A: 4 | def store(a, b): 5 | a.value = b 6 | 7 | class B: 8 | pass 9 | 10 | b = B() 11 | A.store(b, 1) 12 | print(b.value) 13 | -------------------------------------------------------------------------------- /tests/basics/closure1.py: -------------------------------------------------------------------------------- 1 | # closures 2 | 3 | def f(x): 4 | y = 2 * x 5 | def g(z): 6 | return y + z 7 | return g 8 | 9 | print(f(1)(1)) 10 | 11 | x = f(2) 12 | y = f(3) 13 | print(x(1), x(2), x(3)) 14 | print(y(1), y(2), y(3)) 15 | print(x(1), x(2), x(3)) 16 | print(y(1), y(2), y(3)) 17 | -------------------------------------------------------------------------------- /tests/basics/closure2.py: -------------------------------------------------------------------------------- 1 | # closures; closing over an argument 2 | 3 | def f(x): 4 | y = 2 * x 5 | def g(z): 6 | return x + y + z 7 | return g 8 | 9 | print(f(1)(1)) 10 | 11 | x = f(2) 12 | y = f(3) 13 | print(x(1), x(2), x(3)) 14 | print(y(1), y(2), y(3)) 15 | print(x(1), x(2), x(3)) 16 | print(y(1), y(2), y(3)) 17 | -------------------------------------------------------------------------------- /tests/basics/closure_defargs.py: -------------------------------------------------------------------------------- 1 | # test closure with default args 2 | 3 | def f(): 4 | a = 1 5 | def bar(b = 10, c = 20): 6 | print(a + b + c) 7 | bar() 8 | bar(2) 9 | bar(2, 3) 10 | 11 | print(f()) 12 | -------------------------------------------------------------------------------- /tests/basics/closure_manyvars.py: -------------------------------------------------------------------------------- 1 | # test closure with lots of closed over variables 2 | 3 | def f(): 4 | a, b, c, d, e, f, g, h = [i for i in range(8)] 5 | def x(): 6 | print(a, b, c, d, e, f, g, h) 7 | x() 8 | 9 | f() 10 | -------------------------------------------------------------------------------- /tests/basics/closure_namedarg.py: -------------------------------------------------------------------------------- 1 | # test passing named arg to closed-over function 2 | 3 | def f(): 4 | x = 1 5 | def g(z): 6 | print(x, z) 7 | return g 8 | 9 | f()(z=42) 10 | -------------------------------------------------------------------------------- /tests/basics/compare_multi.py: -------------------------------------------------------------------------------- 1 | print(1 < 2 < 3) 2 | print(1 < 2 < 3 < 4) 3 | print(1 > 2 < 3) 4 | print(1 < 2 > 3) 5 | -------------------------------------------------------------------------------- /tests/basics/continue.py: -------------------------------------------------------------------------------- 1 | for i in range(4): 2 | print('one', i) 3 | if i > 2: 4 | continue 5 | print('two', i) 6 | 7 | for i in range(4): 8 | print('one', i) 9 | if i < 2: 10 | continue 11 | print('two', i) 12 | 13 | for i in [1, 2, 3, 4]: 14 | if i == 3: 15 | continue 16 | print(i) 17 | -------------------------------------------------------------------------------- /tests/basics/del_name.py: -------------------------------------------------------------------------------- 1 | # del name 2 | 3 | x = 1 4 | print(x) 5 | del x 6 | try: 7 | print(x) 8 | except NameError: 9 | print("NameError") 10 | try: 11 | del x 12 | except: # NameError: 13 | # FIXME uPy returns KeyError for this 14 | print("NameError") 15 | 16 | class C: 17 | def f(): 18 | pass 19 | -------------------------------------------------------------------------------- /tests/basics/del_subscr.py: -------------------------------------------------------------------------------- 1 | l = [1, 2, 3] 2 | print(l) 3 | del l[0] 4 | print(l) 5 | del l[-1] 6 | print(l) 7 | 8 | d = {1:2, 3:4, 5:6} 9 | del d[1] 10 | del d[3] 11 | print(d) 12 | del d[5] 13 | print(d) 14 | 15 | # delete nested subscr 16 | d = {0:{0:0}} 17 | del d[0][0] 18 | print(d) 19 | -------------------------------------------------------------------------------- /tests/basics/deque2.py.exp: -------------------------------------------------------------------------------- 1 | ValueError 2 | ValueError 3 | TypeError 4 | IndexError 5 | None 6 | 1 7 | 2 8 | 3 4 9 | IndexError('empty',) 10 | 2 11 | IndexError('full',) 12 | 2 13 | 5 6 14 | 0 15 | IndexError('empty',) 16 | -------------------------------------------------------------------------------- /tests/basics/dict2.py: -------------------------------------------------------------------------------- 1 | # using strings as keys in dict 2 | 3 | d = {'1': 1, '2': 2} 4 | print(d['1'], d['2']) 5 | 6 | d['3'] = 3 7 | print(d['1'], d['2'], d['3']) 8 | 9 | d['2'] = 222 10 | print(d['1'], d['2'], d['3']) 11 | 12 | d2 = dict(d) 13 | print('2' in d2) 14 | print(id(d) != id(d2), d == d2) 15 | -------------------------------------------------------------------------------- /tests/basics/dict_clear.py: -------------------------------------------------------------------------------- 1 | d = {1: 2, 3: 4} 2 | print(len(d)) 3 | d.clear() 4 | print(d) 5 | d[2] = 42 6 | print(d) 7 | -------------------------------------------------------------------------------- /tests/basics/dict_construct.py: -------------------------------------------------------------------------------- 1 | # dict constructor 2 | 3 | d = dict() 4 | print(d) 5 | 6 | d = dict({1:2}) 7 | print(d) 8 | 9 | d = dict(a=1) 10 | print(d) 11 | 12 | d = dict({1:2}, a=3) 13 | print(d[1], d['a']) 14 | 15 | d = dict([(1, 2)], a=3, b=4) 16 | print(d[1], d['a'], d['b']) 17 | -------------------------------------------------------------------------------- /tests/basics/dict_copy.py: -------------------------------------------------------------------------------- 1 | a = {i: 2*i for i in range(100)} 2 | b = a.copy() 3 | for i in range(100): 4 | print(i, b[i]) 5 | print(len(b)) 6 | -------------------------------------------------------------------------------- /tests/basics/dict_fixed.py.exp: -------------------------------------------------------------------------------- 1 | TypeError 2 | TypeError 3 | TypeError 4 | TypeError 5 | TypeError 6 | TypeError 7 | TypeError 8 | -------------------------------------------------------------------------------- /tests/basics/dict_fromkeys.py: -------------------------------------------------------------------------------- 1 | d = dict.fromkeys([1, 2, 3, 4]) 2 | l = list(d.keys()) 3 | l.sort() 4 | print(l) 5 | 6 | d = dict.fromkeys([1, 2, 3, 4], 42) 7 | l = list(d.values()) 8 | l.sort() 9 | print(l) 10 | -------------------------------------------------------------------------------- /tests/basics/dict_fromkeys2.py: -------------------------------------------------------------------------------- 1 | try: 2 | reversed 3 | except: 4 | print("SKIP") 5 | raise SystemExit 6 | 7 | # argument to fromkeys has no __len__ 8 | d = dict.fromkeys(reversed(range(1))) 9 | #d = dict.fromkeys((x for x in range(1))) 10 | print(d) 11 | -------------------------------------------------------------------------------- /tests/basics/dict_get.py: -------------------------------------------------------------------------------- 1 | for d in {}, {42:2}: 2 | print(d.get(42)) 3 | print(d.get(42,2)) 4 | -------------------------------------------------------------------------------- /tests/basics/dict_iterator.py: -------------------------------------------------------------------------------- 1 | d = {1: 2, 3: 4} 2 | els = [] 3 | for i in d: 4 | els.append((i, d[i])) 5 | print(sorted(els)) 6 | -------------------------------------------------------------------------------- /tests/basics/dict_pop.py: -------------------------------------------------------------------------------- 1 | d = {1: 2, 3: 4} 2 | print(d.pop(3), d) 3 | print(d) 4 | print(d.pop(1, 42), d) 5 | print(d.pop(1, 42), d) 6 | print(d.pop(1, None), d) 7 | try: 8 | print(d.pop(1), "!!!",) 9 | except KeyError: 10 | print("Raised KeyError") 11 | else: 12 | print("Did not rise KeyError!") 13 | -------------------------------------------------------------------------------- /tests/basics/dict_setdefault.py: -------------------------------------------------------------------------------- 1 | d = {} 2 | print(d.setdefault(1)) 3 | print(d.setdefault(1)) 4 | print(d.setdefault(5, 42)) 5 | print(d.setdefault(5, 1)) 6 | print(d[1]) 7 | print(d[5]) 8 | d.pop(5) 9 | print(d.setdefault(5, 1)) 10 | print(d[1]) 11 | print(d[5]) 12 | 13 | 14 | -------------------------------------------------------------------------------- /tests/basics/dict_specialmeth.py: -------------------------------------------------------------------------------- 1 | # dict object with special methods 2 | 3 | d = {} 4 | d.__setitem__('2', 'two') 5 | print(d.__getitem__('2')) 6 | d.__delitem__('2') 7 | print(d) 8 | -------------------------------------------------------------------------------- /tests/basics/dict_update.py: -------------------------------------------------------------------------------- 1 | d = {1:2, 3:4} 2 | print(len(d)) 3 | d.update(["ab"]) 4 | print(d[1]) 5 | print(d[3]) 6 | print(d["a"]) 7 | print(len(d)) 8 | d.update([(1,4)]) 9 | print(d[1]) 10 | print(len(d)) 11 | 12 | # using keywords 13 | d.update(a=5) 14 | print(d['a']) 15 | d.update([(1,5)], b=6) 16 | print(d[1], d['b']) 17 | -------------------------------------------------------------------------------- /tests/basics/errno1.py.exp: -------------------------------------------------------------------------------- 1 | 2 | [Errno ] EIO 3 | 9999 4 | uerrno 5 | -------------------------------------------------------------------------------- /tests/basics/exception_chain.py: -------------------------------------------------------------------------------- 1 | # Exception chaining is not supported, but check that basic 2 | # exception works as expected. 3 | try: 4 | raise Exception from None 5 | except Exception: 6 | print("Caught Exception") 7 | -------------------------------------------------------------------------------- /tests/basics/exception_chain.py.exp: -------------------------------------------------------------------------------- 1 | Warning: exception chaining not supported 2 | Caught Exception 3 | -------------------------------------------------------------------------------- /tests/basics/floordivide.py: -------------------------------------------------------------------------------- 1 | # check modulo matches python definition 2 | 3 | # This tests compiler version 4 | print(123 // 7) 5 | print(-123 // 7) 6 | print(123 // -7) 7 | print(-123 // -7) 8 | 9 | a = 10000001 10 | b = 10000000 11 | print(a // b) 12 | print(a // -b) 13 | print(-a // b) 14 | print(-a // -b) 15 | -------------------------------------------------------------------------------- /tests/basics/for2.py: -------------------------------------------------------------------------------- 1 | i = 'init' 2 | for i in range(0): 3 | pass 4 | print(i) # should not have been modified 5 | 6 | for i in range(10): 7 | pass 8 | print(i) # should be last successful value of loop 9 | -------------------------------------------------------------------------------- /tests/basics/for3.py: -------------------------------------------------------------------------------- 1 | # test assigning to iterator within the loop 2 | for i in range(2): 3 | print(i) 4 | i = 2 5 | 6 | # test assigning to range parameter within the loop 7 | # (since we optimise for loops, this needs checking, currently it fails) 8 | n = 2 9 | for i in range(n): 10 | print(i) 11 | n = 0 12 | -------------------------------------------------------------------------------- /tests/basics/for_return.py: -------------------------------------------------------------------------------- 1 | # test returning from within a for loop 2 | 3 | def f(): 4 | for i in [1, 2, 3]: 5 | return i 6 | 7 | print(f()) 8 | -------------------------------------------------------------------------------- /tests/basics/frozenset_copy.py: -------------------------------------------------------------------------------- 1 | try: 2 | frozenset 3 | except NameError: 4 | print("SKIP") 5 | raise SystemExit 6 | 7 | s = frozenset({1, 2, 3, 4}) 8 | t = s.copy() 9 | print(type(t)) 10 | for i in s, t: 11 | print(sorted(i)) 12 | -------------------------------------------------------------------------------- /tests/basics/fun1.py: -------------------------------------------------------------------------------- 1 | # calling a function 2 | 3 | def f(): 4 | print(1) 5 | f() 6 | -------------------------------------------------------------------------------- /tests/basics/fun2.py: -------------------------------------------------------------------------------- 1 | # calling a function from a function 2 | 3 | def f(x): 4 | print(x + 1) 5 | 6 | def g(x): 7 | f(2 * x) 8 | f(4 * x) 9 | 10 | g(3) 11 | -------------------------------------------------------------------------------- /tests/basics/fun3.py: -------------------------------------------------------------------------------- 1 | # function with large number of arguments 2 | 3 | def fun(a, b, c, d, e, f, g): 4 | return a + b + c * d + e * f * g 5 | 6 | print(fun(1, 2, 3, 4, 5, 6, 7)) 7 | -------------------------------------------------------------------------------- /tests/basics/fun_annotations.py: -------------------------------------------------------------------------------- 1 | def foo(x: int, y: list) -> dict: 2 | return {x: y} 3 | 4 | print(foo(1, [2, 3])) 5 | -------------------------------------------------------------------------------- /tests/basics/fun_error2.py: -------------------------------------------------------------------------------- 1 | # test errors from bad function calls 2 | try: 3 | enumerate 4 | except: 5 | print("SKIP") 6 | raise SystemExit 7 | 8 | # function with keyword args not given a specific keyword arg 9 | try: 10 | enumerate() 11 | except TypeError: 12 | print('TypeError') 13 | -------------------------------------------------------------------------------- /tests/basics/fun_str.py: -------------------------------------------------------------------------------- 1 | # test str of function 2 | 3 | def f(): 4 | pass 5 | print(str(f)[:8]) 6 | -------------------------------------------------------------------------------- /tests/basics/gen_yield_from_exc.py: -------------------------------------------------------------------------------- 1 | def gen(): 2 | yield 1 3 | yield 2 4 | raise ValueError 5 | 6 | def gen2(): 7 | try: 8 | print((yield from gen())) 9 | except ValueError: 10 | print("caught ValueError from downstream") 11 | 12 | g = gen2() 13 | print(list(g)) 14 | -------------------------------------------------------------------------------- /tests/basics/gen_yield_from_iter.py: -------------------------------------------------------------------------------- 1 | def gen(): 2 | yield from (1, 2, 3) 3 | 4 | def gen2(): 5 | yield from gen() 6 | 7 | def gen3(): 8 | yield from (4, 5) 9 | yield 6 10 | 11 | print(list(gen())) 12 | print(list(gen2())) 13 | print(list(gen3())) 14 | -------------------------------------------------------------------------------- /tests/basics/gen_yield_from_send.py: -------------------------------------------------------------------------------- 1 | def gen(): 2 | print("sent:", (yield 1)) 3 | yield 2 4 | 5 | def gen2(): 6 | print((yield from gen())) 7 | 8 | g = gen2() 9 | next(g) 10 | print("yielded:", g.send("val")) 11 | try: 12 | next(g) 13 | except StopIteration: 14 | print("StopIteration") 15 | -------------------------------------------------------------------------------- /tests/basics/generator2.py: -------------------------------------------------------------------------------- 1 | gen = (i for i in range(10)) 2 | for i in gen: 3 | print(i) 4 | -------------------------------------------------------------------------------- /tests/basics/generator_pend_throw.py.exp: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | raised ValueError() 4 | ret was: None 5 | TypeError 6 | -------------------------------------------------------------------------------- /tests/basics/generator_return.py: -------------------------------------------------------------------------------- 1 | def gen(): 2 | yield 1 3 | return 42 4 | 5 | g = gen() 6 | print(next(g)) 7 | try: 8 | print(next(g)) 9 | except StopIteration as e: 10 | print(repr(e)) 11 | -------------------------------------------------------------------------------- /tests/basics/getattr.py: -------------------------------------------------------------------------------- 1 | # test __getattr__ 2 | 3 | class A: 4 | def __init__(self, d): 5 | self.d = d 6 | 7 | def __getattr__(self, attr): 8 | return self.d[attr] 9 | 10 | a = A({'a':1, 'b':2}) 11 | print(a.a, a.b) 12 | -------------------------------------------------------------------------------- /tests/basics/ifexpr.py: -------------------------------------------------------------------------------- 1 | # test if-expressions 2 | 3 | print(1 if 0 else 2) 4 | print(3 if 1 else 4) 5 | 6 | def f(x): 7 | print('a' if x else 'b') 8 | f([]) 9 | f([1]) 10 | -------------------------------------------------------------------------------- /tests/basics/int2.py: -------------------------------------------------------------------------------- 1 | # test basic int operations 2 | 3 | # test conversion of bool on RHS of binary op 4 | a = False 5 | print(1 + a) 6 | a = True 7 | print(1 + a) 8 | -------------------------------------------------------------------------------- /tests/basics/int_big_cmp.py: -------------------------------------------------------------------------------- 1 | # test bignum comparisons 2 | 3 | i = 1 << 65 4 | 5 | print(i == 0) 6 | print(i != 0) 7 | print(i < 0) 8 | print(i > 0) 9 | print(i <= 0) 10 | print(i >= 0) 11 | -------------------------------------------------------------------------------- /tests/basics/int_big_pow.py: -------------------------------------------------------------------------------- 1 | # test bignum power 2 | 3 | i = 1 << 65 4 | 5 | print(0 ** i) 6 | print(i ** 0) 7 | print(i ** 1) 8 | print(i ** 2) 9 | -------------------------------------------------------------------------------- /tests/basics/int_big_rshift.py: -------------------------------------------------------------------------------- 1 | i = 123456789012345678901234567890 2 | print(i >> 1) 3 | print(i >> 1000) 4 | 5 | # result needs rounding up 6 | i = -(1 << 70) 7 | print(i >> 80) 8 | i = -0xffffffffffffffff 9 | print(i >> 32) 10 | -------------------------------------------------------------------------------- /tests/basics/int_big_unary.py: -------------------------------------------------------------------------------- 1 | # test bignum unary operations 2 | 3 | i = 1 << 65 4 | 5 | print(bool(i)) 6 | print(+i) 7 | print(-i) 8 | print(~i) 9 | -------------------------------------------------------------------------------- /tests/basics/int_divmod.py: -------------------------------------------------------------------------------- 1 | # test integer floor division and modulo 2 | 3 | # test all combination of +/-/0 cases 4 | for i in range(-2, 3): 5 | for j in range(-4, 5): 6 | if j != 0: 7 | print(i, j, i // j, i % j, divmod(i, j)) 8 | -------------------------------------------------------------------------------- /tests/basics/int_divmod_intbig.py: -------------------------------------------------------------------------------- 1 | # test integer floor division and modulo 2 | 3 | # this tests bignum modulo 4 | a = 987654321987987987987987987987 5 | b = 19 6 | print(a % b) 7 | print(a % -b) 8 | print(-a % b) 9 | print(-a % -b) 10 | -------------------------------------------------------------------------------- /tests/basics/int_divzero.py: -------------------------------------------------------------------------------- 1 | try: 2 | 1 // 0 3 | except ZeroDivisionError: 4 | print("ZeroDivisionError") 5 | 6 | try: 7 | 1 % 0 8 | except ZeroDivisionError: 9 | print("ZeroDivisionError") 10 | -------------------------------------------------------------------------------- /tests/basics/is_isnot.py: -------------------------------------------------------------------------------- 1 | print(1 is 1) 2 | print(1 is 2) 3 | print(1 is not 1) 4 | print(1 is not 2) 5 | 6 | 7 | print([1, 2] is [1, 2]) 8 | a = [1, 2] 9 | b = a 10 | print(b is a) 11 | 12 | # TODO: strings require special "is" handling, postponed 13 | # until qstr refactor. 14 | #print("a" is "a") 15 | -------------------------------------------------------------------------------- /tests/basics/iter0.py: -------------------------------------------------------------------------------- 1 | # builtin type that is not iterable 2 | try: 3 | for i in 1: 4 | pass 5 | except TypeError: 6 | print('TypeError') 7 | 8 | # builtin type that is iterable, calling __next__ explicitly 9 | print(iter(range(4)).__next__()) 10 | -------------------------------------------------------------------------------- /tests/basics/iter_of_iter.py: -------------------------------------------------------------------------------- 1 | i = iter(iter((1, 2, 3))) 2 | print(list(i)) 3 | i = iter(iter([1, 2, 3])) 4 | print(list(i)) 5 | i = iter(iter({1:2, 3:4, 5:6})) 6 | print(sorted(i)) 7 | # set, see set_iter_of_iter.py 8 | -------------------------------------------------------------------------------- /tests/basics/lambda1.py: -------------------------------------------------------------------------------- 1 | # lambda 2 | 3 | f = lambda x, y: x + 3 * y 4 | print(f(3, 5)) 5 | -------------------------------------------------------------------------------- /tests/basics/lambda_defargs.py: -------------------------------------------------------------------------------- 1 | # test default args with lambda 2 | 3 | f = lambda x=1: x 4 | print(f(), f(2), f(x=3)) 5 | 6 | y = 'y' 7 | f = lambda x=y: x 8 | print(f()) 9 | 10 | f = lambda x, y=[]: (x, y) 11 | f(0)[1].append(1) 12 | print(f(1), f(x=2), f(3, 4), f(4, y=5)) 13 | -------------------------------------------------------------------------------- /tests/basics/list_clear.py: -------------------------------------------------------------------------------- 1 | # tests list.clear 2 | x = [1, 2, 3, 4] 3 | x.clear() 4 | print(x) 5 | -------------------------------------------------------------------------------- /tests/basics/list_copy.py: -------------------------------------------------------------------------------- 1 | # list copy tests 2 | a = [1, 2, []] 3 | b = a.copy() 4 | a[-1].append(1) 5 | a.append(4) 6 | print(a) 7 | print(b) 8 | -------------------------------------------------------------------------------- /tests/basics/list_count.py: -------------------------------------------------------------------------------- 1 | # list count tests 2 | a = [1, 2, 3] 3 | a = a + a + a 4 | b = [0, 0, a, 0, a, 0] 5 | print(a.count(2)) 6 | print(b.count(a)) 7 | -------------------------------------------------------------------------------- /tests/basics/list_insert.py: -------------------------------------------------------------------------------- 1 | a = [1, 2, 3] 2 | a.insert(1, 42) 3 | print(a) 4 | a.insert(-1, -1) 5 | print(a) 6 | a.insert(99, 99) 7 | print(a) 8 | a.insert(-99, -99) 9 | print(a) 10 | -------------------------------------------------------------------------------- /tests/basics/list_remove.py: -------------------------------------------------------------------------------- 1 | a = [1, 2, 3] 2 | print(a.remove(2)) 3 | print(a) 4 | try: 5 | a.remove(2) 6 | except ValueError: 7 | print("Raised ValueError") 8 | else: 9 | raise AssertionError("Did not raise ValueError") 10 | -------------------------------------------------------------------------------- /tests/basics/list_reverse.py: -------------------------------------------------------------------------------- 1 | a = [] 2 | for i in range(100): 3 | a.append(i) 4 | a.reverse() 5 | print(a) 6 | -------------------------------------------------------------------------------- /tests/basics/list_sum.py: -------------------------------------------------------------------------------- 1 | # list addition 2 | a = [1,2,3] 3 | b = [4,5,6] 4 | c = a + b 5 | print(c) 6 | -------------------------------------------------------------------------------- /tests/basics/memoryerror.py.exp: -------------------------------------------------------------------------------- 1 | MemoryError 2 | 1000 0 999 3 | MemoryError 4 | -------------------------------------------------------------------------------- /tests/basics/module1.py: -------------------------------------------------------------------------------- 1 | # test behaviour of module objects 2 | 3 | # this module should always exist 4 | import __main__ 5 | 6 | # print module 7 | print(repr(__main__).startswith(">65:]) 4 | print(list(range(10))[:(1<<66)>>65]) 5 | print(list(range(10))[::(1<<66)>>65]) 6 | -------------------------------------------------------------------------------- /tests/basics/string_center.py: -------------------------------------------------------------------------------- 1 | try: 2 | str.center 3 | except: 4 | print("SKIP") 5 | raise SystemExit 6 | 7 | print("foo".center(0)) 8 | print("foo".center(1)) 9 | print("foo".center(3)) 10 | print("foo".center(4)) 11 | print("foo".center(5)) 12 | print("foo".center(6)) 13 | print("foo".center(20)) 14 | -------------------------------------------------------------------------------- /tests/basics/string_cr_conversion.py: -------------------------------------------------------------------------------- 1 | # this file has CR line endings to test lexer's conversion of them to LF # in triple quoted strings print(repr("""abc def""")) -------------------------------------------------------------------------------- /tests/basics/string_crlf_conversion.py: -------------------------------------------------------------------------------- 1 | # this file has CRLF line endings to test lexer's conversion of them to LF 2 | # in triple quoted strings 3 | print(repr("""abc 4 | def""")) 5 | -------------------------------------------------------------------------------- /tests/basics/string_endswith_upy.py: -------------------------------------------------------------------------------- 1 | # MicroPython doesn't support tuple argument 2 | 3 | try: 4 | "foobar".endswith(("bar", "sth")) 5 | except TypeError: 6 | print("TypeError") 7 | -------------------------------------------------------------------------------- /tests/basics/string_endswith_upy.py.exp: -------------------------------------------------------------------------------- 1 | TypeError 2 | -------------------------------------------------------------------------------- /tests/basics/string_escape.py: -------------------------------------------------------------------------------- 1 | a = "a\1b" 2 | print(len(a)) 3 | print(ord(a[1])) 4 | print(len("a\123b")) 5 | a = "a\12345b" 6 | print(len(a)) 7 | print(ord(a[1])) 8 | 9 | a = "a\xffb" 10 | print(len(a)) 11 | print(ord(a[1])) 12 | -------------------------------------------------------------------------------- /tests/basics/string_mult.py: -------------------------------------------------------------------------------- 1 | # basic multiplication 2 | print('0' * 5) 3 | 4 | # check negative, 0, positive; lhs and rhs multiplication 5 | for i in (-4, -2, 0, 2, 4): 6 | print(i * '12') 7 | print('12' * i) 8 | 9 | # check that we don't modify existing object 10 | a = '123' 11 | c = a * 3 12 | print(a, c) 13 | -------------------------------------------------------------------------------- /tests/basics/string_repr.py: -------------------------------------------------------------------------------- 1 | # anything above 0xa0 is printed as Unicode by CPython 2 | # the abobe is CPython implementation detail, stick to ASCII 3 | for c in range(0x80): 4 | print("0x%02x: %s" % (c, repr(chr(c)))) 5 | -------------------------------------------------------------------------------- /tests/basics/string_startswith_upy.py: -------------------------------------------------------------------------------- 1 | # MicroPython doesn't support tuple argument 2 | 3 | try: 4 | "foobar".startswith(("foo", "sth")) 5 | except TypeError: 6 | print("TypeError") 7 | -------------------------------------------------------------------------------- /tests/basics/string_startswith_upy.py.exp: -------------------------------------------------------------------------------- 1 | TypeError 2 | -------------------------------------------------------------------------------- /tests/basics/string_upperlow.py: -------------------------------------------------------------------------------- 1 | print("".lower()) 2 | print(" t\tn\nr\rv\vf\f".upper()) 3 | print(" T E S T".lower()) 4 | print("*@a1b2cabc_[]/\\".upper()) 5 | -------------------------------------------------------------------------------- /tests/basics/struct_micropython.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | b'\x01\x00\x00\x00\x00\x00\x00\x00' 3 | -------------------------------------------------------------------------------- /tests/basics/subclass_native4.py: -------------------------------------------------------------------------------- 1 | # Test calling non-special method inherited from native type 2 | 3 | class mylist(list): 4 | pass 5 | 6 | l = mylist([1, 2, 3]) 7 | print(l) 8 | l.append(10) 9 | print(l) 10 | -------------------------------------------------------------------------------- /tests/basics/subclass_native5.py: -------------------------------------------------------------------------------- 1 | # Subclass from 2 bases explicitly subclasses from object 2 | 3 | class Base1(object): 4 | pass 5 | 6 | class Base2(object): 7 | pass 8 | 9 | class Sub(Base1, Base2): 10 | pass 11 | 12 | o = Sub() 13 | -------------------------------------------------------------------------------- /tests/basics/subclass_native_call.py.exp: -------------------------------------------------------------------------------- 1 | 42 2 | -------------------------------------------------------------------------------- /tests/basics/subclass_native_cmp.py: -------------------------------------------------------------------------------- 1 | # Test calling non-special method inherited from native type 2 | 3 | class mytuple(tuple): 4 | pass 5 | 6 | t = mytuple((1, 2, 3)) 7 | print(t) 8 | print(t == (1, 2, 3)) 9 | print((1, 2, 3) == t) 10 | -------------------------------------------------------------------------------- /tests/basics/subclass_native_iter.py: -------------------------------------------------------------------------------- 1 | # test subclassing a native type which can be iterated over 2 | 3 | class mymap(map): 4 | pass 5 | 6 | m = mymap(lambda x: x + 10, range(4)) 7 | print(list(m)) 8 | -------------------------------------------------------------------------------- /tests/basics/try1.py: -------------------------------------------------------------------------------- 1 | # basic exceptions 2 | x = 1 3 | try: 4 | x.a() 5 | except: 6 | print(x) 7 | 8 | try: 9 | raise IndexError 10 | except IndexError: 11 | print("caught") 12 | -------------------------------------------------------------------------------- /tests/basics/try3.py: -------------------------------------------------------------------------------- 1 | # nested exceptions 2 | 3 | def f(): 4 | try: 5 | foo() 6 | except: 7 | print("except 1") 8 | try: 9 | baz() 10 | except: 11 | print("except 2") 12 | bar() 13 | 14 | try: 15 | f() 16 | except: 17 | print("f except") 18 | -------------------------------------------------------------------------------- /tests/basics/try_as_var.py: -------------------------------------------------------------------------------- 1 | try: 2 | raise ValueError(534) 3 | except ValueError as e: 4 | print(repr(e)) 5 | 6 | # Var bound in except block is automatically deleted 7 | try: 8 | e 9 | except NameError: 10 | print("NameError") 11 | -------------------------------------------------------------------------------- /tests/basics/try_continue.py: -------------------------------------------------------------------------------- 1 | # test continue within exception handler 2 | 3 | def f(): 4 | lst = [1, 2, 3] 5 | for x in lst: 6 | print('a', x) 7 | try: 8 | if x == 2: 9 | raise Exception 10 | except Exception: 11 | continue 12 | print('b', x) 13 | f() 14 | -------------------------------------------------------------------------------- /tests/basics/try_error.py: -------------------------------------------------------------------------------- 1 | # test bad exception match 2 | 3 | try: 4 | try: 5 | a 6 | except 1: 7 | pass 8 | except TypeError: 9 | print("TypeError") 10 | 11 | try: 12 | try: 13 | a 14 | except (1,): 15 | pass 16 | except TypeError: 17 | print("TypeError") 18 | -------------------------------------------------------------------------------- /tests/basics/try_return.py: -------------------------------------------------------------------------------- 1 | # test use of return with try-except 2 | 3 | def f(l, i): 4 | try: 5 | return l[i] 6 | except IndexError: 7 | print('IndexError') 8 | return -1 9 | 10 | print(f([1], 0)) 11 | print(f([], 0)) 12 | -------------------------------------------------------------------------------- /tests/basics/tuple_count.py: -------------------------------------------------------------------------------- 1 | a = (1, 2, 3) 2 | a = a + a + a 3 | b = (0, 0, a, 0, a, 0) 4 | print(a.count(2)) 5 | print(b.count(a)) 6 | -------------------------------------------------------------------------------- /tests/basics/types2.py: -------------------------------------------------------------------------------- 1 | # Types are hashable 2 | print(hash(type) != 0) 3 | print(hash(int) != 0) 4 | print(hash(list) != 0) 5 | class Foo: pass 6 | print(hash(Foo) != 0) 7 | 8 | print(int == int) 9 | print(int != list) 10 | 11 | d = {} 12 | d[int] = list 13 | d[list] = int 14 | print(len(d)) 15 | -------------------------------------------------------------------------------- /tests/basics/while1.py: -------------------------------------------------------------------------------- 1 | # basic while loop 2 | 3 | x = 0 4 | while x < 2: 5 | y = 0 6 | while y < 2: 7 | z = 0 8 | while z < 2: 9 | z = z + 1 10 | print(x, y, z) 11 | y = y + 1 12 | x = x + 1 13 | -------------------------------------------------------------------------------- /tests/basics/while_nest_exc.py: -------------------------------------------------------------------------------- 1 | # test nested whiles within a try-except 2 | 3 | while 1: 4 | print(1) 5 | try: 6 | print(2) 7 | while 1: 8 | print(3) 9 | break 10 | except: 11 | print(4) 12 | print(5) 13 | break 14 | -------------------------------------------------------------------------------- /tests/basics/with_break.py: -------------------------------------------------------------------------------- 1 | class CtxMgr: 2 | 3 | def __enter__(self): 4 | print("__enter__") 5 | return self 6 | 7 | def __exit__(self, a, b, c): 8 | print("__exit__", repr(a), repr(b)) 9 | 10 | for i in range(5): 11 | print(i) 12 | with CtxMgr(): 13 | if i == 3: 14 | break 15 | -------------------------------------------------------------------------------- /tests/basics/with_continue.py: -------------------------------------------------------------------------------- 1 | class CtxMgr: 2 | 3 | def __enter__(self): 4 | print("__enter__") 5 | return self 6 | 7 | def __exit__(self, a, b, c): 8 | print("__exit__", repr(a), repr(b)) 9 | 10 | for i in range(5): 11 | print(i) 12 | with CtxMgr(): 13 | if i == 3: 14 | continue 15 | -------------------------------------------------------------------------------- /tests/bench/bench.py: -------------------------------------------------------------------------------- 1 | import time 2 | 3 | 4 | ITERS = 20000000 5 | 6 | def run(f): 7 | t = time.time() 8 | f(ITERS) 9 | t = time.time() - t 10 | print(t) 11 | -------------------------------------------------------------------------------- /tests/bench/bytealloc-1-bytes_n.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | def test(num): 4 | for i in iter(range(num // 1000)): 5 | bytes(10000) 6 | 7 | bench.run(test) 8 | -------------------------------------------------------------------------------- /tests/bench/bytealloc-2-repeat.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | def test(num): 4 | for i in iter(range(num // 1000)): 5 | b"\0" * 10000 6 | 7 | bench.run(test) 8 | -------------------------------------------------------------------------------- /tests/bench/bytebuf-1-inplace.py: -------------------------------------------------------------------------------- 1 | # Doing some operation on bytearray 2 | # Inplace - the most memory efficient way 3 | import bench 4 | 5 | def test(num): 6 | for i in iter(range(num//10000)): 7 | ba = bytearray(b"\0" * 1000) 8 | for i in range(len(ba)): 9 | ba[i] += 1 10 | 11 | bench.run(test) 12 | -------------------------------------------------------------------------------- /tests/bench/bytebuf-3-bytarray_map.py: -------------------------------------------------------------------------------- 1 | # Doing some operation on bytearray 2 | # No joins, but still map(). 3 | import bench 4 | 5 | def test(num): 6 | for i in iter(range(num//10000)): 7 | ba = bytearray(b"\0" * 1000) 8 | ba2 = bytearray(map(lambda x: x + 1, ba)) 9 | 10 | bench.run(test) 11 | -------------------------------------------------------------------------------- /tests/bench/from_iter-1-list_bound.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | def test(num): 4 | for i in iter(range(num//10000)): 5 | l = [0] * 1000 6 | l2 = list(l) 7 | 8 | bench.run(test) 9 | -------------------------------------------------------------------------------- /tests/bench/from_iter-2-list_unbound.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | def test(num): 4 | for i in iter(range(num//10000)): 5 | l = [0] * 1000 6 | l2 = list(map(lambda x: x, l)) 7 | 8 | bench.run(test) 9 | -------------------------------------------------------------------------------- /tests/bench/from_iter-3-tuple_bound.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | def test(num): 4 | for i in iter(range(num//10000)): 5 | l = [0] * 1000 6 | l2 = tuple(l) 7 | 8 | bench.run(test) 9 | -------------------------------------------------------------------------------- /tests/bench/from_iter-4-tuple_unbound.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | def test(num): 4 | for i in iter(range(num//10000)): 5 | l = [0] * 1000 6 | l2 = tuple(map(lambda x: x, l)) 7 | 8 | bench.run(test) 9 | -------------------------------------------------------------------------------- /tests/bench/from_iter-5-bytes_bound.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | def test(num): 4 | for i in iter(range(num//10000)): 5 | l = [0] * 1000 6 | l2 = bytes(l) 7 | 8 | bench.run(test) 9 | -------------------------------------------------------------------------------- /tests/bench/from_iter-6-bytes_unbound.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | def test(num): 4 | for i in iter(range(num//10000)): 5 | l = [0] * 1000 6 | l2 = bytes(map(lambda x: x, l)) 7 | 8 | bench.run(test) 9 | -------------------------------------------------------------------------------- /tests/bench/from_iter-7-bytearray_bound.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | def test(num): 4 | for i in iter(range(num//10000)): 5 | l = [0] * 1000 6 | l2 = bytearray(l) 7 | 8 | bench.run(test) 9 | -------------------------------------------------------------------------------- /tests/bench/from_iter-8-bytearray_unbound.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | def test(num): 4 | for i in iter(range(num//10000)): 5 | l = [0] * 1000 6 | l2 = bytearray(map(lambda x: x, l)) 7 | 8 | bench.run(test) 9 | -------------------------------------------------------------------------------- /tests/bench/func_args-1.1-pos_1.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | def func(a): 4 | pass 5 | 6 | def test(num): 7 | for i in iter(range(num)): 8 | func(i) 9 | 10 | bench.run(test) 11 | -------------------------------------------------------------------------------- /tests/bench/func_args-1.2-pos_3.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | def func(a, b, c): 4 | pass 5 | 6 | def test(num): 7 | for i in iter(range(num)): 8 | func(i, i, i) 9 | 10 | bench.run(test) 11 | -------------------------------------------------------------------------------- /tests/bench/func_args-2-pos_default_2_of_3.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | def func(a, b=1, c=2): 4 | pass 5 | 6 | def test(num): 7 | for i in iter(range(num)): 8 | func(i) 9 | 10 | bench.run(test) 11 | -------------------------------------------------------------------------------- /tests/bench/func_args-3.1-kw_1.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | def func(a): 4 | pass 5 | 6 | def test(num): 7 | for i in iter(range(num)): 8 | func(a=i) 9 | 10 | bench.run(test) 11 | -------------------------------------------------------------------------------- /tests/bench/func_args-3.2-kw_3.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | def func(a, b, c): 4 | pass 5 | 6 | def test(num): 7 | for i in iter(range(num)): 8 | func(c=i, b=i, a=i) 9 | 10 | bench.run(test) 11 | -------------------------------------------------------------------------------- /tests/bench/func_builtin-1-enum_pos.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | def test(num): 4 | for i in iter(range(num//20)): 5 | enumerate([1, 2], 1) 6 | 7 | bench.run(test) 8 | -------------------------------------------------------------------------------- /tests/bench/func_builtin-2-enum_kw.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | def test(num): 4 | for i in iter(range(num//20)): 5 | enumerate(iterable=[1, 2], start=1) 6 | 7 | bench.run(test) 8 | -------------------------------------------------------------------------------- /tests/bench/funcall-1-inline.py: -------------------------------------------------------------------------------- 1 | # Function call overhead test 2 | # Establish a baseline for performing a trivial operation inline 3 | import bench 4 | 5 | def test(num): 6 | for i in iter(range(num)): 7 | a = i + 1 8 | 9 | bench.run(test) 10 | -------------------------------------------------------------------------------- /tests/bench/funcall-2-funcall.py: -------------------------------------------------------------------------------- 1 | # Function call overhead test 2 | # Perform the same trivial operation as global function call 3 | import bench 4 | 5 | def f(x): 6 | return x + 1 7 | 8 | def test(num): 9 | for i in iter(range(num)): 10 | a = f(i) 11 | 12 | bench.run(test) 13 | -------------------------------------------------------------------------------- /tests/bench/loop_count-1-range.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | def test(num): 4 | for i in range(num): 5 | pass 6 | 7 | bench.run(test) 8 | -------------------------------------------------------------------------------- /tests/bench/loop_count-2-range_iter.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | def test(num): 4 | for i in iter(range(num)): 5 | pass 6 | 7 | bench.run(test) 8 | -------------------------------------------------------------------------------- /tests/bench/loop_count-3-while_up.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | def test(num): 4 | i = 0 5 | while i < num: 6 | i += 1 7 | 8 | bench.run(test) 9 | -------------------------------------------------------------------------------- /tests/bench/loop_count-4-while_down_gt.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | def test(num): 4 | while num > 0: 5 | num -= 1 6 | 7 | bench.run(test) 8 | -------------------------------------------------------------------------------- /tests/bench/loop_count-5-while_down_ne.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | def test(num): 4 | while num != 0: 5 | num -= 1 6 | 7 | bench.run(test) 8 | -------------------------------------------------------------------------------- /tests/bench/loop_count-5.1-while_down_ne_localvar.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | def test(num): 4 | zero = 0 5 | while num != zero: 6 | num -= 1 7 | 8 | bench.run(test) 9 | -------------------------------------------------------------------------------- /tests/bench/var-1-constant.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | def test(num): 4 | i = 0 5 | while i < 20000000: 6 | i += 1 7 | 8 | bench.run(test) 9 | -------------------------------------------------------------------------------- /tests/bench/var-2-global.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | ITERS = 20000000 4 | 5 | def test(num): 6 | i = 0 7 | while i < ITERS: 8 | i += 1 9 | 10 | bench.run(test) 11 | -------------------------------------------------------------------------------- /tests/bench/var-3-local.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def test(num): 5 | ITERS = 20000000 6 | i = 0 7 | while i < ITERS: 8 | i += 1 9 | 10 | bench.run(test) 11 | -------------------------------------------------------------------------------- /tests/bench/var-4-arg.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | 4 | def test(num): 5 | i = 0 6 | while i < num: 7 | i += 1 8 | 9 | bench.run(lambda n:test(20000000)) 10 | -------------------------------------------------------------------------------- /tests/bench/var-5-class-attr.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | class Foo: 4 | num = 20000000 5 | 6 | def test(num): 7 | i = 0 8 | while i < Foo.num: 9 | i += 1 10 | 11 | bench.run(test) 12 | -------------------------------------------------------------------------------- /tests/bench/var-6-instance-attr.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | class Foo: 4 | 5 | def __init__(self): 6 | self.num = 20000000 7 | 8 | def test(num): 9 | o = Foo() 10 | i = 0 11 | while i < o.num: 12 | i += 1 13 | 14 | bench.run(test) 15 | -------------------------------------------------------------------------------- /tests/bench/var-7-instance-meth.py: -------------------------------------------------------------------------------- 1 | import bench 2 | 3 | class Foo: 4 | 5 | def __init__(self): 6 | self._num = 20000000 7 | 8 | def num(self): 9 | return self._num 10 | 11 | def test(num): 12 | o = Foo() 13 | i = 0 14 | while i < o.num(): 15 | i += 1 16 | 17 | bench.run(test) 18 | -------------------------------------------------------------------------------- /tests/bench/var-8-namedtuple-1st.py: -------------------------------------------------------------------------------- 1 | import bench 2 | from ucollections import namedtuple 3 | 4 | T = namedtuple("Tup", ["num", "bar"]) 5 | 6 | def test(num): 7 | t = T(20000000, 0) 8 | i = 0 9 | while i < t.num: 10 | i += 1 11 | 12 | bench.run(test) 13 | -------------------------------------------------------------------------------- /tests/bench/var-8.1-namedtuple-5th.py: -------------------------------------------------------------------------------- 1 | import bench 2 | from ucollections import namedtuple 3 | 4 | T = namedtuple("Tup", ["foo1", "foo2", "foo3", "foo4", "num"]) 5 | 6 | def test(num): 7 | t = T(0, 0, 0, 0, 20000000) 8 | i = 0 9 | while i < t.num: 10 | i += 1 11 | 12 | bench.run(test) 13 | -------------------------------------------------------------------------------- /tests/cmdline/cmd_optimise.py: -------------------------------------------------------------------------------- 1 | # cmdline: -O 2 | # test optimisation output 3 | print(__debug__) 4 | assert 0 5 | -------------------------------------------------------------------------------- /tests/cmdline/cmd_optimise.py.exp: -------------------------------------------------------------------------------- 1 | False 2 | -------------------------------------------------------------------------------- /tests/cmdline/cmd_parsetree.py: -------------------------------------------------------------------------------- 1 | # cmdline: -v -v -v 2 | # test printing of the parse-tree 3 | 4 | for i in (): 5 | pass 6 | a = None 7 | b = 'str' 8 | c = 'a very long str that will not be interned' 9 | d = b'bytes' 10 | e = b'a very long bytes that will not be interned' 11 | f = 123456789012345678901234567890 12 | g = 123 13 | -------------------------------------------------------------------------------- /tests/cmdline/cmd_verbose.py: -------------------------------------------------------------------------------- 1 | # cmdline: -v -v 2 | # test verbose output 3 | print(1) 4 | -------------------------------------------------------------------------------- /tests/cmdline/repl_autocomplete.py: -------------------------------------------------------------------------------- 1 | # tests for autocompletion 2 | impo sys 3 | not_exist.  4 | not_exist  5 | x = '123' 6 | 1, x.isdi () 7 | i = str 8 | i.lowe ('ABC') 9 | None.  10 | -------------------------------------------------------------------------------- /tests/cmdline/repl_basic.py: -------------------------------------------------------------------------------- 1 | # basic REPL tests 2 | print(1) 3 |  4 | 2 5 | -------------------------------------------------------------------------------- /tests/cmdline/repl_basic.py.exp: -------------------------------------------------------------------------------- 1 | MicroPython \.\+ version 2 | Use \.\+ 3 | >>> # basic REPL tests 4 | >>> print(1) 5 | 1 6 | >>> print(1) 7 | 1 8 | >>> 2 9 | 2 10 | >>> 11 | -------------------------------------------------------------------------------- /tests/cmdline/repl_emacs_keys.py: -------------------------------------------------------------------------------- 1 | # REPL tests of GNU-ish readline navigation 2 | # history buffer navigation 3 | 1 4 | 2 5 | 3 6 |  7 |  8 | # input line motion 9 | t = 12 10 | 'boofar fbar' 11 | -------------------------------------------------------------------------------- /tests/cmdline/repl_emacs_keys.py.exp: -------------------------------------------------------------------------------- 1 | MicroPython \.\+ version 2 | Use \.\+ 3 | >>> # REPL tests of GNU-ish readline navigation 4 | >>> # history buffer navigation 5 | >>> 1 6 | 1 7 | >>> 2 8 | 2 9 | >>> 3 10 | 3 11 | >>> 321 12 | 1 13 | >>> 1323 14 | 3 15 | >>> # input line motion 16 | >>> t = 121 17 | >>> \.\+ 18 | 'foobar' 19 | >>> 20 | -------------------------------------------------------------------------------- /tests/cpydiff/core_function_userattr.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Core,Functions 3 | description: User-defined attributes for functions are not supported 4 | cause: MicroPython is highly optimized for memory usage. 5 | workaround: Use external dictionary, e.g. ``FUNC_X[f] = 0``. 6 | """ 7 | def f(): 8 | pass 9 | 10 | f.x = 0 11 | print(f.x) 12 | -------------------------------------------------------------------------------- /tests/cpydiff/modules/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/tests/cpydiff/modules/__init__.py -------------------------------------------------------------------------------- /tests/cpydiff/modules/foo.py: -------------------------------------------------------------------------------- 1 | print('foo') 2 | xxx 3 | -------------------------------------------------------------------------------- /tests/cpydiff/modules/subpkg/foo.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/tests/cpydiff/modules/subpkg/foo.py -------------------------------------------------------------------------------- /tests/cpydiff/modules2/subpkg/bar.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/tests/cpydiff/modules2/subpkg/bar.py -------------------------------------------------------------------------------- /tests/cpydiff/modules_array_containment.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Modules,array 3 | description: Looking for integer not implemented 4 | cause: Unknown 5 | workaround: Unknown 6 | """ 7 | import array 8 | print(1 in array.array('B', b'12')) 9 | -------------------------------------------------------------------------------- /tests/cpydiff/modules_array_deletion.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Modules,array 3 | description: Array deletion not implemented 4 | cause: Unknown 5 | workaround: Unknown 6 | """ 7 | import array 8 | a = array.array('b', (1, 2, 3)) 9 | del a[1] 10 | print(a) 11 | -------------------------------------------------------------------------------- /tests/cpydiff/modules_array_subscrstep.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Modules,array 3 | description: Subscript with step != 1 is not yet implemented 4 | cause: Unknown 5 | workaround: Unknown 6 | """ 7 | import array 8 | a = array.array('b', (1, 2, 3)) 9 | print(a[3:2:2]) 10 | -------------------------------------------------------------------------------- /tests/cpydiff/modules_deque.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Modules,deque 3 | description: Deque not implemented 4 | cause: Unknown 5 | workaround: Use regular lists. micropython-lib has implementation of collections.deque. 6 | """ 7 | import collections 8 | D = collections.deque() 9 | print(D) 10 | -------------------------------------------------------------------------------- /tests/cpydiff/modules_struct_fewargs.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Modules,struct 3 | description: Struct pack with too few args, not checked by uPy 4 | cause: Unknown 5 | workaround: Unknown 6 | """ 7 | import struct 8 | try: 9 | print(struct.pack('bb', 1)) 10 | print('Should not get here') 11 | except: 12 | print('struct.error') 13 | -------------------------------------------------------------------------------- /tests/cpydiff/modules_sys_stdassign.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Modules,sys 3 | description: Overriding sys.stdin, sys.stdout and sys.stderr not possible 4 | cause: They are stored in read-only memory. 5 | workaround: Unknown 6 | """ 7 | import sys 8 | sys.stdin = None 9 | print(sys.stdin) 10 | -------------------------------------------------------------------------------- /tests/cpydiff/syntax_unicode_nameesc.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Syntax,Unicode 3 | description: Unicode name escapes are not implemented 4 | cause: Unknown 5 | workaround: Unknown 6 | """ 7 | print("\N{LATIN SMALL LETTER A}") 8 | -------------------------------------------------------------------------------- /tests/cpydiff/types_bytearray_sliceassign.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Types,bytearray 3 | description: Array slice assignment with unsupported RHS 4 | cause: Unknown 5 | workaround: Unknown 6 | """ 7 | b = bytearray(4) 8 | b[0:1] = [1, 2] 9 | print(b) 10 | -------------------------------------------------------------------------------- /tests/cpydiff/types_bytes_keywords.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Types,bytes 3 | description: bytes() with keywords not implemented 4 | cause: Unknown 5 | workaround: Pass the encoding as a positional paramter, e.g. ``print(bytes('abc', 'utf-8'))`` 6 | """ 7 | print(bytes('abc', encoding='utf8')) 8 | -------------------------------------------------------------------------------- /tests/cpydiff/types_bytes_subscrstep.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Types,bytes 3 | description: Bytes subscription with step != 1 not implemented 4 | cause: MicroPython is highly optimized for memory usage. 5 | workaround: Use explicit loop for this very rare operation. 6 | """ 7 | print(b'123'[0:3:2]) 8 | -------------------------------------------------------------------------------- /tests/cpydiff/types_exception_chaining.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Types,Exception 3 | description: Exception chaining not implemented 4 | cause: Unknown 5 | workaround: Unknown 6 | """ 7 | try: 8 | raise TypeError 9 | except TypeError: 10 | raise ValueError 11 | -------------------------------------------------------------------------------- /tests/cpydiff/types_exception_instancevar.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Types,Exception 3 | description: User-defined attributes for builtin exceptions are not supported 4 | cause: MicroPython is highly optimized for memory usage. 5 | workaround: Use user-defined exception subclasses. 6 | """ 7 | e = Exception() 8 | e.x = 0 9 | print(e.x) 10 | -------------------------------------------------------------------------------- /tests/cpydiff/types_float_rounding.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Types,float 3 | description: uPy and CPython outputs formats may differ 4 | cause: Unknown 5 | workaround: Unknown 6 | """ 7 | print('%.1g' % -9.9) 8 | -------------------------------------------------------------------------------- /tests/cpydiff/types_list_delete_subscrstep.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Types,list 3 | description: List delete with step != 1 not implemented 4 | cause: Unknown 5 | workaround: Use explicit loop for this rare operation. 6 | """ 7 | l = [1, 2, 3, 4] 8 | del l[0:4:2] 9 | print(l) 10 | -------------------------------------------------------------------------------- /tests/cpydiff/types_list_store_noniter.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Types,list 3 | description: List slice-store with non-iterable on RHS is not implemented 4 | cause: RHS is restricted to be a tuple or list 5 | workaround: Use ``list()`` on RHS to convert the iterable to a list 6 | """ 7 | l = [10, 20] 8 | l[0:1] = range(4) 9 | print(l) 10 | -------------------------------------------------------------------------------- /tests/cpydiff/types_list_store_subscrstep.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Types,list 3 | description: List store with step != 1 not implemented 4 | cause: Unknown 5 | workaround: Use explicit loop for this rare operation. 6 | """ 7 | l = [1, 2, 3, 4] 8 | l[0:4:2] = [5, 6] 9 | print(l) 10 | -------------------------------------------------------------------------------- /tests/cpydiff/types_str_endswith.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Types,str 3 | description: Start/end indices such as str.endswith(s, start) not implemented 4 | cause: Unknown 5 | workaround: Unknown 6 | """ 7 | print('abc'.endswith('c', 1)) 8 | -------------------------------------------------------------------------------- /tests/cpydiff/types_str_formatsubscr.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Types,str 3 | description: Attributes/subscr not implemented 4 | cause: Unknown 5 | workaround: Unknown 6 | """ 7 | print('{a[0]}'.format(a=[1, 2])) 8 | -------------------------------------------------------------------------------- /tests/cpydiff/types_str_keywords.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Types,str 3 | description: str(...) with keywords not implemented 4 | cause: Unknown 5 | workaround: Input the encoding format directly. eg ``print(bytes('abc', 'utf-8'))`` 6 | """ 7 | print(str(b'abc', encoding='utf8')) 8 | -------------------------------------------------------------------------------- /tests/cpydiff/types_str_rsplitnone.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Types,str 3 | description: None as first argument for rsplit such as str.rsplit(None, n) not implemented 4 | cause: Unknown 5 | workaround: Unknown 6 | """ 7 | print('a a a'.rsplit(None, 1)) 8 | -------------------------------------------------------------------------------- /tests/cpydiff/types_str_subclassequality.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Types,str 3 | description: Instance of a subclass of str cannot be compared for equality with an instance of a str 4 | cause: Unknown 5 | workaround: Unknown 6 | """ 7 | class S(str): 8 | pass 9 | 10 | s = S('hello') 11 | print(s == 'hello') 12 | -------------------------------------------------------------------------------- /tests/cpydiff/types_str_subscrstep.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Types,str 3 | description: Subscript with step != 1 is not yet implemented 4 | cause: Unknown 5 | workaround: Unknown 6 | """ 7 | print('abcdefghi'[0:9:2]) 8 | -------------------------------------------------------------------------------- /tests/cpydiff/types_tuple_subscrstep.py: -------------------------------------------------------------------------------- 1 | """ 2 | categories: Types,tuple 3 | description: Tuple load with step != 1 not implemented 4 | cause: Unknown 5 | workaround: Unknown 6 | """ 7 | print((1, 2, 3, 4)[0:4:2]) 8 | -------------------------------------------------------------------------------- /tests/extmod/framebuf8.py.exp: -------------------------------------------------------------------------------- 1 | --8<-- 2 | 5555555555555555 3 | 5555555555555555 4 | 5555555555555555 5 | 5555555555555555 6 | 5555555555555555 7 | -->8-- 8 | --8<-- 9 | 1155555555555522 10 | 5555555555555555 11 | 5555555555555555 12 | 5555555555555555 13 | 33555555555555ff 14 | -->8-- 15 | 0x33 0x55 16 | -------------------------------------------------------------------------------- /tests/extmod/framebuf_subclass.py.exp: -------------------------------------------------------------------------------- 1 | b'\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x03\x04\x03\x04\x03' 2 | -------------------------------------------------------------------------------- /tests/extmod/machine1.py.exp: -------------------------------------------------------------------------------- 1 | <8-bit memory> 2 | ValueError 3 | ValueError 4 | TypeError 5 | -------------------------------------------------------------------------------- /tests/extmod/machine_pinbase.py.exp: -------------------------------------------------------------------------------- 1 | __init__ 2 | value: None 3 | 1 4 | value: None 5 | 0 6 | value: None 7 | 1 8 | value: 1 9 | value: 0 10 | -------------------------------------------------------------------------------- /tests/extmod/machine_pulse.py.exp: -------------------------------------------------------------------------------- 1 | value: 1 2 | value: 0 3 | 4 | value: 1 5 | value: 0 6 | value: 1 7 | 8 | -2 9 | -1 10 | -------------------------------------------------------------------------------- /tests/extmod/machine_signal.py.exp: -------------------------------------------------------------------------------- 1 | 0 0 2 | 1 1 3 | 1 0 4 | 0 1 5 | -------------------------------------------------------------------------------- /tests/extmod/ticks_diff.py.exp: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /tests/extmod/time_ms_us.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | True 3 | True 4 | -------------------------------------------------------------------------------- /tests/extmod/ubinascii_micropython.py.exp: -------------------------------------------------------------------------------- 1 | b'31:32:33' 2 | b'' 3 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_array_assign_le.py.exp: -------------------------------------------------------------------------------- 1 | 0x11 2 | 0x2233 3 | 0x4455 4 | 0x66778899 5 | True 6 | 0xaabbccdd 7 | True 8 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_array_assign_native_le.py.exp: -------------------------------------------------------------------------------- 1 | 0x11 2 | 0x2233 3 | 0x4455 4 | 0x66778899 5 | True 6 | 0x11 7 | 0x1122 8 | 0x11223344 9 | IndexError 10 | TypeError 11 | TypeError 12 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_array_assign_native_le_intbig.py.exp: -------------------------------------------------------------------------------- 1 | 0x11223344 2 | 0x11223344 3 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_bytearray.py.exp: -------------------------------------------------------------------------------- 1 | bytearray(b'01') 2 | 3 | bytearray(b'0123') 4 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_byteat.py: -------------------------------------------------------------------------------- 1 | try: 2 | import uctypes 3 | except ImportError: 4 | print("SKIP") 5 | raise SystemExit 6 | 7 | data = bytearray(b'01234567') 8 | 9 | print(uctypes.bytes_at(uctypes.addressof(data), 4)) 10 | print(uctypes.bytearray_at(uctypes.addressof(data), 4)) 11 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_byteat.py.exp: -------------------------------------------------------------------------------- 1 | b'0123' 2 | bytearray(b'0123') 3 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_error.py.exp: -------------------------------------------------------------------------------- 1 | TypeError 2 | TypeError 3 | TypeError 4 | TypeError 5 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_le.py.exp: -------------------------------------------------------------------------------- 1 | 0x3130 2 | 48 49 3 | TypeError 4 | arr: 48 49 5 | arr of struct: 48 49 6 | IndexError 7 | bf: 48 49 8 | bf 4bit: 3 1 3 0 9 | bytearray(b'21') 10 | bytearray(b'2Q') 11 | bytearray(b'5123') 12 | bytearray(b'51R3') 13 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_le_float.py.exp: -------------------------------------------------------------------------------- 1 | 12.3400 2 | 12.3400 3 | 12.3400 4 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_native_float.py.exp: -------------------------------------------------------------------------------- 1 | 12.3400 2 | 12.3400 3 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_native_le.py.exp: -------------------------------------------------------------------------------- 1 | 0x3130 2 | 48 49 3 | TypeError 4 | arr: 48 49 5 | arr of struct: 48 49 6 | IndexError 7 | bf: 48 49 8 | bf 4bit: 3 1 3 0 9 | bytearray(b'21') 10 | bytearray(b'2Q') 11 | bytearray(b'5123') 12 | bytearray(b'51R3') 13 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_print.py.exp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_ptr_le.py.exp: -------------------------------------------------------------------------------- 1 | 48 2 | 49 3 | 0x3130 4 | 48 49 5 | 48 49 6 | 0x3130 7 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_ptr_native_le.py.exp: -------------------------------------------------------------------------------- 1 | 48 2 | 49 3 | 0x3130 4 | 48 49 5 | 48 49 6 | 0x3130 7 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_sizeof.py.exp: -------------------------------------------------------------------------------- 1 | 2 2 | 2 3 | 4 4 | TypeError 5 | 6 6 | 1 7 | TypeError 8 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_sizeof_float.py: -------------------------------------------------------------------------------- 1 | try: 2 | import uctypes 3 | except ImportError: 4 | print("SKIP") 5 | raise SystemExit 6 | 7 | print(uctypes.sizeof({'f':uctypes.FLOAT32})) 8 | print(uctypes.sizeof({'f':uctypes.FLOAT64})) 9 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_sizeof_float.py.exp: -------------------------------------------------------------------------------- 1 | 4 2 | 8 3 | -------------------------------------------------------------------------------- /tests/extmod/uctypes_sizeof_native.py.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/tests/extmod/uctypes_sizeof_native.py.exp -------------------------------------------------------------------------------- /tests/extmod/ujson_dumps_extra.py: -------------------------------------------------------------------------------- 1 | # test uPy ujson behaviour that's not valid in CPy 2 | 3 | try: 4 | import ujson 5 | except ImportError: 6 | print("SKIP") 7 | raise SystemExit 8 | 9 | print(ujson.dumps(b'1234')) 10 | -------------------------------------------------------------------------------- /tests/extmod/ujson_dumps_extra.py.exp: -------------------------------------------------------------------------------- 1 | "1234" 2 | -------------------------------------------------------------------------------- /tests/extmod/ujson_dumps_float.py: -------------------------------------------------------------------------------- 1 | try: 2 | import ujson as json 3 | except ImportError: 4 | try: 5 | import json 6 | except ImportError: 7 | print("SKIP") 8 | raise SystemExit 9 | 10 | print(json.dumps(1.2)) 11 | -------------------------------------------------------------------------------- /tests/extmod/ure_debug.py: -------------------------------------------------------------------------------- 1 | # test printing debugging info when compiling 2 | try: 3 | import ure 4 | except ImportError: 5 | print("SKIP") 6 | raise SystemExit 7 | 8 | ure.compile('^a|b[0-9]\w$', ure.DEBUG) 9 | -------------------------------------------------------------------------------- /tests/extmod/ure_debug.py.exp: -------------------------------------------------------------------------------- 1 | 0: rsplit 5 (3) 2 | 2: any 3 | 3: jmp 0 (-5) 4 | 5: save 0 5 | 7: split 14 (5) 6 | 9: assert bol 7 | 10: char a 8 | 12: jmp 23 (9) 9 | 14: char b 10 | 16: class 1 0x30-0x39 11 | 20: namedclass w 12 | 22: assert eol 13 | 23: save 1 14 | 25: match 15 | Bytes: 26, insts: 14 16 | -------------------------------------------------------------------------------- /tests/extmod/ure_split_empty.py.exp: -------------------------------------------------------------------------------- 1 | ['a b c foobar'] 2 | ['foo'] 3 | ['axbc'] 4 | -------------------------------------------------------------------------------- /tests/extmod/ure_split_notimpl.py: -------------------------------------------------------------------------------- 1 | try: 2 | import ure as re 3 | except ImportError: 4 | print("SKIP") 5 | raise SystemExit 6 | 7 | r = re.compile('( )') 8 | try: 9 | s = r.split("a b c foobar") 10 | except NotImplementedError: 11 | print('NotImplementedError') 12 | -------------------------------------------------------------------------------- /tests/extmod/ure_split_notimpl.py.exp: -------------------------------------------------------------------------------- 1 | NotImplementedError 2 | -------------------------------------------------------------------------------- /tests/extmod/ure_stack_overflow.py: -------------------------------------------------------------------------------- 1 | try: 2 | import ure as re 3 | except ImportError: 4 | try: 5 | import re 6 | except ImportError: 7 | print("SKIP") 8 | raise SystemExit 9 | 10 | try: 11 | re.match("(a*)*", "aaa") 12 | except RuntimeError: 13 | print("RuntimeError") 14 | -------------------------------------------------------------------------------- /tests/extmod/ure_stack_overflow.py.exp: -------------------------------------------------------------------------------- 1 | RuntimeError 2 | -------------------------------------------------------------------------------- /tests/extmod/ussl_basic.py.exp: -------------------------------------------------------------------------------- 1 | ssl_handshake_status: -256 2 | wrap_socket: OSError(5,) 3 | <_SSLSocket 4 | setblocking: NotImplementedError 5 | 4 6 | b'' 7 | read: OSError(-261,) 8 | read: OSError(9,) 9 | write: OSError(9,) 10 | -------------------------------------------------------------------------------- /tests/extmod/utimeq1.py.exp: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /tests/extmod/utimeq_stable.py.exp: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /tests/extmod/uzlib_decompio.py.exp: -------------------------------------------------------------------------------- 1 | 0 2 | b'h' 3 | 2 4 | b'el' 5 | b'lo' 6 | 7 7 | b'' 8 | b'' 9 | 7 10 | b'0000000000' 11 | b'000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' 12 | OSError(22,) 13 | -------------------------------------------------------------------------------- /tests/extmod/uzlib_decompio_gz.py.exp: -------------------------------------------------------------------------------- 1 | 16 2 | b'h' 3 | 18 4 | b'el' 5 | b'lo' 6 | 31 7 | b'' 8 | b'' 9 | 31 10 | b'hello' 11 | b'hello' 12 | ValueError 13 | OSError(22,) 14 | -------------------------------------------------------------------------------- /tests/extmod/vfs_fat_fileio1.py.exp: -------------------------------------------------------------------------------- 1 | 2 | True 3 | True 4 | True 5 | True 6 | hello!world! 7 | 12 8 | h 9 | e 10 | o 11 | d 12 | True 13 | [('foo_dir', 16384, 0, 0)] 14 | MemoryError 15 | x0 16 | x1 17 | x2 18 | x3 19 | -------------------------------------------------------------------------------- /tests/extmod/vfs_fat_oldproto.py.exp: -------------------------------------------------------------------------------- 1 | [('file.txt', 32768, 0, 6)] 2 | hello! 3 | [] 4 | -------------------------------------------------------------------------------- /tests/feature_check/README: -------------------------------------------------------------------------------- 1 | This directory doesn't contain real tests, but code snippets to detect 2 | various interpreter features, which can't be/inconvenient to detecte by 3 | other means. Scripts here are executed by run-tests at the beginning of 4 | testsuite to decide what other test groups to run/exclude. 5 | -------------------------------------------------------------------------------- /tests/feature_check/async_check.py: -------------------------------------------------------------------------------- 1 | # check if async/await keywords are supported 2 | async def foo(): 3 | await 1 4 | -------------------------------------------------------------------------------- /tests/feature_check/async_check.py.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/tests/feature_check/async_check.py.exp -------------------------------------------------------------------------------- /tests/feature_check/byteorder.py: -------------------------------------------------------------------------------- 1 | import sys 2 | print(sys.byteorder) 3 | -------------------------------------------------------------------------------- /tests/feature_check/byteorder.py.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/tests/feature_check/byteorder.py.exp -------------------------------------------------------------------------------- /tests/feature_check/complex.py: -------------------------------------------------------------------------------- 1 | try: 2 | complex 3 | print("complex") 4 | except NameError: 5 | print("no") 6 | 7 | -------------------------------------------------------------------------------- /tests/feature_check/complex.py.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/tests/feature_check/complex.py.exp -------------------------------------------------------------------------------- /tests/feature_check/const.py: -------------------------------------------------------------------------------- 1 | x = const(1) 2 | -------------------------------------------------------------------------------- /tests/feature_check/const.py.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/tests/feature_check/const.py.exp -------------------------------------------------------------------------------- /tests/feature_check/coverage.py: -------------------------------------------------------------------------------- 1 | try: 2 | extra_coverage 3 | print('coverage') 4 | except NameError: 5 | print('no') 6 | -------------------------------------------------------------------------------- /tests/feature_check/coverage.py.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/tests/feature_check/coverage.py.exp -------------------------------------------------------------------------------- /tests/feature_check/float.py.exp: -------------------------------------------------------------------------------- 1 | 64 2 | -------------------------------------------------------------------------------- /tests/feature_check/int_big.py: -------------------------------------------------------------------------------- 1 | # Check whether arbitrary-precision integers (MPZ) are supported 2 | print(1000000000000000000000000000000000000000000000) 3 | -------------------------------------------------------------------------------- /tests/feature_check/int_big.py.exp: -------------------------------------------------------------------------------- 1 | 1000000000000000000000000000000000000000000000 2 | -------------------------------------------------------------------------------- /tests/feature_check/native_check.py: -------------------------------------------------------------------------------- 1 | # this test for the availability of native emitter 2 | @micropython.native 3 | def f(): 4 | pass 5 | -------------------------------------------------------------------------------- /tests/feature_check/native_check.py.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/tests/feature_check/native_check.py.exp -------------------------------------------------------------------------------- /tests/feature_check/repl_emacs_check.py: -------------------------------------------------------------------------------- 1 | # Check for emacs keys in REPL 2 | t = +11 3 | t == 2 4 | -------------------------------------------------------------------------------- /tests/feature_check/repl_emacs_check.py.exp: -------------------------------------------------------------------------------- 1 | MicroPython \.\+ version 2 | Use \.\+ 3 | >>> # Check for emacs keys in REPL 4 | >>> t = \.\+ 5 | >>> t == 2 6 | True 7 | >>> 8 | -------------------------------------------------------------------------------- /tests/feature_check/reverse_ops.py: -------------------------------------------------------------------------------- 1 | class Foo: 2 | 3 | def __radd__(self, other): 4 | pass 5 | 6 | try: 7 | 5 + Foo() 8 | except TypeError: 9 | print("TypeError") 10 | -------------------------------------------------------------------------------- /tests/feature_check/reverse_ops.py.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/tests/feature_check/reverse_ops.py.exp -------------------------------------------------------------------------------- /tests/feature_check/set_check.py: -------------------------------------------------------------------------------- 1 | # check if set literal syntax is supported 2 | {1} 3 | -------------------------------------------------------------------------------- /tests/feature_check/set_check.py.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/tests/feature_check/set_check.py.exp -------------------------------------------------------------------------------- /tests/float/array_construct.py: -------------------------------------------------------------------------------- 1 | # test construction of array from array with float type 2 | 3 | try: 4 | from array import array 5 | except ImportError: 6 | print("SKIP") 7 | raise SystemExit 8 | 9 | print(array('f', array('h', [1, 2]))) 10 | print(array('d', array('f', [1, 2]))) 11 | -------------------------------------------------------------------------------- /tests/float/builtin_float_pow.py: -------------------------------------------------------------------------------- 1 | # test builtin pow function with float args 2 | 3 | print(pow(0.0, 0.0)) 4 | print(pow(0, 1.0)) 5 | print(pow(1.0, 1)) 6 | print(pow(2.0, 3.0)) 7 | print(pow(2.0, -4.0)) 8 | 9 | print(pow(0.0, float('inf'))) 10 | print(pow(0.0, float('-inf'))) 11 | print(pow(0.0, float('nan'))) 12 | -------------------------------------------------------------------------------- /tests/float/builtin_float_round_intbig.py: -------------------------------------------------------------------------------- 1 | # test round() with floats that return large integers 2 | 3 | for x in (-1e25, 1e25): 4 | print('%.3g' % round(x)) 5 | -------------------------------------------------------------------------------- /tests/float/bytearray_construct.py: -------------------------------------------------------------------------------- 1 | # test construction of bytearray from array with float type 2 | 3 | try: 4 | from array import array 5 | except ImportError: 6 | print("SKIP") 7 | raise SystemExit 8 | 9 | print(bytearray(array('f', [1, 2.3]))) 10 | -------------------------------------------------------------------------------- /tests/float/bytes_construct.py: -------------------------------------------------------------------------------- 1 | # test construction of bytearray from array with float type 2 | 3 | try: 4 | from array import array 5 | except ImportError: 6 | print("SKIP") 7 | raise SystemExit 8 | 9 | print(bytes(array('f', [1, 2.3]))) 10 | -------------------------------------------------------------------------------- /tests/float/complex1_intbig.py: -------------------------------------------------------------------------------- 1 | # test basic complex number functionality 2 | 3 | # convert bignum to complex on rhs 4 | ans = 1j + (1 << 70); print("%.5g %.5g" % (ans.real, ans.imag)) 5 | -------------------------------------------------------------------------------- /tests/float/int_divzero.py: -------------------------------------------------------------------------------- 1 | try: 2 | 1 / 0 3 | except ZeroDivisionError: 4 | print("ZeroDivisionError") 5 | 6 | try: 7 | 0 ** -1 8 | except ZeroDivisionError: 9 | print("ZeroDivisionError") 10 | -------------------------------------------------------------------------------- /tests/float/int_power.py: -------------------------------------------------------------------------------- 1 | # negative power should produce float 2 | 3 | x = 2 4 | print(x ** -2) 5 | 6 | x = 3 7 | x **= -2 8 | print('%.5f' % x) 9 | -------------------------------------------------------------------------------- /tests/float/list_index.py: -------------------------------------------------------------------------------- 1 | x = [1, 2] 2 | 3 | print(x[1]) 4 | 5 | try: 6 | print(x[1.0]) 7 | except TypeError: 8 | print("TypeError") 9 | -------------------------------------------------------------------------------- /tests/float/math_fun_intbig.py: -------------------------------------------------------------------------------- 1 | # test the math functions that return ints, with very large results 2 | 3 | try: 4 | import math 5 | except ImportError: 6 | print("SKIP") 7 | raise SystemExit 8 | 9 | for fun in (math.ceil, math.floor, math.trunc): 10 | for x in (-1e25, 1e25): 11 | print('%.3g' % fun(x)) 12 | -------------------------------------------------------------------------------- /tests/float/string_format_modulo3.py: -------------------------------------------------------------------------------- 1 | # uPy and CPython outputs differ for the following 2 | print("%.1g" % -9.9) # round up 'g' with '-' sign 3 | print("%.2g" % 99.9) # round up 4 | -------------------------------------------------------------------------------- /tests/float/string_format_modulo3.py.exp: -------------------------------------------------------------------------------- 1 | -10 2 | 100 3 | -------------------------------------------------------------------------------- /tests/float/true_value.py: -------------------------------------------------------------------------------- 1 | # Test true-ish value handling 2 | 3 | if not 0.0: 4 | print("float 0") 5 | 6 | if not 0+0j: 7 | print("complex 0") 8 | -------------------------------------------------------------------------------- /tests/float/types.py: -------------------------------------------------------------------------------- 1 | # float types 2 | 3 | print(float) 4 | print(complex) 5 | 6 | print(type(float()) == float) 7 | print(type(complex()) == complex) 8 | 9 | print(type(0.0) == float) 10 | print(type(1j) == complex) 11 | 12 | # hashing float types 13 | 14 | d = dict() 15 | d[float] = complex 16 | d[complex] = float 17 | print(len(d)) 18 | -------------------------------------------------------------------------------- /tests/import/gen_context.py: -------------------------------------------------------------------------------- 1 | import gen_context2 2 | 3 | GLOBAL = "GLOBAL" 4 | 5 | def gen(): 6 | print(GLOBAL) 7 | yield 1 8 | 9 | gen_context2.call(gen()) 10 | -------------------------------------------------------------------------------- /tests/import/gen_context2.py: -------------------------------------------------------------------------------- 1 | def call(g): 2 | next(g) 3 | -------------------------------------------------------------------------------- /tests/import/import1a.py: -------------------------------------------------------------------------------- 1 | import import1b 2 | print(import1b.var) 3 | -------------------------------------------------------------------------------- /tests/import/import1b.py: -------------------------------------------------------------------------------- 1 | var = 123 2 | 3 | def throw(): 4 | raise ValueError 5 | -------------------------------------------------------------------------------- /tests/import/import2a.py: -------------------------------------------------------------------------------- 1 | from import1b import var 2 | print(var) 3 | 4 | from import1b import var as var2 5 | print(var2) 6 | -------------------------------------------------------------------------------- /tests/import/import3a.py: -------------------------------------------------------------------------------- 1 | from import1b import * 2 | print(var) 3 | -------------------------------------------------------------------------------- /tests/import/import_file.py: -------------------------------------------------------------------------------- 1 | import import1b 2 | print(import1b.__file__) 3 | -------------------------------------------------------------------------------- /tests/import/import_pkg3.py: -------------------------------------------------------------------------------- 1 | from pkg import mod 2 | 3 | print(mod.foo()) 4 | 5 | import pkg.mod 6 | print(mod is pkg.mod) 7 | -------------------------------------------------------------------------------- /tests/import/import_pkg4.py: -------------------------------------------------------------------------------- 1 | # Testing that "recursive" imports (pkg2/__init__.py imports from pkg2) work 2 | import pkg2 3 | -------------------------------------------------------------------------------- /tests/import/import_pkg5.py: -------------------------------------------------------------------------------- 1 | # This tests relative imports as used in pkg3 2 | import pkg3 3 | import pkg3.mod1 4 | import pkg3.subpkg1.mod1 5 | 6 | pkg3.subpkg1.mod1.foo() 7 | -------------------------------------------------------------------------------- /tests/import/import_pkg6.py: -------------------------------------------------------------------------------- 1 | # This tests relative imports as used in pkg6 2 | import pkg6 3 | -------------------------------------------------------------------------------- /tests/import/import_pkg7.py: -------------------------------------------------------------------------------- 1 | # This tests ... relative imports as used in pkg7 and imports beyond package root 2 | import pkg7.subpkg1.subpkg2.mod3 3 | -------------------------------------------------------------------------------- /tests/import/import_pkg8.py: -------------------------------------------------------------------------------- 1 | # import with no __init__.py files 2 | import pkg8.mod 3 | -------------------------------------------------------------------------------- /tests/import/pkg/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/tests/import/pkg/__init__.py -------------------------------------------------------------------------------- /tests/import/pkg/mod.py: -------------------------------------------------------------------------------- 1 | def foo(): 2 | return 42 3 | -------------------------------------------------------------------------------- /tests/import/pkg2/__init__.py: -------------------------------------------------------------------------------- 1 | from pkg2 import mod1 2 | -------------------------------------------------------------------------------- /tests/import/pkg2/mod1.py: -------------------------------------------------------------------------------- 1 | from pkg2 import mod2 2 | -------------------------------------------------------------------------------- /tests/import/pkg2/mod2.py: -------------------------------------------------------------------------------- 1 | print("in mod2") 2 | -------------------------------------------------------------------------------- /tests/import/pkg3/__init__.py: -------------------------------------------------------------------------------- 1 | print("pkg __name__:", __name__) 2 | -------------------------------------------------------------------------------- /tests/import/pkg3/mod1.py: -------------------------------------------------------------------------------- 1 | print("mod1 __name__:", __name__) 2 | from . import mod2 3 | -------------------------------------------------------------------------------- /tests/import/pkg3/mod2.py: -------------------------------------------------------------------------------- 1 | print("mod2 __name__:", __name__) 2 | print("in mod2") 3 | 4 | def foo(): 5 | print("mod2.foo()") 6 | -------------------------------------------------------------------------------- /tests/import/pkg3/subpkg1/__init__.py: -------------------------------------------------------------------------------- 1 | print("subpkg1 __name__:", __name__) 2 | -------------------------------------------------------------------------------- /tests/import/pkg3/subpkg1/mod1.py: -------------------------------------------------------------------------------- 1 | print("subpkg1.mod1 __name__:", __name__) 2 | from ..mod2 import foo 3 | -------------------------------------------------------------------------------- /tests/import/pkg6/__init__.py: -------------------------------------------------------------------------------- 1 | from .x import * 2 | print('init') 3 | -------------------------------------------------------------------------------- /tests/import/pkg6/x/__init__.py: -------------------------------------------------------------------------------- 1 | from .y import * 2 | print('x') 3 | -------------------------------------------------------------------------------- /tests/import/pkg6/x/y.py: -------------------------------------------------------------------------------- 1 | print('y') 2 | -------------------------------------------------------------------------------- /tests/import/pkg7/__init__.py: -------------------------------------------------------------------------------- 1 | print("pkg __name__:", __name__) 2 | -------------------------------------------------------------------------------- /tests/import/pkg7/mod1.py: -------------------------------------------------------------------------------- 1 | print('mod1') 2 | foo = 'mod1.foo' 3 | -------------------------------------------------------------------------------- /tests/import/pkg7/mod2.py: -------------------------------------------------------------------------------- 1 | print('mod2') 2 | bar = 'mod2.bar' 3 | -------------------------------------------------------------------------------- /tests/import/pkg7/subpkg1/__init__.py: -------------------------------------------------------------------------------- 1 | print("pkg __name__:", __name__) 2 | -------------------------------------------------------------------------------- /tests/import/pkg7/subpkg1/subpkg2/__init__.py: -------------------------------------------------------------------------------- 1 | print("pkg __name__:", __name__) 2 | -------------------------------------------------------------------------------- /tests/import/pkg7/subpkg1/subpkg2/mod3.py: -------------------------------------------------------------------------------- 1 | from ... import mod1 2 | from ...mod2 import bar 3 | print(mod1.foo) 4 | print(bar) 5 | 6 | # attempted relative import beyond top-level package 7 | try: 8 | from .... import mod1 9 | except ValueError: 10 | print('ValueError') 11 | -------------------------------------------------------------------------------- /tests/import/pkg8/mod.py: -------------------------------------------------------------------------------- 1 | print('foo') 2 | -------------------------------------------------------------------------------- /tests/import/rel_import_inv.py: -------------------------------------------------------------------------------- 1 | try: 2 | from . import foo 3 | except: 4 | print("Invalid relative import caught") 5 | -------------------------------------------------------------------------------- /tests/inlineasm/asmargs.py.exp: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 6 5 | 10 6 | -------------------------------------------------------------------------------- /tests/inlineasm/asmbcc.py.exp: -------------------------------------------------------------------------------- 1 | 0 2 | 10 3 | 20 4 | 30 5 | -------------------------------------------------------------------------------- /tests/inlineasm/asmbitops.py: -------------------------------------------------------------------------------- 1 | @micropython.asm_thumb 2 | def clz(r0): 3 | clz(r0, r0) 4 | 5 | print(clz(0xf0)) 6 | print(clz(0x8000)) 7 | 8 | @micropython.asm_thumb 9 | def rbit(r0): 10 | rbit(r0, r0) 11 | 12 | print(hex(rbit(0xf0))) 13 | print(hex(rbit(0x8000))) 14 | -------------------------------------------------------------------------------- /tests/inlineasm/asmbitops.py.exp: -------------------------------------------------------------------------------- 1 | 24 2 | 16 3 | 0xf000000 4 | 0x10000 5 | -------------------------------------------------------------------------------- /tests/inlineasm/asmblbx.py.exp: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | -------------------------------------------------------------------------------- /tests/inlineasm/asmconst.py: -------------------------------------------------------------------------------- 1 | # test constants in assembler 2 | 3 | @micropython.asm_thumb 4 | def c1(): 5 | movwt(r0, 0xffffffff) 6 | movwt(r1, 0xf0000000) 7 | sub(r0, r0, r1) 8 | print(hex(c1())) 9 | -------------------------------------------------------------------------------- /tests/inlineasm/asmconst.py.exp: -------------------------------------------------------------------------------- 1 | 0xfffffff 2 | -------------------------------------------------------------------------------- /tests/inlineasm/asmdiv.py.exp: -------------------------------------------------------------------------------- 1 | 411 2 | -411 3 | -411 4 | 411 5 | 411 6 | 2 7 | 1 8 | -------------------------------------------------------------------------------- /tests/inlineasm/asmfpaddsub.py.exp: -------------------------------------------------------------------------------- 1 | 90 2 | -------------------------------------------------------------------------------- /tests/inlineasm/asmfpcmp.py: -------------------------------------------------------------------------------- 1 | @micropython.asm_thumb # test vcmp, vmrs 2 | def f(r0, r1): 3 | vmov(s0, r0) 4 | vcvt_f32_s32(s0, s0) 5 | vmov(s1, r1) 6 | vcvt_f32_s32(s1, s1) 7 | vcmp(s1, s0) 8 | vmrs(r0, FPSCR) 9 | mov(r1, 28) 10 | lsr(r0, r1) 11 | 12 | print(f(0,1)) 13 | print(f(1,1)) 14 | print(f(1,0)) 15 | -------------------------------------------------------------------------------- /tests/inlineasm/asmfpcmp.py.exp: -------------------------------------------------------------------------------- 1 | 2 2 | 6 3 | 8 4 | -------------------------------------------------------------------------------- /tests/inlineasm/asmfpldrstr.py: -------------------------------------------------------------------------------- 1 | import array 2 | @micropython.asm_thumb # test vldr, vstr 3 | def arrayadd(r0): 4 | vldr(s0, [r0, 0]) 5 | vldr(s1, [r0, 4]) 6 | vadd(s2, s0, s1) 7 | vstr(s2, [r0, 8]) 8 | 9 | z = array.array("f", [2, 4, 10]) 10 | arrayadd(z) 11 | print(z[2]) 12 | 13 | -------------------------------------------------------------------------------- /tests/inlineasm/asmfpldrstr.py.exp: -------------------------------------------------------------------------------- 1 | 6.0 2 | -------------------------------------------------------------------------------- /tests/inlineasm/asmfpmuldiv.py.exp: -------------------------------------------------------------------------------- 1 | 20 2 | -------------------------------------------------------------------------------- /tests/inlineasm/asmfpsqrt.py.exp: -------------------------------------------------------------------------------- 1 | -160 2 | -------------------------------------------------------------------------------- /tests/inlineasm/asmit.py.exp: -------------------------------------------------------------------------------- 1 | 100 1 2 | 100 200 3 | -------------------------------------------------------------------------------- /tests/inlineasm/asmpushpop.py: -------------------------------------------------------------------------------- 1 | @micropython.asm_thumb 2 | def f(r0, r1, r2): 3 | push({r0}) 4 | push({r1, r2}) 5 | pop({r0}) 6 | pop({r1, r2}) 7 | 8 | print(f(0, 1, 2)) 9 | -------------------------------------------------------------------------------- /tests/inlineasm/asmpushpop.py.exp: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /tests/inlineasm/asmrettype.py.exp: -------------------------------------------------------------------------------- 1 | 1 2 | False True 3 | 0 0x20000000 0x40000000 -0x80000000 4 | 0 0x20000000 0x40000000 0x80000000 5 | -------------------------------------------------------------------------------- /tests/inlineasm/asmshift.py.exp: -------------------------------------------------------------------------------- 1 | 0x246 2 | 0x800000 3 | 0x91 4 | 0x1 5 | 0x91 6 | -0x1 7 | -------------------------------------------------------------------------------- /tests/inlineasm/asmspecialregs.py: -------------------------------------------------------------------------------- 1 | @micropython.asm_thumb 2 | def getIPSR(): 3 | mrs(r0, IPSR) 4 | 5 | @micropython.asm_thumb 6 | def getBASEPRI(): 7 | mrs(r0, BASEPRI) 8 | 9 | print(getBASEPRI()) 10 | print(getIPSR()) 11 | 12 | -------------------------------------------------------------------------------- /tests/inlineasm/asmspecialregs.py.exp: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | -------------------------------------------------------------------------------- /tests/inlineasm/asmsum.py.exp: -------------------------------------------------------------------------------- 1 | array('l', [100, 200, 300, 400]) 1000 2 | array('b', [10, 20, 30, 40, 50, 60, 70, 80]) 360 3 | -------------------------------------------------------------------------------- /tests/io/argv.py: -------------------------------------------------------------------------------- 1 | import sys 2 | print(sys.argv) 3 | -------------------------------------------------------------------------------- /tests/io/buffered_writer.py.exp: -------------------------------------------------------------------------------- 1 | b'' 2 | b'foobarfo' 3 | b'foobarfoobar' 4 | b'foobarfoobar' 5 | b'foo' 6 | -------------------------------------------------------------------------------- /tests/io/bytesio_ext2.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | -------------------------------------------------------------------------------- /tests/io/data/file1: -------------------------------------------------------------------------------- 1 | longer line1 2 | line2 3 | line3 4 | -------------------------------------------------------------------------------- /tests/io/data/file2: -------------------------------------------------------------------------------- 1 | 1234 -------------------------------------------------------------------------------- /tests/io/file_iter.py: -------------------------------------------------------------------------------- 1 | f = open("io/data/file1") 2 | for l in f: 3 | print(l) 4 | -------------------------------------------------------------------------------- /tests/io/file_long_read.py: -------------------------------------------------------------------------------- 1 | f = open("io/data/file1") 2 | b = f.read(100) 3 | print(len(b)) 4 | -------------------------------------------------------------------------------- /tests/io/file_long_read2.py: -------------------------------------------------------------------------------- 1 | f = open("io/data/bigfile1") 2 | b = f.read() 3 | print(len(b)) 4 | print(b) 5 | -------------------------------------------------------------------------------- /tests/io/file_long_read3.py: -------------------------------------------------------------------------------- 1 | f = open("io/data/bigfile1", "rb") 2 | b = f.read(512) 3 | print(len(b)) 4 | print(b) 5 | -------------------------------------------------------------------------------- /tests/io/file_readinto_len.py: -------------------------------------------------------------------------------- 1 | b = bytearray(30) 2 | f = open("io/data/file1", "rb") 3 | # 2nd arg (length to read) is extension to CPython 4 | print(f.readinto(b, 8)) 5 | print(b) 6 | 7 | b = bytearray(4) 8 | f = open("io/data/file1", "rb") 9 | print(f.readinto(b, 8)) 10 | print(b) 11 | -------------------------------------------------------------------------------- /tests/io/file_readinto_len.py.exp: -------------------------------------------------------------------------------- 1 | 8 2 | bytearray(b'longer l\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') 3 | 4 4 | bytearray(b'long') 5 | -------------------------------------------------------------------------------- /tests/io/file_readline.py: -------------------------------------------------------------------------------- 1 | f = open("io/data/file1") 2 | print(f.readline()) 3 | print(f.readline(3)) 4 | print(f.readline(4)) 5 | print(f.readline(5)) 6 | print(f.readline()) 7 | 8 | # readline() on writable file 9 | f = open('io/data/file1', 'ab') 10 | try: 11 | f.readline() 12 | except OSError: 13 | print('OSError') 14 | f.close() 15 | -------------------------------------------------------------------------------- /tests/io/file_stdio.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | print(sys.stdin.fileno()) 4 | print(sys.stdout.fileno()) 5 | -------------------------------------------------------------------------------- /tests/io/resource_stream.py.exp: -------------------------------------------------------------------------------- 1 | 1234 2 | 1234 3 | -------------------------------------------------------------------------------- /tests/io/stringio_with.py: -------------------------------------------------------------------------------- 1 | try: 2 | import uio as io 3 | except ImportError: 4 | import io 5 | 6 | # test __enter__/__exit__ 7 | with io.StringIO() as b: 8 | b.write("foo") 9 | print(b.getvalue()) 10 | -------------------------------------------------------------------------------- /tests/io/write_ext.py.exp: -------------------------------------------------------------------------------- 1 | b'fo' 2 | b'fofoo' 3 | b'fofoooob' 4 | b'fofooooboobar' 5 | b'fofooooboobar' 6 | -------------------------------------------------------------------------------- /tests/jni/list.py: -------------------------------------------------------------------------------- 1 | import jni 2 | try: 3 | ArrayList = jni.cls("java/util/ArrayList") 4 | except: 5 | print("SKIP") 6 | raise SystemExit 7 | 8 | l = ArrayList() 9 | print(l) 10 | l.add("one") 11 | l.add("two") 12 | 13 | print(l.toString()) 14 | print(l) 15 | print(l[0], l[1]) 16 | -------------------------------------------------------------------------------- /tests/jni/list.py.exp: -------------------------------------------------------------------------------- 1 | [] 2 | [one, two] 3 | [one, two] 4 | one two 5 | -------------------------------------------------------------------------------- /tests/jni/object.py.exp: -------------------------------------------------------------------------------- 1 | 42 2 | 42 3 | 42 4 | -------------------------------------------------------------------------------- /tests/jni/system_out.py: -------------------------------------------------------------------------------- 1 | try: 2 | import jni 3 | System = jni.cls("java/lang/System") 4 | except: 5 | print("SKIP") 6 | raise SystemExit 7 | 8 | System.out.println("Hello, Java!") 9 | -------------------------------------------------------------------------------- /tests/jni/system_out.py.exp: -------------------------------------------------------------------------------- 1 | Hello, Java! 2 | -------------------------------------------------------------------------------- /tests/micropython/const.py.exp: -------------------------------------------------------------------------------- 1 | 123 580 2 | 123 580 3 | 12 46 4 | 1 2 5 | True False 6 | -------------------------------------------------------------------------------- /tests/micropython/const2.py.exp: -------------------------------------------------------------------------------- 1 | 2 | function X 1 3 | class X 1 4 | method X 2 4 4 5 | -------------------------------------------------------------------------------- /tests/micropython/const_error.py.exp: -------------------------------------------------------------------------------- 1 | SyntaxError 2 | SyntaxError 3 | -------------------------------------------------------------------------------- /tests/micropython/const_intbig.py.exp: -------------------------------------------------------------------------------- 1 | 0xffffffff 0xffffffffffffffff 2 | 0x100000000fffffffe 0x100000000000000000ffffffff 3 | -------------------------------------------------------------------------------- /tests/micropython/decorator.py: -------------------------------------------------------------------------------- 1 | # test micropython-specific decorators 2 | 3 | @micropython.bytecode 4 | def f(): 5 | return 'bytecode' 6 | 7 | print(f()) 8 | -------------------------------------------------------------------------------- /tests/micropython/decorator.py.exp: -------------------------------------------------------------------------------- 1 | bytecode 2 | -------------------------------------------------------------------------------- /tests/micropython/decorator_error.py.exp: -------------------------------------------------------------------------------- 1 | SyntaxError 2 | SyntaxError 3 | -------------------------------------------------------------------------------- /tests/micropython/emg_exc.py.exp: -------------------------------------------------------------------------------- 1 | Traceback (most recent call last): 2 | , line 20, in f 3 | ValueError: 1 4 | 5 | -------------------------------------------------------------------------------- /tests/micropython/extreme_exc.py.exp: -------------------------------------------------------------------------------- 1 | Exception() 2 | TypeError( 3 | TypeError( 4 | RuntimeError( 5 | Exception('my exception',) 6 | -------------------------------------------------------------------------------- /tests/micropython/heap_lock.py.exp: -------------------------------------------------------------------------------- 1 | MemoryError 2 | MemoryError 3 | [] 4 | -------------------------------------------------------------------------------- /tests/micropython/heapalloc.py.exp: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 0 4 | 0 2 5 | 0 0 6 | 1 7 | 3 8 | 1 9 | 1 2 10 | 1 1 11 | 1 2 3 4 10 12 | -------------------------------------------------------------------------------- /tests/micropython/heapalloc_bytesio.py.exp: -------------------------------------------------------------------------------- 1 | b'1234123412341234123412341234123412341234123412341234123412341234' 2 | -------------------------------------------------------------------------------- /tests/micropython/heapalloc_bytesio2.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | -------------------------------------------------------------------------------- /tests/micropython/heapalloc_exc_raise.py.exp: -------------------------------------------------------------------------------- 1 | error 2 | ok 3 | -------------------------------------------------------------------------------- /tests/micropython/heapalloc_inst_call.py.exp: -------------------------------------------------------------------------------- 1 | __call__ 2 | __call__ 1 3 | __call__ 1 2 4 | __call__ 1 2 3 5 | -------------------------------------------------------------------------------- /tests/micropython/heapalloc_int_from_bytes.py.exp: -------------------------------------------------------------------------------- 1 | 49 2 | 12849 3 | 50 4 | -------------------------------------------------------------------------------- /tests/micropython/heapalloc_str.py.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/tests/micropython/heapalloc_str.py.exp -------------------------------------------------------------------------------- /tests/micropython/heapalloc_super.py.exp: -------------------------------------------------------------------------------- 1 | B foo 2 | A foo 3 | 42 4 | -------------------------------------------------------------------------------- /tests/micropython/heapalloc_traceback.py.exp: -------------------------------------------------------------------------------- 1 | StopIteration 2 | Traceback (most recent call last): 3 | File , line 23, in test 4 | StopIteration: 5 | 6 | -------------------------------------------------------------------------------- /tests/micropython/kbd_intr.py: -------------------------------------------------------------------------------- 1 | # test the micropython.kbd_intr() function 2 | 3 | import micropython 4 | 5 | try: 6 | micropython.kbd_intr 7 | except AttributeError: 8 | print('SKIP') 9 | raise SystemExit 10 | 11 | # just check we can actually call it 12 | micropython.kbd_intr(3) 13 | -------------------------------------------------------------------------------- /tests/micropython/kbd_intr.py.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmicko/micropython/70d7e9e89f16723e46b955bc0b1d01e821e8f0c8/tests/micropython/kbd_intr.py.exp -------------------------------------------------------------------------------- /tests/micropython/memstats.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | True 3 | True 4 | -------------------------------------------------------------------------------- /tests/micropython/native_closure.py.exp: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 9 4 | -------------------------------------------------------------------------------- /tests/micropython/native_const_intbig.py: -------------------------------------------------------------------------------- 1 | # check loading constants 2 | 3 | @micropython.native 4 | def f(): 5 | return 123456789012345678901234567890 6 | 7 | print(f()) 8 | -------------------------------------------------------------------------------- /tests/micropython/native_const_intbig.py.exp: -------------------------------------------------------------------------------- 1 | 123456789012345678901234567890 2 | -------------------------------------------------------------------------------- /tests/micropython/native_misc.py.exp: -------------------------------------------------------------------------------- 1 | 1 [] 2 2 | 1 [] 3 3 | 3 4 | 6 5 | True 6 | False 7 | -------------------------------------------------------------------------------- /tests/micropython/opt_level.py.exp: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | True 4 | False 5 | Traceback (most recent call last): 6 | File "", line 1, in 7 | NameError: name 'xyz' is not defined 8 | -------------------------------------------------------------------------------- /tests/micropython/schedule.py.exp: -------------------------------------------------------------------------------- 1 | 1 2 | outer 3 | inner 4 | RuntimeError 5 | -------------------------------------------------------------------------------- /tests/micropython/stack_use.py: -------------------------------------------------------------------------------- 1 | # tests stack_use function in micropython module 2 | import micropython 3 | 4 | if not hasattr(micropython, 'stack_use'): 5 | print('SKIP') 6 | else: 7 | print(type(micropython.stack_use())) # output varies 8 | -------------------------------------------------------------------------------- /tests/micropython/stack_use.py.exp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/micropython/viper_addr.py.exp: -------------------------------------------------------------------------------- 1 | 2 | 3 | bytearray(b'0000') 4 | bytearray(b'1111') 5 | bytearray(b'2222') 6 | bytearray(b'2233') 7 | -------------------------------------------------------------------------------- /tests/micropython/viper_args.py.exp: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 1 2 4 | 1 2 3 5 | 1 2 3 4 6 | -------------------------------------------------------------------------------- /tests/micropython/viper_binop_comp.py.exp: -------------------------------------------------------------------------------- 1 | 1 == 1 2 | 1 <= 1 3 | 1 >= 1 4 | 2 > 1 5 | 2 >= 1 6 | 2 != 1 7 | 1 < 2 8 | 1 <= 2 9 | 1 != 2 10 | 2 > -1 11 | 2 >= -1 12 | 2 != -1 13 | -2 < 1 14 | -2 <= 1 15 | -2 != 1 16 | -------------------------------------------------------------------------------- /tests/micropython/viper_binop_comp_imm.py: -------------------------------------------------------------------------------- 1 | # comparisons with immediate boundary values 2 | @micropython.viper 3 | def f(a: int): 4 | print(a == -1, a == -255, a == -256, a == -257) 5 | 6 | f(-1) 7 | f(-255) 8 | f(-256) 9 | f(-257) 10 | -------------------------------------------------------------------------------- /tests/micropython/viper_binop_comp_imm.py.exp: -------------------------------------------------------------------------------- 1 | True False False False 2 | False True False False 3 | False False True False 4 | False False False True 5 | -------------------------------------------------------------------------------- /tests/micropython/viper_binop_divmod.py.exp: -------------------------------------------------------------------------------- 1 | 0 -6 2 | 1 0 3 | 1 -1 4 | 1 -2 5 | 2 0 6 | 3 0 7 | 6 0 8 | -6 0 9 | -3 0 10 | -2 0 11 | -2 2 12 | -2 4 13 | -1 0 14 | -1 1 15 | -1 -1 16 | -1 0 17 | -2 -4 18 | -2 -2 19 | -2 0 20 | -3 0 21 | -6 0 22 | 6 0 23 | 3 0 24 | 2 0 25 | 1 2 26 | 1 1 27 | 1 0 28 | 0 6 29 | -------------------------------------------------------------------------------- /tests/micropython/viper_binop_multi_comp.py.exp: -------------------------------------------------------------------------------- 1 | 1 == 1 2 | 2 > 1 3 | 2 >= 1 4 | 2 != 1 5 | 1 < 2 6 | 2 > -1 7 | 2 >= -1 8 | 2 != -1 9 | -2 <= 1 10 | -------------------------------------------------------------------------------- /tests/micropython/viper_cond.py.exp: -------------------------------------------------------------------------------- 1 | not x False 2 | x True 3 | y 1 4 | -------------------------------------------------------------------------------- /tests/micropython/viper_import.py: -------------------------------------------------------------------------------- 1 | # test import within viper function 2 | 3 | @micropython.viper 4 | def f(): 5 | import micropython 6 | print(micropython.const(1)) 7 | 8 | from micropython import const 9 | print(const(2)) 10 | f() 11 | -------------------------------------------------------------------------------- /tests/micropython/viper_import.py.exp: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | -------------------------------------------------------------------------------- /tests/micropython/viper_misc.py.exp: -------------------------------------------------------------------------------- 1 | 6 2 | 3 3 | 0 4 | Ellipsis 5 | 6 6 | 7 7 | 20 8 | 49994955 9 | 1 1 10 | 1 3 11 | (0, 1, False, True) 12 | (1, 3) 13 | [1, 3] 14 | [1, 3] 15 | OSError(1,) 16 | 1 17 | 1 18 | -------------------------------------------------------------------------------- /tests/micropython/viper_misc_intbig.py: -------------------------------------------------------------------------------- 1 | import micropython 2 | 3 | # unsigned ints 4 | @micropython.viper 5 | def viper_uint() -> uint: 6 | return uint(-1) 7 | import sys 8 | print(viper_uint() == (sys.maxsize << 1 | 1)) 9 | -------------------------------------------------------------------------------- /tests/micropython/viper_misc_intbig.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | -------------------------------------------------------------------------------- /tests/micropython/viper_ptr16_load.py.exp: -------------------------------------------------------------------------------- 1 | bytearray(b'1234') 2 | 12849 13363 3 | 26212 4 | 26212 5 | -------------------------------------------------------------------------------- /tests/micropython/viper_ptr16_store.py.exp: -------------------------------------------------------------------------------- 1 | bytearray(b'\x00\x00\x00\x00') 2 | bytearray(b'BB\x00\x00') 3 | bytearray(b'BBCC') 4 | bytearray(b'DDDD') 5 | bytearray(b'EEEE') 6 | -------------------------------------------------------------------------------- /tests/micropython/viper_ptr32_load.py.exp: -------------------------------------------------------------------------------- 1 | bytearray(b'\x12\x12\x12\x124444') 2 | 0x12121212 0x34343434 3 | 0x46464646 4 | 0x46464646 5 | -------------------------------------------------------------------------------- /tests/micropython/viper_ptr32_store.py.exp: -------------------------------------------------------------------------------- 1 | bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') 2 | bytearray(b'BBBB\x00\x00\x00\x00') 3 | bytearray(b'BBBBCCCC') 4 | bytearray(b'DDDDDDDD') 5 | bytearray(b'EEEEEEEE') 6 | -------------------------------------------------------------------------------- /tests/micropython/viper_ptr8_load.py.exp: -------------------------------------------------------------------------------- 1 | bytearray(b'1234') 2 | 49 50 3 | 202 4 | 202 5 | -------------------------------------------------------------------------------- /tests/micropython/viper_ptr8_store.py.exp: -------------------------------------------------------------------------------- 1 | bytearray(b'\x00\x00\x00\x00') 2 | bytearray(b')\x00\x00\x00') 3 | bytearray(b')*\x00\x00') 4 | bytearray(b'++++') 5 | bytearray(b',,,,') 6 | -------------------------------------------------------------------------------- /tests/micropython/viper_subscr.py.exp: -------------------------------------------------------------------------------- 1 | [1, 2, 3] 2 | 1 3 | 2 4 | 3 5 | -------------------------------------------------------------------------------- /tests/misc/non_compliant_lexer.py.exp: -------------------------------------------------------------------------------- 1 | SyntaxError 2 | SyntaxError 3 | SyntaxError 4 | SyntaxError 5 | NotImplementedError 6 | -------------------------------------------------------------------------------- /tests/net_hosted/accept_nonblock.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | -------------------------------------------------------------------------------- /tests/net_hosted/accept_timeout.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | -------------------------------------------------------------------------------- /tests/net_hosted/connect_nonblock.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | -------------------------------------------------------------------------------- /tests/net_hosted/connect_poll.py.exp: -------------------------------------------------------------------------------- 1 | 1 4 2 | 1 3 | 1 4 4 | -------------------------------------------------------------------------------- /tests/net_hosted/ssl_getpeercert.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | -------------------------------------------------------------------------------- /tests/net_inet/README: -------------------------------------------------------------------------------- 1 | This directory contains network tests which require Internet connection. 2 | Note that these tests are not run as part of the main testsuite and need 3 | to be run seperately (from the main test/ directory): 4 | 5 | ./run-tests net_inet/*.py 6 | -------------------------------------------------------------------------------- /tests/net_inet/test_tls_sites.py.exp: -------------------------------------------------------------------------------- 1 | google.com ok 2 | www.google.com ok 3 | api.telegram.org ok 4 | api.pushbullet.com ok 5 | w9rybpfril.execute-api.ap-southeast-2.amazonaws.com ok 6 | -------------------------------------------------------------------------------- /tests/pyb/accel.py: -------------------------------------------------------------------------------- 1 | import pyb 2 | 3 | accel = pyb.Accel() 4 | print(accel) 5 | accel.x() 6 | accel.y() 7 | accel.z() 8 | accel.tilt() 9 | accel.filtered_xyz() 10 | -------------------------------------------------------------------------------- /tests/pyb/accel.py.exp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/pyb/adc.py.exp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 50 4 | 25 5 | 30 6 | -------------------------------------------------------------------------------- /tests/pyb/dac.py.exp: -------------------------------------------------------------------------------- 1 | DAC(1, bits=8) 2 | -------------------------------------------------------------------------------- /tests/pyb/extint.py.exp: -------------------------------------------------------------------------------- 1 | 6 2 | line: 6 3 | line: 6 4 | -------------------------------------------------------------------------------- /tests/pyb/halerror.py: -------------------------------------------------------------------------------- 1 | # test hal errors 2 | 3 | import pyb 4 | 5 | i2c = pyb.I2C(2, pyb.I2C.MASTER) 6 | try: 7 | i2c.recv(1, 1) 8 | except OSError as e: 9 | print(repr(e)) 10 | 11 | can = pyb.CAN(1, pyb.CAN.NORMAL) 12 | try: 13 | can.send('1', 1, timeout=50) 14 | except OSError as e: 15 | print(repr(e)) 16 | -------------------------------------------------------------------------------- /tests/pyb/halerror.py.exp: -------------------------------------------------------------------------------- 1 | OSError(5,) 2 | OSError(110,) 3 | -------------------------------------------------------------------------------- /tests/pyb/i2c.py.exp: -------------------------------------------------------------------------------- 1 | ValueError -1 2 | ValueError 0 3 | I2C 1 4 | I2C 2 5 | ValueError 3 6 | I2C X 7 | I2C Y 8 | ValueError Z 9 | [] 10 | [76] 11 | True 12 | b'\x01' 13 | -------------------------------------------------------------------------------- /tests/pyb/i2c_error.py.exp: -------------------------------------------------------------------------------- 1 | OSError(5,) 2 | OSError(5,) 3 | OSError(5,) 4 | OSError(5,) 5 | -------------------------------------------------------------------------------- /tests/pyb/irq.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | True False 3 | -------------------------------------------------------------------------------- /tests/pyb/led.py.exp: -------------------------------------------------------------------------------- 1 | LED(1) 2 | LED(2) 3 | LED(3) 4 | LED(4) 5 | -------------------------------------------------------------------------------- /tests/pyb/modstm.py.exp: -------------------------------------------------------------------------------- 1 | 0x8000 2 | 0x0 3 | -------------------------------------------------------------------------------- /tests/pyb/pin.py.exp: -------------------------------------------------------------------------------- 1 | Pin(Pin.cpu.C6, mode=Pin.IN) 2 | C6 3 | 6 4 | 2 5 | Pin(Pin.cpu.C6, mode=Pin.IN, pull=Pin.PULL_UP) 6 | 1 7 | Pin(Pin.cpu.C6, mode=Pin.IN, pull=Pin.PULL_DOWN) 8 | 0 9 | 0 10 | 1 11 | 0 12 | 1 13 | 0 14 | 1 15 | -------------------------------------------------------------------------------- /tests/pyb/pyb1.py.exp: -------------------------------------------------------------------------------- 1 | 3 2 | 3 3 | True 4 | 12 5 | -------------------------------------------------------------------------------- /tests/pyb/pyb_f405.py: -------------------------------------------------------------------------------- 1 | # test pyb module on F405 MCUs 2 | 3 | import os, pyb 4 | 5 | if not 'STM32F405' in os.uname().machine: 6 | print('SKIP') 7 | raise SystemExit 8 | 9 | print(pyb.freq()) 10 | print(type(pyb.rng())) 11 | -------------------------------------------------------------------------------- /tests/pyb/pyb_f405.py.exp: -------------------------------------------------------------------------------- 1 | (168000000, 168000000, 42000000, 84000000) 2 | 3 | -------------------------------------------------------------------------------- /tests/pyb/pyb_f411.py: -------------------------------------------------------------------------------- 1 | # test pyb module on F411 MCUs 2 | 3 | import os, pyb 4 | 5 | if not 'STM32F411' in os.uname().machine: 6 | print('SKIP') 7 | raise SystemExit 8 | 9 | print(pyb.freq()) 10 | -------------------------------------------------------------------------------- /tests/pyb/pyb_f411.py.exp: -------------------------------------------------------------------------------- 1 | (96000000, 96000000, 24000000, 48000000) 2 | -------------------------------------------------------------------------------- /tests/pyb/servo.py: -------------------------------------------------------------------------------- 1 | from pyb import Servo 2 | 3 | servo = Servo(1) 4 | print(servo) 5 | 6 | servo.angle(0) 7 | servo.angle(10, 100) 8 | 9 | servo.speed(-10) 10 | servo.speed(10, 100) 11 | 12 | servo.pulse_width(1500) 13 | print(servo.pulse_width()) 14 | 15 | servo.calibration(630, 2410, 1490, 2460, 2190) 16 | print(servo.calibration()) 17 | -------------------------------------------------------------------------------- /tests/pyb/servo.py.exp: -------------------------------------------------------------------------------- 1 | 2 | 1500 3 | (630, 2410, 1490, 2460, 2190) 4 | -------------------------------------------------------------------------------- /tests/pyb/spi.py.exp: -------------------------------------------------------------------------------- 1 | ValueError -1 2 | ValueError 0 3 | SPI 1 4 | SPI 2 5 | ValueError 3 6 | SPI X 7 | SPI Y 8 | ValueError Z 9 | SPI(1) 10 | SPI(1, SPI.MASTER, baudrate=328125, prescaler=256, polarity=1, phase=0, bits=8) 11 | SPI(1, SPI.SLAVE, polarity=1, phase=1, bits=8) 12 | OSError 13 | b'\xff' 14 | b'\xff' 15 | -------------------------------------------------------------------------------- /tests/pyb/switch.py: -------------------------------------------------------------------------------- 1 | from pyb import Switch 2 | 3 | sw = Switch() 4 | print(sw()) 5 | sw.callback(print) 6 | sw.callback(None) 7 | -------------------------------------------------------------------------------- /tests/pyb/switch.py.exp: -------------------------------------------------------------------------------- 1 | False 2 | -------------------------------------------------------------------------------- /tests/pyb/timer.py: -------------------------------------------------------------------------------- 1 | # check basic functionality of the timer class 2 | 3 | import pyb 4 | from pyb import Timer 5 | 6 | tim = Timer(4) 7 | tim = Timer(4, prescaler=100, period=200) 8 | print(tim.prescaler()) 9 | print(tim.period()) 10 | tim.prescaler(300) 11 | print(tim.prescaler()) 12 | tim.period(400) 13 | print(tim.period()) 14 | -------------------------------------------------------------------------------- /tests/pyb/timer.py.exp: -------------------------------------------------------------------------------- 1 | 100 2 | 200 3 | 300 4 | 400 5 | -------------------------------------------------------------------------------- /tests/pyb/timer_callback.py.exp: -------------------------------------------------------------------------------- 1 | before cb1 2 | cb1 3 | before cb2 4 | cb2 5 | before cb1 6 | cb1 7 | before cb4 8 | cb4 3 9 | -------------------------------------------------------------------------------- /tests/pybnative/for.py: -------------------------------------------------------------------------------- 1 | import pyb 2 | 3 | @micropython.native 4 | def f1(n): 5 | for i in range(n): 6 | print(i) 7 | 8 | f1(4) 9 | 10 | @micropython.native 11 | def f2(r): 12 | for i in r: 13 | print(i) 14 | 15 | f2(range(4)) 16 | -------------------------------------------------------------------------------- /tests/pybnative/for.py.exp: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 2 4 | 3 5 | 0 6 | 1 7 | 2 8 | 3 9 | -------------------------------------------------------------------------------- /tests/pybnative/while.py: -------------------------------------------------------------------------------- 1 | import pyb 2 | 3 | @micropython.native 4 | def f(led, n, d): 5 | led.off() 6 | i = 0 7 | while i < n: 8 | print(i) 9 | led.toggle() 10 | pyb.delay(d) 11 | i += 1 12 | led.off() 13 | 14 | f(pyb.LED(1), 2, 150) 15 | f(pyb.LED(2), 4, 50) 16 | -------------------------------------------------------------------------------- /tests/pybnative/while.py.exp: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 0 4 | 1 5 | 2 6 | 3 7 | -------------------------------------------------------------------------------- /tests/pyboard.py: -------------------------------------------------------------------------------- 1 | ../tools/pyboard.py -------------------------------------------------------------------------------- /tests/stress/dict_copy.py: -------------------------------------------------------------------------------- 1 | # copying a large dictionary 2 | 3 | a = {i:2*i for i in range(1000)} 4 | b = a.copy() 5 | for i in range(1000): 6 | print(i, b[i]) 7 | print(len(b)) 8 | -------------------------------------------------------------------------------- /tests/stress/dict_create.py: -------------------------------------------------------------------------------- 1 | # create a large dictionary 2 | 3 | d = {} 4 | x = 1 5 | while x < 1000: 6 | d[x] = x 7 | x += 1 8 | print(d[500]) 9 | -------------------------------------------------------------------------------- /tests/stress/list_sort.py: -------------------------------------------------------------------------------- 1 | # test large list sorting (should not stack overflow) 2 | l = list(range(2000)) 3 | l.sort() 4 | print(l[0], l[-1]) 5 | l.sort(reverse=True) 6 | print(l[0], l[-1]) 7 | -------------------------------------------------------------------------------- /tests/stress/recursion.py: -------------------------------------------------------------------------------- 1 | def foo(): 2 | foo() 3 | 4 | try: 5 | foo() 6 | except RuntimeError: 7 | print("RuntimeError") 8 | -------------------------------------------------------------------------------- /tests/stress/recursive_data.py.exp: -------------------------------------------------------------------------------- 1 | RuntimeError 2 | -------------------------------------------------------------------------------- /tests/stress/recursive_iternext.py.exp: -------------------------------------------------------------------------------- 1 | RuntimeError 2 | RuntimeError 3 | RuntimeError 4 | RuntimeError 5 | -------------------------------------------------------------------------------- /tests/thread/thread_exc2.py: -------------------------------------------------------------------------------- 1 | # test raising exception within thread which is not caught 2 | import utime 3 | import _thread 4 | 5 | def thread_entry(): 6 | raise ValueError 7 | 8 | _thread.start_new_thread(thread_entry, ()) 9 | utime.sleep(1) 10 | print('done') 11 | -------------------------------------------------------------------------------- /tests/thread/thread_exc2.py.exp: -------------------------------------------------------------------------------- 1 | Unhandled exception in thread started by 2 | Traceback (most recent call last): 3 | File \.\+, line 6, in thread_entry 4 | ValueError: 5 | done 6 | -------------------------------------------------------------------------------- /tests/unicode/data/utf-8_1.txt: -------------------------------------------------------------------------------- 1 | Привет 2 | -------------------------------------------------------------------------------- /tests/unicode/data/utf-8_2.txt: -------------------------------------------------------------------------------- 1 | aαbβcγdδ 2 | ぁ🙐 3 | -------------------------------------------------------------------------------- /tests/unicode/file1.py: -------------------------------------------------------------------------------- 1 | f = open("unicode/data/utf-8_1.txt", encoding="utf-8") 2 | l = f.readline() 3 | print(l) 4 | print(len(l)) 5 | -------------------------------------------------------------------------------- /tests/unicode/unicode_chr.py: -------------------------------------------------------------------------------- 1 | # test builtin chr with unicode characters 2 | 3 | print(chr(945)) 4 | print(chr(0x800)) 5 | print(chr(0x10000)) 6 | -------------------------------------------------------------------------------- /tests/unicode/unicode_index.py: -------------------------------------------------------------------------------- 1 | print("Привет".find("т")) 2 | print("Привет".find("П")) 3 | print("Привет".rfind("т")) 4 | print("Привет".rfind("П")) 5 | print("Привет".index("т")) 6 | print("Привет".index("П")) 7 | -------------------------------------------------------------------------------- /tests/unicode/unicode_iter.py: -------------------------------------------------------------------------------- 1 | for c in "Hello": 2 | print(c) 3 | for c in "Привет": 4 | print(c) 5 | -------------------------------------------------------------------------------- /tests/unicode/unicode_ord.py: -------------------------------------------------------------------------------- 1 | # test builtin ord with unicode characters 2 | 3 | print(ord('α')) 4 | -------------------------------------------------------------------------------- /tests/unicode/unicode_pos.py: -------------------------------------------------------------------------------- 1 | # str methods with explicit start/end pos 2 | print("Привет".startswith("П")) 3 | print("Привет".startswith("р", 1)) 4 | print("абвба".find("а", 1)) 5 | print("абвба".find("а", 1, -1)) 6 | -------------------------------------------------------------------------------- /tests/unicode/unicode_str_format.py: -------------------------------------------------------------------------------- 1 | # test handling of unicode chars in format strings 2 | 3 | print('α'.format()) 4 | print('{α}'.format(α=1)) 5 | -------------------------------------------------------------------------------- /tests/unicode/unicode_str_modulo.py: -------------------------------------------------------------------------------- 1 | # test handling of unicode chars in string % formatting 2 | 3 | print('α' % ()) 4 | -------------------------------------------------------------------------------- /tests/unix/ffi_callback.py.exp: -------------------------------------------------------------------------------- 1 | org string: bytearray(b'foobar') 2 | qsort'ed: bytearray(b'abfoor') 3 | -------------------------------------------------------------------------------- /tests/unix/ffi_float.py.exp: -------------------------------------------------------------------------------- 1 | 1.230000 2 | 1.230000 3 | 1.772454 4 | 1.000000 5 | 1.000000 6 | 0.886227 7 | 6.000000 8 | 6.000000 9 | -------------------------------------------------------------------------------- /tests/unix/ffi_float2.py.exp: -------------------------------------------------------------------------------- 1 | 1.772454 2 | 1.000000 3 | 1.000000 4 | 0.886227 5 | 6.000000 6 | 6.000000 7 | -------------------------------------------------------------------------------- /tests/wipy/modwipy.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | True 3 | True 4 | Exception 5 | -------------------------------------------------------------------------------- /tests/wipy/pin_irq.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | True 3 | True 4 | True 5 | True 6 | True 7 | True 8 | True 9 | True 10 | True 11 | True 12 | True 13 | True 14 | Awake 15 | True 16 | Awake 17 | Exception 18 | Exception 19 | Exception 20 | -------------------------------------------------------------------------------- /tests/wipy/reset/reset.py.exp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/wipy/sd.py.exp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exception 5 | Exception 6 | Exception 7 | -------------------------------------------------------------------------------- /tests/wipy/skipped/rtc_irq.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | True 3 | True 4 | True 5 | True 6 | True 7 | True 8 | True 9 | True 10 | Exception 11 | Exception 12 | -------------------------------------------------------------------------------- /tests/wipy/wdt.py.exp: -------------------------------------------------------------------------------- 1 | Exception 2 | Exception 3 | Exception 4 | 5 | Exception 6 | 7 | 8 | -------------------------------------------------------------------------------- /tests/wipy/wlan/machine.py.exp: -------------------------------------------------------------------------------- 1 | 2 | True 3 | True 4 | Active 5 | True 6 | True 7 | Exception 8 | -------------------------------------------------------------------------------- /tests/wipy/wlan/server.py.exp: -------------------------------------------------------------------------------- 1 | True 2 | True 3 | True 4 | True 5 | True 6 | True 7 | True 8 | Exception 9 | Exception 10 | Exception 11 | -------------------------------------------------------------------------------- /tools/.gitattributes: -------------------------------------------------------------------------------- 1 | *.tar.gz binary 2 | -------------------------------------------------------------------------------- /tools/.gitignore: -------------------------------------------------------------------------------- 1 | tinytest/.gitignore 2 | tinytest/.travis.yml 3 | tinytest/Makefile 4 | tinytest/Makefile.arm-cortex-m3-qemu 5 | tinytest/Makefile.avr 6 | tinytest/TODO 7 | tinytest/portable_demo.c 8 | tinytest/tinytest_demo.c 9 | -------------------------------------------------------------------------------- /tools/gen-changelog.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "MicroPython change log" 4 | 5 | for t in $(git tag | grep -v v1.0-rc1 | sort -rV); do 6 | echo '' 7 | echo '========' 8 | echo '' 9 | git show -s --format=%cD `git rev-list $t --max-count=1` 10 | echo '' 11 | git tag -l $t -n9999 12 | done 13 | --------------------------------------------------------------------------------