Wykres commitów

1569 Commity (master)

Autor SHA1 Wiadomość Data
Matt Trentini 340243e205 time: Add README to explain the purpose of the time extension library.
Signed-off-by: Matt Trentini <matt.trentini@gmail.com>
2023-12-20 12:05:35 +11:00
Jim Mussared 83f3991f41 lcd160cr: Remove support for options in manifest.
This is the last remaining use of the "options" feature. Nothing in the
main repo which `require()`'s this package sets it.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-12-20 12:01:22 +11:00
Jim Mussared cee0945f1c all: Replace "black" with "ruff format".
- Add config for [tool.ruff.format] to pyproject.toml.
- Update pre-commit to run both ruff and ruff-format.
- Update a small number of files that change with ruff's rules.
- Update CI.
- Simplify codeformat.py just forward directly to "ruff format"

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-12-20 11:56:24 +11:00
Jim Mussared ad0a2590cc tools/verifygitlog.py: Add git commit message checking.
This adds verifygitlog.py from the main repo, adds it to GitHub workflows,
and also pre-commit.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-12-20 11:46:40 +11:00
Christian Marangi d8e163bb5f unix-ffi/re: Convert to PCRE2.
PCRE is marked as EOL and won't receive any new security update.

Convert the re module to PCRE2 API to enforce security.  Additional
dependency is now needed with uctypes due to changes in how PCRE2 return
the match_data in a pointer and require special handling.

The converted module is tested with the test_re.py with no regression.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-11-01 10:14:36 +11:00
Jim Mussared 0620d02290 .github/workflows/ruff.yml: Pin to 0.1.0.
The `--format` flag was changed to `--output-format` in the recent update.

Pin to this version to prevent further updates from breaking (e.g. through new rules or other changes).

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-10-26 11:48:26 +11:00
Brian Whitman e025c843b6 requests: Fix detection of iterators in chunked data requests.
Chunked detection does not work as generators never have an `__iter__`
attribute.  They do have `__next__`.

Example that now works with this commit:

    def read_in_chunks(file_object, chunk_size=4096):
        while True:
            data = file_object.read(chunk_size)
            if not data:
                break
            yield data

    file = open(filename, "rb")
    r = requests.post(url, data=read_in_chunks(file))
2023-10-05 10:42:14 +11:00
Jim Mussared 46748d2817 aioble/server.py: Allow BufferedCharacteristic to support all ops.
Previously a BufferedCharacteristic could only be read by the client, where
it should have been writeable. This makes it support all ops (read / write
/ write-with-response, etc).

Adds a test to check the max_len and append functionality of
BufferedCharacteristic.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-10-04 14:47:38 +11:00
Jim Mussared e5ba864470 aioble/server.py: Add data arg for indicate.
In micropython/micropython#11239 we added support for passing data to
gatts_indicate (to make it match gatts_notify).

This adds the same to aioble.

Also update the documentation to mention this (and fix some mistakes and
add a few more examples).

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-10-04 14:37:26 +11:00
Matthias Urlichs 55d1d23d6f __future__: Add "annotations".
MicroPython ignores types anyway.
2023-10-04 12:53:52 +11:00
Damien George e6b89eafa3 all: Remove unnecessary start argument in range.
To satisfy Ruff.

Signed-off-by: Damien George <damien@micropython.org>
2023-09-01 00:17:28 +10:00
Angus Gratton 7fcc728db2 lora/sx126x: Fix busy timeout handling.
- If no reset pin was set, calling standby() in the constructor
  would enable the TCXO (XOSC) before the timeout was correctly set.

- This manifested as a BUSY timeout on the STM32WL5, first time after power
on reset.

- Clean up the general handling of BUSY timeouts, but also add some safety
margin to the base timeout just in case (not an issue, is only a stop-gap
to prevent the modem blocking indefinitely.)

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-26 18:16:37 +10:00
Angus Gratton 0bdecbcba1 lora: Note known issue with STM32WL5 HP antenna.
For unknown reason, power output in this configuration is lower than it
should be (including when compared to the STM32Cube C libraries running on
the same board.

Suspect either the Nucleo board antenna switch or the power amplifier
registers are being set wrong, but the actual root cause remains elusive...

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-26 18:16:25 +10:00
Angus Gratton ed688cf019 lora: Add STM32WL55 subghz LoRa modem class.
Support depends on hardware support in MicroPython.

Also includes some tweaks in the SX126x base class, to deal with slightly
different platform configuration on STM32WL55, longer timeouts, tx_ant
options, etc.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-26 18:16:04 +10:00
Angus Gratton 93bf707d6f lora: Remove the pin parameter from IRQ callback.
It's not necessary to know which pin triggered the IRQ, and it saves some
code size.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-23 11:42:59 +10:00
Damien George dc765ad822 wm8960: Bump patch version.
For changes in 1f3002b537.

Signed-off-by: Damien George <damien@micropython.org>
2023-08-23 11:42:00 +10:00
Damien George 1b557eee5c lsm6dsox: Bump patch version.
For changes in 2d16f210b9.

Signed-off-by: Damien George <damien@micropython.org>
2023-08-23 11:41:22 +10:00
Angus Gratton 5b6fb2bc56 top: Enable Ruff linter to check undefined-name (F821).
Also adds some global ignores for manifest files (which have implicit
imports) and the multitests (which have the same).

Other F821 fixes or accommodations are in the parent commits to this
commit.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-22 22:44:01 +10:00
Angus Gratton b46306cc5a uaiohttpclient: Fix missing name in unreachable example code.
As-written this code is unreachable (return statement two line above),
so this change is really just to make the linter happy.

Found by Ruff checking F821.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-22 22:43:51 +10:00
Angus Gratton 991ac986fd iperf3: Pre-declare some variables set in the loop.
This is a change just to make the linter happy, the code
probably would have run OK without it.

Found by Ruff checking F821.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-22 22:43:46 +10:00
Angus Gratton c6a72c70b9 cbor2: Improve decoder to pass Ruff F821 undefined-name.
These were probably intentional missing names, however raising
NotImplementedError or KeyError is more explicit than trying to call an
unknown function.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-22 22:43:20 +10:00
Angus Gratton 786c0ea895 all: Add missing const imports
Found by Ruff checking F821.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-22 22:43:18 +10:00
Angus Gratton 1f3002b537 wm8960: Add missing self reference for sample table.
Found by Ruff checking F821.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-22 22:43:12 +10:00
Angus Gratton 2d16f210b9 lsm6dsox: Add missing time import.
Driver calls time.sleep_ms() in one place.

Found by Ruff checking F821.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-22 22:43:04 +10:00
Angus Gratton 86050c3d7a bmm150: Remove broken reset function.
Looks like copy-pasta from bmi270 driver.

There is a soft reset capability documented in the BMM150 datasheet, but it
uses different register bits and I don't have a BMM150 at hand to test it.

Found by Ruff checking F821.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-22 22:42:48 +10:00
Angus Gratton 674e734a1c drivers/display/lcd160cr: Use isinstance() for type checking.
Fixes linter warning E721, expanded in Ruff 823 to include
direct comparison against built-in types.
2023-08-09 18:59:03 +10:00
Graeme Winter 01ab7ba6e2 iperf3: Add compatibility for servers pre version 3.2.
Result message from servers pre version 3.2 do not encode start or end
time, so workaround this by using the t3, t0 timestamps used elsewhere for
sending.

Fixes issue #665.
2023-07-27 16:01:30 +10:00
Jim Mussared ce3f282967 github/workflows: Split ruff into its own action.
This matches the main repo, and conceputually ruff is not strictly doing
"code formatting".

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-27 12:28:29 +10:00
Jim Mussared efa0402846 tools/codeformat.py: Fix ruff warnings.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-27 12:28:29 +10:00
Jim Mussared 5cdfe71536 top: Add pre-commit config.
This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-27 12:28:15 +10:00
Jim Mussared 232859250c tools/codeformat.py: Remove git state detection.
This was added to speed up running codeformat.py when only a small number
of files are changed, but it breaks running the tool on the master branch.
The pre-commit tool handles this correctly, and it's working well in the
main repo, so we can remove the special handling.

This makes codeformat.py behave identically to the main repository, but
without additional code for handling .c/.h files.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-27 12:26:08 +10:00
Jim Mussared 36e74c1b57 zlib: Add zlib module.
This is a replacement for the `zlib` module that used to be built-in and
has been replaced by the MicroPython-specific `deflate` module.

Also updates the `gzip` module in a similar fashion and provide the
`gzip.GzipFile` class and `gzip.open` function.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-25 18:19:51 +10:00
Christian Clauss 4da6e6f1b2 all: Lint Python code with ruff.
Signed-off-by: Christian Clauss <cclauss@me.com>
2023-07-24 07:51:33 +02:00
Damien George 752ce66c24 github/workflows: Build all example .py files as part of CI.
Signed-off-by: Damien George <damien@micropython.org>
2023-07-24 10:28:49 +10:00
Jim Mussared 8fc9edabf3 all: Standardise x.y.z versioning for all packages.
- For packages that were just x.y, update to x.y.0.
- For that were x.y.z-n, update to x.y.(z+1)

From now on we'll apply semver rules:
- MAJOR version when you make incompatible API changes
- MINOR version when you add functionality in a backward compatible manner
- PATCH version when you make backward compatible bug fixes

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-23 11:48:57 +10:00
Jim Mussared ebbb78e8e4 logging: Bump minor version.
For changes in 5329ef5301.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-23 11:48:46 +10:00
Jim Mussared a19d2a3596 copy: Bump patch version.
For changes in 0e68c7d518.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-23 11:48:29 +10:00
Jim Mussared 97b7a30ab9 xmltok: Bump patch version.
For changes in 66924d9fa1.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-23 11:48:25 +10:00
Jim Mussared 87b4cdae2f aiorepl: Bump patch version.
For changes in ff842310de.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-23 11:48:14 +10:00
Jim Mussared 8513bfbe9d requests: Rename urequests to requests.
This module implements a subset of the Python requests module, and so
it should have the same name.

Added a backwards-compatibility wrapper to allow people to continue to use
`import urequests`. This lives in micropython/urequests.

Changed requests to be a package, so that we can implement extension
packages in the future for optional functionality.

Added a basic README.md to both.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-23 11:41:44 +10:00
Jim Mussared 5004436164 tarfile: Rename from utarfile.
This is compatible with the CPython module, so should
be named tarfile.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-23 11:41:44 +10:00
Andrew Leech e45a7f6c18 fnmatch: Fix compatibility with ure -> re.
With the recent MicroPython change to remove the u prefix by default on
builtins (micropython/micropython#11740) the format checker in fnmatch
which was detecting ure no longer works.

This commit updates the module to filter the regex automatically as needed.

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2023-07-21 17:19:43 +10:00
Jim Mussared 6103823b1b all: Remove __version__ from .py files.
It is inserted automatically during publish/freezing and having them in the
code prevents the automatic process from happening.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-21 17:15:00 +10:00
Jim Mussared ff842310de aiorepl: Replace f-string with str.format.
f-strings aren't enabled on all builds (e.g. low-flash ESP8266).

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-21 17:10:41 +10:00
Andrew Leech 0e68c7d518 copy: Declare dependency on types. 2023-07-21 17:07:06 +10:00
Andrew Leech 5329ef5301 logging: Add full support for logging exception tracebacks.
This commit allows you to pass an exception object in as the exc_info kwarg
(CPython allows this), so logging exceptions can work even if the
MICROPY_PY_SYS_EXC_INFO option is disabled in the firmware.

Separately to that, currently even when sys.exc_info() is enabled, it's
only printing the traceback to _stream = sys.stderr - not to the configured
logging handlers.  This means for instance if you've got a file log
handler it misses out on the tracebacks.  That's also fixed in this commit.

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2023-07-21 17:01:42 +10:00
Andrew Leech 028a369f90 keyword: Add manifest file. 2023-07-21 16:58:48 +10:00
Andrew Leech b95deb31e5 json: Add manifest file. 2023-07-21 16:58:48 +10:00
Andrew Leech 0f768c9af7 bisect: Add manifest file. 2023-07-21 16:58:48 +10:00
Andrew Leech c2b44ea83b types: Add manifest file. 2023-07-21 16:58:48 +10:00