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

Doc: Developer reference update #3755

Merged
merged 2 commits into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@
<!-- Major changes to documentation and policies. Small docs changes
don't need a changelog entry. -->

- Updated the _classes_ and _exceptions_ documentation in Developer reference to match
the latest ccode base. (#3755)

## 23.3.0

### Highlights
Expand Down
161 changes: 153 additions & 8 deletions docs/contributing/reference/reference_classes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

*Contents are subject to change.*

Black Classes
~~~~~~~~~~~~~~

.. currentmodule:: black

:class:`BracketTracker`
Expand All @@ -18,6 +21,12 @@
:members:
:special-members: __str__, __bool__

:class:`RHSResult`
-------------------------

.. autoclass:: black.lines.RHSResult
:members:

:class:`LinesBlock`
-------------------------

Expand All @@ -43,34 +52,149 @@
.. autoclass:: black.comments.ProtoComment
:members:

:class:`Mode`
---------------------

.. autoclass:: black.mode.Mode
:members:

:class:`Report`
---------------

.. autoclass:: black.report.Report
:members:
:special-members: __str__

:class:`Ok`
---------------

.. autoclass:: black.rusty.Ok
:show-inheritance:
:members:

:class:`Err`
---------------

.. autoclass:: black.rusty.Err
:show-inheritance:
:members:

:class:`Visitor`
----------------

.. autoclass:: black.nodes.Visitor
:show-inheritance:
:members:

Enums
=====
:class:`StringTransformer`
----------------------------

:class:`Changed`
----------------
.. autoclass:: black.trans.StringTransformer
:show-inheritance:
:members:

.. autoclass:: black.Changed
:class:`CustomSplit`
----------------------------

.. autoclass:: black.trans.CustomSplit
:members:

:class:`CustomSplitMapMixin`
-----------------------------

.. autoclass:: black.trans.CustomSplitMapMixin
:show-inheritance:
:members:

:class:`Mode`
-----------------
:class:`StringMerger`
----------------------

.. autoclass:: black.Mode
.. autoclass:: black.trans.StringMerger
:show-inheritance:
:members:

:class:`StringParenStripper`
-----------------------------

.. autoclass:: black.trans.StringParenStripper
:show-inheritance:
:members:

:class:`BaseStringSplitter`
-----------------------------

.. autoclass:: black.trans.BaseStringSplitter
:show-inheritance:
:members:

:class:`StringSplitter`
-----------------------------

.. autoclass:: black.trans.StringSplitter
:show-inheritance:
:members:

:class:`StringParenWrapper`
-----------------------------

.. autoclass:: black.trans.StringParenWrapper
:show-inheritance:
:members:

:class:`StringParser`
-----------------------------

.. autoclass:: black.trans.StringParser
:members:

:class:`DebugVisitor`
------------------------

.. autoclass:: black.debug.DebugVisitor
:show-inheritance:
:members:

:class:`Replacement`
------------------------

.. autoclass:: black.handle_ipynb_magics.Replacement
:members:

:class:`CellMagic`
------------------------

.. autoclass:: black.handle_ipynb_magics.CellMagic
:members:

:class:`CellMagicFinder`
------------------------

.. autoclass:: black.handle_ipynb_magics.CellMagicFinder
:show-inheritance:
:members:

:class:`OffsetAndMagic`
------------------------

.. autoclass:: black.handle_ipynb_magics.OffsetAndMagic
:members:

:class:`MagicFinder`
------------------------

.. autoclass:: black.handle_ipynb_magics.MagicFinder
:show-inheritance:
:members:

Enum Classes
~~~~~~~~~~~~~

Classes inherited from Python `Enum <https://docs.python.org/3/library/enum.html#enum.Enum>`_ class.

:class:`Changed`
----------------

.. autoclass:: black.report.Changed
:show-inheritance:
:members:

Expand All @@ -80,3 +204,24 @@ Enums
.. autoclass:: black.WriteBack
:show-inheritance:
:members:

:class:`TargetVersion`
----------------------

.. autoclass:: black.mode.TargetVersion
:show-inheritance:
:members:

:class:`Feature`
------------------

.. autoclass:: black.mode.Feature
:show-inheritance:
:members:

:class:`Preview`
------------------

.. autoclass:: black.mode.Preview
:show-inheritance:
:members:
10 changes: 8 additions & 2 deletions docs/contributing/reference/reference_exceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@

.. currentmodule:: black

.. autoexception:: black.trans.CannotTransform

.. autoexception:: black.linegen.CannotSplit

.. autoexception:: black.NothingChanged
.. autoexception:: black.brackets.BracketMatchError

.. autoexception:: black.report.NothingChanged

.. autoexception:: black.parsing.InvalidInput

.. autoexception:: black.InvalidInput
.. autoexception:: black.mode.Deprecated
7 changes: 5 additions & 2 deletions docs/contributing/reference/reference_summary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ Developer reference

.. note::

The documentation here is quite outdated and has been neglected. Many objects worthy
of inclusion aren't documented. Contributions are appreciated!
As of June 2023, the documentation of *Black classes* and *Black exceptions*
has been updated to the latest available version.

The documentation of *Black functions* is quite outdated and has been neglected. Many
functions worthy of inclusion aren't documented. Contributions are appreciated!

*Contents are subject to change.*

Expand Down
3 changes: 2 additions & 1 deletion src/black/handle_ipynb_magics.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,8 @@ class CellMagicFinder(ast.NodeVisitor):

For example,

%%time\nfoo()
%%time\n
foo()

would have been transformed to

Expand Down
Loading