Skip to content

Commit a8284ea

Browse files
committed
Updated docsrings in exemplar and stub to use Google style.
1 parent 2aef6c1 commit a8284ea

2 files changed

Lines changed: 82 additions & 30 deletions

File tree

‎exercises/concept/little-sisters-vocab/.meta/exemplar.py‎

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,34 @@
44
def add_prefix_un(word):
55
"""Take the given word and add the 'un' prefix.
66
7-
:param word: str - containing the root word.
8-
:return: str - of root word prepended with 'un'.
7+
Parameters:
8+
word (str): The root word.
9+
10+
Returns:
11+
str: Root word prepended with 'un'.
912
"""
1013

1114
return 'un' + word
1215

1316

1417
def make_word_groups(vocab_words):
15-
"""Transform a list containing a prefix and words into a string with the prefix followed by the words with prefix prepended.
18+
"""Transform a list containing a prefix and words.
19+
20+
Parameters:
21+
vocab_words (list[str]): Vocabulary words with prefix at first index.
1622
17-
:param vocab_words: list - of vocabulary words with prefix in first index.
18-
:return: str - of prefix followed by vocabulary words with
23+
Returns:
24+
str: Prefix followed by vocabulary words with
1925
prefix applied.
2026
21-
This function takes a `vocab_words` list and returns a string
27+
This function takes a `vocab_words` list of strings and returns a string
2228
with the prefix and the words with prefix applied, separated
2329
by ' :: '.
2430
25-
For example: list('en', 'close', 'joy', 'lighten'),
26-
produces the following string: 'en :: enclose :: enjoy :: enlighten'.
31+
Examples:
32+
>>> list('en', 'close', 'joy', 'lighten')
33+
'en :: enclose :: enjoy :: enlighten'.
34+
2735
"""
2836

2937
prefix = vocab_words[0]
@@ -35,10 +43,19 @@ def make_word_groups(vocab_words):
3543
def remove_suffix_ness(word):
3644
"""Remove the suffix from the word while keeping spelling in mind.
3745
38-
:param word: str - of word to remove suffix from.
39-
:return: str - of word with suffix removed & spelling adjusted.
46+
Parameters:
47+
word (str): Word to remove suffix from.
48+
49+
Returns:
50+
str: Word with suffix removed & spelling adjusted.
51+
52+
Examples:
53+
>>> remove_suffix_ness('heaviness')
54+
'heavy'
55+
56+
>>> remove_suffix_ness('sadness')
57+
'sad'
4058
41-
For example: "heaviness" becomes "heavy", but "sadness" becomes "sad".
4259
"""
4360

4461
word = word[:-4]
@@ -51,11 +68,20 @@ def remove_suffix_ness(word):
5168
def adjective_to_verb(sentence, index):
5269
"""Change the adjective within the sentence to a verb.
5370
54-
:param sentence: str - that uses the word in sentence.
55-
:param index: int - index of the word to remove and transform.
56-
:return: str - word that changes the extracted adjective to a verb.
71+
Parameters:
72+
sentence (str): The word used in a sentence as an adjective.
73+
index (int): Index of the adjective to remove and transform.
74+
75+
Returns:
76+
str: The extracted adjective in verb form.
77+
78+
Examples:
79+
>>> adjective_to_verb('It got dark as the sun set.', 2)
80+
'darken'
81+
82+
>>> adjective_to_verb('The ink stains her fingers black.', -1)
83+
'blacken'
5784
58-
For example, ("It got dark as the sun set", 2) becomes "darken".
5985
"""
6086

6187
word = sentence.split()[index]

‎exercises/concept/little-sisters-vocab/strings.py‎

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,34 @@
44
def add_prefix_un(word):
55
"""Take the given word and add the 'un' prefix.
66
7-
:param word: str - containing the root word.
8-
:return: str - of root word prepended with 'un'.
7+
Parameters:
8+
word (str): The root word.
9+
10+
Returns:
11+
str: Root word prepended with 'un'.
912
"""
1013

1114
pass
1215

1316

1417
def make_word_groups(vocab_words):
15-
"""Transform a list containing a prefix and words into a string with the prefix followed by the words with prefix prepended.
18+
"""Transform a list containing a prefix and words.
19+
20+
Parameters:
21+
vocab_words (list[str]): Vocabulary words with prefix at first index.
1622
17-
:param vocab_words: list - of vocabulary words with prefix in first index.
18-
:return: str - of prefix followed by vocabulary words with
23+
Returns:
24+
str: Prefix followed by vocabulary words with
1925
prefix applied.
2026
21-
This function takes a `vocab_words` list and returns a string
27+
This function takes a `vocab_words` list of strings and returns a string
2228
with the prefix and the words with prefix applied, separated
2329
by ' :: '.
2430
25-
For example: list('en', 'close', 'joy', 'lighten'),
26-
produces the following string: 'en :: enclose :: enjoy :: enlighten'.
31+
Examples:
32+
>>> list('en', 'close', 'joy', 'lighten')
33+
'en :: enclose :: enjoy :: enlighten'.
34+
2735
"""
2836

2937
pass
@@ -32,10 +40,19 @@ def make_word_groups(vocab_words):
3240
def remove_suffix_ness(word):
3341
"""Remove the suffix from the word while keeping spelling in mind.
3442
35-
:param word: str - of word to remove suffix from.
36-
:return: str - of word with suffix removed & spelling adjusted.
43+
Parameters:
44+
word (str): Word to remove suffix from.
45+
46+
Returns:
47+
str: Word with suffix removed & spelling adjusted.
48+
49+
Examples:
50+
>>> remove_suffix_ness('heaviness')
51+
'heavy'
52+
53+
>>> remove_suffix_ness('sadness')
54+
'sad'
3755
38-
For example: "heaviness" becomes "heavy", but "sadness" becomes "sad".
3956
"""
4057

4158
pass
@@ -44,11 +61,20 @@ def remove_suffix_ness(word):
4461
def adjective_to_verb(sentence, index):
4562
"""Change the adjective within the sentence to a verb.
4663
47-
:param sentence: str - that uses the word in sentence.
48-
:param index: int - index of the word to remove and transform.
49-
:return: str - word that changes the extracted adjective to a verb.
64+
Parameters:
65+
sentence (str): The word used in a sentence as an adjective.
66+
index (int): Index of the adjective to remove and transform.
67+
68+
Returns:
69+
str: The extracted adjective in verb form.
70+
71+
Examples:
72+
>>> adjective_to_verb('It got dark as the sun set.', 2)
73+
'darken'
74+
75+
>>> adjective_to_verb('The ink stains her fingers black.', -1)
76+
'blacken'
5077
51-
For example, ("It got dark as the sun set.", 2) becomes "darken".
5278
"""
5379

5480
pass

0 commit comments

Comments
 (0)