Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions taskiq/abc/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from taskiq.result_backends.dummy import DummyResultBackend
from taskiq.serializers.json_serializer import JSONSerializer
from taskiq.state import TaskiqState
from taskiq.utils import maybe_awaitable, remove_suffix
from taskiq.utils import maybe_awaitable
from taskiq.warnings import TaskiqDeprecationWarning

if sys.version_info >= (3, 11):
Expand Down Expand Up @@ -317,10 +317,9 @@ def inner(
fmodule = func.__module__
if fmodule == "__main__": # pragma: no cover
fmodule = ".".join(
remove_suffix(
os.path.normpath(sys.argv[0]),
".py",
).split(os.path.sep),
os.path.normpath(sys.argv[0])
.removesuffix(".py")
.split(os.path.sep),
)
fname = func.__name__
if fname == "<lambda>":
Expand Down
13 changes: 0 additions & 13 deletions taskiq/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,3 @@ async def maybe_awaitable(
if inspect.isawaitable(possible_coroutine):
return await possible_coroutine
return possible_coroutine # type: ignore


def remove_suffix(text: str, suffix: str) -> str:
"""
Removing a Suffix from a String with a Custom Function.

:param text: String
:param suffix: Removing a Suffix
:return: value.
"""
if text.endswith(suffix):
return text[: -len(suffix)]
return text