From f930b109f670241e88c3fd9d0362e26fdca69ace Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Sat, 5 Oct 2024 12:08:36 +0200 Subject: [PATCH] DOC: restore viewcode highlighting, disable unwanted highlighting --- CONTRIBUTING.rst | 12 +++++------ doc/CONTRIBUTING.rst | 1 - doc/api/checking-hardware.rst | 2 +- doc/api/convenience-functions.rst | 2 +- doc/api/expert-mode.rst | 2 +- doc/api/misc.rst | 2 +- doc/api/platform-specific-settings.rst | 2 +- doc/api/raw-streams.rst | 2 +- doc/api/streams.rst | 3 +-- doc/conf.py | 1 - doc/contributing.rst | 3 +++ doc/examples.rst | 11 ---------- doc/index.rst | 2 +- doc/installation.rst | 2 +- sounddevice.py | 28 +++++++++++++++++++------- 15 files changed, 39 insertions(+), 36 deletions(-) delete mode 120000 doc/CONTRIBUTING.rst create mode 100644 doc/contributing.rst diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 18a24c1..a10a6a0 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -17,13 +17,13 @@ please make sure to provide as much useful information as possible. You can use Markdown formatting to show Python code, e.g. :: I have created a script named `my_script.py`: - + ```python import sounddevice as sd - + fs = 48000 duration = 1.5 - + data = sd.rec(int(duration * fs), channels=99) sd.wait() print(data.shape) @@ -37,7 +37,7 @@ including all ``import`` statements. You should of course also show what happens when you run your code, e.g. :: Running my script, I got this error: - + ``` $ python my_script.py Expression 'parameters->channelCount <= maxChans' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1514 @@ -71,7 +71,7 @@ If you don't want to clutter the issue description with a huge load of gibberish you can use the ``
`` HTML tag to show some content only on demand::
- + ``` $ python -m sounddevice 0 Built-in Line Input, Core Audio (2 in, 0 out) @@ -80,7 +80,7 @@ you can use the ``
`` HTML tag to show some content only on demand:: 3 Built-in Line Output, Core Audio (0 in, 2 out) 4 Built-in Digital Output, Core Audio (0 in, 2 out) ``` - +
diff --git a/doc/CONTRIBUTING.rst b/doc/CONTRIBUTING.rst deleted file mode 120000 index 798f2aa..0000000 --- a/doc/CONTRIBUTING.rst +++ /dev/null @@ -1 +0,0 @@ -../CONTRIBUTING.rst \ No newline at end of file diff --git a/doc/api/checking-hardware.rst b/doc/api/checking-hardware.rst index 34dc983..b65d8e9 100644 --- a/doc/api/checking-hardware.rst +++ b/doc/api/checking-hardware.rst @@ -7,7 +7,7 @@ Checking Available Hardware .. autosummary:: :nosignatures: - + query_devices DeviceList query_hostapis diff --git a/doc/api/convenience-functions.rst b/doc/api/convenience-functions.rst index 328854a..08a5210 100644 --- a/doc/api/convenience-functions.rst +++ b/doc/api/convenience-functions.rst @@ -7,7 +7,7 @@ Convenience Functions using NumPy Arrays .. autosummary:: :nosignatures: - + play rec playrec diff --git a/doc/api/expert-mode.rst b/doc/api/expert-mode.rst index b0c5e43..f885ad7 100644 --- a/doc/api/expert-mode.rst +++ b/doc/api/expert-mode.rst @@ -7,7 +7,7 @@ Expert Mode .. autosummary:: :nosignatures: - + _initialize _terminate _split diff --git a/doc/api/misc.rst b/doc/api/misc.rst index d89d905..ce2b55f 100644 --- a/doc/api/misc.rst +++ b/doc/api/misc.rst @@ -7,7 +7,7 @@ Miscellaneous .. autosummary:: :nosignatures: - + sleep get_portaudio_version CallbackFlags diff --git a/doc/api/platform-specific-settings.rst b/doc/api/platform-specific-settings.rst index eb13bd7..dc5e1ed 100644 --- a/doc/api/platform-specific-settings.rst +++ b/doc/api/platform-specific-settings.rst @@ -7,7 +7,7 @@ Platform-specific Settings .. autosummary:: :nosignatures: - + AsioSettings CoreAudioSettings WasapiSettings diff --git a/doc/api/raw-streams.rst b/doc/api/raw-streams.rst index 8c5e626..e8da8a2 100644 --- a/doc/api/raw-streams.rst +++ b/doc/api/raw-streams.rst @@ -7,7 +7,7 @@ Raw Streams .. autosummary:: :nosignatures: - + RawStream RawInputStream RawOutputStream diff --git a/doc/api/streams.rst b/doc/api/streams.rst index 9bc5026..6e4c2b6 100644 --- a/doc/api/streams.rst +++ b/doc/api/streams.rst @@ -7,7 +7,7 @@ Streams using NumPy Arrays .. autosummary:: :nosignatures: - + Stream InputStream OutputStream @@ -20,4 +20,3 @@ Streams using NumPy Arrays .. autoclass:: InputStream .. autoclass:: OutputStream - diff --git a/doc/conf.py b/doc/conf.py index b07438b..0c35fe9 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -56,7 +56,6 @@ today = '' default_role = 'any' -highlight_language = 'none' nitpicky = True diff --git a/doc/contributing.rst b/doc/contributing.rst new file mode 100644 index 0000000..f6acf5e --- /dev/null +++ b/doc/contributing.rst @@ -0,0 +1,3 @@ +.. highlight:: none + +.. include:: ../CONTRIBUTING.rst diff --git a/doc/examples.rst b/doc/examples.rst index 89f23f2..bd0cccf 100644 --- a/doc/examples.rst +++ b/doc/examples.rst @@ -6,7 +6,6 @@ Play a Sound File :gh-example:`play_file.py` .. literalinclude:: ../examples/play_file.py - :language: python Play a Very Long Sound File --------------------------- @@ -14,7 +13,6 @@ Play a Very Long Sound File :gh-example:`play_long_file.py` .. literalinclude:: ../examples/play_long_file.py - :language: python Play a Very Long Sound File without Using NumPy ----------------------------------------------- @@ -22,7 +20,6 @@ Play a Very Long Sound File without Using NumPy :gh-example:`play_long_file_raw.py` .. literalinclude:: ../examples/play_long_file_raw.py - :language: python Play a Web Stream ----------------- @@ -30,7 +27,6 @@ Play a Web Stream :gh-example:`play_stream.py` .. literalinclude:: ../examples/play_stream.py - :language: python Play a Sine Signal ------------------ @@ -38,7 +34,6 @@ Play a Sine Signal :gh-example:`play_sine.py` .. literalinclude:: ../examples/play_sine.py - :language: python Input to Output Pass-Through ---------------------------- @@ -46,7 +41,6 @@ Input to Output Pass-Through :gh-example:`wire.py` .. literalinclude:: ../examples/wire.py - :language: python Plot Microphone Signal(s) in Real-Time -------------------------------------- @@ -54,7 +48,6 @@ Plot Microphone Signal(s) in Real-Time :gh-example:`plot_input.py` .. literalinclude:: ../examples/plot_input.py - :language: python Real-Time Text-Mode Spectrogram ------------------------------- @@ -62,7 +55,6 @@ Real-Time Text-Mode Spectrogram :gh-example:`spectrogram.py` .. literalinclude:: ../examples/spectrogram.py - :language: python Recording with Arbitrary Duration --------------------------------- @@ -70,7 +62,6 @@ Recording with Arbitrary Duration :gh-example:`rec_unlimited.py` .. literalinclude:: ../examples/rec_unlimited.py - :language: python Using a stream in an `asyncio` coroutine ---------------------------------------- @@ -78,7 +69,6 @@ Using a stream in an `asyncio` coroutine :gh-example:`asyncio_coroutines.py` .. literalinclude:: ../examples/asyncio_coroutines.py - :language: python Creating an `asyncio` generator for audio blocks ------------------------------------------------ @@ -86,4 +76,3 @@ Creating an `asyncio` generator for audio blocks :gh-example:`asyncio_generators.py` .. literalinclude:: ../examples/asyncio_generators.py - :language: python diff --git a/doc/index.rst b/doc/index.rst index a5c0fd2..6b99611 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -12,7 +12,7 @@ installation usage examples - CONTRIBUTING + contributing api/index version-history diff --git a/doc/installation.rst b/doc/installation.rst index 85ccff1..f1a1556 100644 --- a/doc/installation.rst +++ b/doc/installation.rst @@ -22,7 +22,7 @@ To un-install, use:: python -m pip uninstall sounddevice If you want to try the very latest development version of the ``sounddevice`` module, -have a look at the section about :doc:`CONTRIBUTING`. +have a look at the section about :doc:`contributing`. If you install the ``sounddevice`` module with ``pip`` on macOS or Windows, the PortAudio_ library will be installed automagically. diff --git a/sounddevice.py b/sounddevice.py index 85144e9..9b9b9e8 100644 --- a/sounddevice.py +++ b/sounddevice.py @@ -1187,7 +1187,9 @@ def __init__(self, samplerate=None, blocksize=None, callback : callable User-supplied function to consume audio data in response to requests from an active stream. - The callback must have this signature:: + The callback must have this signature: + + .. code-block:: text callback(indata: buffer, frames: int, time: CData, status: CallbackFlags) -> None @@ -1271,7 +1273,9 @@ def __init__(self, samplerate=None, blocksize=None, callback : callable User-supplied function to generate audio data in response to requests from an active stream. - The callback must have this signature:: + The callback must have this signature: + + .. code-block:: text callback(outdata: buffer, frames: int, time: CData, status: CallbackFlags) -> None @@ -1378,7 +1382,9 @@ def __init__(self, samplerate=None, blocksize=None, callback : callable User-supplied function to consume, process or generate audio data in response to requests from an active stream. - The callback must have this signature:: + The callback must have this signature: + + .. code-block:: text callback(indata: buffer, outdata: buffer, frames: int, time: CData, status: CallbackFlags) -> None @@ -1416,7 +1422,9 @@ def __init__(self, samplerate=None, blocksize=None, callback : callable User-supplied function to consume audio in response to requests from an active stream. - The callback must have this signature:: + The callback must have this signature: + + .. code-block:: text callback(indata: numpy.ndarray, frames: int, time: CData, status: CallbackFlags) -> None @@ -1489,7 +1497,9 @@ def __init__(self, samplerate=None, blocksize=None, callback : callable User-supplied function to generate audio data in response to requests from an active stream. - The callback must have this signature:: + The callback must have this signature: + + .. code-block:: text callback(outdata: numpy.ndarray, frames: int, time: CData, status: CallbackFlags) -> None @@ -1691,7 +1701,9 @@ def __init__(self, samplerate=None, blocksize=None, read or written without blocking is returned by `read_available` and `write_available`, respectively. - The callback must have this signature:: + The callback must have this signature: + + .. code-block:: text callback(indata: ndarray, outdata: ndarray, frames: int, time: CData, status: CallbackFlags) -> None @@ -1794,7 +1806,9 @@ def __init__(self, samplerate=None, blocksize=None, raises `CallbackStop`, or `stop()` is called, the stream finished callback will not be called until all generated sample data has been played. The callback must have this - signature:: + signature: + + .. code-block:: text finished_callback() -> None