Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2f42a70

Browse files
committed
changes after merging #14
1 parent d02904b commit 2f42a70

File tree

1 file changed

+20
-22
lines changed

1 file changed

+20
-22
lines changed

basics/docstrings.md

+20-22
Original file line numberDiff line numberDiff line change
@@ -139,20 +139,20 @@ that [the official Python documentation](https://docs.python.org/3/) uses.
139139
By default, sphinx expects you to write docstrings like this:
140140

141141
```python
142-
class Vehicle(object):
143-
'''
144-
The Vehicle object contains lots of vehicles.
142+
class Vehicles:
143+
"""
144+
The Vehicles object contains lots of vehicles.
145145
:param arg: The arg is used for ...
146146
:type arg: str
147147
:ivar arg: This is where we store arg
148148
:vartype arg: str
149-
'''
149+
"""
150150

151151
def __init__(self, arg):
152152
self.arg = arg
153153

154154
def cars(self, distance, destination):
155-
'''We can't travel a certain distance in vehicles without fuels, so here's the fuels
155+
"""We can't travel a certain distance in vehicles without fuels, so here's the fuels
156156
157157
:param distance: The amount of distance traveled
158158
:type amount: int
@@ -161,7 +161,7 @@ class Vehicle(object):
161161
162162
:returns: A Car mileage
163163
:rtype: Cars
164-
'''
164+
"""
165165
...
166166
```
167167

@@ -172,22 +172,22 @@ Sphinx can be configured to use that with
172172
[sphinx.ext.napoleon](https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html).
173173

174174
```python
175-
class Vehicles(object):
176-
'''
177-
The Vehicle object contains a lot of vehicles
175+
class Vehicles:
176+
"""
177+
The Vehicles object contains lots of vehicles.
178178
179179
Args:
180180
arg (str): The arg is used for...
181181
182182
Attributes:
183-
arg (str): This is where we store arg,
184-
'''
183+
arg (str): This is where we store arg.
184+
"""
185185

186186
def __init__(self, arg):
187187
self.arg = arg
188188

189189
def cars(self, distance, destination):
190-
'''We can't travel distance in vehicles without fuels, so here is the fuels
190+
"""We can't travel distance in vehicles without fuels, so here is the fuels
191191
192192
Args:
193193
distance (int): The amount of distance traveled
@@ -198,7 +198,7 @@ class Vehicles(object):
198198
199199
Returns:
200200
cars: A car mileage
201-
'''
201+
"""
202202
...
203203

204204
```
@@ -207,13 +207,11 @@ class Vehicles(object):
207207

208208
[Numpy](https://numpy.org/) is a large and popular Python library,
209209
and numpy developers have their own docstring style.
210-
It is an excellent choice if you want to do detailed documentation,
211-
i.e., extensive documentation of all the functions and parameters.
212210

213211
```python
214-
class Vehicles(object):
215-
'''
216-
The Vehicles object contains lots of vehicles
212+
class Vehicles:
213+
"""
214+
The Vehicles object contains lots of vehicles.
217215
218216
Parameters
219217
----------
@@ -227,14 +225,14 @@ class Vehicles(object):
227225
Attributes
228226
----------
229227
arg : str
230-
This is where we store arg,
231-
'''
228+
This is where we store arg.
229+
"""
232230

233231
def __init__(self, arg):
234232
self.arg = arg
235233

236234
def cars(self, distance, destination):
237-
'''We can't travel distance in vehicles without fuels, so here is the fuels
235+
"""We can't travel distance in vehicles without fuels, so here is the fuels
238236
239237
Parameters
240238
----------
@@ -252,7 +250,7 @@ class Vehicles(object):
252250
-------
253251
cars
254252
A car mileage
255-
'''
253+
"""
256254
pass
257255
```
258256

0 commit comments

Comments
 (0)