Skip to content

Commit

Permalink
Refine docstrings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken Kundert authored and Ken Kundert committed Jul 21, 2020
1 parent 4ecf14d commit ec42df7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
23 changes: 8 additions & 15 deletions inform/inform.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@
# Inform Utilities {{{1
# indent {{{2
def indent(text, leader=' ', first=0, stops=1, sep='\n'):
r"""
Add indentation.
r"""Add indentation.
Args:
leader (string):
Expand Down Expand Up @@ -520,8 +519,7 @@ def _join(args, kwargs):
_level = 0
_sort = None
def render(obj, sort=None, level=None, tab=' '):
"""
Recursively convert object to string with reasonable formatting.
"""Recursively convert object to string with reasonable formatting.
Args:
obj:
Expand Down Expand Up @@ -674,8 +672,7 @@ def leader(relative_level=0):

# fmt {{{2
def fmt(message, *args, **kwargs):
"""
Similar to ''.format(), but it can pull arguments from the local scope.
"""Similar to ''.format(), but it can pull arguments from the local scope.
Convert a message with embedded attributes to a string. The values for the
attributes can come from the argument list, as with ''.format(), or they
Expand Down Expand Up @@ -853,9 +850,7 @@ def conjoin(iterable, conj=' and ', sep=', ', end='', fmt=None):

# did_you_mean {{{2
def did_you_mean(invalid_str, valid_strs):
"""
Given an invalid string from the user, return the valid string with the
most similarity.
"""Given an invalid string from the user, return the valid string with the most similarity.
Args:
invalid_str (string):
Expand All @@ -880,9 +875,7 @@ def did_you_mean(invalid_str, valid_strs):

# plural {{{2
class plural:
"""
Conditionally format a phrase depending on whether it refers to a singular
or plural number of things.
"""Conditionally format a phrase depending on whether it refers to a singular or plural number of things.
The format string has three sections, separated by '/'. The first section
is always included, the last section is included if the given number is
Expand Down Expand Up @@ -954,8 +947,7 @@ def __init__(self, value, num='#', invert='!', slash='/'):
self.slash = slash

def format(self, formatter):
"""
Expand plural to a string.
"""Expand plural to a string.
You can use this method to directly expand plural to a string without
needing to use f-strings or the string format method.
Expand Down Expand Up @@ -1449,7 +1441,8 @@ def sss():
# whereas the print functions returned from InformantFactory are referred to
# as informants.
class InformantFactory:
"""
"""Create informants.
An object of InformantFactory is referred to as an informant. It is
generally treated as a function that is called to produce the desired
output.
Expand Down
2 changes: 1 addition & 1 deletion tests/pytest.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[pytest]
python_files=test_*.py
addopts = -vv
#addopts = -vv

0 comments on commit ec42df7

Please sign in to comment.