diff --git a/.github/dependabot.yml b/.github/dependabot.yml index dbe907783..70463c491 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,7 +9,10 @@ updates: # Enable version updates for development dependencies directory: "/" schedule: - interval: "monthly" + interval: "cron" + cronjob: "0 0 1 */3 *" # Run once every 3 months + cooldown: + default-days: 7 versioning-strategy: "increase-if-necessary" groups: dev-deps: @@ -20,7 +23,10 @@ updates: # Enable version updates for GitHub Actions directory: "/" schedule: - interval: "monthly" + interval: "cron" + cronjob: "0 0 1 */3 *" # Run once every 3 months + cooldown: + default-days: 7 groups: github-actions: patterns: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 796e7c65a..e9655039f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,12 +33,14 @@ jobs: ] fail-fast: false steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2 + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # 6.0.3 with: fetch-depth: 0 persist-credentials: false - name: Install uv - uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # 7.3.1 + uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # 8.1.0 + with: + enable-cache: false - name: Install tox run: uv tool install tox --with tox-uv - name: Setup SocketCAN @@ -66,7 +68,7 @@ jobs: needs: test runs-on: ubuntu-latest steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2 + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # 6.0.3 with: fetch-depth: 0 persist-credentials: false @@ -79,12 +81,14 @@ jobs: static-code-analysis: runs-on: ubuntu-latest steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2 + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # 6.0.3 with: fetch-depth: 0 persist-credentials: false - name: Install uv - uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # 7.3.1 + uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # 8.1.0 + with: + enable-cache: false - name: Install tox run: uv tool install tox --with tox-uv - name: Run linters @@ -97,12 +101,14 @@ jobs: docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2 + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # 6.0.3 with: fetch-depth: 0 persist-credentials: false - name: Install uv - uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # 7.3.1 + uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # 8.1.0 + with: + enable-cache: false - name: Install tox run: uv tool install tox --with tox-uv - name: Build documentation @@ -113,18 +119,20 @@ jobs: name: Packaging runs-on: ubuntu-latest steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2 + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # 6.0.3 with: fetch-depth: 0 persist-credentials: false - name: Install uv - uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # 7.3.1 + uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # 8.1.0 + with: + enable-cache: false - name: Build wheel and sdist run: uv build - name: Check build artifacts run: uvx twine check --strict dist/* - name: Save artifacts - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # 7.0.0 + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # 7.0.1 with: name: release path: ./dist @@ -140,7 +148,7 @@ jobs: # upload to PyPI only on release if: github.event.release && github.event.action == 'published' steps: - - uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # 8.0.0 + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1 with: path: dist merge-multiple: true @@ -151,4 +159,4 @@ jobs: subject-path: 'dist/*' - name: Publish release distributions to PyPI - uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # 1.13.0 + uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # 1.14.0 diff --git a/.mergify.yml b/.mergify.yml deleted file mode 100644 index 52b243cd3..000000000 --- a/.mergify.yml +++ /dev/null @@ -1,25 +0,0 @@ -queue_rules: - - name: default - conditions: - - "status-success=test" # "GitHub Actions works slightly differently [...], only the job name is used." - - "status-success=format" - -pull_request_rules: - - name: Automatic merge passing PR on up to date branch with approving CR - conditions: - - "base=develop" - - "#approved-reviews-by>=1" - - "#review-requested=0" - - "#changes-requested-reviews-by=0" - - "status-success=test" - - "status-success=format" - - "label!=work-in-progress" - actions: - queue: - name: default - - - name: Delete head branch after merge - conditions: - - merged - actions: - delete_head_branch: {} diff --git a/can/bit_timing.py b/can/bit_timing.py index 2bb04bfbe..4311ff9a4 100644 --- a/can/bit_timing.py +++ b/can/bit_timing.py @@ -74,8 +74,8 @@ def __init__( "sjw": sjw, "nof_samples": nof_samples, } - self._validate() if strict: + self._validate() self._restrict_to_minimum_range() def _validate(self) -> None: diff --git a/can/interfaces/pcan/basic.py b/can/interfaces/pcan/basic.py index 4d175c645..3654699c5 100644 --- a/can/interfaces/pcan/basic.py +++ b/can/interfaces/pcan/basic.py @@ -990,12 +990,10 @@ def GetValue(self, Channel, Parameter): logger.error("Exception on PCANBasic.GetValue") raise - # Returns a descriptive text of a given TPCANStatus - # error code, in any desired language + # Configures or sets a PCAN Channel value # def SetValue(self, Channel, Parameter, Buffer): - """Returns a descriptive text of a given TPCANStatus error - code, in any desired language + """Configures or sets a PCAN Channel value Remarks: Parameters can be present or not according with the kind @@ -1036,7 +1034,8 @@ def SetValue(self, Channel, Parameter, Buffer): raise def GetErrorText(self, Error, Language=0): - """Configures or sets a PCAN Channel value + """Returns a descriptive text of a given TPCANStatus error + code, in any desired language Remarks: diff --git a/can/notifier.py b/can/notifier.py index cb91cf7b4..fd21a0662 100644 --- a/can/notifier.py +++ b/can/notifier.py @@ -133,7 +133,7 @@ def __init__( :raises ValueError: If a passed in *bus* is already assigned to an active :class:`~can.Notifier`. """ - self.listeners: list[MessageRecipient] = list(listeners) + self.listeners: set[MessageRecipient] = set(listeners) self._bus_list: list[BusABC] = [] self.timeout = timeout self._loop = loop @@ -278,20 +278,18 @@ def _on_error(self, exc: Exception) -> bool: return was_handled def add_listener(self, listener: MessageRecipient) -> None: - """Add new Listener to the notification list. - If it is already present, it will be called two times - each time a message arrives. + """Add new Listener to the notification set. :param listener: Listener to be added to the list to be notified """ - self.listeners.append(listener) + self.listeners.add(listener) def remove_listener(self, listener: MessageRecipient) -> None: - """Remove a listener from the notification list. This method + """Remove a listener from the notification set. This method throws an exception if the given listener is not part of the stored listeners. - :param listener: Listener to be removed from the list to be notified + :param listener: Listener to be removed from the set to be notified :raises ValueError: if `listener` was never added to this notifier """ self.listeners.remove(listener) diff --git a/doc/changelog.d/2061.fixed.rst b/doc/changelog.d/2061.fixed.rst new file mode 100644 index 000000000..48afb4c86 --- /dev/null +++ b/doc/changelog.d/2061.fixed.rst @@ -0,0 +1 @@ +Fix ``can.BitTiming`` rejecting bit rate prescaler values greater than 64 even when ``strict=False``. \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 23bebd12e..9dd55f8df 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -92,16 +92,16 @@ docs = [ lint = [ "pylint==4.0.*", "ruff==0.15.*", - "black==26.1.*", - "mypy==1.19.*", + "black==26.5.*", + "mypy==2.1.*", ] test = [ "pytest==9.0.*", "pytest-timeout==2.4.*", "pytest-modern==0.7.*;platform_system!='Windows'", "coveralls==4.1.*", - "pytest-cov==7.0.*", - "coverage==7.13.*", + "pytest-cov==7.1.*", + "coverage==7.14.*", "hypothesis==6.*", "parameterized==0.9.*", ]