Skip to content

Commit 43973b1

Browse files
committed
Add comments in wikipedia/wikipedia_scratcher.py
Signed-off-by: Priyanshi Gaur <noxdot1134@gmail.com>
1 parent d5fa841 commit 43973b1

File tree

1 file changed

+20
-23
lines changed

1 file changed

+20
-23
lines changed

wikipedia/wikipedia_scratcher.py

+20-23
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,32 @@
2323

2424

2525
def get_wiki_langs():
26-
"""Provides the list of language to find Creative Commons usage data on.
26+
"""
27+
Provides the list of language to find Creative Commons usage data on.
2728
2829
The codes represent the language codes defined by ISO 639-1 and ISO 639-3,
2930
and the decision of which language code to use is usually determined by the
3031
IETF language tag policy.
3132
(https://en.wikipedia.org/wiki/List_of_Wikipedias#Wikipedia_edition_codes)
3233
3334
Returns:
34-
pd.DataFrame: A Dataframe containing information of each Wikipedia
35-
language and its respective encoding on web address.
35+
- pd.DataFrame: A Dataframe containing information of each Wikipedia
36+
language and its respective encoding on web address.
3637
"""
3738
return pd.read_csv(f"{CWD}/language-codes_csv.csv")
3839

3940

4041
def get_request_url(lang="en"):
41-
"""Provides the API Endpoint URL for specified parameter combinations.
42+
"""
43+
Provides the API Endpoint URL for specified parameter combinations.
4244
4345
Args:
44-
lang:
45-
A string representing the language that the search results are
46-
presented in. Alternatively, the default value is by Wikipedia
47-
customs "en".
46+
- lang: A string representing the language that the search results are
47+
presented in. Alternatively, the default value is by Wikipedia customs "en"
4848
4949
Returns:
50-
string: A string representing the API Endpoint URL for the query
51-
specified by this function's parameters.
50+
- string: A string representing the API Endpoint URL for the query
51+
specified by this function's parameters.
5252
"""
5353
base_url = (
5454
r"wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop=statistics"
@@ -59,17 +59,16 @@ def get_request_url(lang="en"):
5959

6060

6161
def get_response_elems(language="en"):
62-
"""Provides the metadata for query of specified parameters
62+
"""
63+
Provides the metadata for query of specified parameters
6364
6465
Args:
65-
language:
66-
A string representing the language that the search results are
67-
presented in. Alternatively, the default value is by Wikipedia
68-
customs "en".
66+
- language: A string representing the language that the search results are
67+
presented in. Alternatively, the default value is by Wikipedia customs "en"
6968
7069
Returns:
71-
dict: A dictionary mapping metadata to its value provided from the API
72-
query of specified parameters.
70+
- dict: A dictionary mapping metadata to its value provided from the API
71+
query of specified parameters.
7372
"""
7473
search_data = None
7574
try:
@@ -114,10 +113,8 @@ def record_lang_data(lang="en"):
114113
"""Writes the row for LICENSE_TYPE to file to contain Google Query data.
115114
116115
Args:
117-
lang:
118-
A string representing the language that the search results are
119-
presented in. Alternatively, the default value is by Wikipedia
120-
customs "en".
116+
- lang: A string representing the language that the search results are
117+
presented in. Alternatively, the default value is by Wikipedia customs "en"
121118
"""
122119
response = get_response_elems(lang)
123120
if response != {}:
@@ -141,8 +138,8 @@ def get_current_data():
141138
Wikipedia texts are licensed under CC-BY-SA 3.0
142139
143140
Returns:
144-
pd.DataFrame: A DataFrame recording the number of CC-licensed documents
145-
per search query of assumption.
141+
- pd.DataFrame: A DataFrame recording the number of CC-licensed documents
142+
per search query of assumption.
146143
"""
147144
return pd.read_csv(DATA_WRITE_FILE).set_index("language")
148145

0 commit comments

Comments
 (0)