Skip to content

Commit

Permalink
Some code clearing
Browse files Browse the repository at this point in the history
  • Loading branch information
Badiboy committed Nov 19, 2023
1 parent 9ff9e11 commit 62e195a
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions telebot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,16 @@ def __init__(
self.token = token
self.skip_pending = skip_pending # backward compatibility
self.last_update_id = last_update_id
# propertys

# properties
self.suppress_middleware_excepions = suppress_middleware_excepions
self.parse_mode = parse_mode
self.disable_web_page_preview = disable_web_page_preview
self.disable_notification = disable_notification
self.protect_content = protect_content
self.allow_sending_without_reply = allow_sending_without_reply
self.webhook_listener = None
self._user = None

# logs-related
if colorful_logs:
Expand Down Expand Up @@ -269,7 +271,7 @@ def user(self) -> types.User:
:return: Bot's info.
:rtype: :class:`telebot.types.User`
"""
if not hasattr(self, "_user"):
if not self._user:
self._user = self.get_me()
return self._user

Expand Down Expand Up @@ -1055,7 +1057,7 @@ def _handle_exception(self, exception: Exception) -> bool:

def __threaded_polling(self, non_stop = False, interval = 0, timeout = None, long_polling_timeout = None,
logger_level=logging.ERROR, allowed_updates=None):
if not(logger_level) or (logger_level < logging.INFO):
if (not logger_level) or (logger_level < logging.INFO):
warning = "\n Warning: this message appearance will be changed. Set logger_level=logging.INFO to continue seeing it."
else:
warning = ""
Expand Down Expand Up @@ -1130,7 +1132,7 @@ def __threaded_polling(self, non_stop = False, interval = 0, timeout = None, lon

def __non_threaded_polling(self, non_stop=False, interval=0, timeout=None, long_polling_timeout=None,
logger_level=logging.ERROR, allowed_updates=None):
if not(logger_level) or (logger_level < logging.INFO):
if (not logger_level) or (logger_level < logging.INFO):
warning = "\n Warning: this message appearance will be changed. Set logger_level=logging.INFO to continue seeing it."
else:
warning = ""
Expand Down Expand Up @@ -2076,7 +2078,7 @@ def send_document(
protect_content = self.protect_content if (protect_content is None) else protect_content
allow_sending_without_reply = self.allow_sending_without_reply if (allow_sending_without_reply is None) else allow_sending_without_reply

if data and not(document):
if data and (not document):
# function typo miss compatibility
logger.warning('The parameter "data" is deprecated. Use "document" instead.')
document = data
Expand Down Expand Up @@ -2157,7 +2159,7 @@ def send_sticker(
protect_content = self.protect_content if (protect_content is None) else protect_content
allow_sending_without_reply = self.allow_sending_without_reply if (allow_sending_without_reply is None) else allow_sending_without_reply

if data and not(sticker):
if data and (not sticker):
# function typo miss compatibility
logger.warning('The parameter "data" is deprecated. Use "sticker" instead.')
sticker = data
Expand Down Expand Up @@ -2265,7 +2267,7 @@ def send_video(
protect_content = self.protect_content if (protect_content is None) else protect_content
allow_sending_without_reply = self.allow_sending_without_reply if (allow_sending_without_reply is None) else allow_sending_without_reply

if data and not(video):
if data and (not video):
# function typo miss compatibility
logger.warning('The parameter "data" is deprecated. Use "video" instead.')
video = data
Expand Down Expand Up @@ -6872,7 +6874,7 @@ def _notify_command_handlers(self, handlers, new_messages, update_type):
:param update_type: handler/update type (Update fields)
:return:
"""
if not(handlers) and not(self.use_class_middlewares):
if (not handlers) and (not self.use_class_middlewares):
return

if self.use_class_middlewares:
Expand Down

0 comments on commit 62e195a

Please sign in to comment.