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

Remove SocketPoolContants #162

Merged
merged 2 commits into from
May 21, 2024
Merged
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
16 changes: 6 additions & 10 deletions adafruit_wiznet5k/adafruit_wiznet5k_socketpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
_global_socketpool = {}


class SocketPoolContants: # pylint: disable=too-few-public-methods
"""Helper class for the constants that are needed everywhere"""
class SocketPool:
"""WIZNET5K SocketPool library"""

# These must match circuitpython "socketpoool" values. However, we cannot
# These must match circuitpython "socketpool" values. However, we cannot
# depend on socketpool being importable, so hard-code them here.
SOCK_STREAM = 1
SOCK_DGRAM = 2
Expand All @@ -50,10 +50,6 @@ class SocketPoolContants: # pylint: disable=too-few-public-methods

AF_INET = const(3)


class SocketPool(SocketPoolContants):
"""WIZNET5K SocketPool library"""

def __new__(cls, iface: WIZNET5K):
# We want to make sure to return the same pool for the same interface
if iface not in _global_socketpool:
Expand Down Expand Up @@ -191,7 +187,7 @@ def getaddrinfo( # pylint: disable=redefined-builtin,too-many-arguments,unused-
raise ValueError("Port must be an integer")
if not self._is_ipv4_string(host):
host = self.gethostbyname(host)
return [(SocketPoolContants.AF_INET, type, proto, "", (host, port))]
return [(SocketPool.AF_INET, type, proto, "", (host, port))]
dhalbert marked this conversation as resolved.
Show resolved Hide resolved

def gethostbyname(self, hostname: str) -> str:
"""
Expand All @@ -210,8 +206,8 @@ def gethostbyname(self, hostname: str) -> str:

def socket( # pylint: disable=redefined-builtin
self,
family: int = SocketPoolContants.AF_INET,
type: int = SocketPoolContants.SOCK_STREAM,
family: int = AF_INET,
type: int = SOCK_STREAM,
proto: int = 0,
fileno: Optional[int] = None,
):
Expand Down
Loading