Skip to content

Remove checks for None on assignement for opt args #1600

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 23, 2019
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
21 changes: 7 additions & 14 deletions telegram/inline/inlinekeyboardbutton.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,13 @@ def __init__(self,
self.text = text

# Optionals
if url:
self.url = url
if login_url:
self.login_url = login_url
if callback_data:
self.callback_data = callback_data
if switch_inline_query:
self.switch_inline_query = switch_inline_query
if switch_inline_query_current_chat:
self.switch_inline_query_current_chat = switch_inline_query_current_chat
if callback_game:
self.callback_game = callback_game
if pay:
self.pay = pay
self.url = url
self.login_url = login_url
self.callback_data = callback_data
self.switch_inline_query = switch_inline_query
self.switch_inline_query_current_chat = switch_inline_query_current_chat
self.callback_game = callback_game
self.pay = pay

@classmethod
def de_json(cls, data, bot):
Expand Down
21 changes: 7 additions & 14 deletions telegram/inline/inlinequeryresultarticle.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,10 @@ def __init__(self,
self.input_message_content = input_message_content

# Optional
if reply_markup:
self.reply_markup = reply_markup
if url:
self.url = url
if hide_url:
self.hide_url = hide_url
if description:
self.description = description
if thumb_url:
self.thumb_url = thumb_url
if thumb_width:
self.thumb_width = thumb_width
if thumb_height:
self.thumb_height = thumb_height
self.reply_markup = reply_markup
self.url = url
self.hide_url = hide_url
self.description = description
self.thumb_url = thumb_url
self.thumb_width = thumb_width
self.thumb_height = thumb_height
18 changes: 6 additions & 12 deletions telegram/inline/inlinequeryresultaudio.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,9 @@ def __init__(self,
self.title = title

# Optionals
if performer:
self.performer = performer
if audio_duration:
self.audio_duration = audio_duration
if caption:
self.caption = caption
if parse_mode:
self.parse_mode = parse_mode
if reply_markup:
self.reply_markup = reply_markup
if input_message_content:
self.input_message_content = input_message_content
self.performer = performer
self.audio_duration = audio_duration
self.caption = caption
self.parse_mode = parse_mode
self.reply_markup = reply_markup
self.input_message_content = input_message_content
12 changes: 4 additions & 8 deletions telegram/inline/inlinequeryresultcachedaudio.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,7 @@ def __init__(self,
self.audio_file_id = audio_file_id

# Optionals
if caption:
self.caption = caption
if parse_mode:
self.parse_mode = parse_mode
if reply_markup:
self.reply_markup = reply_markup
if input_message_content:
self.input_message_content = input_message_content
self.caption = caption
self.parse_mode = parse_mode
self.reply_markup = reply_markup
self.input_message_content = input_message_content
15 changes: 5 additions & 10 deletions telegram/inline/inlinequeryresultcacheddocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,8 @@ def __init__(self,
self.document_file_id = document_file_id

# Optionals
if description:
self.description = description
if caption:
self.caption = caption
if parse_mode:
self.parse_mode = parse_mode
if reply_markup:
self.reply_markup = reply_markup
if input_message_content:
self.input_message_content = input_message_content
self.description = description
self.caption = caption
self.parse_mode = parse_mode
self.reply_markup = reply_markup
self.input_message_content = input_message_content
15 changes: 5 additions & 10 deletions telegram/inline/inlinequeryresultcachedgif.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,8 @@ def __init__(self,
self.gif_file_id = gif_file_id

# Optionals
if title:
self.title = title
if caption:
self.caption = caption
if parse_mode:
self.parse_mode = parse_mode
if reply_markup:
self.reply_markup = reply_markup
if input_message_content:
self.input_message_content = input_message_content
self.title = title
self.caption = caption
self.parse_mode = parse_mode
self.reply_markup = reply_markup
self.input_message_content = input_message_content
15 changes: 5 additions & 10 deletions telegram/inline/inlinequeryresultcachedmpeg4gif.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,8 @@ def __init__(self,
self.mpeg4_file_id = mpeg4_file_id

# Optionals
if title:
self.title = title
if caption:
self.caption = caption
if parse_mode:
self.parse_mode = parse_mode
if reply_markup:
self.reply_markup = reply_markup
if input_message_content:
self.input_message_content = input_message_content
self.title = title
self.caption = caption
self.parse_mode = parse_mode
self.reply_markup = reply_markup
self.input_message_content = input_message_content
18 changes: 6 additions & 12 deletions telegram/inline/inlinequeryresultcachedphoto.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,9 @@ def __init__(self,
self.photo_file_id = photo_file_id

# Optionals
if title:
self.title = title
if description:
self.description = description
if caption:
self.caption = caption
if parse_mode:
self.parse_mode = parse_mode
if reply_markup:
self.reply_markup = reply_markup
if input_message_content:
self.input_message_content = input_message_content
self.title = title
self.description = description
self.caption = caption
self.parse_mode = parse_mode
self.reply_markup = reply_markup
self.input_message_content = input_message_content
6 changes: 2 additions & 4 deletions telegram/inline/inlinequeryresultcachedsticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,5 @@ def __init__(self,
self.sticker_file_id = sticker_file_id

# Optionals
if reply_markup:
self.reply_markup = reply_markup
if input_message_content:
self.input_message_content = input_message_content
self.reply_markup = reply_markup
self.input_message_content = input_message_content
15 changes: 5 additions & 10 deletions telegram/inline/inlinequeryresultcachedvideo.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,8 @@ def __init__(self,
self.title = title

# Optionals
if description:
self.description = description
if caption:
self.caption = caption
if parse_mode:
self.parse_mode = parse_mode
if reply_markup:
self.reply_markup = reply_markup
if input_message_content:
self.input_message_content = input_message_content
self.description = description
self.caption = caption
self.parse_mode = parse_mode
self.reply_markup = reply_markup
self.input_message_content = input_message_content
12 changes: 4 additions & 8 deletions telegram/inline/inlinequeryresultcachedvoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,7 @@ def __init__(self,
self.title = title

# Optionals
if caption:
self.caption = caption
if parse_mode:
self.parse_mode = parse_mode
if reply_markup:
self.reply_markup = reply_markup
if input_message_content:
self.input_message_content = input_message_content
self.caption = caption
self.parse_mode = parse_mode
self.reply_markup = reply_markup
self.input_message_content = input_message_content
21 changes: 7 additions & 14 deletions telegram/inline/inlinequeryresultcontact.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,10 @@ def __init__(self,
self.first_name = first_name

# Optionals
if last_name:
self.last_name = last_name
if vcard:
self.vcard = vcard
if reply_markup:
self.reply_markup = reply_markup
if input_message_content:
self.input_message_content = input_message_content
if thumb_url:
self.thumb_url = thumb_url
if thumb_width:
self.thumb_width = thumb_width
if thumb_height:
self.thumb_height = thumb_height
self.last_name = last_name
self.vcard = vcard
self.reply_markup = reply_markup
self.input_message_content = input_message_content
self.thumb_url = thumb_url
self.thumb_width = thumb_width
self.thumb_height = thumb_height
24 changes: 8 additions & 16 deletions telegram/inline/inlinequeryresultdocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,11 @@ def __init__(self,
self.mime_type = mime_type

# Optionals
if caption:
self.caption = caption
if parse_mode:
self.parse_mode = parse_mode
if description:
self.description = description
if reply_markup:
self.reply_markup = reply_markup
if input_message_content:
self.input_message_content = input_message_content
if thumb_url:
self.thumb_url = thumb_url
if thumb_width:
self.thumb_width = thumb_width
if thumb_height:
self.thumb_height = thumb_height
self.caption = caption
self.parse_mode = parse_mode
self.description = description
self.reply_markup = reply_markup
self.input_message_content = input_message_content
self.thumb_url = thumb_url
self.thumb_width = thumb_width
self.thumb_height = thumb_height
3 changes: 1 addition & 2 deletions telegram/inline/inlinequeryresultgame.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,4 @@ def __init__(self, id, game_short_name, reply_markup=None, **kwargs):
self.id = id
self.game_short_name = game_short_name

if reply_markup:
self.reply_markup = reply_markup
self.reply_markup = reply_markup
24 changes: 8 additions & 16 deletions telegram/inline/inlinequeryresultgif.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,11 @@ def __init__(self,
self.thumb_url = thumb_url

# Optionals
if gif_width:
self.gif_width = gif_width
if gif_height:
self.gif_height = gif_height
if gif_duration:
self.gif_duration = gif_duration
if title:
self.title = title
if caption:
self.caption = caption
if parse_mode:
self.parse_mode = parse_mode
if reply_markup:
self.reply_markup = reply_markup
if input_message_content:
self.input_message_content = input_message_content
self.gif_width = gif_width
self.gif_height = gif_height
self.gif_duration = gif_duration
self.title = title
self.caption = caption
self.parse_mode = parse_mode
self.reply_markup = reply_markup
self.input_message_content = input_message_content
18 changes: 6 additions & 12 deletions telegram/inline/inlinequeryresultlocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,9 @@ def __init__(self,
self.title = title

# Optionals
if live_period:
self.live_period = live_period
if reply_markup:
self.reply_markup = reply_markup
if input_message_content:
self.input_message_content = input_message_content
if thumb_url:
self.thumb_url = thumb_url
if thumb_width:
self.thumb_width = thumb_width
if thumb_height:
self.thumb_height = thumb_height
self.live_period = live_period
self.reply_markup = reply_markup
self.input_message_content = input_message_content
self.thumb_url = thumb_url
self.thumb_width = thumb_width
self.thumb_height = thumb_height
24 changes: 8 additions & 16 deletions telegram/inline/inlinequeryresultmpeg4gif.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,11 @@ def __init__(self,
self.thumb_url = thumb_url

# Optional
if mpeg4_width:
self.mpeg4_width = mpeg4_width
if mpeg4_height:
self.mpeg4_height = mpeg4_height
if mpeg4_duration:
self.mpeg4_duration = mpeg4_duration
if title:
self.title = title
if caption:
self.caption = caption
if parse_mode:
self.parse_mode = parse_mode
if reply_markup:
self.reply_markup = reply_markup
if input_message_content:
self.input_message_content = input_message_content
self.mpeg4_width = mpeg4_width
self.mpeg4_height = mpeg4_height
self.mpeg4_duration = mpeg4_duration
self.title = title
self.caption = caption
self.parse_mode = parse_mode
self.reply_markup = reply_markup
self.input_message_content = input_message_content
24 changes: 8 additions & 16 deletions telegram/inline/inlinequeryresultphoto.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,11 @@ def __init__(self,
self.thumb_url = thumb_url

# Optionals
if photo_width:
self.photo_width = int(photo_width)
if photo_height:
self.photo_height = int(photo_height)
if title:
self.title = title
if description:
self.description = description
if caption:
self.caption = caption
if parse_mode:
self.parse_mode = parse_mode
if reply_markup:
self.reply_markup = reply_markup
if input_message_content:
self.input_message_content = input_message_content
self.photo_width = int(photo_width)if photo_width is not None else None
self.photo_height = int(photo_height) if photo_height is not None else None
self.title = title
self.description = description
self.caption = caption
self.parse_mode = parse_mode
self.reply_markup = reply_markup
self.input_message_content = input_message_content
Loading