File _message.py
has 4083 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
# pylint: disable=too-many-instance-attributes, too-many-arguments
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2024
Function __init__
has 82 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function _parse_markdown
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
def _parse_markdown(
cls,
message_text: Optional[str],
entities: Dict[MessageEntity, str],
urled: bool = False,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _parse_html
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def _parse_html(
cls,
message_text: Optional[str],
entities: Dict[MessageEntity, str],
urled: bool = False,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function de_json
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
def de_json(cls, data: Optional[JSONDict], bot: "Bot") -> Optional["Message"]:
"""See :meth:`telegram.TelegramObject.de_json`."""
data = cls._parse_data(data)
if not data:
Function _quote
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _quote(
self, quote: Optional[bool], reply_to_message_id: Optional[int] = None
) -> Optional[ReplyParameters]:
"""Modify kwargs for replying with or without quoting."""
if reply_to_message_id is not None:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function build_reply_arguments
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def build_reply_arguments(
Function _parse_markdown
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _parse_markdown(
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function _parse_html
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _parse_html(
Function link
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def link(self) -> Optional[str]:
""":obj:`str`: Convenience property. If the chat of the message is not
a private chat or normal group, returns a t.me link of the message.
.. versionchanged:: 20.3
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _de_json
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _de_json(
cls, data: Optional[JSONDict], bot: "Bot", api_kwargs: Optional[JSONDict] = None
) -> Optional["MaybeInaccessibleMessage"]:
"""See :meth:`telegram.TelegramObject.de_json`."""
data = cls._parse_data(data)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function build_reply_arguments
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def build_reply_arguments(
self,
quote: Optional[str] = None,
quote_index: Optional[int] = None,
target_chat_id: Optional[Union[int, str]] = None,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"