From 2b2ff736e1284702272f3b1ac9ebffa2a6301466 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 5 Nov 2021 16:22:10 -0400 Subject: [PATCH] Linted --- .pre-commit-config.yaml | 2 +- adafruit_hashlib/_sha256.py | 3 +-- adafruit_hashlib/_sha512.py | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1b9fadc..43d1385 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: name: pylint (library code) types: [python] args: - - --disable=consider-using-f-string + - --disable=consider-using-f-string,duplicate-code exclude: "^(docs/|examples/|tests/|setup.py$)" - id: pylint name: pylint (example code) diff --git a/adafruit_hashlib/_sha256.py b/adafruit_hashlib/_sha256.py index bbd5cce..e19b467 100644 --- a/adafruit_hashlib/_sha256.py +++ b/adafruit_hashlib/_sha256.py @@ -331,8 +331,7 @@ def sha_update(sha_info, buffer): if sha_info["local"]: i = SHA_BLOCKSIZE - sha_info["local"] - if i > size: - i = size + i = min(i, size) # copy sha buffer for x in enumerate(buffer[buffer_idx : buffer_idx + i]): diff --git a/adafruit_hashlib/_sha512.py b/adafruit_hashlib/_sha512.py index 390e019..5514e7f 100644 --- a/adafruit_hashlib/_sha512.py +++ b/adafruit_hashlib/_sha512.py @@ -388,8 +388,7 @@ def sha_update(sha_info, buffer): if sha_info["local"]: i = SHA_BLOCKSIZE - sha_info["local"] - if i > count: - i = count + i = min(i, count) # copy buffer for x in enumerate(buffer[buffer_idx : buffer_idx + i]):