1
0
mirror of https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git synced 2026-10-25 12:39:18 +03:00
Commit Graph

11 Commits

Author SHA1 Message Date
Vincent Fazio
3bb5368ba2 bindings: python: tests: selectively use f-strings
Since their inclusion in Python 3.6, f-strings have become the preferred
way to format strings with variable values as they are generally more
readable as the value substitution is in place and doesn't have to be
parsed from the list or arguments to `.format()`.

Where it does not impact readability (when the line is <120 characters),
swap usage of `.format()` to an f-string.

For lines that are not converted, inform the linter to ignore attempts
to upgrade those instances to f-strings [0]

[0]: https://docs.astral.sh/ruff/rules/f-string/

Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
Link: https://lore.kernel.org/r/20241114145116.2123714-23-vfazio@xes-inc.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-11-19 15:23:58 +01:00
Vincent Fazio
632ea4df4b bindings: python: tests: ignore purposeful type errors
Some of the unit tests intentionally call methods or assign properties
with invalid values to ensure they fail in an expected way.

Type checkers complain for these instances so inform them via directive
that these lines should be ignore for specific errors.

Additionally, some lines that access properties without assigning the
value look like they perform no action to linters.

To appease the linter, read the value into a throw-away variable.

Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
Link: https://lore.kernel.org/r/20241114145116.2123714-22-vfazio@xes-inc.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-11-19 15:23:58 +01:00
Vincent Fazio
d9313c18a0 bindings: python: tests: add missing method type hints
Add type hints for all method arguments and return values.

Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
Link: https://lore.kernel.org/r/20241114145116.2123714-20-vfazio@xes-inc.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-11-19 15:23:58 +01:00
Vincent Fazio
171577eb41 bindings: python: tests: clean up imports and exports
Remove unused imports and sort the remainder following isort rules.

Update the submodules to use `__all__` to advertise available imports.

Remove an unnecessary blank line in the VersionString class to abide by
the ruff formatter's rules (compatible with black's formatting).

Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
Link: https://lore.kernel.org/r/20241114145116.2123714-17-vfazio@xes-inc.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-11-19 15:21:01 +01:00
Bartosz Golaszewski
f054a7099d tests: fix version parsing (again)
This time we missed the fact that the last part is optional. Fix it
treewide.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-11-03 17:17:34 +01:00
Bartosz Golaszewski
b740f64daf tests: simplify and reduce the strictness of version string regex patterns
It seems like every release there's some new problem with parsing the
version strings in tests. Let's reduce the strictness of the patterns
to avoid future test failures and accept the following version schemes:

X.Y
X.Y.Z
X.Y-devel
X.Y-rcZ

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-04-11 17:54:57 +02:00
Bartosz Golaszewski
7936f50218 tests: fix version regex treewide
The square bracket is in the wrong place which makes the regex not match
version strings of the form: x.y.z. Fix the pattern in core and bindings
tests.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-04-11 13:56:23 +02:00
Bartosz Golaszewski
159940076e bindings: python: tests: fix the version parsing regex
Two-digit versions are not correctly parsed as the last "segment" is not
optional as it should.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-03-02 15:37:46 +01:00
Bartosz Golaszewski
265124bae0 tests: extend the regex matching string versions
We need to match release candidate versions too.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-02-08 14:25:17 +01:00
Bartosz Golaszewski
242d88b7fe bindings: python: decouple the version of the bindings from libgpiod API version
Python bindings now have their own setup.py script and can be built
separately from the rest of the code-base. Let's decouple the python
package version from libgpiod API (but let's keep a module attribute
containing the API version) by introducing a version.py submodule that
can be executed by the setup.py script. This way we have a single
canonical place defining the version number.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2022-12-07 09:54:14 +01:00
Bartosz Golaszewski
b7ba732e6a treewide: libgpiod v2 implementation
This commit is the result of a squash of all the commits created during
the development of libgpiod v2. This is done to preserve bisectability
of the git tree. It contains significant re-writes of the core C library
as well as C++ and python bindings. The tools have been adjusted to work
with the new API but have not undergone significant changes yet.

This commit contains the bulk of the work on libgpiod v2 but the
development continues with more changes planned.

Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
[Ben: fix format specifier for uint64_t]
Signed-off-by: Ben Hutchings <ben.hutchings@mind.be>
[Viresh: Fix ioctl number for gpiod_line_request_reconfigure_lines()]
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
[Kent: bug fixes, improvements, better pointer contracts, type strictness]
Signed-off-by: Kent Gibson <warthog618@gmail.com>
2022-10-31 11:15:14 +01:00