From 3c3ee09d9016e5711e2a73d79983db4090c2e416 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Mon, 31 Aug 2020 17:39:42 +0200 Subject: [PATCH] Fixed auto-generated docs indentation and code blocks --- docs/source/platypush/events/.rst | 5 - .../platypush/plugins/stt.picovoice.rst | 5 - .../source/platypush/responses/deepspeech.rst | 5 - platypush/backend/mail.py | 58 ++--- platypush/message/response/bluetooth.py | 244 +++++++++--------- platypush/message/response/camera/android.py | 98 +++---- .../plugins/assistant/google/pushtotalk.py | 22 +- platypush/plugins/gpio/sensor/ltr559.py | 10 +- platypush/plugins/lcd/i2c.py | 19 +- platypush/plugins/tensorflow/__init__.py | 65 +++-- platypush/plugins/twilio.py | 5 +- platypush/plugins/zeroconf.py | 38 +-- platypush/plugins/zwave/__init__.py | 2 +- 13 files changed, 278 insertions(+), 298 deletions(-) delete mode 100644 docs/source/platypush/events/.rst delete mode 100644 docs/source/platypush/plugins/stt.picovoice.rst delete mode 100644 docs/source/platypush/responses/deepspeech.rst diff --git a/docs/source/platypush/events/.rst b/docs/source/platypush/events/.rst deleted file mode 100644 index abf3b8adc..000000000 --- a/docs/source/platypush/events/.rst +++ /dev/null @@ -1,5 +0,0 @@ -``platypush.message.event`` -=========================== - -.. automodule:: platypush.message.event - :members: diff --git a/docs/source/platypush/plugins/stt.picovoice.rst b/docs/source/platypush/plugins/stt.picovoice.rst deleted file mode 100644 index 593b8e5fc..000000000 --- a/docs/source/platypush/plugins/stt.picovoice.rst +++ /dev/null @@ -1,5 +0,0 @@ -``platypush.plugins.stt.picovoice`` -=================================== - -.. automodule:: platypush.plugins.stt.picovoice - :members: diff --git a/docs/source/platypush/responses/deepspeech.rst b/docs/source/platypush/responses/deepspeech.rst deleted file mode 100644 index bf01d3265..000000000 --- a/docs/source/platypush/responses/deepspeech.rst +++ /dev/null @@ -1,5 +0,0 @@ -``platypush.message.response.deepspeech`` -========================================= - -.. automodule:: platypush.message.response.deepspeech - :members: diff --git a/platypush/backend/mail.py b/platypush/backend/mail.py index 62476ba89..49b584430 100644 --- a/platypush/backend/mail.py +++ b/platypush/backend/mail.py @@ -69,43 +69,43 @@ class MailBackend(Backend): The ``name`` parameter can be used to identify this mailbox in the relevant events, otherwise ``Mailbox #{id}`` will be used as a name. Example configuration: - .. code-block:: yaml + .. code-block:: yaml - backend.mail: - mailboxes: - - plugin: mail.imap - name: "My Local Server" - username: me@mydomain.com - password: my-imap-password - server: localhost - ssl: true - folder: "All Mail" + backend.mail: + mailboxes: + - plugin: mail.imap + name: "My Local Server" + username: me@mydomain.com + password: my-imap-password + server: localhost + ssl: true + folder: "All Mail" - - plugin: mail.imap - name: "GMail" - username: me@gmail.com - password: my-google-password - server: imap.gmail.com - ssl: true - folder: "INBOX" + - plugin: mail.imap + name: "GMail" + username: me@gmail.com + password: my-google-password + server: imap.gmail.com + ssl: true + folder: "INBOX" If you have a default configuration available for a mail plugin you can implicitly reuse it without replicating it here. Example: - .. code-block:: yaml + .. code-block:: yaml - mail.imap: - username: me@mydomain.com - password: my-imap-password - server: localhost - ssl: true + mail.imap: + username: me@mydomain.com + password: my-imap-password + server: localhost + ssl: true - backend.mail: - mailboxes: - # The mail.imap default configuration will be used - - plugin: mail.imap - name: "My Local Server" - folder: "All Mail" + backend.mail: + mailboxes: + # The mail.imap default configuration will be used + - plugin: mail.imap + name: "My Local Server" + folder: "All Mail" :param timeout: Connect/read timeout for a mailbox, in seconds (default: 60). """ diff --git a/platypush/message/response/bluetooth.py b/platypush/message/response/bluetooth.py index daa37a536..3b42be385 100644 --- a/platypush/message/response/bluetooth.py +++ b/platypush/message/response/bluetooth.py @@ -45,55 +45,55 @@ class BluetoothLookupServiceResponse(BluetoothResponse): """ Example services response output: - .. code-block:: json + .. 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): @@ -105,30 +105,30 @@ class BluetoothDiscoverPrimaryResponse(BluetoothResponse): """ Example services response output: - .. code-block:: json + .. 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 - } - ] + [ + { + "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): @@ -140,58 +140,58 @@ class BluetoothDiscoverCharacteristicsResponse(BluetoothResponse): """ Example services response output: - .. code-block:: json + .. 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 - } - ] + [ + { + "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): diff --git a/platypush/message/response/camera/android.py b/platypush/message/response/camera/android.py index 8becf538f..7a750a5ed 100644 --- a/platypush/message/response/camera/android.py +++ b/platypush/message/response/camera/android.py @@ -7,56 +7,56 @@ class AndroidCameraStatusResponse(CameraResponse): """ 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" + } """ diff --git a/platypush/plugins/assistant/google/pushtotalk.py b/platypush/plugins/assistant/google/pushtotalk.py index 96dc4e941..0233d7ea2 100644 --- a/platypush/plugins/assistant/google/pushtotalk.py +++ b/platypush/plugins/assistant/google/pushtotalk.py @@ -217,18 +217,18 @@ class AssistantGooglePushtotalkPlugin(AssistantPlugin): :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 + .. 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" + } + ] """ diff --git a/platypush/plugins/gpio/sensor/ltr559.py b/platypush/plugins/gpio/sensor/ltr559.py index ddf00527e..eb2e34680 100644 --- a/platypush/plugins/gpio/sensor/ltr559.py +++ b/platypush/plugins/gpio/sensor/ltr559.py @@ -21,12 +21,12 @@ class GpioSensorLtr559Plugin(GpioSensorPlugin): """ :returns: dict. Example: - .. code-block:: python + .. code-block:: python - output = { - "light": 109.3543, # Lux - "proximity": 103 # The higher the value, the nearest the object, within a ~5cm range - } + output = { + "light": 109.3543, # Lux + "proximity": 103 # The higher the value, the nearest the object, within a ~5cm range + } """ diff --git a/platypush/plugins/lcd/i2c.py b/platypush/plugins/lcd/i2c.py index f76e9b8e6..eb9d38220 100644 --- a/platypush/plugins/lcd/i2c.py +++ b/platypush/plugins/lcd/i2c.py @@ -20,8 +20,8 @@ class LcdI2cPlugin(LcdPlugin): Pin mapping:: - 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 - BL | D7 | D6 | D5 | D4 | E | RS | - + 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 + BL | D7 | D6 | D5 | D4 | E | RS | - Requires: @@ -40,20 +40,15 @@ class LcdI2cPlugin(LcdPlugin): :param i2c_expander: Set your I²C chip type. Supported: "PCF8574", "MCP23008", "MCP23017". :param address: The I2C address of your LCD. :param expander_params: Parameters for expanders, in a dictionary. Only needed for MCP23017 - gpio_bank - This must be either ``A`` or ``B`` - If you have a HAT, A is usually marked 1 and B is 2. + gpio_bank - This must be either ``A`` or ``B``. If you have a HAT, A is usually marked 1 and B is 2. Example: ``expander_params={'gpio_bank': 'A'}`` :param port: The I2C port number. Default: ``1``. :param cols: Number of columns per row (usually 16 or 20). Default: ``16``. :param rows: Number of display rows (usually 1, 2 or 4). Default: ``2``. - :param backlight_enabled: Whether the backlight is enabled initially. - Default: ``True``. Has no effect if pin_backlight is ``None`` - :param dotsize: Some 1 line displays allow a font height of 10px. - Allowed: ``8`` or ``10``. Default: ``8``. - :param charmap: The character map used. Depends on your LCD. This must - be either ``A00`` or ``A02`` or ``ST0B``. Default: ``A02``. - :param auto_linebreaks: Whether or not to automatically insert line - breaks. Default: ``True``. + :param backlight_enabled: Whether the backlight is enabled initially. Default: ``True``. Has no effect if pin_backlight is ``None`` + :param dotsize: Some 1 line displays allow a font height of 10px. Allowed: ``8`` or ``10``. Default: ``8``. + :param charmap: The character map used. Depends on your LCD. This must be either ``A00`` or ``A02`` or ``ST0B``. Default: ``A02``. + :param auto_linebreaks: Whether or not to automatically insert line breaks. Default: ``True``. """ super().__init__(**kwargs) diff --git a/platypush/plugins/tensorflow/__init__.py b/platypush/plugins/tensorflow/__init__.py index 5164d18ca..aaab6f689 100644 --- a/platypush/plugins/tensorflow/__init__.py +++ b/platypush/plugins/tensorflow/__init__.py @@ -196,7 +196,7 @@ class TensorflowPlugin(Plugin): :param name: Name of the model. :param layers: List of layers. Example: - .. code-block:: javascript + .. code-block:: javascript [ // Input flatten layer with 10 units @@ -265,7 +265,7 @@ class TensorflowPlugin(Plugin): :return: The model configuration, as a dict. Example: - .. code-block:: json + .. code-block:: json { "name": "test_model", @@ -463,7 +463,7 @@ class TensorflowPlugin(Plugin): :return: Configuration of the model, as a dict. Example: - .. code-block:: json + .. code-block:: json { "name": "test_regression_model", @@ -712,16 +712,15 @@ class TensorflowPlugin(Plugin): Fraction of the training data to be used as validation data. The model will set apart this fraction of the training data, will not train on it, and will evaluate the loss and any model metrics on this data at the end of each epoch. The validation data is selected from the last samples in the ``x`` and ``y`` - data provided, before shuffling. This argument is not supported when ``x`` is a dataset, generator or - ``keras.utils.Sequence`` instance. + data provided, before shuffling. Not supported when ``x`` is a dataset, generator or ``keras.utils.Sequence`` instance. :param validation_data: Data on which to evaluate the loss and any model metrics at the end of each epoch. 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. @@ -966,43 +965,43 @@ class TensorflowPlugin(Plugin): - For regression models with no output labels specified: ``values`` will contain the output vector: - .. code-block:: json + .. code-block:: json - { - "values": [[3.1415]] - } + { + "values": [[3.1415]] + } - For regression models with output labels specified: ``values`` will be a list of ``{label -> value}`` maps: - .. code-block:: json + .. code-block:: json - { - "values": [ - { - "x": 42.0, - "y": 43.0 - } - ] - } + { + "values": [ + { + "x": 42.0, + "y": 43.0 + } + ] + } - For neural networks: ``values`` will contain the list of the output vector like in the case of regression, and ``labels`` will store the list of ``argmax`` (i.e. the index of the output unit with the highest value) or their labels, if the model has output labels: - .. code-block:: json + .. code-block:: json - { - "labels": [ - "positive" - ], - "values": [ - { - "positive": 0.998, - "negative": 0.002 - } - ] - } + { + "labels": [ + "positive" + ], + "values": [ + { + "positive": 0.998, + "negative": 0.002 + } + ] + } """ name = model diff --git a/platypush/plugins/twilio.py b/platypush/plugins/twilio.py index cd5599fa6..e70a949c4 100644 --- a/platypush/plugins/twilio.py +++ b/platypush/plugins/twilio.py @@ -84,9 +84,9 @@ class TwilioPlugin(Plugin): "MMS": false, "fax": false } - }, - ... + } ] + """ phone_numbers = self.client.available_phone_numbers(country.upper()).fetch() resp = requests.get(self._api_base_url + phone_numbers.uri, auth=(self.account_sid, self.auth_token)).json() @@ -372,6 +372,7 @@ class TwilioPlugin(Plugin): "to": "+18182008801", "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/SMded05904ccb347238880ca9264e8fe1c.json" } + """ if to in self.address_book: to = self.address_book[to] diff --git a/platypush/plugins/zeroconf.py b/platypush/plugins/zeroconf.py index b92e1d45c..c136a4537 100644 --- a/platypush/plugins/zeroconf.py +++ b/platypush/plugins/zeroconf.py @@ -88,28 +88,28 @@ class ZeroconfPlugin(Plugin): discovery will loop forever and generate events upon service changes. :return: A ``service_type -> [service_names]`` mapping. Example: - .. code-block:: json + .. 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' diff --git a/platypush/plugins/zwave/__init__.py b/platypush/plugins/zwave/__init__.py index 667d4e285..b11343665 100644 --- a/platypush/plugins/zwave/__init__.py +++ b/platypush/plugins/zwave/__init__.py @@ -813,7 +813,7 @@ class ZwavePlugin(Plugin): Add a value to a scene. WARNING: This method actually doesn't work, by own admission of the - :ref:`OpenZWave developer `_ + `OpenZWave developer `_. :param data: Data to set for the value (default: current value data).