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>
Includes:
- component oriented driver, to only install the parts that are needed
- synchronous operation
- async wrapper class for asynchronous operation
- two examples with async & synchronous versions
- documentation
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
This adds a utarfile-write extension package that adds the ability to
create and append to tar files.
Work done by Doug Ellis <dpwe@ee.columbia.edu>.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Removes the workaround for micropython/issues/6864.
Sets the default flags for discovered descriptors to be WRITE,
so that d.write() will implicitly set response=True.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This tool makes a buildable package (including pyproject.toml) from
supported micropython-lib packages, suitable for publishing to PyPI and
using from CPython.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This is so the package knows the "upstream" name of the corresponding PyPI
package that it's based on.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Prior to this commit, if no tests were found when running unittest discover
then nothing at all was written to stdout, leading one to think it's not
working at all. CPython unittest does display a "0 tests run" sort of
output in such a case, and this commit ensures this package does the same.
Opt-in feature to make it easier for folks to test packages that are still
in development, open in Pull Requests, or even in independent forks.
---
To enable this on your own GitHub fork of the micropython-lib repository
then navigate to the fork's "Settings" -> "Secrets and variables" ->
"Actions" -> "Variables" page, then click "New repository variable", and
create a variable named MIP_INDEX with value true (or any "truthy" value).
Once enabled then any time a branch is pushed to your fork and builds
successfully, GitHub Actions will also push the built packages and package
index to the gh-pages branch which is associated with the repo's GitHub
Pages web site. The packages can then be installed remotely via:
mpremote mip --index \
https://USERNAME.github.io/micropython-lib/mip/BRANCH_NAME PACKAGE_NAME
or on a device as:
mip.install(PACKAGE_NAME, index="https://USERNAME.github.io/micropython-lib/mip/BRANCHNAME")
(Replace USERNAME, BRANCH_NAME and PACKAGE_NAME as applicable. If you've
renamed your fork, change the name micropython-lib to match.)
Note: As well as the MIP_INDEX repository variable, this functionality
depends on both GitHub Actions and GitHub Pages being enabled on your
repository in GitHub. However both options should enable automatically,
unless they have been manually disabled.
This work was funded through GitHub Sponsors.