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 SocketPoolConstants typo #204

Closed

Conversation

justmobilize
Copy link
Collaborator

@justmobilize justmobilize commented May 20, 2024

I can't spell. Another user found a type in WIZnet, so also fixing it here

@justmobilize justmobilize marked this pull request as ready for review May 20, 2024 04:22
Copy link
Contributor

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

I am thinking that the superclass SocketPoolConstants is not really needed, since the native socketpool doesn't have it either. It would save space and time to just have the constants as class attributes in SocketPool.


def socket( # pylint: disable=redefined-builtin
self,
family=SocketPoolContants.AF_INET,
type=SocketPoolContants.SOCK_STREAM,
family=SocketPoolConstants.AF_INET,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@dhalbert I'm open to suggestions, but this is why the superclass was added. Since we are in the class, it's not defined and thus this line will error on import:
image
ignore the line number in the image, it's this one

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. But what about something like this? This works:

class ConstantsTest:
    A = 1
    B = 2

    def f(self, a=A, b=B):
        pass

The unqualified name works.

This actually is more complicated. In CPython, AF_INET, etc. are defined at the module level, not inside the Socket class. I can't remember why we defined them as class constants in SocketPool instead of in socketpool.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ahh, I can do a commination of both...

I'm assuming they are in SocketPool, since that's where they were when ESP32SPI was created and so when socketpool.SocketPool was created if followed suit?

@justmobilize justmobilize deleted the fix-Socketpoolconstants-typo branch May 20, 2024 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants