Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tox: fix lint target on python 3.13 #130

Merged
merged 1 commit into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@
---
name: CI

on: [push, pull_request]
on:
pull_request:
branches:
- master
push:
branches:
- master

jobs:
lint:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand All @@ -23,24 +29,24 @@ jobs:
- run: python -m tox -e lint

check-commits:
if: github.event_name == 'pull_request'
if: ${{ github.event.pull_request.commits }}
runs-on: ubuntu-latest
env:
LYPY_START_COMMIT: "${{ github.event.pull_request.base.sha }}"
LYPY_END_COMMIT: "${{ github.event.pull_request.head.sha }}"
LYPY_COMMIT_RANGE: "HEAD~${{ github.event.pull_request.commits }}.."
steps:
- run: sudo apt-get install git make
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- run: make check-commits

test:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
strategy:
matrix:
include:
- python: 3.9
- python: "3.9"
toxenv: py39
- python: "3.10"
toxenv: py310
Expand All @@ -56,7 +62,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
python-version: "${{ matrix.python }}"
- uses: actions/cache@v3
with:
path: ~/.cache/pip
Expand Down Expand Up @@ -86,7 +92,7 @@ jobs:
deploy:
needs: [lint, test]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
runs-on: ubuntu-24.03
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand Down
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ tests:
format:
tox -e format

LYPY_START_COMMIT ?= origin/master
LYPY_END_COMMIT ?= HEAD
LYPY_COMMIT_RANGE ?= origin/master..

check-commits:
./check-commits.sh $(LYPY_START_COMMIT)..$(LYPY_END_COMMIT)
./check-commits.sh $(LYPY_COMMIT_RANGE)

.PHONY: lint tests format check-commits
4 changes: 1 addition & 3 deletions libyang/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -1542,9 +1542,7 @@ def defaults(self) -> Iterator[Union[None, bool, int, str, float]]:

def max_elements(self) -> Optional[int]:
return (
self.cdata_leaflist.max
if self.cdata_leaflist.max != (2**32 - 1)
else None
self.cdata_leaflist.max if self.cdata_leaflist.max != (2**32 - 1) else None
)

def min_elements(self) -> int:
Expand Down
2 changes: 2 additions & 0 deletions libyang/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,6 @@ def data_load(in_type, in_data, data, data_keepalive, encode=True):
c_str = str2c(in_data, encode=encode)
data_keepalive.append(c_str)
ret = lib.ly_in_new_memory(c_str, data)
else:
raise ValueError("invalid input")
return ret
2 changes: 1 addition & 1 deletion libyang/xpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def xpath_split(xpath: str) -> Iterator[Tuple[str, str, List[Tuple[str, str]]]]:

# -------------------------------------------------------------------------------------
def _xpath_keys_to_key_name(
keys: List[Tuple[str, str]]
keys: List[Tuple[str, str]],
) -> Optional[Union[str, Tuple[str, ...]]]:
"""
Extract key name from parsed xpath keys returned by xpath_split. The return value
Expand Down
1 change: 1 addition & 0 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ disable=
too-many-branches,
too-many-lines,
too-many-locals,
too-many-positional-arguments,
too-many-return-statements,
too-many-statements,
unused-argument,
Expand Down
18 changes: 9 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ basepython = python3
description = Format python code using isort and black.
changedir = .
deps =
black~=23.12.1
isort~=5.13.2
black~=25.1.0
isort~=6.0.0
skip_install = true
install_command = python3 -m pip install {opts} {packages}
allowlist_externals =
Expand All @@ -52,14 +52,14 @@ basepython = python3
description = Run coding style checks.
changedir = .
deps =
astroid~=3.0.2
black~=23.12.1
flake8~=7.0.0
isort~=5.13.2
pycodestyle~=2.11.1
astroid~=3.3.8
black~=25.1.0
flake8~=7.1.1
isort~=6.0.0
pycodestyle~=2.12.1
pyflakes~=3.2.0
pylint~=3.0.3
setuptools~=69.0.3
pylint~=3.3.4
setuptools~=75.8.0
allowlist_externals =
/bin/sh
/usr/bin/sh
Expand Down