Skip to content

Commit cdf6746

Browse files
ShubhamsmKevin D Smith
authored and
Kevin D Smith
committed
Replace single with double backticks in RST file pandas-dev#36617 (pandas-dev#36632)
1 parent 3f08269 commit cdf6746

39 files changed

+232
-246
lines changed

.pre-commit-config.yaml

-14
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,6 @@ repos:
3434
rev: v1.6.0
3535
hooks:
3636
- id: rst-backticks
37-
# these exclusions should be removed and the files fixed
38-
exclude: (?x)(
39-
categorical\.rst|
40-
contributing\.rst|
41-
contributing_docstring\.rst|
42-
extending\.rst|
43-
ecosystem\.rst|
44-
comparison_with_sql\.rst|
45-
install\.rst|
46-
calculate_statistics\.rst|
47-
combine_dataframes\.rst|
48-
v0\.|
49-
v1\.0\.|
50-
v1\.1\.[012])
5137
- repo: local
5238
hooks:
5339
- id: pip_to_conda

doc/source/development/contributing.rst

+10-10
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ comment letting others know they are working on an issue. While this is ok, you
3131
check each issue individually, and it's not possible to find the unassigned ones.
3232

3333
For this reason, we implemented a workaround consisting of adding a comment with the exact
34-
text `take`. When you do it, a GitHub action will automatically assign you the issue
34+
text ``take``. When you do it, a GitHub action will automatically assign you the issue
3535
(this will take seconds, and may require refreshing the page to see it).
3636
By doing this, it's possible to filter the list of issues and find only the unassigned ones.
3737

3838
So, a good way to find an issue to start contributing to pandas is to check the list of
3939
`unassigned good first issues <https://github.com/pandas-dev/pandas/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22+no%3Aassignee>`_
40-
and assign yourself one you like by writing a comment with the exact text `take`.
40+
and assign yourself one you like by writing a comment with the exact text ``take``.
4141

4242
If for whatever reason you are not able to continue working with the issue, please try to
4343
unassign it, so other people know it's available again. You can check the list of
@@ -133,7 +133,7 @@ want to clone your fork to your machine::
133133
cd pandas-yourname
134134
git remote add upstream https://github.com/pandas-dev/pandas.git
135135

136-
This creates the directory `pandas-yourname` and connects your repository to
136+
This creates the directory ``pandas-yourname`` and connects your repository to
137137
the upstream (main project) *pandas* repository.
138138

139139
Note that performing a shallow clone (with ``--depth==N``, for some ``N`` greater
@@ -155,12 +155,12 @@ Using a Docker container
155155

156156
Instead of manually setting up a development environment, you can use `Docker
157157
<https://docs.docker.com/get-docker/>`_ to automatically create the environment with just several
158-
commands. Pandas provides a `DockerFile` in the root directory to build a Docker image
158+
commands. Pandas provides a ``DockerFile`` in the root directory to build a Docker image
159159
with a full pandas development environment.
160160

161161
**Docker Commands**
162162

163-
Pass your GitHub username in the `DockerFile` to use your own fork::
163+
Pass your GitHub username in the ``DockerFile`` to use your own fork::
164164

165165
# Build the image pandas-yourname-env
166166
docker build --tag pandas-yourname-env .
@@ -172,7 +172,7 @@ Even easier, you can integrate Docker with the following IDEs:
172172
**Visual Studio Code**
173173

174174
You can use the DockerFile to launch a remote session with Visual Studio Code,
175-
a popular free IDE, using the `.devcontainer.json` file.
175+
a popular free IDE, using the ``.devcontainer.json`` file.
176176
See https://code.visualstudio.com/docs/remote/containers for details.
177177

178178
**PyCharm (Professional)**
@@ -782,7 +782,7 @@ As part of :ref:`Continuous Integration <contributing.ci>` checks we run::
782782

783783
isort --check-only pandas
784784

785-
to check that imports are correctly formatted as per the `setup.cfg`.
785+
to check that imports are correctly formatted as per the ``setup.cfg``.
786786

787787
If you see output like the below in :ref:`Continuous Integration <contributing.ci>` checks:
788788

@@ -979,7 +979,7 @@ For example, quite a few functions in pandas accept a ``dtype`` argument. This c
979979
def as_type(dtype: Dtype) -> ...:
980980
...
981981
982-
This module will ultimately house types for repeatedly used concepts like "path-like", "array-like", "numeric", etc... and can also hold aliases for commonly appearing parameters like `axis`. Development of this module is active so be sure to refer to the source for the most up to date list of available types.
982+
This module will ultimately house types for repeatedly used concepts like "path-like", "array-like", "numeric", etc... and can also hold aliases for commonly appearing parameters like ``axis``. Development of this module is active so be sure to refer to the source for the most up to date list of available types.
983983

984984
Validating type hints
985985
~~~~~~~~~~~~~~~~~~~~~
@@ -1302,7 +1302,7 @@ Or with one of the following constructs::
13021302

13031303
Using `pytest-xdist <https://pypi.org/project/pytest-xdist>`_, one can
13041304
speed up local testing on multicore machines. To use this feature, you will
1305-
need to install `pytest-xdist` via::
1305+
need to install ``pytest-xdist`` via::
13061306

13071307
pip install pytest-xdist
13081308

@@ -1465,7 +1465,7 @@ The following defines how a commit message should be structured. Please referen
14651465
relevant GitHub issues in your commit message using GH1234 or #1234. Either style
14661466
is fine, but the former is generally preferred:
14671467

1468-
* a subject line with `< 80` chars.
1468+
* a subject line with ``< 80`` chars.
14691469
* One blank line.
14701470
* Optionally, a commit message body.
14711471

doc/source/development/contributing_docstring.rst

+31-31
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The next example gives an idea of what a docstring looks like:
2525
"""
2626
Add up two integer numbers.
2727
28-
This function simply wraps the `+` operator, and does not
28+
This function simply wraps the ``+`` operator, and does not
2929
do anything interesting, except for illustrating what
3030
the docstring of a very simple function looks like.
3131
@@ -39,7 +39,7 @@ The next example gives an idea of what a docstring looks like:
3939
Returns
4040
-------
4141
int
42-
The sum of `num1` and `num2`.
42+
The sum of ``num1`` and ``num2``.
4343
4444
See Also
4545
--------
@@ -126,9 +126,9 @@ backticks. The following are considered inline code:
126126
127127
def add_values(arr):
128128
"""
129-
Add the values in `arr`.
129+
Add the values in ``arr``.
130130
131-
This is equivalent to Python `sum` of :meth:`pandas.Series.sum`.
131+
This is equivalent to Python ``sum`` of :meth:`pandas.Series.sum`.
132132
133133
Some sections are omitted here for simplicity.
134134
"""
@@ -144,13 +144,13 @@ backticks. The following are considered inline code:
144144
145145
With several mistakes in the docstring.
146146
147-
It has a blank like after the signature `def func():`.
147+
It has a blank like after the signature ``def func():``.
148148
149149
The text 'Some function' should go in the line after the
150150
opening quotes of the docstring, not in the same line.
151151
152152
There is a blank line between the docstring and the first line
153-
of code `foo = 1`.
153+
of code ``foo = 1``.
154154
155155
The closing quotes should be in the next line, not in this one."""
156156
@@ -269,11 +269,11 @@ after, and not between the line with the word "Parameters" and the one with
269269
the hyphens.
270270

271271
After the title, each parameter in the signature must be documented, including
272-
`*args` and `**kwargs`, but not `self`.
272+
``*args`` and ``**kwargs``, but not ``self``.
273273

274274
The parameters are defined by their name, followed by a space, a colon, another
275275
space, and the type (or types). Note that the space between the name and the
276-
colon is important. Types are not defined for `*args` and `**kwargs`, but must
276+
colon is important. Types are not defined for ``*args`` and ``**kwargs``, but must
277277
be defined for all other parameters. After the parameter definition, it is
278278
required to have a line with the parameter description, which is indented, and
279279
can have multiple lines. The description must start with a capital letter, and
@@ -285,13 +285,13 @@ comma at the end of the type. The exact form of the type in this case will be
285285
argument means, which can be added after a comma "int, default -1, meaning all
286286
cpus".
287287

288-
In cases where the default value is `None`, meaning that the value will not be
289-
used. Instead of "str, default None", it is preferred to write "str, optional".
290-
When `None` is a value being used, we will keep the form "str, default None".
291-
For example, in `df.to_csv(compression=None)`, `None` is not a value being used,
288+
In cases where the default value is ``None``, meaning that the value will not be
289+
used. Instead of ``"str, default None"``, it is preferred to write ``"str, optional"``.
290+
When ``None`` is a value being used, we will keep the form "str, default None".
291+
For example, in ``df.to_csv(compression=None)``, ``None`` is not a value being used,
292292
but means that compression is optional, and no compression is being used if not
293-
provided. In this case we will use `str, optional`. Only in cases like
294-
`func(value=None)` and `None` is being used in the same way as `0` or `foo`
293+
provided. In this case we will use ``"str, optional"``. Only in cases like
294+
``func(value=None)`` and ``None`` is being used in the same way as ``0`` or ``foo``
295295
would be used, then we will specify "str, int or None, default None".
296296

297297
**Good:**
@@ -331,13 +331,13 @@ would be used, then we will specify "str, int or None, default None".
331331
specified kind.
332332
333333
Note the blank line between the parameters title and the first
334-
parameter. Also, note that after the name of the parameter `kind`
334+
parameter. Also, note that after the name of the parameter ``kind``
335335
and before the colon, a space is missing.
336336
337337
Also, note that the parameter descriptions do not start with a
338338
capital letter, and do not finish with a dot.
339339
340-
Finally, the `**kwargs` parameter is missing.
340+
Finally, the ``**kwargs`` parameter is missing.
341341
342342
Parameters
343343
----------
@@ -361,9 +361,9 @@ boolean, etc):
361361
* str
362362
* bool
363363

364-
For complex types, define the subtypes. For `dict` and `tuple`, as more than
364+
For complex types, define the subtypes. For ``dict`` and ``tuple``, as more than
365365
one type is present, we use the brackets to help read the type (curly brackets
366-
for `dict` and normal brackets for `tuple`):
366+
for ``dict`` and normal brackets for ``tuple``):
367367

368368
* list of int
369369
* dict of {str : int}
@@ -512,8 +512,8 @@ This section is used to let users know about pandas functionality
512512
related to the one being documented. In rare cases, if no related methods
513513
or functions can be found at all, this section can be skipped.
514514

515-
An obvious example would be the `head()` and `tail()` methods. As `tail()` does
516-
the equivalent as `head()` but at the end of the `Series` or `DataFrame`
515+
An obvious example would be the ``head()`` and ``tail()`` methods. As ``tail()`` does
516+
the equivalent as ``head()`` but at the end of the ``Series`` or ``DataFrame``
517517
instead of at the beginning, it is good to let the users know about it.
518518

519519
To give an intuition on what can be considered related, here there are some
@@ -608,8 +608,8 @@ Examples in docstrings, besides illustrating the usage of the function or
608608
method, must be valid Python code, that returns the given output in a
609609
deterministic way, and that can be copied and run by users.
610610

611-
Examples are presented as a session in the Python terminal. `>>>` is used to
612-
present code. `...` is used for code continuing from the previous line.
611+
Examples are presented as a session in the Python terminal. ``>>>`` is used to
612+
present code. ``...`` is used for code continuing from the previous line.
613613
Output is presented immediately after the last line of code generating the
614614
output (no blank lines in between). Comments describing the examples can
615615
be added with blank lines before and after them.
@@ -664,7 +664,7 @@ A simple example could be:
664664
4 Falcon
665665
dtype: object
666666
667-
With the `n` parameter, we can change the number of returned rows:
667+
With the ``n`` parameter, we can change the number of returned rows:
668668
669669
>>> s.head(n=3)
670670
0 Ant
@@ -742,7 +742,7 @@ positional arguments ``head(3)``.
742742
743743
def fillna(self, value):
744744
"""
745-
Replace missing values by `value`.
745+
Replace missing values by ``value``.
746746
747747
Examples
748748
--------
@@ -771,7 +771,7 @@ positional arguments ``head(3)``.
771771
772772
def contains(self, pattern, case_sensitive=True, na=numpy.nan):
773773
"""
774-
Return whether each value contains `pattern`.
774+
Return whether each value contains ``pattern``.
775775
776776
In this case, we are illustrating how to use sections, even
777777
if the example is simple enough and does not require them.
@@ -788,8 +788,8 @@ positional arguments ``head(3)``.
788788
789789
**Case sensitivity**
790790
791-
With `case_sensitive` set to `False` we can match `a` with both
792-
`a` and `A`:
791+
With ``case_sensitive`` set to ``False`` we can match ``a`` with both
792+
``a`` and ``A``:
793793
794794
>>> s.contains(pattern='a', case_sensitive=False)
795795
0 True
@@ -800,7 +800,7 @@ positional arguments ``head(3)``.
800800
801801
**Missing values**
802802
803-
We can fill missing values in the output using the `na` parameter:
803+
We can fill missing values in the output using the ``na`` parameter:
804804
805805
>>> s.contains(pattern='a', na=False)
806806
0 False
@@ -824,9 +824,9 @@ positional arguments ``head(3)``.
824824
Try to use meaningful data, when it makes the example easier
825825
to understand.
826826
827-
Try to avoid positional arguments like in `df.method(1)`. They
827+
Try to avoid positional arguments like in ``df.method(1)``. They
828828
can be all right if previously defined with a meaningful name,
829-
like in `present_value(interest_rate)`, but avoid them otherwise.
829+
like in ``present_value(interest_rate)``, but avoid them otherwise.
830830
831831
When presenting the behavior with different parameters, do not place
832832
all the calls one next to the other. Instead, add a short sentence
@@ -914,7 +914,7 @@ plot will be generated automatically when building the documentation.
914914
class Series:
915915
def plot(self):
916916
"""
917-
Generate a plot with the `Series` data.
917+
Generate a plot with the ``Series`` data.
918918
919919
Examples
920920
--------

doc/source/development/extending.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ This can be a convenient way to extend pandas objects without subclassing them.
6161
If you write a custom accessor, make a pull request adding it to our
6262
:ref:`ecosystem` page.
6363

64-
We highly recommend validating the data in your accessor's `__init__`.
64+
We highly recommend validating the data in your accessor's ``__init__``.
6565
In our ``GeoAccessor``, we validate that the data contains the expected columns,
6666
raising an ``AttributeError`` when the validation fails.
6767
For a ``Series`` accessor, you should validate the ``dtype`` if the accessor

doc/source/ecosystem.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ arrays can be stored inside pandas' Series and DataFrame.
436436
`Pint-Pandas`_
437437
~~~~~~~~~~~~~~
438438

439-
`Pint-Pandas <https://github.com/hgrecco/pint-pandas>` provides an extension type for
439+
``Pint-Pandas <https://github.com/hgrecco/pint-pandas>`` provides an extension type for
440440
storing numeric arrays with units. These arrays can be stored inside pandas'
441441
Series and DataFrame. Operations between Series and DataFrame columns which
442442
use pint's extension array are then units aware.

doc/source/getting_started/comparison/comparison_with_sql.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ As is customary, we import pandas and NumPy as follows:
1919
import numpy as np
2020
2121
Most of the examples will utilize the ``tips`` dataset found within pandas tests. We'll read
22-
the data into a DataFrame called `tips` and assume we have a database table of the same name and
22+
the data into a DataFrame called ``tips`` and assume we have a database table of the same name and
2323
structure.
2424

2525
.. ipython:: python
@@ -429,7 +429,7 @@ Top n rows per group
429429
.query('rn < 3')
430430
.sort_values(['day', 'rn']))
431431
432-
the same using `rank(method='first')` function
432+
the same using ``rank(method='first')`` function
433433

434434
.. ipython:: python
435435
@@ -453,7 +453,7 @@ the same using `rank(method='first')` function
453453
454454
Let's find tips with (rank < 3) per gender group for (tips < 2).
455455
Notice that when using ``rank(method='min')`` function
456-
`rnk_min` remains the same for the same `tip`
456+
``rnk_min`` remains the same for the same ``tip``
457457
(as Oracle's RANK() function)
458458

459459
.. ipython:: python

doc/source/getting_started/install.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ In Linux/Mac you can run ``which python`` on your terminal and it will tell you
179179
using. If it's something like "/usr/bin/python", you're using the Python from the system, which is not recommended.
180180

181181
It is highly recommended to use ``conda``, for quick installation and for package and dependency updates.
182-
You can find simple installation instructions for pandas in this document: `installation instructions </getting_started.html>`.
182+
You can find simple installation instructions for pandas in this document: ``installation instructions </getting_started.html>``.
183183

184184
Installing from source
185185
~~~~~~~~~~~~~~~~~~~~~~

doc/source/getting_started/intro_tutorials/06_calculate_statistics.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ on the grouped data as well:
197197
:align: center
198198

199199
.. note::
200-
The `Pclass` column contains numerical data but actually
200+
The ``Pclass`` column contains numerical data but actually
201201
represents 3 categories (or factors) with respectively the labels ‘1’,
202202
‘2’ and ‘3’. Calculating statistics on these does not make much sense.
203203
Therefore, pandas provides a ``Categorical`` data type to handle this

doc/source/getting_started/intro_tutorials/08_combine_dataframes.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ concatenated tables to verify the operation:
123123

124124
.. ipython:: python
125125
126-
print('Shape of the `air_quality_pm25` table: ', air_quality_pm25.shape)
127-
print('Shape of the `air_quality_no2` table: ', air_quality_no2.shape)
128-
print('Shape of the resulting `air_quality` table: ', air_quality.shape)
126+
print('Shape of the ``air_quality_pm25`` table: ', air_quality_pm25.shape)
127+
print('Shape of the ``air_quality_no2`` table: ', air_quality_no2.shape)
128+
print('Shape of the resulting ``air_quality`` table: ', air_quality.shape)
129129
130130
Hence, the resulting table has 3178 = 1110 + 2068 rows.
131131

0 commit comments

Comments
 (0)