Skip to content

Commit 170e922

Browse files
committed
Update docstubs stubs for stable
1 parent 84ff9c2 commit 170e922

File tree

1 file changed

+16
-123
lines changed
  • stubs/micropython-v1_26_1-docstubs/network

1 file changed

+16
-123
lines changed

stubs/micropython-v1_26_1-docstubs/network/WLAN.pyi

Lines changed: 16 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,16 @@
22

33
from __future__ import annotations
44
from _typeshed import Incomplete
5-
from typing import overload, Any, List, Tuple
5+
from typing import Any, List, Optional, Tuple
66
from typing_extensions import TypeVar, TypeAlias, Awaitable
77

88
class WLAN:
99
"""
10-
This class provides a driver for WiFi network processors. Example usage::
11-
12-
import network
13-
# enable station interface and connect to WiFi access point
14-
nic = network.WLAN(network.STA_IF)
15-
nic.active(True)
16-
nic.connect('your-ssid', 'your-password')
17-
# now use sockets as usual
10+
Create a WLAN network interface object. Supported interfaces are
11+
``network.WLAN.IF_STA`` (station aka client, connects to upstream WiFi access
12+
points) and ``network.WLAN.IF_AP`` (access point, allows other WiFi clients to
13+
connect). Availability of the methods below depends on interface type.
14+
For example, only STA interface may `WLAN.connect()` to an access point.
1815
"""
1916

2017
PM_PERFORMANCE: Incomplete
@@ -30,40 +27,15 @@ class WLAN:
3027
savings and reduced WiFi performance
3128
* ``PM_NONE``: disable wifi power management
3229
"""
33-
PM_NONE: int
34-
PM_POWERSAVE: int
35-
def __init__(self, interface_id: int = ..., /) -> None:
36-
"""
37-
Create a WLAN network interface object. Supported interfaces are
38-
``network.STA_IF`` (station aka client, connects to upstream WiFi access
39-
points) and ``network.AP_IF`` (access point, allows other WiFi clients to
40-
connect). Availability of the methods below depends on interface type.
41-
For example, only STA interface may `WLAN.connect()` to an access point.
42-
"""
43-
44-
@overload
45-
def active(self, /) -> bool:
30+
def __init__(self, interface_id) -> None: ...
31+
def active(self, is_active: Optional[Any] = None) -> None:
4632
"""
4733
Activate ("up") or deactivate ("down") network interface, if boolean
4834
argument is passed. Otherwise, query current state if no argument is
4935
provided. Most other methods require active interface.
5036
"""
51-
52-
@overload
53-
def active(self, is_active: bool | int, /) -> None:
54-
"""
55-
Activate ("up") or deactivate ("down") network interface, if boolean
56-
argument is passed. Otherwise, query current state if no argument is
57-
provided. Most other methods require active interface.
58-
"""
59-
def connect(
60-
self,
61-
ssid: str | None = None,
62-
password: str | None = None,
63-
/,
64-
*,
65-
bssid: bytes | None = None,
66-
) -> None:
37+
...
38+
def connect(self, ssid=None, key=None, *, bssid=None) -> None:
6739
"""
6840
Connect to the specified wireless network, using the specified key.
6941
If *bssid* is given then the connection will be restricted to the
@@ -104,39 +76,7 @@ class WLAN:
10476
* 1 -- hidden
10577
"""
10678
...
107-
108-
@overload
109-
def status(self) -> int:
110-
"""
111-
Return the current status of the wireless connection.
112-
113-
When called with no argument the return value describes the network link status.
114-
The possible statuses are defined as constants in the :mod:`network` module:
115-
116-
* ``STAT_IDLE`` -- no connection and no activity,
117-
* ``STAT_CONNECTING`` -- connecting in progress,
118-
* ``STAT_WRONG_PASSWORD`` -- failed due to incorrect password,
119-
* ``STAT_NO_AP_FOUND`` -- failed because no access point replied,
120-
* ``STAT_CONNECT_FAIL`` -- failed due to other problems,
121-
* ``STAT_GOT_IP`` -- connection successful.
122-
123-
When called with one argument *param* should be a string naming the status
124-
parameter to retrieve, and different parameters are supported depending on the
125-
mode the WiFi is in.
126-
127-
In STA mode, passing ``'rssi'`` returns a signal strength indicator value, whose
128-
format varies depending on the port (this is available on all ports that support
129-
WiFi network interfaces, except for CC3200).
130-
131-
In AP mode, passing ``'stations'`` returns a list of connected WiFi stations
132-
(this is available on all ports that support WiFi network interfaces, except for
133-
CC3200). The format of the station information entries varies across ports,
134-
providing either the raw BSSID of the connected station, the IP address of the
135-
connected station, or both.
136-
"""
137-
138-
@overload
139-
def status(self, param: str, /) -> int:
79+
def status(self, param: Optional[Any] = None) -> List[int]:
14080
"""
14181
Return the current status of the wireless connection.
14282
@@ -164,16 +104,15 @@ class WLAN:
164104
providing either the raw BSSID of the connected station, the IP address of the
165105
connected station, or both.
166106
"""
107+
...
167108
def isconnected(self) -> bool:
168109
"""
169110
In case of STA mode, returns ``True`` if connected to a WiFi access
170111
point and has a valid IP address. In AP mode returns ``True`` when a
171112
station is connected. Returns ``False`` otherwise.
172113
"""
173114
...
174-
175-
@overload
176-
def ifconfig(self) -> tuple[str, str, str, str]:
115+
def ifconfig(self, configtuple: Optional[Any] = None) -> Tuple:
177116
"""
178117
Get/set IP-level network interface parameters: IP address, subnet mask,
179118
gateway and DNS server. When called with no arguments, this method returns
@@ -182,55 +121,8 @@ class WLAN:
182121
183122
nic.ifconfig(('192.168.0.4', '255.255.255.0', '192.168.0.1', '8.8.8.8'))
184123
"""
185-
186-
@overload
187-
def ifconfig(self, ip_mask_gateway_dns: tuple[str, str, str, str], /) -> None:
188-
"""
189-
Get/set IP-level network interface parameters: IP address, subnet mask,
190-
gateway and DNS server. When called with no arguments, this method returns
191-
a 4-tuple with the above information. To set the above values, pass a
192-
4-tuple with the required information. For example::
193-
194-
nic.ifconfig(('192.168.0.4', '255.255.255.0', '192.168.0.1', '8.8.8.8'))
195-
"""
196-
197-
@overload
198-
def config(self, param: str, /) -> Any:
199-
"""
200-
Get or set general network interface parameters. These methods allow to work
201-
with additional parameters beyond standard IP configuration (as dealt with by
202-
`AbstractNIC.ipconfig()`). These include network-specific and hardware-specific
203-
parameters. For setting parameters, keyword argument syntax should be used,
204-
multiple parameters can be set at once. For querying, parameters name should
205-
be quoted as a string, and only one parameter can be queries at time::
206-
207-
# Set WiFi access point name (formally known as SSID) and WiFi channel
208-
ap.config(ssid='My AP', channel=11)
209-
# Query params one by one
210-
print(ap.config('ssid'))
211-
print(ap.config('channel'))
212-
213-
Following are commonly supported parameters (availability of a specific parameter
214-
depends on network technology type, driver, and :term:`MicroPython port`).
215-
216-
============= ===========
217-
Parameter Description
218-
============= ===========
219-
mac MAC address (bytes)
220-
ssid WiFi access point name (string)
221-
channel WiFi channel (integer). Depending on the port this may only be supported on the AP interface.
222-
hidden Whether SSID is hidden (boolean)
223-
security Security protocol supported (enumeration, see module constants)
224-
key Access key (string)
225-
hostname The hostname that will be sent to DHCP (STA interfaces) and mDNS (if supported, both STA and AP). (Deprecated, use :func:`network.hostname` instead)
226-
reconnects Number of reconnect attempts to make (integer, 0=none, -1=unlimited)
227-
txpower Maximum transmit power in dBm (integer or float)
228-
pm WiFi Power Management setting (see below for allowed values)
229-
============= ===========
230-
"""
231-
232-
@overload
233-
def config(self, **kwargs: Any) -> None:
124+
...
125+
def config(self, *args, **kwargs) -> Incomplete:
234126
"""
235127
Get or set general network interface parameters. These methods allow to work
236128
with additional parameters beyond standard IP configuration (as dealt with by
@@ -263,3 +155,4 @@ class WLAN:
263155
pm WiFi Power Management setting (see below for allowed values)
264156
============= ===========
265157
"""
158+
...

0 commit comments

Comments
 (0)