From f479fb9ad2d3e758fb4d980cd8982f0c8e4f47b5 Mon Sep 17 00:00:00 2001 From: "H. Shay" Date: Thu, 16 Dec 2021 13:23:44 -0800 Subject: [PATCH 1/4] update black version --- pyproject.toml | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8bca1fa4efd9..d7f2be586cba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ showcontent = true [tool.black] -target-version = ['py36'] +target-version = ['py37'] exclude = ''' ( diff --git a/setup.py b/setup.py index 2c6fb9aacb45..4ac92bd73a92 100755 --- a/setup.py +++ b/setup.py @@ -96,7 +96,7 @@ def exec_file(path_segments): # We pin black so that our tests don't start failing on new releases. CONDITIONAL_REQUIREMENTS["lint"] = [ "isort==5.7.0", - "black==21.6b0", + "black==21.12b0", "flake8-comprehensions", "flake8-bugbear==21.3.2", "flake8", From 42652409373cb8066793c9f1c37b842422d0e36a Mon Sep 17 00:00:00 2001 From: "H. Shay" Date: Thu, 16 Dec 2021 13:31:36 -0800 Subject: [PATCH 2/4] run updated version of black on code --- synapse/logging/context.py | 1 - synapse/util/caches/lrucache.py | 1 - 2 files changed, 2 deletions(-) diff --git a/synapse/logging/context.py b/synapse/logging/context.py index 25e78cc82fcd..d4ee89337642 100644 --- a/synapse/logging/context.py +++ b/synapse/logging/context.py @@ -68,7 +68,6 @@ def get_thread_resource_usage() -> "Optional[resource.struct_rusage]": return resource.getrusage(RUSAGE_THREAD) - except Exception: # If the system doesn't support resource.getrusage(RUSAGE_THREAD) then we # won't track resource usage. diff --git a/synapse/util/caches/lrucache.py b/synapse/util/caches/lrucache.py index eb96f7e665e6..3f11a2f9dd5c 100644 --- a/synapse/util/caches/lrucache.py +++ b/synapse/util/caches/lrucache.py @@ -69,7 +69,6 @@ def _get_size_of(val: Any, *, recurse: bool = True) -> int: sizer.exclude_refs((), None, "") return sizer.asizeof(val, limit=100 if recurse else 0) - except ImportError: def _get_size_of(val: Any, *, recurse: bool = True) -> int: From fb79ff553043e7c01b3beaeb0cdb00b3bdd8236e Mon Sep 17 00:00:00 2001 From: "H. Shay" Date: Thu, 16 Dec 2021 13:33:51 -0800 Subject: [PATCH 3/4] newsfragment --- changelog.d/11596.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/11596.misc diff --git a/changelog.d/11596.misc b/changelog.d/11596.misc new file mode 100644 index 000000000000..3064bc632d57 --- /dev/null +++ b/changelog.d/11596.misc @@ -0,0 +1 @@ +Update black version and run it on all the files. \ No newline at end of file From 1dbff111b7d7a5d0244ccb818fb38570c7934d2c Mon Sep 17 00:00:00 2001 From: "H. Shay" Date: Tue, 21 Dec 2021 08:17:25 -0800 Subject: [PATCH 4/4] enumerate python versions --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d7f2be586cba..963f149c6af6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ showcontent = true [tool.black] -target-version = ['py37'] +target-version = ['py37', 'py38', 'py39', 'py310'] exclude = ''' (