Skip to content

Conversation

@Eldinnie
Copy link
Member

Closes #1010

@python-telegram-bot python-telegram-bot deleted a comment from codecov bot Feb 19, 2018
Copy link
Member

@tsnoam tsnoam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I like it how you used from html import escape and gaining from future.
    However, in helpers.py we still use the approach. Maybe fix there too?
  2. I had some small nitpicks on the code (look on the comments).
  3. Other than that, looks good :)

entities = self.parse_entities()
message_text = self.text
def _parse_html(self, text, entities, urled=False):
message_text = text
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not get message_text as one of the function arguments?
/me asking because you never use text but to initialize message_text; afterwards at the first line of the for loop you override text.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where I was being an idiot with double named parameters before. My fix is bad too :D. Will change

return self._parse_html(self.caption, self.parse_caption_entities(), urled=True)

def _parse_markdown(self, text, entities, urled=False):
message_text = text
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not get message_text as one of the function arguments?
/me asking because you never use text but to initialize message_text; afterwards at the first line of the for loop you override text.

"""
return self._parse_html(self.caption, self.parse_caption_entities(), urled=True)

def _parse_markdown(self, text, entities, urled=False):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change this to be @staticmethod?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed, because this method needs nothing from the instance which makes it a good enough reason to be static.

def _text_html(self, urled=False):
entities = self.parse_entities()
message_text = self.text
def _parse_html(self, text, entities, urled=False):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change this to be @staticmethod?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why again?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FeatureRequest] Bot API 3.6: caption_html and caption_markdown

3 participants