Skip to content

Commit f403901

Browse files
authored
Update all rST :: to code-block directives
1 parent e2ae6de commit f403901

File tree

8 files changed

+198
-38
lines changed

8 files changed

+198
-38
lines changed

.gitignore

Lines changed: 143 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,145 @@
1-
.eggs/*
2-
.*.swp
3-
*~
4-
*.py[co]
5-
.coverage
6-
test_elasticsearch/cover
7-
test_elasticsearch/local.py
8-
docs/_build
9-
elasticsearch.egg-info
10-
.tox
11-
.noseids
12-
dist
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
1326
*.egg
14-
coverage.xml
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
1546
nosetests.xml
16-
junit-*.xml
17-
build
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
98+
__pypackages__/
99+
100+
# Celery stuff
101+
celerybeat-schedule
102+
celerybeat.pid
103+
104+
# SageMath parsed files
105+
*.sage.py
106+
107+
# Environments
108+
.env
109+
.venv
110+
env/
111+
venv/
112+
ENV/
113+
env.bak/
114+
venv.bak/
115+
116+
# Spyder project settings
117+
.spyderproject
118+
.spyproject
119+
120+
# Rope project settings
121+
.ropeproject
122+
123+
# mkdocs documentation
124+
/site
125+
126+
# mypy
127+
.mypy_cache/
128+
.dmypy.json
129+
dmypy.json
130+
131+
# Pyre type checker
132+
.pyre/
133+
134+
# pytype static type analyzer
135+
.pytype/
136+
137+
# Cython debug symbols
138+
cython_debug/
139+
140+
# Pycharm project settings
141+
.idea
142+
143+
# elasticsearch files
144+
test_elasticsearch/cover
145+
test_elasticsearch/local.py

Changelog.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ Changelog
4646

4747
.. _#1169: https://github.com/elastic/elasticsearch-py/pull/1169
4848
.. _#1179: https://github.com/elastic/elasticsearch-py/pull/1179
49-
.. _#1180: https://github.com/elastic/elasticsearch-py/pull/1180
5049
.. _#1182: https://github.com/elastic/elasticsearch-py/pull/1182
5150

5251
7.6.0 (2020-03-19)

docs/api.rst

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ elasticsearch returns a 2XX response. Otherwise an instance of
3030
raised. You can see other exception and error states in :ref:`exceptions`. If
3131
you do not wish an exception to be raised you can always pass in an ``ignore``
3232
parameter with either a single status code that should be ignored or a list of
33-
them::
33+
them:
34+
35+
.. code-block:: python
3436
3537
from elasticsearch import Elasticsearch
3638
es = Elasticsearch()
@@ -49,7 +51,9 @@ Global timeout can be set when constructing the client (see
4951
:class:`~elasticsearch.Connection`'s ``timeout`` parameter) or on a per-request
5052
basis using ``request_timeout`` (float value in seconds) as part of any API
5153
call, this value will get passed to the ``perform_request`` method of the
52-
connection class::
54+
connection class:
55+
56+
.. code-block:: python
5357
5458
# only wait for 1 second, regardless of the client's default
5559
es.cluster.health(wait_for_status='yellow', request_timeout=1)
@@ -85,12 +89,16 @@ Response Filtering
8589
~~~~~~~~~~~~~~~~~~
8690

8791
The ``filter_path`` parameter is used to reduce the response returned by
88-
elasticsearch. For example, to only return ``_id`` and ``_type``, do::
92+
elasticsearch. For example, to only return ``_id`` and ``_type``, do:
93+
94+
.. code-block:: python
8995
9096
es.search(index='test-index', filter_path=['hits.hits._id', 'hits.hits._type'])
9197
9298
It also supports the ``*`` wildcard character to match any field or part of a
93-
field's name::
99+
field's name:
100+
101+
.. code-block:: python
94102
95103
es.search(index='test-index', filter_path=['hits.hits._*'])
96104

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
# Add any paths that contain custom static files (such as style sheets) here,
143143
# relative to this directory. They are copied after the builtin static files,
144144
# so a file named "default.css" will overwrite the builtin "default.css".
145-
html_static_path = ["_static"]
145+
# html_static_path = []
146146

147147
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
148148
# using the given strftime format.

docs/connection.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ If you have complex SSL logic for connecting to Elasticsearch using an `SSLConte
4949
might be more helpful. You can create one natively using the python SSL library with the
5050
`create_default_context` (https://docs.python.org/3/library/ssl.html#ssl.create_default_context) method.
5151

52-
To create an `SSLContext` object you only need to use one of cafile, capath or cadata::
52+
To create an `SSLContext` object you only need to use one of cafile, capath or cadata:
53+
54+
.. code-block:: python
5355
5456
>>> from ssl import create_default_context
5557
>>> context = create_default_context(cafile=None, capath=None, cadata=None)

docs/index.rst

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ Installation
1010
------------
1111

1212
Install the ``elasticsearch`` package with `pip
13-
<https://pypi.org/project/elasticsearch>`_::
13+
<https://pypi.org/project/elasticsearch>`_:
14+
15+
.. code-block:: console
1416
1517
$ python -m pip install elasticsearch
1618
1719
If your application uses async/await in Python you can install with
18-
the ``async`` extra::
20+
the ``async`` extra:
21+
22+
.. code-block:: console
1923
2024
$ python -m pip install elasticsearch[async]
2125
@@ -41,7 +45,9 @@ For **Elasticsearch 2.0** and later, use the major version 2 (``2.x.y``) of the
4145
library, and so on.
4246

4347
The recommended way to set your requirements in your `setup.py` or
44-
`requirements.txt` is::
48+
`requirements.txt` is:
49+
50+
.. code-block:: python
4551
4652
# Elasticsearch 7.x
4753
elasticsearch>=7.0.0,<8.0.0
@@ -62,7 +68,7 @@ versions are also released as ``elasticsearch2``, ``elasticsearch5`` and ``elast
6268
Example Usage
6369
-------------
6470

65-
::
71+
.. code-block:: python
6672
6773
from datetime import datetime
6874
from elasticsearch import Elasticsearch
@@ -177,7 +183,9 @@ location.
177183

178184
By default we allow ``urllib3`` to open up to 10 connections to each node, if
179185
your application calls for more parallelism, use the ``maxsize`` parameter to
180-
raise the limit::
186+
raise the limit:
187+
188+
.. code-block:: python
181189
182190
# allow up to 25 connections to each node
183191
es = Elasticsearch(["host1", "host2"], maxsize=25)
@@ -194,7 +202,9 @@ SSL and Authentication
194202
~~~~~~~~~~~~~~~~~~~~~~
195203

196204
You can configure the client to use ``SSL`` for connecting to your
197-
elasticsearch cluster, including certificate verification and HTTP auth::
205+
elasticsearch cluster, including certificate verification and HTTP auth:
206+
207+
.. code-block:: python
198208
199209
from elasticsearch import Elasticsearch
200210
@@ -310,7 +320,9 @@ your configuration this might be something you don't want or break completely.
310320
In some environments (notably on Google App Engine) your HTTP requests might be
311321
restricted so that ``GET`` requests won't accept body. In that case use the
312322
``send_get_body_as`` parameter of :class:`~elasticsearch.Transport` to send all
313-
bodies via post::
323+
bodies via post:
324+
325+
.. code-block:: python
314326
315327
from elasticsearch import Elasticsearch
316328
es = Elasticsearch(send_get_body_as='POST')
@@ -320,7 +332,8 @@ Compression
320332
When using capacity-constrained networks (low throughput), it may be handy to enable
321333
compression. This is especially useful when doing bulk loads or inserting large
322334
documents. This will configure compression.
323-
::
335+
336+
.. code-block:: python
324337
325338
from elasticsearch import Elasticsearch
326339
es = Elasticsearch(hosts, http_compress=True)
@@ -331,7 +344,9 @@ Running on AWS with IAM
331344
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
332345

333346
If you want to use this client with IAM based authentication on AWS you can use
334-
the `requests-aws4auth`_ package::
347+
the `requests-aws4auth`_ package:
348+
349+
.. code-block:: python
335350
336351
from elasticsearch import Elasticsearch, RequestsHttpConnection
337352
from requests_aws4auth import AWS4Auth
@@ -357,7 +372,9 @@ Custom serializers
357372
~~~~~~~~~~~~~~~~~~
358373

359374
By default, `JSONSerializer`_ is used to encode all outgoing requests.
360-
However, you can implement your own custom serializer::
375+
However, you can implement your own custom serializer
376+
377+
.. code-block:: python
361378
362379
from elasticsearch.serializer import JSONSerializer
363380

docs/transports.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ it to the constructor of :class:`~elasticsearch.Elasticsearch` as
99
:class:`~elasticsearch.connection.RequestsHttpConnection` requires ``requests``
1010
to be installed.
1111

12-
For example to use the ``requests``-based connection just import it and use it::
12+
For example to use the ``requests``-based connection just import it and use it:
13+
14+
.. code-block:: python
1315
1416
from elasticsearch import Elasticsearch, RequestsHttpConnection
1517
es = Elasticsearch(connection_class=RequestsHttpConnection)

test_elasticsearch/README.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ To simply run the tests just execute the ``run_tests.py`` script or invoke
2626
* ``TEST_ES_REPO`` - path to the elasticsearch repo, by default it will look in
2727
the same directory as ``elasticsearch-py`` is in. It will not be used if
2828
``TEST_ES_YAML_DIR`` is specified directly.
29-
29+
3030
* ``TEST_ES_NOFETCH`` - controls if we should fetch new updates to elasticsearch
3131
repo and reset it's version to the sha used to build the current es server.
3232
Defaults to ``False`` which means we will fetch the elasticsearch repo and
@@ -46,15 +46,19 @@ Run Elasticsearch in a Container
4646

4747
To run elasticsearch in a container, optionally set the ``ES_VERSION``
4848
environment evariable to either 5.4, 5.3 or 2.4. ``ES_VERSION`` is defaulted to
49-
``latest``. Then run ./start_elasticsearch.sh::
49+
``latest``. Then run ./start_elasticsearch.sh:
50+
51+
.. code-block:: console
5052
51-
export ES_VERSION=5.4
52-
./start_elasticsearch.sh
53+
$ export ES_VERSION=5.4
54+
$ ./start_elasticsearch.sh
5355
5456
5557
This will run a version for Elasticsearch in a Docker container suitable for
5658
running the tests. To check that elasticsearch is running first wait for a
57-
``healthy`` status in ``docker ps``::
59+
``healthy`` status in ``docker ps``:
60+
61+
.. code-block:: console
5862
5963
$ docker ps
6064
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

0 commit comments

Comments
 (0)