From e718d766a35dd8c0ef98e796a175c70996e8a2c2 Mon Sep 17 00:00:00 2001 From: Ilya Konstantinov Date: Fri, 24 Apr 2020 10:33:22 -0400 Subject: [PATCH] Fix docs syntax errors (#771) --- .travis.yml | 1 + docs/api.rst | 5 ----- docs/conf.py | 2 +- docs/index.rst | 2 ++ docs/local.rst | 4 ++-- docs/rate_limited_operations.rst | 2 +- docs/release_notes.rst | 2 +- docs/signals.rst | 2 +- docs/transaction.rst | 25 +++++++++++++++---------- pynamodb/models.py | 4 ++-- requirements-dev.txt | 2 ++ 11 files changed, 28 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0bec630fd..c16dc7828 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,6 +29,7 @@ before_script: script: - pytest --cov-report term-missing --cov=pynamodb tests - if [[ "$TRAVIS_PYTHON_VERSION" == "3.7" ]]; then mypy .; fi + - sphinx-build -W docs /tmp/docs-build after_success: - coveralls diff --git a/docs/api.rst b/docs/api.rst index 85cdc284b..f44083e9d 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -39,8 +39,3 @@ Exceptions .. autoexception:: pynamodb.exceptions.TableDoesNotExist .. autoexception:: pynamodb.exceptions.DoesNotExist -Migration API -------------- - -.. automodule:: pynamodb.migration - :members: diff --git a/docs/conf.py b/docs/conf.py index bd4f9053e..1b88c664a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -138,7 +138,7 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +#html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied diff --git a/docs/index.rst b/docs/index.rst index 4f6215ebe..e52f36db4 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -34,6 +34,8 @@ Topics conditional attributes transaction + optimistic_locking + rate_limited_operations local backup_restore signals diff --git a/docs/local.rst b/docs/local.rst index e3b734daf..1d0fe2acb 100644 --- a/docs/local.rst +++ b/docs/local.rst @@ -34,7 +34,7 @@ that your server is listening on. Running dynalite ^^^^^^^^^^^^^^^^ -Make sure you have the Node Package Manager installed, instructions `here `_. +Make sure you have the Node Package Manager installed (see `npm instructions `_). Install dynalite:: @@ -55,7 +55,7 @@ store your data. You can use DynamoDB local with PynamoDB for testing, debugging For more information, you can read `Amazon's Announcement `_ and `Jeff Barr's blog post `_ about it. -* Download the latest version of DynamoDB local `here `_. +* Download the `latest version of DynamoDB local `_. * Unpack the contents of the archive into a directory of your choice. DynamoDB local requires the `Java Runtime Environment `_ version 7. Make sure the JRE is installed before continuing. diff --git a/docs/rate_limited_operations.rst b/docs/rate_limited_operations.rst index a0e5f573b..dfbffb294 100644 --- a/docs/rate_limited_operations.rst +++ b/docs/rate_limited_operations.rst @@ -1,5 +1,5 @@ Rate-Limited Operation -================ +====================== `Scan`, `Query` and `Count` operations can be rate-limited based on the consumed capacities returned from DynamoDB. Simply specify the `rate_limit` argument when calling these methods. Rate limited batch writes are not currently supported, diff --git a/docs/release_notes.rst b/docs/release_notes.rst index 8711c34b9..0a50ac66e 100644 --- a/docs/release_notes.rst +++ b/docs/release_notes.rst @@ -453,7 +453,7 @@ re-serialize any data that was written with v1.5.4 and below. Temporary feature in this release: * Model.fix_unicode_set_attributes() migration helper -# Model.needs_unicode_set_fix() migration helper +* Model.needs_unicode_set_fix() migration helper v2.1.6 diff --git a/docs/signals.rst b/docs/signals.rst index 76cb70cc5..48222df3f 100644 --- a/docs/signals.rst +++ b/docs/signals.rst @@ -24,7 +24,7 @@ The callback must taking the following arguments: Arguments Description ================ =========== *sender* The object that fired that method. -*operation_name* The string name of the `DynamoDB action`_ +*operation_name* The string name of the DynamoDB action *table_name* The name of the table the operation is called upon. *req_uuid* A unique identifer so subscribers can correlate the before and after events. ================ =========== diff --git a/docs/transaction.rst b/docs/transaction.rst index 66f696d0e..088c8470f 100644 --- a/docs/transaction.rst +++ b/docs/transaction.rst @@ -30,7 +30,7 @@ Transact Writes A :py:class:`TransactWrite ` can be initialized with the following parameters: -* ``connection`` (required) - the :py:class:`Connection ` used to make the request (see :ref:`low_level`) +* ``connection`` (required) - the :py:class:`Connection ` used to make the request (see :ref:`low-level`) * ``client_request_token`` - an idempotency key for the request (see `ClientRequestToken `_ in the DynamoDB API reference) * ``return_consumed_capacity`` - determines the level of detail about provisioned throughput consumption that is returned in the response (see `ReturnConsumedCapacity `_ in the DynamoDB API reference) * ``return_item_collection_metrics`` - determines whether item collection metrics are returned (see `ReturnItemCollectionMetrics `_ in the DynamoDB API reference) @@ -118,12 +118,12 @@ Condition Check The ``ConditionCheck`` operation is used on a :py:class:`TransactWrite ` to check if the current state of a record you aren't modifying within the overall transaction fits some criteria that, if it fails, would cause the entire -transaction to fail. The ``condition`` argument is of type :ref:`conditional`. +transaction to fail. The ``condition`` argument is of type :ref:`conditional_operations`. * ``model_cls`` (required) * ``hash_key`` (required) * ``range_key`` (optional) -* ``condition`` (required) - of type :py:class:`Condition ` (see :ref:`conditional`) +* ``condition`` (required) - of type :py:class:`Condition ` (see :ref:`conditional_operations`) .. code-block:: python @@ -137,7 +137,7 @@ Delete The ``Delete`` operation functions similarly to ``Model.delete``. * ``model`` (required) -* ``condition`` (optional) - of type :py:class:`Condition ` (see :ref:`conditional`) +* ``condition`` (optional) - of type :py:class:`Condition ` (see :ref:`conditional_operations`) .. code-block:: python @@ -154,8 +154,8 @@ Save The ``Put`` operation functions similarly to ``Model.save``. * ``model`` (required) -* ``condition`` (optional) - of type :py:class:`Condition ` (see :ref:`conditional`) -* ``return_values`` (optional) - the values that should be returned if the condition fails ((see `ReturnValuesOnConditionCheckFailure `_ in the DynamoDB API reference) +* ``condition`` (optional) - of type :py:class:`Condition ` (see :ref:`conditional_operations`) +* ``return_values`` (optional) - the values that should be returned if the condition fails ((see `Put ReturnValuesOnConditionCheckFailure`_ in the DynamoDB API reference) .. code-block:: python @@ -172,8 +172,8 @@ The ``Update`` operation functions similarly to ``Model.update``. * ``model`` (required) * ``actions`` (required) - a list of type :py:class:`Action ` (see :ref:`updates`) -* ``condition`` (optional) - of type :py:class:`Condition ` (see :ref:`conditional`) -* ``return_values`` (optional) - the values that should be returned if the condition fails (see `ReturnValuesOnConditionCheckFailure `_ in the DynamoDB API reference) +* ``condition`` (optional) - of type :py:class:`Condition ` (see :ref:`conditional_operations`) +* ``return_values`` (optional) - the values that should be returned if the condition fails (see `Update ReturnValuesOnConditionCheckFailure`_ in the DynamoDB API reference) .. code-block:: python @@ -215,6 +215,11 @@ Error Types You can expect some new error types with transactions, such as: -* :py:exc:`TransactWriteError ` - thrown when a :py:class:`TransactWrite ` request returns a bad response (see the `Errors `_ section in the DynamoDB API reference). -* :py:exc:`TransactGetError ` - thrown when a :py:class:`TransactGet ` request returns a bad response (see the `Errors `_ section in the DynamoDB API reference). +* :py:exc:`TransactWriteError ` - thrown when a :py:class:`TransactWrite ` request returns a bad response (see the `TransactWriteItems Errors`_ section in the DynamoDB API reference). +* :py:exc:`TransactGetError ` - thrown when a :py:class:`TransactGet ` request returns a bad response (see the `TransactGetItems Errors`_ section in the DynamoDB API reference). * :py:exc:`InvalidStateError ` - thrown when an attempt is made to access data on a :py:class:`_ModelFuture ` before the `TransactGet` request is completed. + +.. _Update ReturnValuesOnConditionCheckFailure: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Update.html#DDB-Type-Update-ReturnValuesOnConditionCheckFailure> +.. _Put ReturnValuesOnConditionCheckFailure: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Put.html#DDB-Type-Put-ReturnValuesOnConditionCheckFailure +.. _TransactWriteItems Errors: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TransactWriteItems.html#API_TransactWriteItems_Errors +.. _TransactGetItems Errors: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TransactGetItems.html#API_TransactGetItems_Errors diff --git a/pynamodb/models.py b/pynamodb/models.py index 676fb6666..8de8c96f7 100644 --- a/pynamodb/models.py +++ b/pynamodb/models.py @@ -476,8 +476,8 @@ def get(cls, :param hash_key: The hash key of the desired item :param range_key: The range key of the desired item, only used when appropriate. - :param consistent_read - :param attributes_to_get + :param consistent_read: + :param attributes_to_get: :raises ModelInstance.DoesNotExist: if the object to be updated does not exist """ hash_key, range_key = cls._serialize_keys(hash_key, range_key) diff --git a/requirements-dev.txt b/requirements-dev.txt index 688aef2ca..b16ebf016 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -9,3 +9,5 @@ python-dateutil==2.8.0 coveralls mypy==0.761;python_version>="3.7" pytest-cov +sphinx +sphinx-rtd-theme