Skip to content

Commit de2cf89

Browse files
committed
docs: Fix enums example using outdated WifiCapabilities name
The new name is WifiCapabilitiesFlags. Also add a link to the enums themselves.
1 parent 1c80ffb commit de2cf89

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

docs/enums.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,31 @@ Python's Enum quick intro
55
-------------------------
66

77
There are two types of enums. ``IntEnum`` is used for a discrete values
8-
and ``IntFlag`` is used for bit flags. For example, ``DeviceType`` identifies
9-
a single device type as a device cannot be of multiple types.
10-
``WifiCapabilities`` shows a particular Wifi device capabilities which it
11-
can have multiple, for example, supporting both 5GHz and 2.4GHz radio bands.
8+
and ``IntFlag`` is used for bit flags. For example, :py:class:`DeviceType <sdbus_async.networkmanager.enums.DeviceType>`
9+
identifies a single device type as a device cannot be of multiple types.
10+
:py:class:`WifiCapabilitiesFlags <sdbus_async.networkmanager.enums.WifiCapabilitiesFlags>`
11+
shows a particular Wifi device capabilities which it can have multiple, for example, supporting
12+
both 5GHz and 2.4GHz radio bands.
1213

1314
Usually ``IntEnum`` is implied unless the enum's name ends with ``Flag``.
1415

1516
Example code using enums:
1617

1718
.. code-block:: python
1819
19-
from sdbus_async.networkmanager.enums import DeviceType, WifiCapabilities
20+
from sdbus_async.networkmanager.enums import DeviceType, WifiCapabilitiesFlags
2021
2122
# Get particular device type from an integer
2223
DeviceType(2) == DeviceType.WIFI
2324
# Returns: True
2425
2526
# Check if a specific flag is enabled
26-
WifiCapabilities.FREQ_2GHZ in WifiCapabilities(0x00000400 | 0x00000200)
27+
WifiCapabilitiesFlags.FREQ_2GHZ in WifiCapabilitiesFlags(0x00000400 | 0x00000200)
2728
# Returns: True
2829
2930
# Iterate over all enabled flags
30-
list(WifiCapabilities(0x00000400 | 0x00000200))
31-
# Returns: [<WifiCapabilities.FREQ_2GHZ: 512>, <WifiCapabilities.FREQ_5GHZ: 1024>]
31+
list(WifiCapabilitiesFlags(0x00000400 | 0x00000200))
32+
# Returns: [<WifiCapabilitiesFlags.FREQ_2GHZ: 512>, <WifiCapabilitiesFlags.FREQ_5GHZ: 1024>]
3233
3334
`See Python's standard library documentation for more detailed
3435
tutorial and API reference. <https://docs.python.org/3/library/enum.html>`_

0 commit comments

Comments
 (0)