-
-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example documentation of docstring formats (#224)
- Loading branch information
1 parent
e946679
commit 0191e18
Showing
7 changed files
with
142 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# docBlockr Docstring Format | ||
|
||
```python | ||
def abc(a: int, c = [1,2]): | ||
"""_summary_ | ||
Arguments: | ||
a {int} -- _description_ | ||
Keyword Arguments: | ||
c {list} -- _description_ (default: {[1,2]}) | ||
Raises: | ||
AssertionError: _description_ | ||
Returns: | ||
_type_ -- _description_ | ||
""" | ||
if a > 10: | ||
raise AssertionError("a is more than 10") | ||
|
||
return c | ||
if a > 10: | ||
raise AssertionError("a is more than 10") | ||
|
||
return c | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Google Docstring Format | ||
|
||
```python | ||
def abc(a: int, c = [1,2]): | ||
"""_summary_ | ||
Args: | ||
a (int): _description_ | ||
c (list, optional): _description_. Defaults to [1,2]. | ||
Raises: | ||
AssertionError: _description_ | ||
Returns: | ||
_type_: _description_ | ||
""" | ||
if a > 10: | ||
raise AssertionError("a is more than 10") | ||
|
||
return c | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Numpy Docstring Format | ||
|
||
```python | ||
def abc(a: int, c = [1,2]): | ||
"""_summary_ | ||
Parameters | ||
---------- | ||
a : int | ||
_description_ | ||
c : list, optional | ||
_description_, by default [1,2] | ||
Returns | ||
------- | ||
_type_ | ||
_description_ | ||
Raises | ||
------ | ||
AssertionError | ||
_description_ | ||
""" | ||
if a > 10: | ||
raise AssertionError("a is more than 10") | ||
|
||
return c | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# One Line Sphinx Docstring Format | ||
|
||
```python | ||
def abc(a: int, c = [1,2]): | ||
"""_summary_ | ||
:param int a: _description_ | ||
:param list c: _description_, defaults to [1,2] | ||
:raises AssertionError: _description_ | ||
:return _type_: _description_ | ||
""" | ||
if a > 10: | ||
raise AssertionError("a is more than 10") | ||
|
||
return c | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Pep257 Docstring Format | ||
|
||
```python | ||
def abc(a: int, c = [1,2]): | ||
"""_summary_ | ||
Arguments: | ||
a -- _description_ | ||
Keyword Arguments: | ||
c -- _description_ (default: {[1,2]}) | ||
Raises: | ||
AssertionError: _description_ | ||
Returns: | ||
_description_ | ||
""" | ||
if a > 10: | ||
raise AssertionError("a is more than 10") | ||
|
||
return c | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Sphinx Docstring Format | ||
|
||
```python | ||
def abc(a: int, c = [1,2]): | ||
"""_summary_ | ||
:param a: _description_ | ||
:type a: int | ||
:param c: _description_, defaults to [1,2] | ||
:type c: list, optional | ||
:raises AssertionError: _description_ | ||
:return: _description_ | ||
:rtype: _type_ | ||
""" | ||
if a > 10: | ||
raise AssertionError("a is more than 10") | ||
|
||
return c | ||
``` |