ReadTheDocs fixes

This commit is contained in:
Fabio Manganiello 2020-08-24 01:14:40 +02:00
parent 5d2e74eb97
commit 2e6388f6f4
17 changed files with 236 additions and 258 deletions

View File

@ -6,7 +6,6 @@ Events
:maxdepth: 2
:caption: Events:
platypush/events/.rst
platypush/events/adafruit.rst
platypush/events/alarm.rst
platypush/events/application.rst

View File

@ -1,5 +0,0 @@
``platypush.backend.stt.picovoice``
===================================
.. automodule:: platypush.backend.stt.picovoice
:members:

View File

@ -1,6 +0,0 @@
``platypush.plugins.google.credentials``
========================================
.. automodule:: platypush.plugins.google.credentials
:members:

View File

@ -1,6 +0,0 @@
``platypush.plugins.media.search.local``
========================================
.. automodule:: platypush.plugins.media.search.local
:members:

View File

@ -1,6 +0,0 @@
``platypush.plugins.media.search.torrent``
==========================================
.. automodule:: platypush.plugins.media.search.torrent
:members:

View File

@ -1,6 +0,0 @@
``platypush.plugins.media.search.youtube``
==========================================
.. automodule:: platypush.plugins.media.search.youtube
:members:

View File

@ -10,13 +10,18 @@ class Response(Message):
def __init__(self, target=None, origin=None, id=None, output=None, errors=None,
timestamp=None, disable_logging=False):
"""
Params:
target -- Target [String]
origin -- Origin [String]
output -- Output [String]
errors -- Errors [List of strings or exceptions]
id -- Message ID this response refers to
timestamp -- Message timestamp [Float]
:param target: Target
:type target: str
:param origin: Origin
:type origin: str
:param output: Output
:type output: str
:param errors: Errors
:type errors: list
:param id: Message ID this response refers to
:type id: str
:param timestamp: Message timestamp
:type timestamp: float
"""
super().__init__(timestamp=timestamp)
@ -63,7 +68,7 @@ class Response(Message):
def __str__(self):
"""
Overrides the str() operator and converts
Overrides the ``str()`` operator and converts
the message into a UTF-8 JSON string
"""
output = self.output if self.output is not None else {

View File

@ -43,55 +43,58 @@ class BluetoothLookupNameResponse(BluetoothResponse):
class BluetoothLookupServiceResponse(BluetoothResponse):
"""
Example services response output::
Example services response output:
.. code-block:: json
[
{
"service-classes": [
"1801"
],
"profiles": [],
"name": "Service name #1",
"description": null,
"provider": null,
"service-id": null,
"protocol": "L2CAP",
"port": 31,
"host": "00:11:22:33:44:55"
},
{
"service-classes": [
"1800"
],
"profiles": [],
"name": "Service name #2",
"description": null,
"provider": null,
"service-id": null,
"protocol": "L2CAP",
"port": 31,
"host": "00:11:22:33:44:56"
},
{
"service-classes": [
"1112",
"1203"
],
"profiles": [
[
"1108",
258
]
],
"name": "Headset Gateway",
"description": null,
"provider": null,
"service-id": null,
"protocol": "RFCOMM",
"port": 2,
"host": "00:11:22:33:44:57"
}
]
[
{
"service-classes": [
"1801"
],
"profiles": [],
"name": "Service name #1",
"description": null,
"provider": null,
"service-id": null,
"protocol": "L2CAP",
"port": 31,
"host": "00:11:22:33:44:55"
},
{
"service-classes": [
"1800"
],
"profiles": [],
"name": "Service name #2",
"description": null,
"provider": null,
"service-id": null,
"protocol": "L2CAP",
"port": 31,
"host": "00:11:22:33:44:56"
},
{
"service-classes": [
"1112",
"1203"
],
"profiles": [
[
"1108",
258
]
],
"name": "Headset Gateway",
"description": null,
"provider": null,
"service-id": null,
"protocol": "RFCOMM",
"port": 2,
"host": "00:11:22:33:44:57"
}
]
"""
def __init__(self, services: list, *args, **kwargs):
self.services = services
@ -100,30 +103,32 @@ class BluetoothLookupServiceResponse(BluetoothResponse):
class BluetoothDiscoverPrimaryResponse(BluetoothResponse):
"""
Example services response output::
Example services response output:
[
{
"uuid": "00001800-0000-1000-8000-00805f9b34fb",
"start": 1,
"end": 7
},
{
"uuid": "00001801-0000-1000-8000-00805f9b34fb",
"start": 8,
"end": 8
},
{
"uuid": "0000fee7-0000-1000-8000-00805f9b34fb",
"start": 9,
"end": 16
},
{
"uuid": "cba20d00-224d-11e6-9fb8-0002a5d5c51b",
"start": 17,
"end": 65535
}
]
.. code-block:: json
[
{
"uuid": "00001800-0000-1000-8000-00805f9b34fb",
"start": 1,
"end": 7
},
{
"uuid": "00001801-0000-1000-8000-00805f9b34fb",
"start": 8,
"end": 8
},
{
"uuid": "0000fee7-0000-1000-8000-00805f9b34fb",
"start": 9,
"end": 16
},
{
"uuid": "cba20d00-224d-11e6-9fb8-0002a5d5c51b",
"start": 17,
"end": 65535
}
]
"""
def __init__(self, services: list, *args, **kwargs):
@ -133,58 +138,60 @@ class BluetoothDiscoverPrimaryResponse(BluetoothResponse):
class BluetoothDiscoverCharacteristicsResponse(BluetoothResponse):
"""
Example services response output::
Example services response output:
[
{
"uuid": "00002a00-0000-1000-8000-00805f9b34fb",
"handle": 2,
"properties": 10,
"value_handle": 3
},
{
"uuid": "00002a01-0000-1000-8000-00805f9b34fb",
"handle": 4,
"properties": 2,
"value_handle": 5
},
{
"uuid": "00002a04-0000-1000-8000-00805f9b34fb",
"handle": 6,
"properties": 2,
"value_handle": 7
},
{
"uuid": "0000fec8-0000-1000-8000-00805f9b34fb",
"handle": 10,
"properties": 32,
"value_handle": 11
},
{
"uuid": "0000fec7-0000-1000-8000-00805f9b34fb",
"handle": 13,
"properties": 8,
"value_handle": 14
},
{
"uuid": "0000fec9-0000-1000-8000-00805f9b34fb",
"handle": 15,
"properties": 2,
"value_handle": 16
},
{
"uuid": "cba20003-224d-11e6-9fb8-0002a5d5c51b",
"handle": 18,
"properties": 16,
"value_handle": 19
},
{
"uuid": "cba20002-224d-11e6-9fb8-0002a5d5c51b",
"handle": 21,
"properties": 12,
"value_handle": 22
}
]
.. code-block:: json
[
{
"uuid": "00002a00-0000-1000-8000-00805f9b34fb",
"handle": 2,
"properties": 10,
"value_handle": 3
},
{
"uuid": "00002a01-0000-1000-8000-00805f9b34fb",
"handle": 4,
"properties": 2,
"value_handle": 5
},
{
"uuid": "00002a04-0000-1000-8000-00805f9b34fb",
"handle": 6,
"properties": 2,
"value_handle": 7
},
{
"uuid": "0000fec8-0000-1000-8000-00805f9b34fb",
"handle": 10,
"properties": 32,
"value_handle": 11
},
{
"uuid": "0000fec7-0000-1000-8000-00805f9b34fb",
"handle": 13,
"properties": 8,
"value_handle": 14
},
{
"uuid": "0000fec9-0000-1000-8000-00805f9b34fb",
"handle": 15,
"properties": 2,
"value_handle": 16
},
{
"uuid": "cba20003-224d-11e6-9fb8-0002a5d5c51b",
"handle": 18,
"properties": 16,
"value_handle": 19
},
{
"uuid": "cba20002-224d-11e6-9fb8-0002a5d5c51b",
"handle": 21,
"properties": 12,
"value_handle": 22
}
]
"""
def __init__(self, characteristics: list, *args, **kwargs):

View File

@ -5,58 +5,58 @@ from platypush.message.response.camera import CameraResponse
class AndroidCameraStatusResponse(CameraResponse):
"""
Sample response::
Example response:
.. code-block:: json
.. code-block:: json
{
"stream_url": "https://192.168.1.30:8080/video",
"image_url": "https://192.168.1.30:8080/photo.jpg",
"audio_url": "https://192.168.1.30:8080/audio.wav",
"orientation": "landscape",
"idle": "off",
"audio_only": "off",
"overlay": "off",
"quality": "49",
"focus_homing": "off",
"ip_address": "192.168.1.30",
"motion_limit": "250",
"adet_limit": "200",
"night_vision": "off",
"night_vision_average": "2",
"night_vision_gain": "1.0",
"motion_detect": "off",
"motion_display": "off",
"video_chunk_len": "60",
"gps_active": "off",
"video_size": "1920x1080",
"mirror_flip": "none",
"ffc": "off",
"rtsp_video_formats": "",
"rtsp_audio_formats": "",
"video_connections": "0",
"audio_connections": "0",
"ivideon_streaming": "off",
"zoom": "100",
"crop_x": "50",
"crop_y": "50",
"coloreffect": "none",
"scenemode": "auto",
"focusmode": "continuous-video",
"whitebalance": "auto",
"flashmode": "off",
"antibanding": "off",
"torch": "off",
"focus_distance": "0.0",
"focal_length": "4.25",
"aperture": "1.7",
"filter_density": "0.0",
"exposure_ns": "9384",
"frame_duration": "33333333",
"iso": "100",
"manual_sensor": "off",
"photo_size": "1920x1080"
}
{
"stream_url": "https://192.168.1.30:8080/video",
"image_url": "https://192.168.1.30:8080/photo.jpg",
"audio_url": "https://192.168.1.30:8080/audio.wav",
"orientation": "landscape",
"idle": "off",
"audio_only": "off",
"overlay": "off",
"quality": "49",
"focus_homing": "off",
"ip_address": "192.168.1.30",
"motion_limit": "250",
"adet_limit": "200",
"night_vision": "off",
"night_vision_average": "2",
"night_vision_gain": "1.0",
"motion_detect": "off",
"motion_display": "off",
"video_chunk_len": "60",
"gps_active": "off",
"video_size": "1920x1080",
"mirror_flip": "none",
"ffc": "off",
"rtsp_video_formats": "",
"rtsp_audio_formats": "",
"video_connections": "0",
"audio_connections": "0",
"ivideon_streaming": "off",
"zoom": "100",
"crop_x": "50",
"crop_y": "50",
"coloreffect": "none",
"scenemode": "auto",
"focusmode": "continuous-video",
"whitebalance": "auto",
"flashmode": "off",
"antibanding": "off",
"torch": "off",
"focus_distance": "0.0",
"focal_length": "4.25",
"aperture": "1.7",
"filter_density": "0.0",
"exposure_ns": "9384",
"frame_duration": "33333333",
"iso": "100",
"manual_sensor": "off",
"photo_size": "1920x1080"
}
"""

View File

@ -34,6 +34,7 @@ class AssistantGooglePushtotalkPlugin(AssistantPlugin):
* **tenacity** (``pip install tenacity``)
* **google-assistant-sdk** (``pip install google-assistant-sdk[samples]``)
"""
api_endpoint = 'embeddedassistant.googleapis.com'
@ -214,24 +215,20 @@ class AssistantGooglePushtotalkPlugin(AssistantPlugin):
:param language: Language code override (default: default configured language).
:param tts_plugin: Optional text-to-speech plugin to be used for rendering text.
:param tts_args: Optional arguments for the TTS plugin say method.
:returns: A list of the interactions that happen within the conversation.
..code-block:: json
[
{
"request": "request 1",
"response": "response 1"
},
{
"request": "request 2",
"response": "response 2"
}
]
[
{
"request": "request 1",
"response": "response 1"
},
{
"request": "request 2",
"response": "response 2"
}
]
"""

View File

@ -75,7 +75,7 @@ class FoursquarePlugin(Plugin):
:param query: Search query (e.g. "coffee shops" or "restaurants").
:param limit: Maximum number of results.
:param url: Venue URL to search.
:param categories: List of ``category IDs <https://developer.foursquare.com/docs/resources/categories>``_
:param categories: List of `category IDs <https://developer.foursquare.com/docs/resources/categories>`_
to be searched.
:param radius: Search radius in meters.
:param sw: South/west boundary box as a ``[latitude, longitude]`` pair.
@ -157,7 +157,7 @@ class FoursquarePlugin(Plugin):
:param query: Search query (e.g. "coffee shops" or "restaurants"). The parameter has no effect if
``section`` is specified.
:param limit: Maximum number of results.
:param categories: List of ``category IDs <https://developer.foursquare.com/docs/resources/categories>``_
:param categories: List of `category IDs <https://developer.foursquare.com/docs/resources/categories>`_
to be searched.
:param radius: Search radius in meters.
:param open_now: Filter by open/not open now.

View File

@ -16,13 +16,13 @@ class GoogleTranslatePlugin(Plugin):
1. Create a project on the `Google Cloud console <https://console.cloud.google.com/projectcreate>`_ if
you don't have one already.
2. In the menu navigate to the _Artificial Intelligence_ section and select _Translations_ and enable the API.
2. In the menu navigate to the *Artificial Intelligence* section and select *Translations* and enable the API.
3. From the menu select _APIs & Services_ and create a service account. You can leave role and permissions
3. From the menu select *APIs & Services* and create a service account. You can leave role and permissions
empty.
4. Create a new private JSON key for the service account and download it. By default platypush will look for the
credentials file under ~/.credentials/platypush/google/translate.json.
credentials file under ``~/.credentials/platypush/google/translate.json``.
Requires:

View File

@ -22,7 +22,7 @@ class GpioSensorLtr559Plugin(GpioSensorPlugin):
:returns: dict. Example:
.. code-block:: python
:
output = {
"light": 109.3543, # Lux
"proximity": 103 # The higher the value, the nearest the object, within a ~5cm range

View File

@ -1,7 +1,6 @@
import os
from typing import Optional, Union
import deepspeech
import numpy as np
import wave
@ -79,6 +78,7 @@ class SttDeepspeechPlugin(SttPlugin):
:param block_duration: Duration of the acquired audio blocks (default: 1 second).
"""
import deepspeech
super().__init__(*args, **kwargs)
self.model_file = os.path.abspath(os.path.expanduser(model_file))
self.lm_file = os.path.abspath(os.path.expanduser(lm_file))
@ -89,7 +89,8 @@ class SttDeepspeechPlugin(SttPlugin):
self._model: Optional[deepspeech.Model] = None
self._context = None
def _get_model(self) -> deepspeech.Model:
def _get_model(self):
import deepspeech
if not self._model:
self._model = deepspeech.Model(self.model_file, self.beam_width)
self._model.enableDecoderWithLM(self.lm_file, self.trie_file, self.lm_alpha, self.lm_beta)

View File

@ -719,9 +719,9 @@ class TensorflowPlugin(Plugin):
The model will not be trained on this data. ``validation_data`` will override ``validation_split``.
``validation_data`` could be:
- tuple ``(x_val, y_val)`` of arrays/numpy arrays/tensors
- tuple ``(x_val, y_val, val_sample_weights)`` of Numpy arrays
- dataset
- tuple ``(x_val, y_val)`` of arrays/numpy arrays/tensors
- tuple ``(x_val, y_val, val_sample_weights)`` of Numpy arrays
- dataset
For the first two cases, ``batch_size`` must be provided. For the last case, ``validation_steps`` could be
provided.

View File

@ -86,32 +86,30 @@ class ZeroconfPlugin(Plugin):
:param service: Service type (e.g. ``_http._tcp.local.``).
:param timeout: Browser timeout in seconds (default: 5). Specify None for no timeout - in such case the
discovery will loop forever and generate events upon service changes.
:return: A ``service_type -> [service_names]`` mapping. Example::
:return: A ``service_type -> [service_names]`` mapping. Example:
.. code-block:: json
{
"host1._platypush-http._tcp.local.": {
"type": "_platypush-http._tcp.local.",
"name": "host1._platypush-http._tcp.local.",
"info": {
"addresses": ["192.168.1.11"],
"port": 8008,
"host_ttl": 120,
"other_ttl": 4500,
"priority": 0,
"properties": {
"name": "Platypush",
"vendor": "Platypush",
"version": "0.13.2"
},
"server": "host1._platypush-http._tcp.local.",
"weight": 0
}
},
...
{
"host1._platypush-http._tcp.local.": {
"type": "_platypush-http._tcp.local.",
"name": "host1._platypush-http._tcp.local.",
"info": {
"addresses": ["192.168.1.11"],
"port": 8008,
"host_ttl": 120,
"other_ttl": 4500,
"priority": 0,
"properties": {
"name": "Platypush",
"vendor": "Platypush",
"version": "0.13.2"
},
"server": "host1._platypush-http._tcp.local.",
"weight": 0
}
}
}
"""
assert not self._discovery_in_progress, 'A discovery process is already running'

View File

@ -19,7 +19,7 @@ class ZigbeeMqttPlugin(MqttPlugin):
- Install `cc-tool <https://github.com/dashesy/cc-tool>`_ either from sources or from a package manager.
- Connect the Zigbee to your PC/RaspberryPi in this way: USB -> CC debugger -> downloader cable -> CC2531 -> USB.
The debugger and the adapter should be connected _at the same time_. If the later ``cc-tool`` command throws up
The debugger and the adapter should be connected *at the same time*. If the later ``cc-tool`` command throws up
an error, put the device in sync while connected by pressing the _Reset_ button on the debugger.
- Check where the device is mapped. On Linux it will usually be ``/dev/ttyACM0``.
- Download the latest `Z-Stack firmware <https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator>`_ to your device.