Commit Graph

37 Commits

Author SHA1 Message Date
applecuckoo
add8f06b75
urandom is supported on nRF boards 2023-04-10 15:27:15 +12:00
Jeff Epler
5ac622a30d
get rid of nearly-empty getenv.c file 2022-12-13 13:13:01 -06:00
Jeff Epler
3459fe322b
Withdraw the _environ module
This existed solely for testing, so expose it a different way during
the unix coverage build

Also turn off os.getenv support on samd21.
2022-12-08 15:33:10 -06:00
Dan Halbert
01c15a1d1b catalog implementation limitations in documentation 2022-10-21 13:58:34 -04:00
Dan Halbert
987030e706
Merge branch 'main' into add-os-utime-function 2022-10-07 22:45:51 -04:00
Jeff Epler
907c5d387f
Tweak black_bindings
Originally, black_bindings found each contiguous "//|" block and sent
it to black independently. This was slower than it needed to be.

Instead, swap the comment prefix: when running black, take off
"//|" prefixes and put "##|" prefixes on all un-prefixed lines.
Then, after black is run, do the opposite operation

This more than doubles the overall speed of "pre-commit run --all",
from 3m20s to 55s CPU time on my local machine (32.5s to under 10s
"elapsed" time)

It also causes a small amount of churn in the bindings, because
black now sees enough context to know whether one 'def' follows another
or ends the 'def's in a 'class'. In the latter case, it adds an extra
newline, which becomes a "//|" line.

I'm less sure why a trailing comma was omitted before down in
rp2pio/StateMachine.c but let's roll with it.
2022-09-30 11:18:13 -05:00
Jeff Epler
b2cc8d2aad
run black_bindings across all bindings 2022-09-27 15:21:42 -05:00
Isaac Benitez
71d649613f Updated utime() to take a 2-tuple instead of a plain int 2022-09-22 00:56:44 -07:00
Isaac Benitez
5a21c30ab2 Added utime() to the os librady 2022-09-18 18:43:27 -07:00
thetazero
1a40757cdd
Change unpopulated to always 0 2022-08-30 11:48:17 -04:00
thetazero
92c77013bf
Lint 2022-08-30 10:37:48 -04:00
thetazero
f5286b4e79
Improve os.stat docs 2022-08-29 13:01:11 -07:00
Scott Shawcroft
9d10a3da66
Conditionalize LTO 2022-05-27 12:59:54 -07:00
Scott Shawcroft
a30de85d57
Add dotenv read support
os.getenv() will use it (when available) to load variables from
/.env

This will also be useful when we need secrets or config for
CircuitPython outside of the VM (like WiFi credentials.)

Fixes #4212
2022-05-18 14:01:35 -07:00
Alec Delaney
bbc29e84a7
Add os, "socket", atexit, ssl, struct, traceback, math links 2022-05-03 12:31:20 -06:00
Alec Delaney
de7a90ab00
Add link to CPython os module 2022-05-03 14:00:52 -04:00
Jeff Epler
621953c960
Additional missing-prototypes fixes
I think this correctly enables missing-prototypes in atmel-samd
and raspberrypi ports.
2021-11-10 10:55:53 -06:00
microDev
a46aa48e23
Convert more modules to use MP_REGISTER_MODULE
Convert espidf, os, rp2pio, samd and time to use MP_REGISTER_MODULE.

Related to #5183.
2021-10-05 16:58:24 +05:30
microDev
a52eb88031
run code formatting script 2021-03-15 19:27:36 +05:30
Mike Causer
eedcc98cc5 Fix some spelling mistakes 2020-12-10 02:52:18 +11:00
Taku Fukada
56c898da80 Modify some Python stubs 2020-08-07 01:01:28 +09:00
Taku Fukada
d356581651 Fix several type hints 2020-07-27 18:05:13 +09:00
Taku Fukada
54a342a7f5 Add and correct some type hints 2020-07-24 18:20:03 +09:00
Scott Shawcroft
2bd6d05663
Add externs. GCC10 complains about duplicate defines 2020-07-22 16:26:46 -07:00
dherrada
612c6bb86b
Merge branch 'main' into type_hints 2020-07-17 14:55:30 -04:00
Diego Elio Pettenò
34b4993d63 Add license to some obvious files. 2020-07-06 19:16:25 +01:00
dherrada
e237dfe3c5 Added type hints to os 2020-07-03 15:18:44 -04:00
Scott Shawcroft
4e8de3c554
Swap sphinx to autoapi and the inline stubs 2020-05-12 17:28:24 -07:00
dherrada
09530e5dc3
Did os, _pixelbuf, _pew 2020-05-08 16:03:39 -04:00
Dan Halbert
e0753c4ad2 avoid os.stat() int overflow on smallint-only builds 2020-02-14 18:33:37 -05:00
Jeff Epler
6735283d8f os: Don't require an on-stack buffer
This allows urandom requests of even 100k bytes to succeed on a fresh
VM session on a Metro M4 express.
2020-01-08 09:43:13 -06:00
Scott Shawcroft
de5a9d72dc
Compress all translated strings with Huffman coding.
This saves code space in builds which use link-time optimization.
The optimization drops the untranslated strings and replaces them
with a compressed_string_t struct. It can then be decompressed to
a c string.

Builds without LTO work as well but include both untranslated
strings and compressed strings.

This work could be expanded to include QSTRs and loaded strings if
a compress method is added to C. Its tracked in #531.
2018-08-16 17:40:57 -07:00
Dan Halbert
327b0f76da fix os.listdir() when current dir is '/' 2018-06-15 10:51:03 -04:00
Dan Halbert
c679c80c71 Modernize module and class static dicts; update freetouch 2017-08-27 15:02:50 -04:00
Dan Halbert
ef61b5ecb5 Initial merge of micropython v1.9.2 into circuitpython 2.0.0 (in development) master.
cpx build compiles and loads and works in repl; test suite not run yet
esp8266 not tested yet
2017-08-25 22:17:07 -04:00
Scott Shawcroft
a0058e6712 Introduce a random module that is a subset of CPython's random. It
also initializes in the same way where it takes from a true random
source when available through os.urandom(). After initializing, it
produces deterministic results until the seed is set.

This replaces urandom!

Fixes #139.
2017-06-27 17:37:24 -07:00
Scott Shawcroft
778e975936 Split uos module into os and storage.
os is a subset of CPython's os. storage contains additional
file system mounting functionality based on UNIX's mount
management.

Fixes #140
2017-06-27 15:17:30 -07:00