Skip to content

Commit

Permalink
Merge pull request #351 from pathunstrom/flags-docs
Browse files Browse the repository at this point in the history
Adds a page documenting ppb.flags.
  • Loading branch information
AstraLuma committed May 20, 2024
2 parents ef81cb4 + 4918ea0 commit 22f3eb0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
21 changes: 21 additions & 0 deletions docs/reference/flags.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
=============
Flags
=============

.. automodule:: ppb.flags

--------------
Base classes
--------------

This is the base class for defining new flags.

.. autoclass:: ppb.flags.Flag

----------------
Metaclasses
----------------

The metaclass that makes the type hinting of flags possible.

.. autoclass:: ppb.flags.FlagMeta
1 change: 1 addition & 0 deletions docs/reference/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ decisions are made, see the :doc:`/discussion/index` section.
directions
deprecations
system
flags
features/index
9 changes: 5 additions & 4 deletions src/ppb/flags.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
"""
ppb.flags contains singletons to communicate various things.
Flags should be used like None and ... (Ellipsis):
* compare against using `is`
Flags should be used like ``None`` and ``...`` (Ellipsis):
* compare against using ``is``
* Do not instantiate new instances
New flags can simply be defined by:
New flags can simply be defined by::
class MyFlag(Flag):
"This is a flag to indicate a thing."
New classes of flags (eg mouse buttons) can be defined as:
New classes of flags (eg mouse buttons) can be defined as::
class MyFlagType(Flag, abstract=True):
"A group of indicators"
Expand Down

0 comments on commit 22f3eb0

Please sign in to comment.