This is an automated email from the ASF dual-hosted git repository. ronny pushed a commit to branch dev/update-python-black in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit b233c3b0f8b6908ed0cc4aea9bc04c0f35a02fdd Author: Ronny Berndt <[email protected]> AuthorDate: Fri Apr 17 13:35:53 2026 +0200 dev: Update Black to 26.3.1 Update Python Black to 26.3.1 to support new Pythons. --- Makefile | 2 +- Makefile.win | 2 +- build-aux/show-test-results.py | 1 - dev/format_check.py | 1 - dev/pbkdf2.py | 57 +++++++++++++++++++++--------------------- dev/run | 18 ++++++------- src/docs/ext/linter.py | 9 ++----- src/mango/test/user_docs.py | 1 - 8 files changed, 40 insertions(+), 51 deletions(-) diff --git a/Makefile b/Makefile index 15c843554..291c5e569 100644 --- a/Makefile +++ b/Makefile @@ -200,7 +200,7 @@ erlfmt-format: .venv/bin/black: @python3 -m venv .venv - @.venv/bin/pip3 install black==23.3.0 || touch .venv/bin/black + @.venv/bin/pip3 install black==26.3.1 || touch .venv/bin/black # target: python-black - Check Python code formatting (requires Python >= 3.6) python-black: .venv/bin/black diff --git a/Makefile.win b/Makefile.win index e05f9b3cb..97292f36a 100644 --- a/Makefile.win +++ b/Makefile.win @@ -189,7 +189,7 @@ erlfmt-format: .venv/bin/black: @$(PYTHON) -m venv .venv - @.venv\Scripts\pip3.exe install black==23.3.0 || copy /b .venv\Scripts\black.exe +,, + @.venv\Scripts\pip3.exe install black==26.3.1 || copy /b .venv\Scripts\black.exe +,, # target: python-black - Check Python code formatting (requires Python >= 3.6) python-black: .venv/bin/black diff --git a/build-aux/show-test-results.py b/build-aux/show-test-results.py index ca28a3ee8..9ca7f11cd 100755 --- a/build-aux/show-test-results.py +++ b/build-aux/show-test-results.py @@ -7,7 +7,6 @@ import os import re import xml.dom.minidom as md - TEST_COLLECTIONS = { "EUnit": "src/**/.eunit/*.xml", "EXUnit": "_build/integration/lib/couchdbtest/*.xml", diff --git a/dev/format_check.py b/dev/format_check.py index cbb0126d9..1c90e8246 100644 --- a/dev/format_check.py +++ b/dev/format_check.py @@ -23,7 +23,6 @@ import sys from format_lib import get_source_paths, get_erlang_version - if __name__ == "__main__": if get_erlang_version() < 21: print("Erlang version is < 21. Skipping format check") diff --git a/dev/pbkdf2.py b/dev/pbkdf2.py index 4416f8632..d7b7ef9d8 100644 --- a/dev/pbkdf2.py +++ b/dev/pbkdf2.py @@ -1,45 +1,46 @@ # -*- coding: utf-8 -*- """ - pbkdf2 - ~~~~~~ +pbkdf2 +~~~~~~ - This module implements pbkdf2 for Python. It also has some basic - tests that ensure that it works. The implementation is straightforward - and uses stdlib only stuff and can be easily be copy/pasted into - your favourite application. +This module implements pbkdf2 for Python. It also has some basic +tests that ensure that it works. The implementation is straightforward +and uses stdlib only stuff and can be easily be copy/pasted into +your favourite application. - Use this as replacement for bcrypt that does not need a c implementation - of a modified blowfish crypto algo. +Use this as replacement for bcrypt that does not need a c implementation +of a modified blowfish crypto algo. - Example usage: +Example usage: - >>> pbkdf2_hex('what i want to hash', 'the random salt') - 'fa7cc8a2b0a932f8e6ea42f9787e9d36e592e0c222ada6a9' +>>> pbkdf2_hex('what i want to hash', 'the random salt') +'fa7cc8a2b0a932f8e6ea42f9787e9d36e592e0c222ada6a9' - How to use this: +How to use this: - 1. Use a constant time string compare function to compare the stored hash - with the one you're generating:: +1. Use a constant time string compare function to compare the stored hash + with the one you're generating:: - def safe_str_cmp(a, b): - if len(a) != len(b): - return False - rv = 0 - for x, y in izip(a, b): - rv |= ord(x) ^ ord(y) - return rv == 0 + def safe_str_cmp(a, b): + if len(a) != len(b): + return False + rv = 0 + for x, y in izip(a, b): + rv |= ord(x) ^ ord(y) + return rv == 0 - 2. Use `os.urandom` to generate a proper salt of at least 8 byte. - Use a unique salt per hashed password. +2. Use `os.urandom` to generate a proper salt of at least 8 byte. + Use a unique salt per hashed password. - 3. Store ``algorithm$salt:costfactor$hash`` in the database so that - you can upgrade later easily to a different algorithm if you need - one. For instance ``PBKDF2-256$thesalt:10000$deadbeef...``. +3. Store ``algorithm$salt:costfactor$hash`` in the database so that + you can upgrade later easily to a different algorithm if you need + one. For instance ``PBKDF2-256$thesalt:10000$deadbeef...``. - :copyright: (c) Copyright 2011 by Armin Ronacher. - :license: BSD, see LICENSE for more details. +:copyright: (c) Copyright 2011 by Armin Ronacher. +:license: BSD, see LICENSE for more details. """ + from binascii import hexlify import hmac import hashlib diff --git a/dev/run b/dev/run index 04aaddc43..7a313a4b4 100755 --- a/dev/run +++ b/dev/run @@ -361,9 +361,7 @@ def check_boot_script(ctx): @log("Prepare configuration files") def setup_configs(ctx): for idx, node in enumerate(ctx["nodes"]): - cluster_port, prometheus_port = get_ports( - ctx, idx + ctx["node_number_seed"] - ) + cluster_port, prometheus_port = get_ports(ctx, idx + ctx["node_number_seed"]) env = { "prefix": toposixpath(ctx["rootdir"]), "package_author_name": "The Apache Software Foundation", @@ -655,8 +653,7 @@ def generate_default_clouseau_config(path, config_file, body): def generate_default_logback_properties(path): print("(generate default logback.xml)") with open(path, "w") as handle: - handle.write( - """<configuration> + handle.write("""<configuration> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%d{ISO8601} %c [%p] %m%n</pattern> @@ -667,8 +664,7 @@ def generate_default_logback_properties(path): <appender-ref ref="STDOUT"/> </root> </configuration> -""" - ) +""") @log("Start Clouseau node clouseau{idx}") @@ -1200,7 +1196,7 @@ def enable_cluster(node_count, port, user, pswd): "node_count": node_count, } ) - (status, response) = try_request( + status, response = try_request( "127.0.0.1", port, "POST", @@ -1227,7 +1223,7 @@ def add_node(lead_port, node_name, node_port, user, pswd): "password": pswd, } ) - (status, response) = try_request( + status, response = try_request( "127.0.0.1", lead_port, "POST", @@ -1240,7 +1236,7 @@ def add_node(lead_port, node_name, node_port, user, pswd): def set_cookie(port, user, pswd): - (status, response) = try_request( + status, response = try_request( "127.0.0.1", port, "POST", @@ -1253,7 +1249,7 @@ def set_cookie(port, user, pswd): def finish_cluster(port, user, pswd): - (status, response) = try_request( + status, response = try_request( "127.0.0.1", port, "POST", diff --git a/src/docs/ext/linter.py b/src/docs/ext/linter.py index 4b171a421..0c1eb92c2 100644 --- a/src/docs/ext/linter.py +++ b/src/docs/ext/linter.py @@ -17,7 +17,6 @@ import os import re - RULES = [] HAS_ERRORS = False IGNORE_ERROR = False @@ -116,8 +115,7 @@ def silent_scream(file): @register_rule def license_adviser(file): """Each source file must include ASF license header.""" - header = iter( - """ + header = iter(""" .. Licensed under the Apache License, Version 2.0 (the "License"); you may not .. use this file except in compliance with the License. You may obtain a copy of .. the License at @@ -130,10 +128,7 @@ def license_adviser(file): .. License for the specific language governing permissions and limitations under .. the License. -""".lstrip().splitlines( - False - ) - ) +""".lstrip().splitlines(False)) error = None for n, hline in enumerate(header): fline = yield error diff --git a/src/mango/test/user_docs.py b/src/mango/test/user_docs.py index b2a19eea7..9f6187e41 100644 --- a/src/mango/test/user_docs.py +++ b/src/mango/test/user_docs.py @@ -49,7 +49,6 @@ With this pattern: ] """ - import copy
