Skip to content

Commit

Permalink
Rebase on dev
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelYvon committed Feb 28, 2023
1 parent 2eba1a3 commit 4c2bd2c
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions netifaces/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@
]


_ROUTE_FILE = Path("/proc/net/route")
_WIN_TCPIP = "\\DEVICE\\TCPIP_"
_NIX_ROUTE_FILE = Path("/proc/net/route")


def interfaces() -> List[InterfaceName]:
Expand All @@ -129,14 +130,17 @@ def interfaces() -> List[InterfaceName]:
"""

if sys.platform.startswith("win"):
result = cast(List[InterfaceName], [
iface[len(_WIN_TCPIP) :]
for iface in _interfaces()
if iface.startswith(_WIN_TCPIP)
])
result = cast(
List[InterfaceName],
[
iface[len(_WIN_TCPIP) :]
for iface in _interfaces()
if iface.startswith(_WIN_TCPIP)
],
)
else:
result = cast(List[InterfaceName], _interfaces())

return result


Expand All @@ -148,7 +152,7 @@ def ifaddresses(if_name: str) -> Addresses:
:return a map of network addresses indexed by network address type.
The values are the addresses, indexed by their roles
"""

if sys.platform.startswith("win"):
result = _ifaddresses(f"{_WIN_TCPIP}{if_name}")
else:
Expand Down Expand Up @@ -176,8 +180,6 @@ def gateways() -> GatewaysTable:
else:
raise NotImplementedError("No implementation for `gateways()` yet")

return {}


def default_gateway() -> DefaultGatewayEntry:
"""
Expand Down

0 comments on commit 4c2bd2c

Please sign in to comment.