Skip to content

Commit

Permalink
style: changes suggested by ruff but not reverted by black
Browse files Browse the repository at this point in the history
ruff is a drop-in replacement for black, flake8 and isort, but runs
about 100 times faster.
Ref: https://github.com/astral-sh/ruff

On Studio, black accepts all the changes ruff makes.

This commit applies what ruff did, and removed a superfluous command in
test/run.py that ruff flagged, but does not change pre-commit or the dev
dependencies yet.
  • Loading branch information
joanise committed Nov 1, 2023
1 parent 51f1dce commit 9e0aeab
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[lint]
select = ["E4", "E7", "E9", "F", "I", "W"]
4 changes: 2 additions & 2 deletions readalongs/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def align(
output_base=output_base,
language=language,
output_formats=output_formats,
**kwargs
**kwargs,
)

cli.align.callback(**align_args) # type: ignore
Expand Down Expand Up @@ -136,7 +136,7 @@ def make_xml(
language=JoinerCallbackForClick(get_langs_deferred())(
value_groups=language
),
**kwargs
**kwargs,
)
cli.make_xml.callback(**make_xml_args) # type: ignore
except OSError as e:
Expand Down
5 changes: 2 additions & 3 deletions readalongs/text/make_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ def encode_from_path(path: str) -> str:
): # We declare it to be application/readalong+xml, not what mimetypes thinks
mime_type = "application/readalong+xml"
elif mime[0]:
mime_type = mime[0].replace(
"video", "audio"
) # Hack: until we properly extract audio from video files, force any video-based mime type to be read as audio
# Hack: until we properly extract audio from video files, force any video-based mime type to be read as audio
mime_type = mime[0].replace("video", "audio")
else:
mime_type = "application"
LOGGER.warning(
Expand Down
2 changes: 1 addition & 1 deletion readalongs/web_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ async def assemble(
},
}
]
)
),
):
"""Create an input RAS from the given text (as plain text or XML).
Also creates the required grammar, pronunciation dictionary,
Expand Down
1 change: 1 addition & 0 deletions test/basic_test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from unittest import TestCase

from click.testing import CliRunner

from readalongs.log import LOGGER


Expand Down
4 changes: 2 additions & 2 deletions test/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ def describe_suite(suite: TestSuite):
full_list = list(list_tests(full_suite))
requested_list = list(list_tests(suite))
requested_set = set(requested_list)
print("Test suite includes:", *sorted(requested_list), sep="\n"),
print("Test suite includes:", *sorted(requested_list), sep="\n")
print(
"\nTest suite excludes:",
*sorted(test for test in full_list if test not in requested_set),
sep="\n"
sep="\n",
)


Expand Down

0 comments on commit 9e0aeab

Please sign in to comment.