Skip to content
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

Fix chat.py example #12070

Merged
merged 6 commits into from Feb 1, 2024
Merged

Conversation

ReneNyffenegger
Copy link
Contributor

Apparently, twisted changed the behavior in that
the library now expects byte arrays rather than
strings.
Also, Python3 replaced the dict method iteritems() with items()

ReneNyffenegger and others added 3 commits December 30, 2023 23:25
Apparently, twisted changed the behavior in that
the library now expects byte arrays rather than
strings.
Also, Python3 replaced the dict method iteritems()
with items()
Copy link
Member

@adiroiban adiroiban left a comment

Choose a reason for hiding this comment

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

Thanks for the fix.

It would be nice to have the examples always executed as part of our continous testing ... but this would be a task for another PR.

I am not using IRC with Twisted.

For this PR, I trust that you have executed this example on Py3 and that the updated example works.

As we don't have a maintainer for Twisted IRC support, I think that is best to merge this PR as it is.

Later, if someone cares more about IRC, they can update the code.

Comment on lines +35 to +37
message = f"<{self.name.decode('utf-8')}> {message.decode('utf-8')}".encode(
"utf-8"
)
Copy link
Member

Choose a reason for hiding this comment

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

Just a minor comment to avoid all the encode + decode

Suggested change
message = f"<{self.name.decode('utf-8')}> {message.decode('utf-8')}".encode(
"utf-8"
)
message = b'<' + self.name + '> ' + message

Copy link
Contributor

Choose a reason for hiding this comment

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

I also agree with this comment but I think

message = b'<' + self.name  + b'> ' + message

is correct to avoid TypeError.
Is there any reason for that we didn't applied it?

Copy link
Member

Choose a reason for hiding this comment

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

Hi. Thanks for the feedback. This was merged as it was better than what we had in trunk. There is alwasy place for improvement :)
Feel free to open a new GitHub Issue and PR if you would like to see this change merged.

The IRC implementation in Twisted needs some love and I would be happy to see people care about this code :)

Cheer

Copy link
Contributor

Choose a reason for hiding this comment

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

Dear @adiroiban, I've created an issue and a pr for it.

@adiroiban
Copy link
Member

@ralphm if you have time, you can check this.

@glyph this is an example where having something like twisted/txirc would help. Ralph could be automatically subscribed to any issue for txirc and I would not have to memorize who is the maintainer for each Twisted subproject and ping them for PRs or issues.

@ralphm
Copy link
Member

ralphm commented Jan 5, 2024

@adiroiban While I appreciate that Twisted's IRC implementation is in Words and I probably can review this on its merits, I am not an IRC expert at all. I have primarily contributed to the XMPP related stuff (twisted.words.xish and twisted.words.protocols.jabber) as well as twisted.names and twisted.logger.

If you want to have more granular control over this, we should set up a CODEOWNERS file.

@glyph
Copy link
Member

glyph commented Jan 5, 2024

@adiroiban While I appreciate that Twisted's IRC implementation is in Words and I probably can review this on its merits, I am not an IRC expert at all. I have primarily contributed to the XMPP related stuff (twisted.words.xish and twisted.words.protocols.jabber) as well as twisted.names and twisted.logger.

If you want to have more granular control over this, we should set up a CODEOWNERS file.

I wouldn't mind if someone wanted to set up CODEOWNERS to get more granular notifications for things they're interested in, but I emphatically do NOT want to set up fiefdoms and official "owners" within the codebase. We have a limited number of maintainers and by far our most pressing problem is getting people to do more reviews, not preventing 'unqualified' reviewers or requiring an expert for things to get merged. If anyone with commit access feels comfortable, they should feel free to do a review :)

@adiroiban
Copy link
Member

I am also -1 for blocking a PR merge if there is no review from CODEOWNERS.

Also, I am not looking for "official" maintainers for parts of twisted/twisted.

What I am saying is that I think that it's a bit to ask for twisted/twisted maintainers to know AMP/POP/IMAP/IRC/XMMP or some GPS possitioning protocol.

I will wait for @ReneNyffenegger to check my comment.

I think that the current PR is an improvemnt over the existing code, so it meets the merge criteria.

@glyph
Copy link
Member

glyph commented Jan 12, 2024

I am also -1 for blocking a PR merge if there is no review from CODEOWNERS.

Also, I am not looking for "official" maintainers for parts of twisted/twisted.

What I am saying is that I think that it's a bit to ask for twisted/twisted maintainers to know AMP/POP/IMAP/IRC/XMMP or some GPS possitioning protocol.

Cool, good to know. If we can use CODEOWNERS that way I'm happy to have it help with making notifications more granular.

@adiroiban
Copy link
Member

CODEOWNERS can work for PR notifications... they will not work for Issues.
But I think that we can give it a go and still have CODEOWNERS as a way to keep a list of
"friends of Twisted" ... that is, people that are not interested into the general Twisted project development, but only into some specific parts of the project

@adiroiban adiroiban merged commit 446ee13 into twisted:trunk Feb 1, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants