diff --git a/CHANGELOG.md b/CHANGELOG.md
index e2a2f522d4ce7..23ca848a40646 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@ No changes to highlight.
- Refactor web component `initial_height` attribute by [@whitphx](https://github.com/whitphx) in [PR 4223](https://github.com/gradio-app/gradio/pull/4223)
- Relocate `mount_css` fn to remove circular dependency [@whitphx](https://github.com/whitphx) in [PR 4222](https://github.com/gradio-app/gradio/pull/4222)
+- Upgrade Black to 23.3 by [@akx](https://github.com/akx) in [PR 4259](https://github.com/gradio-app/gradio/pull/4259)
## Breaking Changes:
diff --git a/client/python/gradio_client/client.py b/client/python/gradio_client/client.py
index db4a1f716f3e9..599e22c6ac72b 100644
--- a/client/python/gradio_client/client.py
+++ b/client/python/gradio_client/client.py
@@ -610,7 +610,6 @@ def __str__(self):
return self.__repr__()
def make_end_to_end_fn(self, helper: Communicator | None = None):
-
_predict = self.make_predict(helper)
def _inner(*data):
diff --git a/client/python/test/requirements.txt b/client/python/test/requirements.txt
index 8a864c0525b0f..76e2e3bcbe808 100644
--- a/client/python/test/requirements.txt
+++ b/client/python/test/requirements.txt
@@ -1,4 +1,4 @@
-black==22.6.0
+black==23.3.0
pytest-asyncio
pytest==7.1.2
ruff==0.0.264
diff --git a/client/python/test/test_serializing.py b/client/python/test/test_serializing.py
index 38ed57550bf1d..521a9b9c485a7 100644
--- a/client/python/test/test_serializing.py
+++ b/client/python/test/test_serializing.py
@@ -34,7 +34,6 @@ def test_all_components_in_component_mapping(all_components):
def test_file_serializing():
-
try:
serializing = FileSerializable()
with tempfile.NamedTemporaryFile(delete=False, mode="w") as f1:
diff --git a/gradio/external.py b/gradio/external.py
index 6080d5405a734..673963f451afa 100644
--- a/gradio/external.py
+++ b/gradio/external.py
@@ -500,7 +500,6 @@ def from_spaces_interface(
iframe_url: str,
**kwargs,
) -> Interface:
-
config = streamline_spaces_interface(config)
api_url = f"{iframe_url}/api/predict/"
headers = {"Content-Type": "application/json"}
diff --git a/gradio/interface.py b/gradio/interface.py
index ae302db1a1605..fd14bbf368835 100644
--- a/gradio/interface.py
+++ b/gradio/interface.py
@@ -616,7 +616,6 @@ def attach_submit_events(self, submit_btn: Button | None, stop_btn: Button | Non
predict_events = []
if stop_btn:
-
# Wrap the original function to show/hide the "Stop" button
async def fn(*args):
# The main idea here is to call the original function
@@ -885,7 +884,7 @@ def __init__(
f"
{title}
"
)
with Tabs():
- for (interface, tab_name) in zip(interface_list, tab_names):
+ for interface, tab_name in zip(interface_list, tab_names):
with Tab(label=tab_name):
interface.render()
diff --git a/gradio/themes/utils/semver_match.py b/gradio/themes/utils/semver_match.py
index 1b12d3c3e3634..25df9265b7a0c 100644
--- a/gradio/themes/utils/semver_match.py
+++ b/gradio/themes/utils/semver_match.py
@@ -30,7 +30,6 @@ def get_theme_assets(space_info: huggingface_hub.hf_api.SpaceInfo) -> list[Theme
def get_matching_version(
assets: list[ThemeAsset], expression: str | None
) -> ThemeAsset | None:
-
expression = expression or "*"
# Return most recent version that matches
diff --git a/test/requirements-37.txt b/test/requirements-37.txt
index 8f7683d20d685..0df29e1969785 100644
--- a/test/requirements-37.txt
+++ b/test/requirements-37.txt
@@ -18,7 +18,7 @@ attrs==21.4.0
# pytest
backcall==0.2.0
# via ipython
-black==22.6.0
+black==23.3.0
# via -r requirements.in
boto3==1.26.65
# via -r requirements.in
@@ -121,7 +121,7 @@ numpy==1.21.6
# shap
# tifffile
# transformers
-packaging==21.3
+packaging==22.0
# via
# huggingface-hub
# pytest
diff --git a/test/requirements.txt b/test/requirements.txt
index 9196e2ae50aa7..f5d596accfe42 100644
--- a/test/requirements.txt
+++ b/test/requirements.txt
@@ -18,7 +18,7 @@ attrs==21.4.0
# pytest
backcall==0.2.0
# via ipython
-black==22.6.0
+black==23.3.0
# via -r requirements.in
boto3==1.26.65
# via -r requirements.in
@@ -111,7 +111,7 @@ numpy==1.21.6
# shap
# tifffile
# transformers
-packaging==21.3
+packaging==22.0
# via
# huggingface-hub
# pytest
diff --git a/test/test_blocks.py b/test/test_blocks.py
index 63b586f33f6c6..76b237200bdac 100644
--- a/test/test_blocks.py
+++ b/test/test_blocks.py
@@ -358,7 +358,6 @@ async def _get_ws_pred(data, fn_index):
demo.close()
def test_socket_reuse(self):
-
try:
io = gr.Interface(lambda x: x, gr.Textbox(), gr.Textbox())
io.launch(server_port=9441, prevent_thread_lock=True)
@@ -375,7 +374,6 @@ def generator_function():
yield from range(10)
with gr.Blocks() as demo:
-
gr.Number(value=lambda: 2, every=2)
meaning_of_life = gr.Number()
counter = gr.Number()
@@ -524,7 +522,6 @@ def test_get_load_events(self, io_components):
class TestBlocksPostprocessing:
def test_blocks_do_not_filter_none_values_from_updates(self, io_components):
-
io_components = [
c()
for c in io_components
@@ -1284,7 +1281,6 @@ def test_raise_exception_if_parameters_invalid(self):
@pytest.mark.asyncio
async def test_every_does_not_block_queue(self):
-
with gr.Blocks() as demo:
num = gr.Number(value=0)
name = gr.Textbox()
diff --git a/test/test_components.py b/test/test_components.py
index d70251f3d3d1c..8cbaa9a0f0b62 100644
--- a/test/test_components.py
+++ b/test/test_components.py
@@ -1546,7 +1546,6 @@ def test_component_functions(self):
}
def test_color_argument(self):
-
label = gr.Label(value=-10, color="red")
assert label.get_config()["color"] == "red"
update_1 = gr.Label.update(value="bad", color="brown")
@@ -2182,7 +2181,6 @@ def test_dataset_calls_as_example(*mocks):
class TestScatterPlot:
@patch.dict("sys.modules", {"bokeh": MagicMock(__version__="3.0.3")})
def test_get_config(self):
-
assert gr.ScatterPlot().get_config() == {
"caption": None,
"elem_id": None,
diff --git a/test/test_networking.py b/test/test_networking.py
index 869ca7f48feb3..e5435bf0371e8 100644
--- a/test/test_networking.py
+++ b/test/test_networking.py
@@ -54,7 +54,6 @@ def test_validation_error(self):
class TestStartServer:
-
# Test IPv4 and IPv6 hostnames as they would be passed from --server-name.
@pytest.mark.parametrize("host", ["127.0.0.1", "[::1]"])
def test_start_server(self, host):
diff --git a/test/test_theme_sharing.py b/test/test_theme_sharing.py
index e44823d47d327..d09be0cb38a7f 100644
--- a/test/test_theme_sharing.py
+++ b/test/test_theme_sharing.py
@@ -205,7 +205,6 @@ def test_breaks_ties_against_prerelease(self):
class TestGetThemeAssets:
def test_get_theme_assets(self):
-
space_info = huggingface_hub.hf_api.SpaceInfo(
id="freddyaboulton/dracula",
siblings=[
@@ -285,7 +284,6 @@ def test_get_next_version(self, mock):
@pytest.mark.flaky
def test_theme_download(self):
-
assert (
gr.themes.Base.from_hub("gradio/dracula_test@0.0.1").to_dict()
== dracula.to_dict()
@@ -298,7 +296,6 @@ def test_theme_download(self):
assert demo.theme.name == "gradio/dracula_test"
def test_theme_download_raises_error_if_theme_does_not_exist(self):
-
with pytest.raises(
ValueError, match="The space freddyaboulton/nonexistent does not exist"
):