Skip to content

Commit

Permalink
Combined adjacent string literals (ISC001) one shot; rule disabled af…
Browse files Browse the repository at this point in the history
…terwards because ruff format warns of possible problems with it.
  • Loading branch information
Tronic committed Oct 29, 2023
1 parent 3fc645c commit 33d7152
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[tool.ruff]
extend-select = ["I", "W", "UP", "C4", "ISC", "S"]
# Worth selecting but still too broken: ASYNC, B, DTZ, FA
# Worth selecting but still too broken: ASYNC, B, DTZ, FA, RUF
ignore = [
"D100",
"D101",
Expand Down
2 changes: 1 addition & 1 deletion sanic/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ async def handle_exception(
response = self.error_handler.default(request, e)
elif self.debug:
response = HTTPResponse(
(f"Error while handling error: {e}\n" f"Stack: {format_exc()}"),
(f"Error while handling error: {e}\nStack: {format_exc()}"),
status=500,
)
else:
Expand Down
2 changes: 1 addition & 1 deletion sanic/cli/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def attach(self):
"--auto-reload",
dest="auto_reload",
action="store_true",
help=("Watch source directory for file changes and reload on " "changes"),
help=("Watch source directory for file changes and reload on changes"),
)
self.container.add_argument(
"-R",
Expand Down
2 changes: 1 addition & 1 deletion sanic/http/http3.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ async def run(self, exception: Exception | None = None):

if exception:
logger.info( # no cov
f"{Colors.BLUE}[exception]: " f"{Colors.RED}{exception}{Colors.END}",
f"{Colors.BLUE}[exception]: {Colors.RED}{exception}{Colors.END}",
exc_info=True,
extra={"verbosity": 1},
)
Expand Down
2 changes: 1 addition & 1 deletion sanic/mixins/startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def prepare(

if single_process and (fast or (workers > 1) or auto_reload):
raise RuntimeError(
"Single process cannot be run with multiple workers " "or auto-reload"
"Single process cannot be run with multiple workers or auto-reload"
)

if register_sys_signals is False and not single_process:
Expand Down
2 changes: 1 addition & 1 deletion sanic/server/websockets/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ async def get(self, timeout: Optional[float] = None) -> Optional[Data]:
# and get_in_progress check, this exception is here
# as a failsafe
raise ServerError(
"Websocket get() found a message when " "state was already fetched."
"Websocket get() found a message when state was already fetched."
)
self.message_fetched.set()
self.chunks = []
Expand Down
2 changes: 1 addition & 1 deletion sanic/server/websockets/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ async def ping(self, data: Optional[Data] = None) -> asyncio.Future:
async with self.conn_mutex:
if self.ws_proto.state in (CLOSED, CLOSING):
raise WebsocketClosed(
"Cannot send a ping when the websocket interface " "is closed."
"Cannot send a ping when the websocket interface is closed."
)
if (not self.io_proto) or (not self.io_proto.loop):
raise ServerError(
Expand Down
2 changes: 1 addition & 1 deletion sanic/worker/multiplexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def restart(
"""
if name and all_workers:
raise ValueError(
"Ambiguous restart with both a named process and" " all_workers=True"
"Ambiguous restart with both a named process and all_workers=True"
)
if not name:
name = "__ALL_PROCESSES__:" if all_workers else self.name
Expand Down
4 changes: 1 addition & 3 deletions tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,7 @@ class CustomSanic(Sanic):
def test_bad_custom_config():
with pytest.raises(
SanicException,
match=(
"When instantiating Sanic with config, you cannot also pass " "env_prefix"
),
match=("When instantiating Sanic with config, you cannot also pass env_prefix"),
):
Sanic("test", config=1, env_prefix=1)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,10 @@ def test_accept_misc():
header = "foo/bar;q=0.0, */plain;param=123, text/plain, text/*, foo/bar;q=0.5"
a = headers.parse_accept(header)
assert repr(a) == (
"[*/plain;param=123, text/plain, text/*, " "foo/bar;q=0.5, foo/bar;q=0.0]"
"[*/plain;param=123, text/plain, text/*, foo/bar;q=0.5, foo/bar;q=0.0]"
) # noqa: E501
assert str(a) == (
"*/plain;param=123, text/plain, text/*, " "foo/bar;q=0.5, foo/bar;q=0.0"
"*/plain;param=123, text/plain, text/*, foo/bar;q=0.5, foo/bar;q=0.0"
) # noqa: E501
# q=1 types don't match foo/bar but match the two others,
# text/* comes first and matches */plain because it
Expand Down
2 changes: 1 addition & 1 deletion tests/test_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ async def handler(request: Request):
)

error_msg2 = (
"Response stream was ended, no more " "response data is allowed to be sent."
"Response stream was ended, no more response data is allowed to be sent."
)

with caplog.at_level(ERROR):
Expand Down

0 comments on commit 33d7152

Please sign in to comment.