Skip to content

Commit 40d041c

Browse files
uhxdanfimov
authored andcommitted
Replace utils.remove_suffix() with built-in str.removesuffix()
1 parent 1e207f6 commit 40d041c

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

taskiq/abc/broker.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from taskiq.result_backends.dummy import DummyResultBackend
3030
from taskiq.serializers.json_serializer import JSONSerializer
3131
from taskiq.state import TaskiqState
32-
from taskiq.utils import maybe_awaitable, remove_suffix
32+
from taskiq.utils import maybe_awaitable
3333
from taskiq.warnings import TaskiqDeprecationWarning
3434

3535
if sys.version_info >= (3, 11):
@@ -317,10 +317,9 @@ def inner(
317317
fmodule = func.__module__
318318
if fmodule == "__main__": # pragma: no cover
319319
fmodule = ".".join(
320-
remove_suffix(
321-
os.path.normpath(sys.argv[0]),
322-
".py",
323-
).split(os.path.sep),
320+
os.path.normpath(sys.argv[0])
321+
.removesuffix(".py")
322+
.split(os.path.sep),
324323
)
325324
fname = func.__name__
326325
if fname == "<lambda>":

taskiq/utils.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,3 @@ async def maybe_awaitable(
2929
if inspect.isawaitable(possible_coroutine):
3030
return await possible_coroutine
3131
return possible_coroutine # type: ignore
32-
33-
34-
def remove_suffix(text: str, suffix: str) -> str:
35-
"""
36-
Removing a Suffix from a String with a Custom Function.
37-
38-
:param text: String
39-
:param suffix: Removing a Suffix
40-
:return: value.
41-
"""
42-
if text.endswith(suffix):
43-
return text[: -len(suffix)]
44-
return text

0 commit comments

Comments
 (0)