@@ -47,11 +47,11 @@ Next example gives an idea on how a docstring looks like:
47
47
48
48
Examples
49
49
--------
50
- >>> add(2, 2)
50
+ >>> add(2, 2) # noqa F821
51
51
4
52
- >>> add(25, 0)
52
+ >>> add(25, 0) # noqa F821
53
53
25
54
- >>> add(10, -10)
54
+ >>> add(10, -10) # noqa F821
55
55
0
56
56
"""
57
57
return num1 + num2
@@ -187,7 +187,7 @@ infinitive verb.
187
187
188
188
.. code-block :: python
189
189
190
- def astype (dtype ):
190
+ def astype (dtype ): # noqa F811
191
191
"""
192
192
Casts Series type.
193
193
@@ -197,7 +197,7 @@ infinitive verb.
197
197
198
198
.. code-block :: python
199
199
200
- def astype (dtype ):
200
+ def astype (dtype ): # noqa F811
201
201
"""
202
202
Method to cast Series type.
203
203
@@ -207,7 +207,7 @@ infinitive verb.
207
207
208
208
.. code-block :: python
209
209
210
- def astype (dtype ):
210
+ def astype (dtype ): # noqa F811
211
211
"""
212
212
Cast Series type
213
213
@@ -217,7 +217,7 @@ infinitive verb.
217
217
218
218
.. code-block :: python
219
219
220
- def astype (dtype ):
220
+ def astype (dtype ): # noqa F811
221
221
"""
222
222
Cast Series type from its current type to the new type defined in
223
223
the parameter dtype.
@@ -322,7 +322,7 @@ would be used, then we will specify "str, int or None, default None".
322
322
323
323
.. code-block :: python
324
324
325
- class Series :
325
+ class Series : # noqa F811
326
326
def plot (self , kind , ** kwargs ):
327
327
"""
328
328
Generate a plot.
@@ -457,12 +457,14 @@ For example, with a single value:
457
457
float
458
458
Random number generated.
459
459
"""
460
- return random.random()
460
+ return np. random.random()
461
461
462
462
With more than one value:
463
463
464
464
.. code-block :: python
465
465
466
+ import string
467
+
466
468
def random_letters ():
467
469
"""
468
470
Generate and return a sequence of random letters.
@@ -477,8 +479,8 @@ With more than one value:
477
479
letters : str
478
480
String of random letters.
479
481
"""
480
- length = random.randint(1 , 10 )
481
- letters = ' ' .join(random.choice(string.ascii_lowercase)
482
+ length = np. random.randint(1 , 10 )
483
+ letters = ' ' .join(np. random.choice(string.ascii_lowercase)
482
484
for i in range (length))
483
485
return length, letters
484
486
@@ -499,7 +501,7 @@ If the method yields its value:
499
501
Random number generated.
500
502
"""
501
503
while True :
502
- yield random.random()
504
+ yield np. random.random()
503
505
504
506
.. _docstring.see_also :
505
507
@@ -558,7 +560,7 @@ For example:
558
560
559
561
.. code-block :: python
560
562
561
- class Series :
563
+ class Series : # noqa F811
562
564
def head (self ):
563
565
"""
564
566
Return the first 5 elements of the Series.
@@ -776,7 +778,7 @@ positional arguments ``head(3)``.
776
778
777
779
Examples
778
780
--------
779
- >>> s = pd.Series('Antelope', 'Lion', 'Zebra', numpy .nan)
781
+ >>> s = pd.Series('Antelope', 'Lion', 'Zebra', np .nan)
780
782
>>> s.contains(pattern='a')
781
783
0 False
782
784
1 False
@@ -834,7 +836,7 @@ positional arguments ``head(3)``.
834
836
--------
835
837
>>> import numpy as np
836
838
>>> import pandas as pd
837
- >>> df = pd.DataFrame(numpy .random.randn(3, 3),
839
+ >>> df = pd.DataFrame(np .random.randn(3, 3),
838
840
... columns=('a', 'b', 'c'))
839
841
>>> df.method(1)
840
842
21
@@ -909,7 +911,7 @@ plot will be generated automatically when building the documentation.
909
911
910
912
.. code-block :: python
911
913
912
- class Series :
914
+ class Series : # noqa F811
913
915
def plot (self ):
914
916
"""
915
917
Generate a plot with the `Series` data.
@@ -953,15 +955,15 @@ substitute the children's class names in this docstring.
953
955
954
956
955
957
class ChildA (Parent ):
956
- @Substitution (klass = " ChildA" )
957
- @Appender (Parent.my_function.__doc__ )
958
+ @Substitution (klass = " ChildA" ) # noqa F821
959
+ @Appender (Parent.my_function.__doc__ ) # noqa F821
958
960
def my_function (self ):
959
961
...
960
962
961
963
962
964
class ChildB (Parent ):
963
- @Substitution (klass = " ChildB" )
964
- @Appender (Parent.my_function.__doc__ )
965
+ @Substitution (klass = " ChildB" ) # noqa F821
966
+ @Appender (Parent.my_function.__doc__ ) # noqa F821
965
967
def my_function (self ):
966
968
...
967
969
@@ -990,7 +992,7 @@ You can substitute and append in one shot with something like
990
992
991
993
.. code-block :: python
992
994
993
- @Appender (template % _shared_doc_kwargs)
995
+ @Appender (template % _shared_doc_kwargs) # noqa F821
994
996
def my_function (self ):
995
997
...
996
998
0 commit comments