Skip to content

Commit

Permalink
Enable more Ruff rules and fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
akx committed Jan 18, 2024
1 parent 3407668 commit 3c962a5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gradio/cli/commands/cli_env_info.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" This file is the part of 'gradio/cli.py' for printing the environment info
""" This file is the part of 'gradio/cli.py' for printing the environment info
for the cli command 'gradio environment'
"""
import platform
Expand Down
2 changes: 1 addition & 1 deletion gradio/cli/commands/components/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
RUN mkdir -p /tmp/cache/
RUN chmod a+rwx -R /tmp/cache/
ENV TRANSFORMERS_CACHE=/tmp/cache/
ENV TRANSFORMERS_CACHE=/tmp/cache/
RUN pip install --no-cache-dir -r requirements.txt
Expand Down
4 changes: 2 additions & 2 deletions gradio/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ def attach_clear_events(
[],
([input_component_column] if input_component_column else []), # type: ignore
js=f"""() => {json.dumps(
[{'variant': None, 'visible': True, '__type__': 'update'}]
if self.interface_type
in [
Expand All @@ -709,7 +709,7 @@ def attach_clear_events(
InterfaceTypes.UNIFIED,
]
else []
)}
""",
)
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,13 @@ exclude = [
extend-select = [
"B",
"C",
"E",
"F",
"I",
"N",
"SIM",
"UP",
"W",
]
ignore = [
"C901", # function is too complex (TODO: un-ignore this)
Expand All @@ -128,6 +131,7 @@ exclude = ["gradio/node/*.py"]

[tool.ruff.per-file-ignores]
"demo/*" = [
"ARG",
"E402", # Demos may have imports not at the top
"E741", # Demos may have ambiguous variable names
"F405", # Demos may use star imports
Expand All @@ -140,6 +144,9 @@ exclude = ["gradio/node/*.py"]
"UP006", # Pydantic on Python 3.7 requires old-style type annotations (TODO: drop when Python 3.7 is dropped)
]
"gradio/cli/commands/files/NoTemplateComponent.py" = ["ALL"]
"test/*" = [
"ARG",
]

[tool.pytest.ini_options]
GRADIO_ANALYTICS_ENABLED = "False"
2 changes: 1 addition & 1 deletion test/test_custom_component_compatibility.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
This suite of tests is designed to ensure compatibility between the current version of Gradio
This suite of tests is designed to ensure compatibility between the current version of Gradio
with custom components created using the previous version of Gradio.
"""
from pathlib import Path
Expand Down

0 comments on commit 3c962a5

Please sign in to comment.