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>
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))
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>
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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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.
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>
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>
- 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>
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>
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>
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>
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>
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>
Due to changes in MicroPython to support PEP-479, StopIteration has been
deprecated for return. This results in xmltok to raise RuntimeError every
time. This commit is a simple fix to just change from StopIteration to
EOFError and then return it in the generator.
Even though we now have a `string` module, just keep the existing
IDENTCHARS definition.
- If someone doesn't already have string installed (or aren't otherwise
importing it), this would add an extra dependency and more memory used.
- If they do, then the resulting concatenated string has to be allocated
separately, so there's no gain from using the string.x components.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
For reading, the size is always terminated by a null, so just ignore it by
using 11 for the uctypes entry (this fixes a regression introduced in
7128d423c2).
For writing, the size must always be terminated by a null.
Signed-off-by: Damien George <damien@micropython.org>
This splits out each algorithm into its own extension package, so that only
the necessary algorithms can be installed.
This allows for a significant reduction in RAM and flash. i.e. previously
installing hashlib meant that all algorithms were imported.
Additionally ensures that any built-in hash algorithms (from uhashlib) are
still exposed (e.g. `md5`), and retains the existing behavior to use the
built-in preferentially.
Also includes a refactoring of the algorithms to reduce code size and
reduce the number of allocations they do as well as using bytearrays in
place of list-of-int where possible.
Add more comprehensive tests (using unittest).
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>