Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TST: run refguide-check on rst files in doc/* #14732

Merged
merged 7 commits into from
Nov 23, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ def foo(var1, var2, long_var_name='hi'):
use the function.

>>> a = [1, 2, 3]
>>> print [x + 3 for x in a]
>>> print([x + 3 for x in a])
[4, 5, 6]
>>> print "a\n\nb"
>>> print("a\n\nb")
a
b

Expand Down
2 changes: 1 addition & 1 deletion doc/source/dev/development_environment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Running tests
Besides using ``runtests.py``, there are various ways to run the tests. Inside
the interpreter, tests can be run like this::

>>> np.test()
>>> np.test() # doctest: +SKIPBLOCK
>>> np.test('full') # Also run tests marked as slow
>>> np.test('full', verbose=2) # Additionally print test name/file

Expand Down
6 changes: 3 additions & 3 deletions doc/source/reference/arrays.datetime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ times in UTC. By default, creating a datetime64 object from a string or
printing it would convert from or to local time::

# old behavior
>>>> np.datetime64('2000-01-01T00:00:00')
>>> np.datetime64('2000-01-01T00:00:00')
numpy.datetime64('2000-01-01T00:00:00-0800') # note the timezone offset -08:00

A consensus of datetime64 users agreed that this behavior is undesirable
Expand All @@ -378,7 +378,7 @@ most use cases, a timezone naive datetime type is preferred, similar to the
datetime64 no longer assumes that input is in local time, nor does it print
local times::

>>>> np.datetime64('2000-01-01T00:00:00')
>>> np.datetime64('2000-01-01T00:00:00')
numpy.datetime64('2000-01-01T00:00:00')

For backwards compatibility, datetime64 still parses timezone offsets, which
Expand All @@ -393,4 +393,4 @@ As a corollary to this change, we no longer prohibit casting between datetimes
with date units and datetimes with timeunits. With timezone naive datetimes,
the rule for casting from dates to times is no longer ambiguous.

.. _pandas: http://pandas.pydata.org
.. _pandas: http://pandas.pydata.org
eric-wieser marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 2 additions & 2 deletions doc/source/release/1.11.0-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ times in UTC. By default, creating a datetime64 object from a string or
printing it would convert from or to local time::

# old behavior
>>>> np.datetime64('2000-01-01T00:00:00')
>>> np.datetime64('2000-01-01T00:00:00')
numpy.datetime64('2000-01-01T00:00:00-0800') # note the timezone offset -08:00


Expand All @@ -96,7 +96,7 @@ type is preferred, similar to the ``datetime.datetime`` type in the Python
standard library. Accordingly, datetime64 no longer assumes that input is in
local time, nor does it print local times::

>>>> np.datetime64('2000-01-01T00:00:00')
>>> np.datetime64('2000-01-01T00:00:00')
rgommers marked this conversation as resolved.
Show resolved Hide resolved
numpy.datetime64('2000-01-01T00:00:00')

For backwards compatibility, datetime64 still parses timezone offsets, which
Expand Down
20 changes: 9 additions & 11 deletions doc/source/user/basics.io.genfromtxt.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,11 @@ This behavior can be overwritten by setting the optional argument
>>> # Without autostrip
>>> np.genfromtxt(StringIO(data), delimiter=",", dtype="|U5")
array([['1', ' abc ', ' 2'],
['3', ' xxx', ' 4']],
dtype='|U5')
['3', ' xxx', ' 4']], dtype='<U5')
>>> # With autostrip
>>> np.genfromtxt(StringIO(data), delimiter=",", dtype="|U5", autostrip=True)
array([['1', 'abc', '2'],
['3', 'xxx', '4']],
dtype='|U5')
['3', 'xxx', '4']], dtype='<U5')


The ``comments`` argument
Expand All @@ -127,11 +125,11 @@ marker(s) is simply ignored::
... 9, 0
... """
>>> np.genfromtxt(StringIO(data), comments="#", delimiter=",")
[[ 1. 2.]
[ 3. 4.]
[ 5. 6.]
[ 7. 8.]
[ 9. 0.]]
array([[1., 2.],
[3., 4.],
[5., 6.],
[7., 8.],
[9., 0.]])

.. versionadded:: 1.7.0

Expand Down Expand Up @@ -376,12 +374,12 @@ single element of the wanted type.
In the following example, the second column is converted from as string
representing a percentage to a float between 0 and 1::

>>> convertfunc = lambda x: float(x.strip("%"))/100.
>>> convertfunc = lambda x: float(x.strip(b"%"))/100.
>>> data = u"1, 2.3%, 45.\n6, 78.9%, 0"
>>> names = ("i", "p", "n")
>>> # General case .....
>>> np.genfromtxt(StringIO(data), delimiter=",", names=names)
array([(1.0, nan, 45.0), (6.0, nan, 0.0)],
array([(1., nan, 45.), (6., nan, 0.)],
dtype=[('i', '<f8'), ('p', '<f8'), ('n', '<f8')])

We need to keep in mind that by default, ``dtype=float``. A float is
Expand Down